@pixerate/editor-react 0.98.0 → 0.100.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-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-TFEKLNC7.js → chunk-OTDAEVHW.js} +415 -358
- 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 +423 -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 +461 -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
|
}
|
|
@@ -273,6 +277,9 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
|
|
|
273
277
|
return presence;
|
|
274
278
|
}
|
|
275
279
|
|
|
280
|
+
// src/image-editor/ImageEditorCanvas.tsx
|
|
281
|
+
var import_tools2 = require("@pixerate/editor/tools");
|
|
282
|
+
|
|
276
283
|
// src/playback/PresenceLayer.tsx
|
|
277
284
|
var import_react4 = __toESM(require("react"), 1);
|
|
278
285
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
@@ -486,6 +493,29 @@ var ImageEditorCanvas = ({
|
|
|
486
493
|
},
|
|
487
494
|
[controller, mode, fit, transformTool]
|
|
488
495
|
);
|
|
496
|
+
(0, import_react5.useEffect)(() => {
|
|
497
|
+
let drafting = false;
|
|
498
|
+
return agentPresence.subscribe(
|
|
499
|
+
(0, import_tools2.trackPresenceDrag)({
|
|
500
|
+
onDrag: (box) => {
|
|
501
|
+
if (cropDragInfoRef.current || selectionGestureRef.current?.active) return;
|
|
502
|
+
const draft = (0, import_image_editor2.agentDragDraft)(modeRef.current, box, controller.getState().imageDimensions);
|
|
503
|
+
if (!draft) return;
|
|
504
|
+
drafting = true;
|
|
505
|
+
if ("crop" in draft) draftCropRef.current = draft.crop;
|
|
506
|
+
else selectionDraftRef.current = draft.selectionPath;
|
|
507
|
+
void renderCanvas();
|
|
508
|
+
},
|
|
509
|
+
onEnd: () => {
|
|
510
|
+
if (!drafting) return;
|
|
511
|
+
drafting = false;
|
|
512
|
+
draftCropRef.current = null;
|
|
513
|
+
selectionDraftRef.current = null;
|
|
514
|
+
void renderCanvas();
|
|
515
|
+
}
|
|
516
|
+
})
|
|
517
|
+
);
|
|
518
|
+
}, [agentPresence, controller, renderCanvas]);
|
|
489
519
|
(0, import_react5.useEffect)(() => typeSession?.subscribe(() => void renderCanvas()), [typeSession, renderCanvas]);
|
|
490
520
|
const finishTyping = () => {
|
|
491
521
|
typeToolRef.current?.finish();
|
|
@@ -1025,11 +1055,11 @@ var ImageEditorCanvas = ({
|
|
|
1025
1055
|
// src/image-editor/ControlSlider.tsx
|
|
1026
1056
|
var import_image_editor3 = require("@pixerate/editor/image-editor");
|
|
1027
1057
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1028
|
-
var ControlSlider = ({ spec, value, onChange, disabled, label }) => {
|
|
1058
|
+
var ControlSlider = ({ spec, value, onChange, disabled, label, className }) => {
|
|
1029
1059
|
const name = label ?? spec.label;
|
|
1030
1060
|
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-
|
|
1061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { "data-control-id": spec.id, className, children: [
|
|
1062
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
1033
1063
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: name }),
|
|
1034
1064
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "font-mono", children: (0, import_image_editor3.formatControlValue)(spec, value) })
|
|
1035
1065
|
] }),
|
|
@@ -1044,7 +1074,7 @@ var ControlSlider = ({ spec, value, onChange, disabled, label }) => {
|
|
|
1044
1074
|
disabled,
|
|
1045
1075
|
value,
|
|
1046
1076
|
onChange: (e) => onChange(Number(e.target.value)),
|
|
1047
|
-
className: "w-full accent-
|
|
1077
|
+
className: "w-full accent-primary disabled:opacity-40"
|
|
1048
1078
|
}
|
|
1049
1079
|
),
|
|
1050
1080
|
track && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "h-0.5 rounded-full opacity-70", style: { background: track } })
|
|
@@ -1079,7 +1109,7 @@ var Histogram = ({ histogram, channel = "rgb", height = 64, className = "", styl
|
|
|
1079
1109
|
role: "img",
|
|
1080
1110
|
"aria-label": histogram ? `Histogram of ${histogram.samples} pixels` : "Histogram (no data)",
|
|
1081
1111
|
"data-testid": "image-editor-histogram",
|
|
1082
|
-
className: `w-full rounded bg-
|
|
1112
|
+
className: `w-full rounded bg-muted/40 ${className}`,
|
|
1083
1113
|
style: { height, ...style },
|
|
1084
1114
|
children: [
|
|
1085
1115
|
paths.map(({ c, d }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d, fill: FILL[c], stroke: "none" }, c)),
|
|
@@ -1104,8 +1134,8 @@ var import_react7 = require("react");
|
|
|
1104
1134
|
var import_image_editor5 = require("@pixerate/editor/image-editor");
|
|
1105
1135
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1106
1136
|
var BOX = 256;
|
|
1107
|
-
var STROKE = { master: "#e2e8f0", red: "#ef4444", green: "#22c55e", blue: "#3b82f6" };
|
|
1108
|
-
var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 200 }) => {
|
|
1137
|
+
var STROKE = { master: "var(--foreground, #e2e8f0)", red: "#ef4444", green: "#22c55e", blue: "#3b82f6" };
|
|
1138
|
+
var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 200, className = "" }) => {
|
|
1109
1139
|
const svgRef = (0, import_react7.useRef)(null);
|
|
1110
1140
|
const [drag, setDrag] = (0, import_react7.useState)(null);
|
|
1111
1141
|
const toBox = (e) => {
|
|
@@ -1146,7 +1176,7 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
1146
1176
|
role: "application",
|
|
1147
1177
|
"aria-label": `${channel} curve`,
|
|
1148
1178
|
"data-testid": "curves-editor",
|
|
1149
|
-
className:
|
|
1179
|
+
className: `rounded bg-muted/40 touch-none select-none cursor-crosshair ${className}`.trim(),
|
|
1150
1180
|
onPointerDown,
|
|
1151
1181
|
onPointerMove,
|
|
1152
1182
|
onPointerUp: () => setDrag(null),
|
|
@@ -1168,7 +1198,7 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
1168
1198
|
cx: b.x,
|
|
1169
1199
|
cy: b.y,
|
|
1170
1200
|
r: 5,
|
|
1171
|
-
fill: drag === i ? STROKE[channel] : "#0f172a",
|
|
1201
|
+
fill: drag === i ? STROKE[channel] : "var(--background, #0f172a)",
|
|
1172
1202
|
stroke: STROKE[channel],
|
|
1173
1203
|
strokeWidth: 2,
|
|
1174
1204
|
"aria-label": `Point ${p.input} to ${p.output}`
|
|
@@ -1181,6 +1211,28 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
1181
1211
|
);
|
|
1182
1212
|
};
|
|
1183
1213
|
|
|
1214
|
+
// src/image-editor/styles.ts
|
|
1215
|
+
var imageEditorFrameClass = "relative flex flex-col bg-background border border-border rounded-xl overflow-hidden shadow-sm text-foreground";
|
|
1216
|
+
var imageEditorHeaderClass = "flex flex-wrap items-center justify-between px-4 py-3 bg-muted/40 border-b border-border gap-3";
|
|
1217
|
+
var imageTabListClass = "flex items-center gap-1 bg-background p-1 rounded-lg border border-border text-xs";
|
|
1218
|
+
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"}`;
|
|
1219
|
+
var imageHeaderButtonClass = "p-1.5 rounded-lg border border-border bg-background text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed";
|
|
1220
|
+
var imagePrimaryButtonClass = "rounded-lg bg-primary hover:bg-primary/90 text-primary-foreground font-medium shadow transition-colors disabled:opacity-50";
|
|
1221
|
+
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]";
|
|
1222
|
+
var imageSectionTitleClass = "font-semibold text-foreground uppercase tracking-wider text-[11px]";
|
|
1223
|
+
var imageSectionClass = "border-t border-border pt-3";
|
|
1224
|
+
var imageDividerClass = "h-px bg-border my-1";
|
|
1225
|
+
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";
|
|
1226
|
+
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";
|
|
1227
|
+
var imageOutlineButtonClass = "rounded border border-border px-1.5 py-0.5 text-[11px] text-foreground hover:bg-muted disabled:opacity-40";
|
|
1228
|
+
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"}`;
|
|
1229
|
+
var imageFieldClass = "rounded border border-input bg-background px-1 py-0.5 text-foreground";
|
|
1230
|
+
var imageSelectClass = "rounded border border-input bg-background px-1.5 py-1 text-foreground";
|
|
1231
|
+
var imageColorInputClass = "h-6 w-8 rounded border border-border bg-transparent";
|
|
1232
|
+
var imageRangeClass = "w-full accent-primary";
|
|
1233
|
+
var imageErrorBannerClass = "border-b border-destructive/40 bg-destructive/10 px-4 py-1.5 text-xs text-destructive";
|
|
1234
|
+
var imageSpinnerClass = "w-3.5 h-3.5 border-2 border-primary-foreground/30 border-t-primary-foreground rounded-full animate-spin";
|
|
1235
|
+
|
|
1184
1236
|
// src/image-editor/AdjustmentLayersPanel.tsx
|
|
1185
1237
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1186
1238
|
var CHANNELS = [
|
|
@@ -1194,8 +1246,7 @@ var TONES = [
|
|
|
1194
1246
|
{ id: "midtones", label: "Midtones" },
|
|
1195
1247
|
{ id: "highlights", label: "Highlights" }
|
|
1196
1248
|
];
|
|
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"}`;
|
|
1249
|
+
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
1250
|
var HueRangeStrip = ({ bounds }) => {
|
|
1200
1251
|
const pts = Array.from({ length: 73 }, (_, i) => `${i / 72 * 360},${20 - (0, import_image_editor6.hueRangeWeight)({ bounds }, i * 5) * 18}`).join(" ");
|
|
1201
1252
|
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 +1255,7 @@ var HueRangeStrip = ({ bounds }) => {
|
|
|
1204
1255
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("polyline", { points: pts, fill: "none", stroke: "#fff", strokeWidth: 1.5 })
|
|
1205
1256
|
] });
|
|
1206
1257
|
};
|
|
1207
|
-
var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
1258
|
+
var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, className = "" }) => {
|
|
1208
1259
|
const follow = layersProp === void 0;
|
|
1209
1260
|
const [, setTick] = (0, import_react8.useState)(0);
|
|
1210
1261
|
(0, import_react8.useEffect)(() => follow ? controller.subscribe(() => setTick((n) => n + 1)) : void 0, [controller, follow]);
|
|
@@ -1228,14 +1279,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1228
1279
|
spec.id
|
|
1229
1280
|
);
|
|
1230
1281
|
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-
|
|
1282
|
+
const checkbox = (layer, path, label) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
1232
1283
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1233
1284
|
"input",
|
|
1234
1285
|
{
|
|
1235
1286
|
type: "checkbox",
|
|
1236
1287
|
checked: Boolean((0, import_image_editor6.getControlPath)(layer.params, path)),
|
|
1237
1288
|
onChange: (e) => setParam(layer, path, e.target.checked),
|
|
1238
|
-
className: "accent-
|
|
1289
|
+
className: "accent-primary"
|
|
1239
1290
|
}
|
|
1240
1291
|
),
|
|
1241
1292
|
label
|
|
@@ -1281,14 +1332,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1281
1332
|
case "blackWhite":
|
|
1282
1333
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
1283
1334
|
controlsOf(layer).map((s) => slider(layer, s)),
|
|
1284
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
1335
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
1285
1336
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1286
1337
|
"input",
|
|
1287
1338
|
{
|
|
1288
1339
|
type: "checkbox",
|
|
1289
1340
|
checked: layer.params.tint !== null,
|
|
1290
1341
|
onChange: (e) => setParam(layer, "tint", e.target.checked ? "#e1d3b3" : null),
|
|
1291
|
-
className: "accent-
|
|
1342
|
+
className: "accent-primary"
|
|
1292
1343
|
}
|
|
1293
1344
|
),
|
|
1294
1345
|
"Tint",
|
|
@@ -1306,7 +1357,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1306
1357
|
] });
|
|
1307
1358
|
case "photoFilter":
|
|
1308
1359
|
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-
|
|
1360
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
1310
1361
|
"Filter colour",
|
|
1311
1362
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1312
1363
|
"input",
|
|
@@ -1323,19 +1374,19 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1323
1374
|
checkbox(layer, "preserveLuminosity", "Preserve luminosity")
|
|
1324
1375
|
] });
|
|
1325
1376
|
case "invert":
|
|
1326
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-
|
|
1377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-muted-foreground text-[11px]", children: "Invert has no settings." });
|
|
1327
1378
|
default:
|
|
1328
1379
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex flex-col gap-2", children: controlsOf(layer).map((s) => slider(layer, s)) });
|
|
1329
1380
|
}
|
|
1330
1381
|
};
|
|
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:
|
|
1382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `flex flex-col gap-2 text-xs ${className}`.trim(), "data-testid": "adjustment-layers-panel", children: [
|
|
1383
|
+
/* @__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
1384
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex gap-1.5", children: [
|
|
1334
1385
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1335
1386
|
"select",
|
|
1336
1387
|
{
|
|
1337
1388
|
"aria-label": "New adjustment layer kind",
|
|
1338
|
-
className: `${
|
|
1389
|
+
className: `${imageSelectClass} flex-1`,
|
|
1339
1390
|
value: newKind,
|
|
1340
1391
|
onChange: (e) => setNewKind(e.target.value),
|
|
1341
1392
|
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 +1396,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1345
1396
|
"button",
|
|
1346
1397
|
{
|
|
1347
1398
|
type: "button",
|
|
1348
|
-
className: "px-2 py-1 rounded bg-
|
|
1399
|
+
className: "px-2 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90",
|
|
1349
1400
|
onClick: () => {
|
|
1350
1401
|
setSelectedId(controller.addAdjustmentLayer(newKind));
|
|
1351
1402
|
setChannel("master");
|
|
@@ -1361,7 +1412,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1361
1412
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1362
1413
|
"li",
|
|
1363
1414
|
{
|
|
1364
|
-
className: `flex items-center gap-1.5 rounded px-1.5 py-1 ${layer.id === selectedId ? "bg-
|
|
1415
|
+
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
1416
|
children: [
|
|
1366
1417
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1367
1418
|
"input",
|
|
@@ -1370,14 +1421,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1370
1421
|
"aria-label": `Show ${label}`,
|
|
1371
1422
|
checked: layer.enabled,
|
|
1372
1423
|
onChange: () => controller.toggleAdjustmentLayer(layer.id),
|
|
1373
|
-
className: "accent-
|
|
1424
|
+
className: "accent-primary"
|
|
1374
1425
|
}
|
|
1375
1426
|
),
|
|
1376
1427
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1377
1428
|
"button",
|
|
1378
1429
|
{
|
|
1379
1430
|
type: "button",
|
|
1380
|
-
className: `flex-1 text-left truncate ${layer.enabled ? "text-
|
|
1431
|
+
className: `flex-1 text-left truncate ${layer.enabled ? "text-foreground" : "text-muted-foreground line-through"}`,
|
|
1381
1432
|
onClick: () => setSelectedId(layer.id === selectedId ? null : layer.id),
|
|
1382
1433
|
"aria-pressed": layer.id === selectedId,
|
|
1383
1434
|
children: label
|
|
@@ -1390,7 +1441,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1390
1441
|
"aria-label": `Move ${label} up`,
|
|
1391
1442
|
disabled: index === layers.length - 1,
|
|
1392
1443
|
onClick: () => controller.moveAdjustmentLayer(layer.id, index + 1),
|
|
1393
|
-
className: "px-1 text-
|
|
1444
|
+
className: "px-1 text-muted-foreground hover:text-foreground disabled:opacity-30",
|
|
1394
1445
|
children: "\u2191"
|
|
1395
1446
|
}
|
|
1396
1447
|
),
|
|
@@ -1401,7 +1452,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1401
1452
|
"aria-label": `Move ${label} down`,
|
|
1402
1453
|
disabled: index === 0,
|
|
1403
1454
|
onClick: () => controller.moveAdjustmentLayer(layer.id, index - 1),
|
|
1404
|
-
className: "px-1 text-
|
|
1455
|
+
className: "px-1 text-muted-foreground hover:text-foreground disabled:opacity-30",
|
|
1405
1456
|
children: "\u2193"
|
|
1406
1457
|
}
|
|
1407
1458
|
),
|
|
@@ -1414,7 +1465,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1414
1465
|
controller.removeAdjustmentLayer(layer.id);
|
|
1415
1466
|
if (selectedId === layer.id) setSelectedId(null);
|
|
1416
1467
|
},
|
|
1417
|
-
className: "px-1 text-
|
|
1468
|
+
className: "px-1 text-destructive hover:text-destructive",
|
|
1418
1469
|
children: "\u2715"
|
|
1419
1470
|
}
|
|
1420
1471
|
)
|
|
@@ -1423,14 +1474,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1423
1474
|
layer.id
|
|
1424
1475
|
);
|
|
1425
1476
|
}) }),
|
|
1426
|
-
selected && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col gap-2 rounded border border-
|
|
1477
|
+
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
1478
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1428
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-
|
|
1479
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-muted-foreground", children: "Blend" }),
|
|
1429
1480
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1430
1481
|
"select",
|
|
1431
1482
|
{
|
|
1432
1483
|
"aria-label": "Blend mode",
|
|
1433
|
-
className: `${
|
|
1484
|
+
className: `${imageSelectClass} flex-1`,
|
|
1434
1485
|
value: selected.blend,
|
|
1435
1486
|
onChange: (e) => controller.updateAdjustmentLayer(selected.id, { blend: e.target.value }),
|
|
1436
1487
|
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 +1509,6 @@ var import_react10 = require("react");
|
|
|
1458
1509
|
var import_react9 = require("react");
|
|
1459
1510
|
var import_image_editor7 = require("@pixerate/editor/image-editor");
|
|
1460
1511
|
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
1512
|
var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
1463
1513
|
const [, setTick] = (0, import_react9.useState)(0);
|
|
1464
1514
|
(0, import_react9.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -1482,7 +1532,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1482
1532
|
onKeyDown: () => commitNext.current = true
|
|
1483
1533
|
};
|
|
1484
1534
|
if (!model.available || !id) {
|
|
1485
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `text-xs text-
|
|
1535
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `text-xs text-muted-foreground ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
|
|
1486
1536
|
}
|
|
1487
1537
|
const effects = controller.getLayerEffects(id);
|
|
1488
1538
|
const patterns = controller.getDocumentPatterns();
|
|
@@ -1498,7 +1548,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1498
1548
|
const k = c.percent ? 100 : 1;
|
|
1499
1549
|
const shown = Math.round(c.value * k * 100) / 100;
|
|
1500
1550
|
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-
|
|
1551
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
1502
1552
|
label,
|
|
1503
1553
|
" ",
|
|
1504
1554
|
shown,
|
|
@@ -1516,24 +1566,24 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1516
1566
|
disabled: model.readOnly,
|
|
1517
1567
|
...sliderEvents,
|
|
1518
1568
|
onChange: (e) => change(effectId, c, Number(e.target.value) / k, true),
|
|
1519
|
-
className: "accent-
|
|
1569
|
+
className: "accent-primary"
|
|
1520
1570
|
}
|
|
1521
1571
|
)
|
|
1522
1572
|
] }, c.key);
|
|
1523
1573
|
}
|
|
1524
1574
|
case "color":
|
|
1525
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-1.5 text-
|
|
1575
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
1526
1576
|
/* @__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
1577
|
label
|
|
1528
1578
|
] }, c.key);
|
|
1529
1579
|
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-
|
|
1580
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
1581
|
+
/* @__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
1582
|
label
|
|
1533
1583
|
] }, c.key);
|
|
1534
1584
|
case "select":
|
|
1535
1585
|
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-
|
|
1586
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-muted-foreground", children: label }),
|
|
1537
1587
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1538
1588
|
"select",
|
|
1539
1589
|
{
|
|
@@ -1541,17 +1591,17 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1541
1591
|
value: c.value,
|
|
1542
1592
|
disabled: model.readOnly,
|
|
1543
1593
|
onChange: (e) => change(effectId, c, e.target.value),
|
|
1544
|
-
className:
|
|
1594
|
+
className: imageSelectClass,
|
|
1545
1595
|
children: c.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: o.value, children: o.label }, o.value))
|
|
1546
1596
|
}
|
|
1547
1597
|
)
|
|
1548
1598
|
] }, c.key);
|
|
1549
1599
|
}
|
|
1550
1600
|
};
|
|
1551
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-
|
|
1601
|
+
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
1602
|
/* @__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-
|
|
1603
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "font-semibold text-foreground", children: "fx Effects" }),
|
|
1604
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
|
|
1555
1605
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1556
1606
|
"input",
|
|
1557
1607
|
{
|
|
@@ -1560,12 +1610,12 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1560
1610
|
checked: model.enabled,
|
|
1561
1611
|
disabled: model.readOnly,
|
|
1562
1612
|
onChange: (e) => attempt(() => controller.setLayerEffectsEnabled(id, e.target.checked)),
|
|
1563
|
-
className: "accent-
|
|
1613
|
+
className: "accent-primary"
|
|
1564
1614
|
}
|
|
1565
1615
|
),
|
|
1566
1616
|
"On"
|
|
1567
1617
|
] }),
|
|
1568
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-1 text-
|
|
1618
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
1569
1619
|
"Scale",
|
|
1570
1620
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1571
1621
|
"input",
|
|
@@ -1581,7 +1631,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1581
1631
|
const v = Number(e.target.value);
|
|
1582
1632
|
if (v >= 1 && v <= 1e3) attempt(() => controller.setLayerEffectsEnabled(id, model.enabled, v / 100));
|
|
1583
1633
|
},
|
|
1584
|
-
className: "w-14 bg-
|
|
1634
|
+
className: "w-14 bg-muted border border-border rounded px-1"
|
|
1585
1635
|
}
|
|
1586
1636
|
),
|
|
1587
1637
|
"%"
|
|
@@ -1597,7 +1647,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1597
1647
|
if (!kind) return;
|
|
1598
1648
|
attempt(() => setOpen(controller.addLayerEffect(id, kind).effect.id));
|
|
1599
1649
|
},
|
|
1600
|
-
className:
|
|
1650
|
+
className: imageSelectClass,
|
|
1601
1651
|
children: [
|
|
1602
1652
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "", children: "Add effect\u2026" }),
|
|
1603
1653
|
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 +1655,11 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1605
1655
|
}
|
|
1606
1656
|
)
|
|
1607
1657
|
] }),
|
|
1608
|
-
model.readOnly && model.reason && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-
|
|
1658
|
+
model.readOnly && model.reason && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-muted-foreground", children: model.reason }),
|
|
1609
1659
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Effects", children: model.rows.map((row) => {
|
|
1610
1660
|
const effect = effects.items.find((e) => e.id === row.id);
|
|
1611
1661
|
const expanded = open === row.id;
|
|
1612
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("li", { "data-effect-id": row.id, className: "rounded bg-
|
|
1662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("li", { "data-effect-id": row.id, className: "rounded bg-background/60 ring-1 ring-border", children: [
|
|
1613
1663
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
|
|
1614
1664
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1615
1665
|
"input",
|
|
@@ -1619,7 +1669,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1619
1669
|
checked: row.enabled,
|
|
1620
1670
|
disabled: model.readOnly,
|
|
1621
1671
|
onChange: (e) => attempt(() => controller.updateLayerEffect(id, row.id, { enabled: e.target.checked })),
|
|
1622
|
-
className: "accent-
|
|
1672
|
+
className: "accent-primary"
|
|
1623
1673
|
}
|
|
1624
1674
|
),
|
|
1625
1675
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
@@ -1627,25 +1677,24 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1627
1677
|
{
|
|
1628
1678
|
type: "button",
|
|
1629
1679
|
"aria-expanded": expanded,
|
|
1630
|
-
className: `flex-1 text-left ${row.enabled && model.enabled ? "" : "text-
|
|
1680
|
+
className: `flex-1 text-left ${row.enabled && model.enabled ? "" : "text-muted-foreground"}`,
|
|
1631
1681
|
onClick: () => setOpen(expanded ? null : row.id),
|
|
1632
1682
|
children: row.label
|
|
1633
1683
|
}
|
|
1634
1684
|
),
|
|
1635
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className:
|
|
1685
|
+
/* @__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
1686
|
] }),
|
|
1637
1687
|
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
1688
|
] }, row.id);
|
|
1639
1689
|
}) }),
|
|
1640
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { role: "alert", className: "text-
|
|
1690
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
1641
1691
|
] });
|
|
1642
1692
|
};
|
|
1643
1693
|
|
|
1644
1694
|
// src/image-editor/LayersPanel.tsx
|
|
1645
1695
|
var import_image_editor8 = require("@pixerate/editor/image-editor");
|
|
1646
1696
|
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"}`;
|
|
1697
|
+
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
1698
|
var Thumbnail = ({
|
|
1650
1699
|
pixels,
|
|
1651
1700
|
size,
|
|
@@ -1674,7 +1723,7 @@ var Thumbnail = ({
|
|
|
1674
1723
|
"data-testid": testId,
|
|
1675
1724
|
onClick,
|
|
1676
1725
|
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-
|
|
1726
|
+
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
1727
|
}
|
|
1679
1728
|
);
|
|
1680
1729
|
};
|
|
@@ -1733,18 +1782,18 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1733
1782
|
const thumb = (layer) => (0, import_image_editor8.layerHasThumbnail)(layer) ? controller.getLayerThumbnail(layer.id, { maxSide: 64 }) : null;
|
|
1734
1783
|
const maskThumb = (layer) => layer.mask && !layer.mask.source ? controller.getLayerThumbnail(layer.id, { maxSide: 64, mask: true }) : null;
|
|
1735
1784
|
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-
|
|
1785
|
+
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
1786
|
/* @__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:
|
|
1787
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-layer"), children: "New Layer" }),
|
|
1788
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-group"), children: "New Group" }),
|
|
1789
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("duplicate"), children: "Duplicate" }),
|
|
1790
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("add-mask"), children: "Add Mask" }),
|
|
1791
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("delete"), children: "Delete" }),
|
|
1743
1792
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1744
1793
|
"button",
|
|
1745
1794
|
{
|
|
1746
1795
|
type: "button",
|
|
1747
|
-
className:
|
|
1796
|
+
className: imageIconButtonClass,
|
|
1748
1797
|
"aria-label": "Layer menu",
|
|
1749
1798
|
"aria-haspopup": "menu",
|
|
1750
1799
|
onClick: (e) => {
|
|
@@ -1760,15 +1809,15 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1760
1809
|
{
|
|
1761
1810
|
"aria-label": "Bits per channel",
|
|
1762
1811
|
title: "Image \u203A Mode: bits per channel",
|
|
1763
|
-
className: "rounded bg-
|
|
1812
|
+
className: "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground",
|
|
1764
1813
|
value: controller.bitDepth,
|
|
1765
1814
|
onChange: (e) => attempt(() => controller.setBitDepth(Number(e.target.value))),
|
|
1766
1815
|
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
1816
|
}
|
|
1768
1817
|
),
|
|
1769
1818
|
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:
|
|
1819
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => fileInput.current?.click(), children: "Open PSD\u2026" }),
|
|
1820
|
+
/* @__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
1821
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1773
1822
|
"input",
|
|
1774
1823
|
{
|
|
@@ -1787,13 +1836,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1787
1836
|
)
|
|
1788
1837
|
] })
|
|
1789
1838
|
] }),
|
|
1790
|
-
psdNotes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("ul", { className: "rounded bg-amber-
|
|
1839
|
+
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
1840
|
psdNotes.map((n) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("li", { children: n }, n)),
|
|
1792
1841
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: "underline", onClick: () => setPsdNotes([]), children: "Dismiss" }) })
|
|
1793
1842
|
] }),
|
|
1794
1843
|
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
1844
|
/* @__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-
|
|
1845
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
1797
1846
|
"Opacity ",
|
|
1798
1847
|
Math.round(active.opacity * 100),
|
|
1799
1848
|
"%"
|
|
@@ -1808,12 +1857,12 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1808
1857
|
value: Math.round(active.opacity * 100),
|
|
1809
1858
|
...sliderEvents,
|
|
1810
1859
|
onChange: (e) => prop("opacity", Number(e.target.value) / 100),
|
|
1811
|
-
className: "accent-
|
|
1860
|
+
className: "accent-primary"
|
|
1812
1861
|
}
|
|
1813
1862
|
)
|
|
1814
1863
|
] }),
|
|
1815
1864
|
/* @__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-
|
|
1865
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
1817
1866
|
"Fill ",
|
|
1818
1867
|
Math.round(((active.type === "pixel" ? active.fillOpacity : void 0) ?? 1) * 100),
|
|
1819
1868
|
"%"
|
|
@@ -1829,7 +1878,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1829
1878
|
value: Math.round(((active.type === "pixel" ? active.fillOpacity : void 0) ?? 1) * 100),
|
|
1830
1879
|
...sliderEvents,
|
|
1831
1880
|
onChange: (e) => prop("fillOpacity", Number(e.target.value) / 100),
|
|
1832
|
-
className: "accent-
|
|
1881
|
+
className: "accent-primary disabled:opacity-40"
|
|
1833
1882
|
}
|
|
1834
1883
|
)
|
|
1835
1884
|
] }),
|
|
@@ -1837,7 +1886,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1837
1886
|
"select",
|
|
1838
1887
|
{
|
|
1839
1888
|
"aria-label": "Layer blend mode",
|
|
1840
|
-
className:
|
|
1889
|
+
className: imageSelectClass,
|
|
1841
1890
|
value: active.blend,
|
|
1842
1891
|
onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { blend: e.target.value })),
|
|
1843
1892
|
children: [
|
|
@@ -1846,7 +1895,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1846
1895
|
]
|
|
1847
1896
|
}
|
|
1848
1897
|
),
|
|
1849
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-1.5 text-
|
|
1898
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
1850
1899
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1851
1900
|
"input",
|
|
1852
1901
|
{
|
|
@@ -1854,12 +1903,12 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1854
1903
|
"aria-label": "Clip to layer below",
|
|
1855
1904
|
checked: Boolean(active.clipped),
|
|
1856
1905
|
onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { clipped: e.target.checked })),
|
|
1857
|
-
className: "accent-
|
|
1906
|
+
className: "accent-primary"
|
|
1858
1907
|
}
|
|
1859
1908
|
),
|
|
1860
1909
|
"Clip to below"
|
|
1861
1910
|
] }),
|
|
1862
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "col-span-2 flex flex-wrap gap-2 text-
|
|
1911
|
+
/* @__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
1912
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1864
1913
|
"input",
|
|
1865
1914
|
{
|
|
@@ -1867,13 +1916,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1867
1916
|
"aria-label": `Lock ${k}`,
|
|
1868
1917
|
checked: Boolean(active.locks?.[k]),
|
|
1869
1918
|
onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { locks: { ...active.locks, [k]: e.target.checked } })),
|
|
1870
|
-
className: "accent-
|
|
1919
|
+
className: "accent-primary"
|
|
1871
1920
|
}
|
|
1872
1921
|
),
|
|
1873
1922
|
k
|
|
1874
1923
|
] }, k)) })
|
|
1875
1924
|
] }),
|
|
1876
|
-
effects && active && active.type !== "adjustment" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(LayerEffectsPanel, { controller, className: "border-t border-
|
|
1925
|
+
effects && active && active.type !== "adjustment" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(LayerEffectsPanel, { controller, className: "border-t border-border pt-1.5" }),
|
|
1877
1926
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { className: "flex flex-col gap-0.5", role: "tree", "aria-label": "Layers", children: rows.map((row) => {
|
|
1878
1927
|
const { layer } = row;
|
|
1879
1928
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
@@ -1912,7 +1961,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1912
1961
|
type: "button",
|
|
1913
1962
|
"aria-label": layer.visible ? `Hide ${row.label}` : `Show ${row.label}`,
|
|
1914
1963
|
"aria-pressed": layer.visible,
|
|
1915
|
-
className: "w-4 text-center text-
|
|
1964
|
+
className: "w-4 text-center text-foreground",
|
|
1916
1965
|
onClick: (e) => {
|
|
1917
1966
|
e.stopPropagation();
|
|
1918
1967
|
attempt(() => controller.setLayerProperties(layer.id, { visible: !layer.visible }));
|
|
@@ -1925,7 +1974,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1925
1974
|
{
|
|
1926
1975
|
type: "button",
|
|
1927
1976
|
"aria-label": layer.collapsed ? `Expand ${row.label}` : `Collapse ${row.label}`,
|
|
1928
|
-
className: "w-3 text-
|
|
1977
|
+
className: "w-3 text-muted-foreground",
|
|
1929
1978
|
onClick: (e) => {
|
|
1930
1979
|
e.stopPropagation();
|
|
1931
1980
|
attempt(() => controller.setLayerProperties(layer.id, { collapsed: !layer.collapsed }));
|
|
@@ -1933,7 +1982,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1933
1982
|
children: layer.collapsed ? "\u25B8" : "\u25BE"
|
|
1934
1983
|
}
|
|
1935
1984
|
),
|
|
1936
|
-
row.clipped && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-
|
|
1985
|
+
row.clipped && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-muted-foreground", "aria-label": "Clipped", children: "\u21B3" }),
|
|
1937
1986
|
(0, import_image_editor8.layerHasThumbnail)(layer) ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "relative shrink-0", children: [
|
|
1938
1987
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1939
1988
|
Thumbnail,
|
|
@@ -1948,14 +1997,14 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1948
1997
|
"span",
|
|
1949
1998
|
{
|
|
1950
1999
|
"data-testid": "layer-kind-badge",
|
|
1951
|
-
className: "absolute -bottom-1 -right-1 rounded bg-
|
|
2000
|
+
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
2001
|
children: (0, import_image_editor8.layerBadge)(layer)
|
|
1953
2002
|
}
|
|
1954
2003
|
)
|
|
1955
2004
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1956
2005
|
"span",
|
|
1957
2006
|
{
|
|
1958
|
-
className: "shrink-0 grid place-items-center rounded bg-
|
|
2007
|
+
className: "shrink-0 grid place-items-center rounded bg-muted text-[9px] text-muted-foreground ring-1 ring-border",
|
|
1959
2008
|
style: { width: thumbnailSize, height: thumbnailSize },
|
|
1960
2009
|
children: (0, import_image_editor8.layerBadge)(layer)
|
|
1961
2010
|
}
|
|
@@ -1968,7 +2017,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1968
2017
|
"aria-pressed": layer.mask.linked !== false,
|
|
1969
2018
|
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
2019
|
"data-testid": "layer-mask-link",
|
|
1971
|
-
className: `shrink-0 text-[10px] leading-none ${layer.mask.linked === false ? "text-
|
|
2020
|
+
className: `shrink-0 text-[10px] leading-none ${layer.mask.linked === false ? "text-muted-foreground/70" : "text-foreground"}`,
|
|
1972
2021
|
onClick: (e) => {
|
|
1973
2022
|
e.stopPropagation();
|
|
1974
2023
|
attempt(() => controller.setLayerMaskProps(layer.id, { linked: layer.mask.linked === false }));
|
|
@@ -1997,7 +2046,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1997
2046
|
autoFocus: true,
|
|
1998
2047
|
"aria-label": "Layer name",
|
|
1999
2048
|
defaultValue: layer.name || row.label,
|
|
2000
|
-
className: "flex-1 min-w-0 bg-
|
|
2049
|
+
className: "flex-1 min-w-0 bg-background border border-border rounded px-1",
|
|
2001
2050
|
onClick: (e) => e.stopPropagation(),
|
|
2002
2051
|
onBlur: (e) => {
|
|
2003
2052
|
setRenaming(null);
|
|
@@ -2011,7 +2060,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2011
2060
|
) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2012
2061
|
"span",
|
|
2013
2062
|
{
|
|
2014
|
-
className: `flex-1 min-w-0 truncate ${layer.visible ? "" : "text-
|
|
2063
|
+
className: `flex-1 min-w-0 truncate ${layer.visible ? "" : "text-muted-foreground"}`,
|
|
2015
2064
|
onDoubleClick: (e) => {
|
|
2016
2065
|
e.stopPropagation();
|
|
2017
2066
|
setRenaming(layer.id);
|
|
@@ -2019,7 +2068,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2019
2068
|
children: row.label
|
|
2020
2069
|
}
|
|
2021
2070
|
),
|
|
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-
|
|
2071
|
+
(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
2072
|
(0, import_image_editor8.layerEffectsBadge)(layer) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2024
2073
|
"button",
|
|
2025
2074
|
{
|
|
@@ -2027,7 +2076,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2027
2076
|
"data-testid": "layer-fx-badge",
|
|
2028
2077
|
"aria-label": (0, import_image_editor8.layerEffectsBadge)(layer) === "on" ? `Turn effects off for ${row.label}` : `Turn effects on for ${row.label}`,
|
|
2029
2078
|
"aria-pressed": (0, import_image_editor8.layerEffectsBadge)(layer) === "on",
|
|
2030
|
-
className: `text-[9px] italic font-semibold ${(0, import_image_editor8.layerEffectsBadge)(layer) === "on" ? "text-
|
|
2079
|
+
className: `text-[9px] italic font-semibold ${(0, import_image_editor8.layerEffectsBadge)(layer) === "on" ? "text-primary" : "text-muted-foreground/70 line-through"}`,
|
|
2031
2080
|
onClick: (e) => {
|
|
2032
2081
|
e.stopPropagation();
|
|
2033
2082
|
attempt(() => controller.setLayerEffectsEnabled(layer.id, (0, import_image_editor8.layerEffectsBadge)(layer) !== "on"));
|
|
@@ -2035,20 +2084,20 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2035
2084
|
children: "fx"
|
|
2036
2085
|
}
|
|
2037
2086
|
),
|
|
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-
|
|
2087
|
+
locked(layer) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { "aria-label": "Locked", className: "text-muted-foreground", children: "\u{1F512}" }),
|
|
2088
|
+
layer.blend !== "normal" && layer.blend !== "pass-through" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-[9px] text-muted-foreground", children: layer.blend })
|
|
2040
2089
|
]
|
|
2041
2090
|
},
|
|
2042
2091
|
layer.id
|
|
2043
2092
|
);
|
|
2044
2093
|
}) }),
|
|
2045
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { role: "alert", className: "text-
|
|
2094
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
|
|
2046
2095
|
menu && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2047
2096
|
"div",
|
|
2048
2097
|
{
|
|
2049
2098
|
role: "menu",
|
|
2050
2099
|
"aria-label": "Layer menu",
|
|
2051
|
-
className: "fixed z-50 min-w-44 rounded border border-
|
|
2100
|
+
className: "fixed z-50 min-w-44 rounded border border-border bg-background py-1 shadow-xl",
|
|
2052
2101
|
style: { left: menu.x, top: menu.y },
|
|
2053
2102
|
onClick: (e) => e.stopPropagation(),
|
|
2054
2103
|
onKeyDown: (e) => e.key === "Escape" && setMenu(null),
|
|
@@ -2058,7 +2107,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2058
2107
|
type: "button",
|
|
2059
2108
|
role: "menuitem",
|
|
2060
2109
|
disabled: !item.enabled,
|
|
2061
|
-
className: "block w-full px-3 py-1 text-left hover:bg-
|
|
2110
|
+
className: "block w-full px-3 py-1 text-left hover:bg-muted disabled:opacity-40",
|
|
2062
2111
|
onClick: () => run(item.action),
|
|
2063
2112
|
children: item.label
|
|
2064
2113
|
},
|
|
@@ -3695,21 +3744,22 @@ function EffectParameters({
|
|
|
3695
3744
|
|
|
3696
3745
|
// src/image-editor/ImageEffectControls.tsx
|
|
3697
3746
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3698
|
-
function ImageEffectControls({ provider, effect, name, values, onChange, onPreset }) {
|
|
3747
|
+
function ImageEffectControls({ provider, effect, name, values, onChange, onPreset, className }) {
|
|
3699
3748
|
const { description, error } = useEffectDescription(provider, effect);
|
|
3700
|
-
|
|
3749
|
+
let body;
|
|
3750
|
+
if (!provider) body = /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
3701
3751
|
'No effects provider: "',
|
|
3702
3752
|
name ?? effect,
|
|
3703
3753
|
'" is kept but not drawn.'
|
|
3704
3754
|
] });
|
|
3705
|
-
if (error)
|
|
3706
|
-
if (!description)
|
|
3707
|
-
|
|
3755
|
+
else if (error) body = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[11px] text-amber-600", children: error });
|
|
3756
|
+
else if (!description) body = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
|
|
3757
|
+
else body = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(EffectParameters, { description, values, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
|
|
3758
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className, "data-testid": "image-effect-controls", children: body });
|
|
3708
3759
|
}
|
|
3709
3760
|
|
|
3710
3761
|
// src/image-editor/ImageProviderEffectsPanel.tsx
|
|
3711
3762
|
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
3763
|
function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
3714
3764
|
const [, setTick] = (0, import_react19.useState)(0);
|
|
3715
3765
|
(0, import_react19.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -3739,17 +3789,17 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
3739
3789
|
const canFilter = !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
|
|
3740
3790
|
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
3791
|
/* @__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:
|
|
3792
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Effects" }),
|
|
3793
|
+
/* @__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" }),
|
|
3794
|
+
/* @__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
3795
|
] }),
|
|
3746
|
-
!provider && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-
|
|
3796
|
+
!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
3797
|
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
3798
|
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
3799
|
generator && layer && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "space-y-1", "data-effect-part": "generator", children: [
|
|
3750
3800
|
/* @__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:
|
|
3801
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "flex-1 font-medium text-foreground", children: generator.name ?? generator.effect }),
|
|
3802
|
+
/* @__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
3803
|
] }),
|
|
3754
3804
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3755
3805
|
ImageEffectControls,
|
|
@@ -3768,20 +3818,20 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
3768
3818
|
const all = layer.smartFilters.filters;
|
|
3769
3819
|
const index = all.indexOf(f);
|
|
3770
3820
|
if (f.kind !== "effect") return null;
|
|
3771
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("li", { className: "rounded border border-
|
|
3821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("li", { className: "rounded border border-border p-1", "data-smart-effect": f.id, children: [
|
|
3772
3822
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
3773
3823
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "checkbox", checked: f.enabled, "aria-label": `${label} on`, onChange: (e) => {
|
|
3774
3824
|
const enabled = e.currentTarget.checked;
|
|
3775
3825
|
run(() => controller.updateEffectFilter(layer.id, f.id, { enabled }));
|
|
3776
3826
|
} }),
|
|
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:
|
|
3827
|
+
/* @__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 }),
|
|
3828
|
+
/* @__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" }),
|
|
3829
|
+
/* @__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" }),
|
|
3830
|
+
/* @__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
3831
|
] }),
|
|
3782
3832
|
open === f.id && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "mt-1 space-y-2", children: [
|
|
3783
3833
|
/* @__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-
|
|
3834
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-14 text-[11px] text-foreground", children: "Opacity" }),
|
|
3785
3835
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3786
3836
|
"input",
|
|
3787
3837
|
{
|
|
@@ -3813,8 +3863,8 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
3813
3863
|
] })
|
|
3814
3864
|
] }, f.id);
|
|
3815
3865
|
}) }),
|
|
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-
|
|
3866
|
+
!layer && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
|
|
3867
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
3818
3868
|
] });
|
|
3819
3869
|
}
|
|
3820
3870
|
|
|
@@ -3829,7 +3879,7 @@ var import_image_editor10 = require("@pixerate/editor/image-editor");
|
|
|
3829
3879
|
// src/paint-editor/PaintGradientEditorView.tsx
|
|
3830
3880
|
var import_react20 = require("react");
|
|
3831
3881
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3832
|
-
var
|
|
3882
|
+
var button = "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700 disabled:opacity-40";
|
|
3833
3883
|
var select = "rounded bg-slate-800 px-1 py-0.5 text-[11px]";
|
|
3834
3884
|
var number = "w-16 rounded bg-slate-800 px-1 py-0.5 text-[11px]";
|
|
3835
3885
|
var pct = (v) => Math.round(v * 1e3) / 10;
|
|
@@ -3865,7 +3915,7 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
|
|
|
3865
3915
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "", children: "Presets\u2026" }),
|
|
3866
3916
|
PAINT_GRADIENT_PRESETS.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: i, children: p.name }, p.name))
|
|
3867
3917
|
] }),
|
|
3868
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className:
|
|
3918
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, onClick: () => onChange(reversePaintGradient(value)), children: "Reverse" })
|
|
3869
3919
|
] }),
|
|
3870
3920
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3871
3921
|
"div",
|
|
@@ -3923,7 +3973,7 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
|
|
|
3923
3973
|
/* @__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
3974
|
"%"
|
|
3925
3975
|
] }),
|
|
3926
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className:
|
|
3976
|
+
/* @__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
3977
|
] }),
|
|
3928
3978
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-mapping", children: [
|
|
3929
3979
|
/* @__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 +4004,6 @@ var PaintGradientEditor = (props) => /* @__PURE__ */ (0, import_jsx_runtime19.js
|
|
|
3954
4004
|
|
|
3955
4005
|
// src/image-editor/BrushOptionsBar.tsx
|
|
3956
4006
|
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
4007
|
var BrushOptionsBar = ({ controller, className }) => {
|
|
3959
4008
|
const [, setTick] = (0, import_react21.useState)(0);
|
|
3960
4009
|
(0, import_react21.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -3970,14 +4019,14 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
3970
4019
|
setError(err instanceof Error ? err.message : String(err));
|
|
3971
4020
|
}
|
|
3972
4021
|
};
|
|
3973
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-
|
|
4022
|
+
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
4023
|
/* @__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
4024
|
"button",
|
|
3976
4025
|
{
|
|
3977
4026
|
type: "button",
|
|
3978
4027
|
"aria-pressed": state.activeTool === t.id,
|
|
3979
4028
|
title: t.shortcut ? `${t.label} (${t.shortcut})` : t.label,
|
|
3980
|
-
className:
|
|
4029
|
+
className: imageChipClass(state.activeTool === t.id),
|
|
3981
4030
|
onClick: () => controller.setTool(t.id),
|
|
3982
4031
|
children: t.label
|
|
3983
4032
|
},
|
|
@@ -3992,10 +4041,10 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
3992
4041
|
"aria-label": "Foreground colour",
|
|
3993
4042
|
value: foreground,
|
|
3994
4043
|
onChange: (e) => controller.setPaintOptions({ foreground: e.target.value }),
|
|
3995
|
-
className:
|
|
4044
|
+
className: imageColorInputClass
|
|
3996
4045
|
}
|
|
3997
4046
|
),
|
|
3998
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-
|
|
4047
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-muted-foreground", children: "FG" })
|
|
3999
4048
|
] }),
|
|
4000
4049
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4001
4050
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
@@ -4005,20 +4054,20 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4005
4054
|
"aria-label": "Background colour",
|
|
4006
4055
|
value: background,
|
|
4007
4056
|
onChange: (e) => controller.setPaintOptions({ background: e.target.value }),
|
|
4008
|
-
className:
|
|
4057
|
+
className: imageColorInputClass
|
|
4009
4058
|
}
|
|
4010
4059
|
),
|
|
4011
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-
|
|
4060
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-muted-foreground", children: "BG" })
|
|
4012
4061
|
] }),
|
|
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:
|
|
4062
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: "Swap colours (X)", className: imageChipClass(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
|
|
4063
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: "Default colours (D)", className: imageChipClass(false), onClick: () => controller.resetPaintColors(), children: "Default" }),
|
|
4015
4064
|
state.activeTool === "brush" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4016
4065
|
"button",
|
|
4017
4066
|
{
|
|
4018
4067
|
type: "button",
|
|
4019
4068
|
"aria-pressed": paint.type === "gradient",
|
|
4020
4069
|
title: "Gradient paint: the brush changes colour as the stroke goes",
|
|
4021
|
-
className:
|
|
4070
|
+
className: imageChipClass(paint.type === "gradient"),
|
|
4022
4071
|
onClick: () => attempt(() => controller.setPaintOptions(paint.type === "gradient" ? { foreground } : { paint: import_image_editor12.DEFAULT_PAINT_GRADIENT })),
|
|
4023
4072
|
children: "Gradient"
|
|
4024
4073
|
}
|
|
@@ -4034,19 +4083,19 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4034
4083
|
},
|
|
4035
4084
|
spec.id
|
|
4036
4085
|
)),
|
|
4037
|
-
state.activeTool === "mixer" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-2 border-t border-
|
|
4086
|
+
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
4087
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4039
4088
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4040
4089
|
"span",
|
|
4041
4090
|
{
|
|
4042
4091
|
"aria-label": "Brush load",
|
|
4043
4092
|
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-
|
|
4093
|
+
className: "h-6 w-6 rounded border border-border",
|
|
4045
4094
|
style: { background: mixerLoad.reservoir ? (0, import_image_editor11.rgbUnitToHex)(mixerLoad.reservoir) : "transparent" }
|
|
4046
4095
|
}
|
|
4047
4096
|
),
|
|
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:
|
|
4097
|
+
/* @__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" }),
|
|
4098
|
+
/* @__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
4099
|
] }),
|
|
4051
4100
|
/* @__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
4101
|
"button",
|
|
@@ -4054,14 +4103,14 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4054
4103
|
type: "button",
|
|
4055
4104
|
"aria-pressed": mixer.mixing === m.id,
|
|
4056
4105
|
title: m.title,
|
|
4057
|
-
className:
|
|
4106
|
+
className: imageChipClass(mixer.mixing === m.id),
|
|
4058
4107
|
onClick: () => controller.setPaintOptions({ mixer: { mixing: m.id } }),
|
|
4059
4108
|
children: m.label
|
|
4060
4109
|
},
|
|
4061
4110
|
m.id
|
|
4062
4111
|
)) }),
|
|
4063
4112
|
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-
|
|
4113
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap gap-3 text-foreground", children: [
|
|
4065
4114
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
4066
4115
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4067
4116
|
"input",
|
|
@@ -4070,7 +4119,7 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4070
4119
|
"aria-label": "Load the brush after each stroke",
|
|
4071
4120
|
checked: mixer.loadEachStroke,
|
|
4072
4121
|
onChange: (e) => controller.setPaintOptions({ mixer: { loadEachStroke: e.target.checked } }),
|
|
4073
|
-
className: "accent-
|
|
4122
|
+
className: "accent-primary"
|
|
4074
4123
|
}
|
|
4075
4124
|
),
|
|
4076
4125
|
"Load each stroke"
|
|
@@ -4083,35 +4132,35 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4083
4132
|
"aria-label": "Clean the brush after each stroke",
|
|
4084
4133
|
checked: mixer.cleanEachStroke,
|
|
4085
4134
|
onChange: (e) => controller.setPaintOptions({ mixer: { cleanEachStroke: e.target.checked } }),
|
|
4086
|
-
className: "accent-
|
|
4135
|
+
className: "accent-primary"
|
|
4087
4136
|
}
|
|
4088
4137
|
),
|
|
4089
4138
|
"Clean each stroke"
|
|
4090
4139
|
] })
|
|
4091
4140
|
] })
|
|
4092
4141
|
] }),
|
|
4093
|
-
(0, import_image_editor11.isRetouchPaintTool)(tool) && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-2 border-t border-
|
|
4142
|
+
(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
4143
|
(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:
|
|
4144
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-muted-foreground", "data-testid": "clone-source", children: (0, import_image_editor11.cloneSourceLabel)(controller) }),
|
|
4145
|
+
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
4146
|
] }),
|
|
4098
4147
|
(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
4148
|
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
4149
|
/* @__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:
|
|
4150
|
+
/* @__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" }),
|
|
4151
|
+
/* @__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" }),
|
|
4152
|
+
!(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
4153
|
] })
|
|
4105
4154
|
] }),
|
|
4106
4155
|
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-
|
|
4156
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-muted-foreground", children: choice.label }),
|
|
4108
4157
|
choice.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4109
4158
|
"button",
|
|
4110
4159
|
{
|
|
4111
4160
|
type: "button",
|
|
4112
4161
|
"aria-pressed": retouch[choice.id] === o.id,
|
|
4113
4162
|
title: o.title,
|
|
4114
|
-
className:
|
|
4163
|
+
className: imageChipClass(retouch[choice.id] === o.id),
|
|
4115
4164
|
onClick: () => (0, import_image_editor11.setRetouchChoice)(controller, choice.id, o.id),
|
|
4116
4165
|
children: o.label
|
|
4117
4166
|
},
|
|
@@ -4119,7 +4168,7 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4119
4168
|
))
|
|
4120
4169
|
] }, choice.id)),
|
|
4121
4170
|
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-
|
|
4171
|
+
/* @__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
4172
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4124
4173
|
"input",
|
|
4125
4174
|
{
|
|
@@ -4127,13 +4176,13 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4127
4176
|
"aria-label": t.label,
|
|
4128
4177
|
checked: retouch[t.id],
|
|
4129
4178
|
onChange: (e) => controller.setPaintOptions({ retouch: { [t.id]: e.target.checked } }),
|
|
4130
|
-
className: "accent-
|
|
4179
|
+
className: "accent-primary"
|
|
4131
4180
|
}
|
|
4132
4181
|
),
|
|
4133
4182
|
t.label
|
|
4134
4183
|
] }, t.id)) })
|
|
4135
4184
|
] }),
|
|
4136
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap gap-3 text-
|
|
4185
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap gap-3 text-foreground", role: "group", "aria-label": "Pressure", children: [
|
|
4137
4186
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
4138
4187
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4139
4188
|
"input",
|
|
@@ -4142,7 +4191,7 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4142
4191
|
"aria-label": "Pressure controls size",
|
|
4143
4192
|
checked: brush.pressureSize,
|
|
4144
4193
|
onChange: (e) => controller.setPaintOptions({ brush: { pressureSize: e.target.checked } }),
|
|
4145
|
-
className: "accent-
|
|
4194
|
+
className: "accent-primary"
|
|
4146
4195
|
}
|
|
4147
4196
|
),
|
|
4148
4197
|
"Pressure size"
|
|
@@ -4155,17 +4204,17 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4155
4204
|
"aria-label": "Pressure controls opacity",
|
|
4156
4205
|
checked: brush.pressureOpacity,
|
|
4157
4206
|
onChange: (e) => controller.setPaintOptions({ brush: { pressureOpacity: e.target.checked } }),
|
|
4158
|
-
className: "accent-
|
|
4207
|
+
className: "accent-primary"
|
|
4159
4208
|
}
|
|
4160
4209
|
),
|
|
4161
4210
|
"Pressure opacity"
|
|
4162
4211
|
] })
|
|
4163
4212
|
] }),
|
|
4164
4213
|
/* @__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:
|
|
4214
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.fillPixels()), children: "Fill" }),
|
|
4215
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.clearPixels()), children: "Clear" })
|
|
4167
4216
|
] }),
|
|
4168
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { role: "alert", className: "text-
|
|
4217
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
4169
4218
|
] });
|
|
4170
4219
|
};
|
|
4171
4220
|
|
|
@@ -4173,8 +4222,8 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4173
4222
|
var import_react22 = require("react");
|
|
4174
4223
|
var import_image_editor13 = require("@pixerate/editor/image-editor");
|
|
4175
4224
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
4176
|
-
var
|
|
4177
|
-
var select2 = "rounded bg-
|
|
4225
|
+
var chip = imageChipClass(false);
|
|
4226
|
+
var select2 = "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground";
|
|
4178
4227
|
var ColorProfilePanel = ({ controller, className }) => {
|
|
4179
4228
|
const [, setTick] = (0, import_react22.useState)(0);
|
|
4180
4229
|
(0, import_react22.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -4203,28 +4252,28 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
4203
4252
|
})
|
|
4204
4253
|
);
|
|
4205
4254
|
};
|
|
4206
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-
|
|
4255
|
+
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
4256
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4208
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-
|
|
4257
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: "Profile" }),
|
|
4209
4258
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "data-testid": "color-profile-name", children: view.profileName })
|
|
4210
4259
|
] }),
|
|
4211
4260
|
/* @__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-
|
|
4261
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: "Mode" }),
|
|
4213
4262
|
/* @__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-
|
|
4263
|
+
view.cmykProfileName && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: view.cmykProfileName })
|
|
4215
4264
|
] }),
|
|
4216
4265
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
|
|
4217
4266
|
/* @__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
4267
|
/* @__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
4268
|
/* @__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-
|
|
4269
|
+
/* @__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
4270
|
"BPC"
|
|
4222
4271
|
] }),
|
|
4223
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className:
|
|
4224
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className:
|
|
4272
|
+
/* @__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" }),
|
|
4273
|
+
/* @__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
4274
|
] }),
|
|
4226
4275
|
/* @__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-
|
|
4276
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: "Proof" }),
|
|
4228
4277
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
4229
4278
|
"select",
|
|
4230
4279
|
{
|
|
@@ -4241,16 +4290,16 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
4241
4290
|
view.proof && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
4242
4291
|
/* @__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
4292
|
/* @__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-
|
|
4293
|
+
/* @__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
4294
|
"Paper"
|
|
4246
4295
|
] }),
|
|
4247
4296
|
/* @__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-
|
|
4297
|
+
/* @__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
4298
|
"Gamut warning"
|
|
4250
4299
|
] })
|
|
4251
4300
|
] })
|
|
4252
4301
|
] }),
|
|
4253
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { role: "alert", className: "text-
|
|
4302
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
4254
4303
|
] });
|
|
4255
4304
|
};
|
|
4256
4305
|
|
|
@@ -4265,7 +4314,7 @@ var MODIFY_OPS = [
|
|
|
4265
4314
|
{ op: "border", label: "Border" },
|
|
4266
4315
|
{ op: "smooth", label: "Smooth" }
|
|
4267
4316
|
];
|
|
4268
|
-
var
|
|
4317
|
+
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
4318
|
var SelectionOptionsBar = ({
|
|
4270
4319
|
controller,
|
|
4271
4320
|
options,
|
|
@@ -4279,11 +4328,11 @@ var SelectionOptionsBar = ({
|
|
|
4279
4328
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
4280
4329
|
const qm = quickMask ?? Boolean(controller.getState().quickMask);
|
|
4281
4330
|
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:
|
|
4331
|
+
/* @__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)) }),
|
|
4332
|
+
/* @__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
4333
|
options.tool === "wand" && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
4285
4334
|
/* @__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-
|
|
4335
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4287
4336
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: "Tolerance" }),
|
|
4288
4337
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "font-mono", children: options.tolerance })
|
|
4289
4338
|
] }),
|
|
@@ -4297,19 +4346,19 @@ var SelectionOptionsBar = ({
|
|
|
4297
4346
|
"aria-label": "Tolerance",
|
|
4298
4347
|
value: options.tolerance,
|
|
4299
4348
|
onChange: (e) => set({ tolerance: Number(e.target.value) }),
|
|
4300
|
-
className:
|
|
4349
|
+
className: imageRangeClass
|
|
4301
4350
|
}
|
|
4302
4351
|
)
|
|
4303
4352
|
] }),
|
|
4304
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
4353
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4305
4354
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "checkbox", checked: options.contiguous, onChange: (e) => set({ contiguous: e.target.checked }) }),
|
|
4306
4355
|
"Contiguous"
|
|
4307
4356
|
] }),
|
|
4308
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
4357
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4309
4358
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "checkbox", checked: options.sampleMerged, onChange: (e) => set({ sampleMerged: e.target.checked }) }),
|
|
4310
4359
|
"Sample adjusted image"
|
|
4311
4360
|
] }),
|
|
4312
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
4361
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4313
4362
|
"Sample",
|
|
4314
4363
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
4315
4364
|
"select",
|
|
@@ -4317,7 +4366,7 @@ var SelectionOptionsBar = ({
|
|
|
4317
4366
|
"aria-label": "Sample from",
|
|
4318
4367
|
value: options.sample ?? "composite",
|
|
4319
4368
|
onChange: (e) => set({ sample: e.target.value }),
|
|
4320
|
-
className: "bg-
|
|
4369
|
+
className: "bg-muted border border-border rounded px-1 py-0.5",
|
|
4321
4370
|
children: [
|
|
4322
4371
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "composite", children: "All layers" }),
|
|
4323
4372
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "active-layer", children: "Active layer" })
|
|
@@ -4326,18 +4375,18 @@ var SelectionOptionsBar = ({
|
|
|
4326
4375
|
)
|
|
4327
4376
|
] })
|
|
4328
4377
|
] }),
|
|
4329
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
4378
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4330
4379
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "checkbox", checked: options.antiAlias, onChange: (e) => set({ antiAlias: e.target.checked }) }),
|
|
4331
4380
|
"Anti-alias"
|
|
4332
4381
|
] }),
|
|
4333
4382
|
/* @__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:
|
|
4383
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
|
|
4384
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
|
|
4385
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
|
|
4386
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", "aria-pressed": qm, className: btn(qm), onClick: () => controller.setQuickMask(!qm), children: "Quick Mask" })
|
|
4338
4387
|
] }),
|
|
4339
4388
|
/* @__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-
|
|
4389
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4341
4390
|
"Radius",
|
|
4342
4391
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4343
4392
|
"input",
|
|
@@ -4349,13 +4398,13 @@ var SelectionOptionsBar = ({
|
|
|
4349
4398
|
"aria-label": "Modify radius",
|
|
4350
4399
|
value: radius,
|
|
4351
4400
|
onChange: (e) => setRadius(Math.max(0, Number(e.target.value) || 0)),
|
|
4352
|
-
className: "w-14 bg-
|
|
4401
|
+
className: "w-14 bg-background border border-border rounded px-1 py-0.5 text-foreground"
|
|
4353
4402
|
}
|
|
4354
4403
|
)
|
|
4355
4404
|
] }),
|
|
4356
|
-
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className:
|
|
4405
|
+
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
4406
|
] }),
|
|
4358
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { "data-testid": "selection-status", className: "text-
|
|
4407
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: (0, import_image_editor14.describeSelection)(sel) })
|
|
4359
4408
|
] });
|
|
4360
4409
|
};
|
|
4361
4410
|
|
|
@@ -4364,7 +4413,7 @@ var import_react24 = require("react");
|
|
|
4364
4413
|
var import_image_editor15 = require("@pixerate/editor/image-editor");
|
|
4365
4414
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4366
4415
|
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
4367
|
-
var
|
|
4416
|
+
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
4417
|
var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
4369
4418
|
const [params, setParams] = (0, import_react24.useState)(DEFAULT_PARAMS);
|
|
4370
4419
|
const [busy, setBusy] = (0, import_react24.useState)(false);
|
|
@@ -4386,9 +4435,9 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4386
4435
|
}
|
|
4387
4436
|
};
|
|
4388
4437
|
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:
|
|
4438
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
|
|
4390
4439
|
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-
|
|
4440
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4392
4441
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: c.label }),
|
|
4393
4442
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-mono", children: [
|
|
4394
4443
|
params[c.id],
|
|
@@ -4405,20 +4454,20 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4405
4454
|
"aria-label": c.label,
|
|
4406
4455
|
value: params[c.id],
|
|
4407
4456
|
onChange: (e) => setParams({ ...params, [c.id]: Number(e.target.value) }),
|
|
4408
|
-
className:
|
|
4457
|
+
className: imageRangeClass
|
|
4409
4458
|
}
|
|
4410
4459
|
)
|
|
4411
4460
|
] }, c.id)),
|
|
4412
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
4461
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4413
4462
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
4414
4463
|
"Smart Radius"
|
|
4415
4464
|
] }),
|
|
4416
4465
|
/* @__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:
|
|
4466
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: button2, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
4467
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: button2, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
|
4419
4468
|
] }),
|
|
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-
|
|
4469
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
|
|
4470
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
|
|
4422
4471
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-1 items-center", children: [
|
|
4423
4472
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4424
4473
|
"select",
|
|
@@ -4426,7 +4475,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4426
4475
|
"aria-label": "New masked layer kind",
|
|
4427
4476
|
value: newKind,
|
|
4428
4477
|
onChange: (e) => setNewKind(e.target.value),
|
|
4429
|
-
className: "flex-1 bg-
|
|
4478
|
+
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
4430
4479
|
children: import_image_editor15.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: k.kind, children: k.label }, k.kind))
|
|
4431
4480
|
}
|
|
4432
4481
|
),
|
|
@@ -4434,7 +4483,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4434
4483
|
"button",
|
|
4435
4484
|
{
|
|
4436
4485
|
type: "button",
|
|
4437
|
-
className:
|
|
4486
|
+
className: button2,
|
|
4438
4487
|
disabled: !sel,
|
|
4439
4488
|
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0, import_image_editor15.layerMaskFromSelection)(sel) })),
|
|
4440
4489
|
children: "New Masked Layer"
|
|
@@ -4448,7 +4497,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4448
4497
|
"aria-label": "Mask layer",
|
|
4449
4498
|
value: target.id,
|
|
4450
4499
|
onChange: (e) => setLayerId(e.target.value),
|
|
4451
|
-
className: "bg-
|
|
4500
|
+
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
4452
4501
|
children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("option", { value: l.id, children: [
|
|
4453
4502
|
l.name || (0, import_image_editor15.adjustmentKindLabel)(l.kind),
|
|
4454
4503
|
l.mask ? " (masked)" : ""
|
|
@@ -4456,13 +4505,13 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4456
4505
|
}
|
|
4457
4506
|
),
|
|
4458
4507
|
/* @__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:
|
|
4508
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: button2, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
|
|
4509
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: button2, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
|
|
4510
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: button2, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
|
|
4462
4511
|
] }),
|
|
4463
4512
|
target.mask && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
4464
4513
|
/* @__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-
|
|
4514
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4466
4515
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Density" }),
|
|
4467
4516
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-mono", children: [
|
|
4468
4517
|
Math.round((target.mask.density ?? 1) * 100),
|
|
@@ -4479,12 +4528,12 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4479
4528
|
"aria-label": "Mask density",
|
|
4480
4529
|
value: Math.round((target.mask.density ?? 1) * 100),
|
|
4481
4530
|
onChange: (e) => controller.setAdjustmentLayerMaskProps(target.id, { density: Number(e.target.value) / 100 }),
|
|
4482
|
-
className:
|
|
4531
|
+
className: imageRangeClass
|
|
4483
4532
|
}
|
|
4484
4533
|
)
|
|
4485
4534
|
] }),
|
|
4486
4535
|
/* @__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-
|
|
4536
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4488
4537
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Mask Feather" }),
|
|
4489
4538
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-mono", children: [
|
|
4490
4539
|
target.mask.feather ?? 0,
|
|
@@ -4501,7 +4550,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4501
4550
|
"aria-label": "Mask feather",
|
|
4502
4551
|
value: target.mask.feather ?? 0,
|
|
4503
4552
|
onChange: (e) => controller.setAdjustmentLayerMaskProps(target.id, { feather: Number(e.target.value) }),
|
|
4504
|
-
className:
|
|
4553
|
+
className: imageRangeClass
|
|
4505
4554
|
}
|
|
4506
4555
|
)
|
|
4507
4556
|
] })
|
|
@@ -4514,7 +4563,6 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4514
4563
|
var import_react25 = require("react");
|
|
4515
4564
|
var import_image_editor16 = require("@pixerate/editor/image-editor");
|
|
4516
4565
|
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
4566
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
4519
4567
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
4520
4568
|
const [, setTick] = (0, import_react25.useState)(0);
|
|
@@ -4530,16 +4578,16 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4530
4578
|
const v = Number(raw);
|
|
4531
4579
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
4532
4580
|
};
|
|
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-
|
|
4581
|
+
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: [
|
|
4582
|
+
/* @__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)) }),
|
|
4583
|
+
/* @__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
4584
|
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
4585
|
/* @__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:
|
|
4586
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
4587
|
+
/* @__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
4588
|
] }),
|
|
4541
4589
|
["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-
|
|
4590
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
4543
4591
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4544
4592
|
"input",
|
|
4545
4593
|
{
|
|
@@ -4549,7 +4597,7 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4549
4597
|
min: -100,
|
|
4550
4598
|
max: 100,
|
|
4551
4599
|
disabled: warp.style === "custom",
|
|
4552
|
-
className: "w-14 rounded border border-
|
|
4600
|
+
className: "w-14 rounded border border-border bg-background px-1 py-0.5 text-right disabled:opacity-40",
|
|
4553
4601
|
onBlur: (e) => warpNumber(k, e.currentTarget.value),
|
|
4554
4602
|
onKeyDown: (e) => {
|
|
4555
4603
|
if (e.key === "Enter") {
|
|
@@ -4561,7 +4609,7 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4561
4609
|
},
|
|
4562
4610
|
`${k}:${warp[k]}`
|
|
4563
4611
|
),
|
|
4564
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-
|
|
4612
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: "%" })
|
|
4565
4613
|
] }, k)),
|
|
4566
4614
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4567
4615
|
"button",
|
|
@@ -4570,13 +4618,13 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4570
4618
|
title: "Bend along the vertical axis",
|
|
4571
4619
|
"aria-pressed": warp.orientation === "vertical",
|
|
4572
4620
|
disabled: warp.style === "custom",
|
|
4573
|
-
className:
|
|
4621
|
+
className: imageChipClass(warp.orientation === "vertical"),
|
|
4574
4622
|
onClick: () => tool.setWarp({ orientation: warp.orientation === "vertical" ? "horizontal" : "vertical" }),
|
|
4575
4623
|
children: "Vertical"
|
|
4576
4624
|
}
|
|
4577
4625
|
),
|
|
4578
4626
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4579
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-
|
|
4627
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
4580
4628
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4581
4629
|
"select",
|
|
4582
4630
|
{
|
|
@@ -4586,14 +4634,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4586
4634
|
const g = import_image_editor16.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
|
|
4587
4635
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
4588
4636
|
},
|
|
4589
|
-
className:
|
|
4637
|
+
className: imageFieldClass,
|
|
4590
4638
|
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
4639
|
}
|
|
4592
4640
|
)
|
|
4593
4641
|
] })
|
|
4594
4642
|
] }),
|
|
4595
4643
|
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-
|
|
4644
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: f.label }),
|
|
4597
4645
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4598
4646
|
"input",
|
|
4599
4647
|
{
|
|
@@ -4602,7 +4650,7 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4602
4650
|
defaultValue: round(bar[f.id], f.unit),
|
|
4603
4651
|
disabled: !bar.affine,
|
|
4604
4652
|
step: f.unit === "px" ? 1 : 0.1,
|
|
4605
|
-
className: "w-16 rounded border border-
|
|
4653
|
+
className: "w-16 rounded border border-border bg-background px-1 py-0.5 text-right disabled:opacity-40",
|
|
4606
4654
|
onBlur: (e) => apply(f.id, e.currentTarget.value),
|
|
4607
4655
|
onKeyDown: (e) => {
|
|
4608
4656
|
if (e.key === "Enter") {
|
|
@@ -4614,14 +4662,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4614
4662
|
},
|
|
4615
4663
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
4616
4664
|
),
|
|
4617
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-
|
|
4665
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
|
|
4618
4666
|
f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4619
4667
|
"button",
|
|
4620
4668
|
{
|
|
4621
4669
|
type: "button",
|
|
4622
4670
|
"aria-label": "Keep width and height proportional",
|
|
4623
4671
|
"aria-pressed": tool.proportional,
|
|
4624
|
-
className:
|
|
4672
|
+
className: imageChipClass(tool.proportional),
|
|
4625
4673
|
onClick: () => {
|
|
4626
4674
|
tool.proportional = !tool.proportional;
|
|
4627
4675
|
setTick((n) => n + 1);
|
|
@@ -4631,21 +4679,21 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4631
4679
|
)
|
|
4632
4680
|
] }, f.id)),
|
|
4633
4681
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4634
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-
|
|
4682
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
4635
4683
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4636
4684
|
"select",
|
|
4637
4685
|
{
|
|
4638
4686
|
"aria-label": "Interpolation",
|
|
4639
4687
|
value: tool.interpolation,
|
|
4640
4688
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
4641
|
-
className:
|
|
4689
|
+
className: imageFieldClass,
|
|
4642
4690
|
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
4691
|
}
|
|
4644
4692
|
)
|
|
4645
4693
|
] }),
|
|
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-
|
|
4694
|
+
/* @__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" }),
|
|
4695
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
4696
|
+
tool.error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
4649
4697
|
] });
|
|
4650
4698
|
};
|
|
4651
4699
|
|
|
@@ -4653,7 +4701,6 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4653
4701
|
var import_react26 = require("react");
|
|
4654
4702
|
var import_image_editor17 = require("@pixerate/editor/image-editor");
|
|
4655
4703
|
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
4704
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
4658
4705
|
const [, setTick] = (0, import_react26.useState)(0);
|
|
4659
4706
|
(0, import_react26.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -4671,8 +4718,8 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4671
4718
|
}
|
|
4672
4719
|
};
|
|
4673
4720
|
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:
|
|
4721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
4722
|
+
/* @__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
4723
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
4677
4724
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4678
4725
|
/* @__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 +4732,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4685
4732
|
disabled: options.fill === null,
|
|
4686
4733
|
value: options.fill ?? "#4f46e5",
|
|
4687
4734
|
onChange: (e) => set({ fill: e.target.value }),
|
|
4688
|
-
className:
|
|
4735
|
+
className: imageColorInputClass
|
|
4689
4736
|
}
|
|
4690
4737
|
)
|
|
4691
4738
|
] }),
|
|
@@ -4700,7 +4747,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4700
4747
|
disabled: options.stroke === null,
|
|
4701
4748
|
value: options.stroke ?? "#000000",
|
|
4702
4749
|
onChange: (e) => set({ stroke: e.target.value }),
|
|
4703
|
-
className:
|
|
4750
|
+
className: imageColorInputClass
|
|
4704
4751
|
}
|
|
4705
4752
|
)
|
|
4706
4753
|
] }),
|
|
@@ -4715,7 +4762,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4715
4762
|
max: 200,
|
|
4716
4763
|
value: options.strokeWidth,
|
|
4717
4764
|
onChange: (e) => set({ strokeWidth: num(e.target.value, 0, 200) }),
|
|
4718
|
-
className:
|
|
4765
|
+
className: `w-14 ${imageFieldClass}`
|
|
4719
4766
|
}
|
|
4720
4767
|
)
|
|
4721
4768
|
] })
|
|
@@ -4723,16 +4770,16 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4723
4770
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
4724
4771
|
options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4725
4772
|
"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:
|
|
4773
|
+
/* @__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
4774
|
] }),
|
|
4728
4775
|
options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4729
4776
|
"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:
|
|
4777
|
+
/* @__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
4778
|
] }),
|
|
4732
4779
|
options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
4733
4780
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4734
4781
|
"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:
|
|
4782
|
+
/* @__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
4783
|
] }),
|
|
4737
4784
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4738
4785
|
"Inner",
|
|
@@ -4746,7 +4793,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4746
4793
|
step: 0.05,
|
|
4747
4794
|
value: options.innerRatio,
|
|
4748
4795
|
onChange: (e) => set({ innerRatio: Number(e.target.value) }),
|
|
4749
|
-
className: "accent-
|
|
4796
|
+
className: "accent-primary"
|
|
4750
4797
|
}
|
|
4751
4798
|
)
|
|
4752
4799
|
] })
|
|
@@ -4754,7 +4801,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4754
4801
|
options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
4755
4802
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4756
4803
|
"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:
|
|
4804
|
+
/* @__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
4805
|
] }),
|
|
4759
4806
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4760
4807
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("input", { type: "checkbox", "aria-label": "Arrowhead", checked: options.arrow, onChange: (e) => set({ arrow: e.target.checked }) }),
|
|
@@ -4762,8 +4809,8 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4762
4809
|
] })
|
|
4763
4810
|
] })
|
|
4764
4811
|
] }),
|
|
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-
|
|
4812
|
+
/* @__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." }),
|
|
4813
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
4767
4814
|
] });
|
|
4768
4815
|
};
|
|
4769
4816
|
|
|
@@ -4771,7 +4818,6 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4771
4818
|
var import_react27 = require("react");
|
|
4772
4819
|
var import_image_editor18 = require("@pixerate/editor/image-editor");
|
|
4773
4820
|
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
4821
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
4776
4822
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
4777
4823
|
const [, setTick] = (0, import_react27.useState)(0);
|
|
@@ -4809,7 +4855,7 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4809
4855
|
setError(e instanceof Error ? e.message : String(e));
|
|
4810
4856
|
}
|
|
4811
4857
|
};
|
|
4812
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-
|
|
4858
|
+
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
4859
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
4814
4860
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4815
4861
|
"Font",
|
|
@@ -4820,7 +4866,7 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4820
4866
|
"aria-label": "Font family",
|
|
4821
4867
|
value: shown.fontFamily,
|
|
4822
4868
|
onChange: (e) => e.target.value.trim() && style({ fontFamily: e.target.value }),
|
|
4823
|
-
className: "w-32 rounded border border-
|
|
4869
|
+
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
4824
4870
|
}
|
|
4825
4871
|
),
|
|
4826
4872
|
/* @__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 +4882,23 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4836
4882
|
max: 2e3,
|
|
4837
4883
|
value: Math.round(shown.fontSize * 10) / 10,
|
|
4838
4884
|
onChange: (e) => Number(e.target.value) > 0 && style({ fontSize: Number(e.target.value) }),
|
|
4839
|
-
className: "w-16 rounded border border-
|
|
4885
|
+
className: "w-16 rounded border border-border bg-background px-1 py-0.5"
|
|
4840
4886
|
}
|
|
4841
4887
|
)
|
|
4842
4888
|
] }),
|
|
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:
|
|
4889
|
+
/* @__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" }),
|
|
4890
|
+
/* @__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" }),
|
|
4891
|
+
/* @__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
4892
|
] }),
|
|
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-
|
|
4893
|
+
/* @__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)) }),
|
|
4894
|
+
/* @__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." }),
|
|
4895
|
+
missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
4850
4896
|
"Missing ",
|
|
4851
4897
|
missing.length === 1 ? "font" : "fonts",
|
|
4852
4898
|
": ",
|
|
4853
4899
|
missing.join(", ")
|
|
4854
4900
|
] }),
|
|
4855
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "alert", className: "text-
|
|
4901
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
4856
4902
|
] });
|
|
4857
4903
|
};
|
|
4858
4904
|
|
|
@@ -5024,11 +5070,11 @@ var ImageEditor = ({
|
|
|
5024
5070
|
"div",
|
|
5025
5071
|
{
|
|
5026
5072
|
ref: rootRef,
|
|
5027
|
-
className:
|
|
5073
|
+
className: `${imageEditorFrameClass} ${className}`,
|
|
5028
5074
|
style,
|
|
5029
5075
|
children: [
|
|
5030
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className:
|
|
5031
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", {
|
|
5076
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: imageEditorHeaderClass, children: [
|
|
5077
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
|
|
5032
5078
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5033
5079
|
"button",
|
|
5034
5080
|
{
|
|
@@ -5038,7 +5084,9 @@ var ImageEditor = ({
|
|
|
5038
5084
|
setActiveTab("crop");
|
|
5039
5085
|
editor.setTool("crop");
|
|
5040
5086
|
},
|
|
5041
|
-
|
|
5087
|
+
role: "tab",
|
|
5088
|
+
"aria-selected": activeTab === "crop",
|
|
5089
|
+
className: `${imageTabClass(activeTab === "crop")}`,
|
|
5042
5090
|
children: "Transform & Crop"
|
|
5043
5091
|
}
|
|
5044
5092
|
),
|
|
@@ -5051,7 +5099,9 @@ var ImageEditor = ({
|
|
|
5051
5099
|
setActiveTab("adjust");
|
|
5052
5100
|
editor.setTool("select");
|
|
5053
5101
|
},
|
|
5054
|
-
|
|
5102
|
+
role: "tab",
|
|
5103
|
+
"aria-selected": activeTab === "adjust",
|
|
5104
|
+
className: `${imageTabClass(activeTab === "adjust")}`,
|
|
5055
5105
|
children: "Adjustments"
|
|
5056
5106
|
}
|
|
5057
5107
|
),
|
|
@@ -5064,7 +5114,9 @@ var ImageEditor = ({
|
|
|
5064
5114
|
setActiveTab("layers");
|
|
5065
5115
|
editor.setTool("select");
|
|
5066
5116
|
},
|
|
5067
|
-
|
|
5117
|
+
role: "tab",
|
|
5118
|
+
"aria-selected": activeTab === "layers",
|
|
5119
|
+
className: `${imageTabClass(activeTab === "layers")}`,
|
|
5068
5120
|
children: "Layers"
|
|
5069
5121
|
}
|
|
5070
5122
|
),
|
|
@@ -5077,7 +5129,9 @@ var ImageEditor = ({
|
|
|
5077
5129
|
setActiveTab("paint");
|
|
5078
5130
|
editor.setTool("brush");
|
|
5079
5131
|
},
|
|
5080
|
-
|
|
5132
|
+
role: "tab",
|
|
5133
|
+
"aria-selected": activeTab === "paint",
|
|
5134
|
+
className: `${imageTabClass(activeTab === "paint")}`,
|
|
5081
5135
|
children: "Paint"
|
|
5082
5136
|
}
|
|
5083
5137
|
),
|
|
@@ -5090,7 +5144,9 @@ var ImageEditor = ({
|
|
|
5090
5144
|
setActiveTab("select");
|
|
5091
5145
|
editor.setTool("select");
|
|
5092
5146
|
},
|
|
5093
|
-
|
|
5147
|
+
role: "tab",
|
|
5148
|
+
"aria-selected": activeTab === "select",
|
|
5149
|
+
className: `${imageTabClass(activeTab === "select")}`,
|
|
5094
5150
|
children: "Select & Mask"
|
|
5095
5151
|
}
|
|
5096
5152
|
),
|
|
@@ -5103,7 +5159,9 @@ var ImageEditor = ({
|
|
|
5103
5159
|
setActiveTab("annotate");
|
|
5104
5160
|
editor.setTool("pen");
|
|
5105
5161
|
},
|
|
5106
|
-
|
|
5162
|
+
role: "tab",
|
|
5163
|
+
"aria-selected": activeTab === "annotate",
|
|
5164
|
+
className: `${imageTabClass(activeTab === "annotate")}`,
|
|
5107
5165
|
children: "Annotations"
|
|
5108
5166
|
}
|
|
5109
5167
|
),
|
|
@@ -5116,7 +5174,9 @@ var ImageEditor = ({
|
|
|
5116
5174
|
setActiveTab("depth");
|
|
5117
5175
|
editor.setTool("select");
|
|
5118
5176
|
},
|
|
5119
|
-
|
|
5177
|
+
role: "tab",
|
|
5178
|
+
"aria-selected": activeTab === "depth",
|
|
5179
|
+
className: `${imageTabClass(activeTab === "depth")}`,
|
|
5120
5180
|
children: "Depth Mask"
|
|
5121
5181
|
}
|
|
5122
5182
|
),
|
|
@@ -5129,7 +5189,9 @@ var ImageEditor = ({
|
|
|
5129
5189
|
setActiveTab("ai");
|
|
5130
5190
|
editor.setTool("select");
|
|
5131
5191
|
},
|
|
5132
|
-
|
|
5192
|
+
role: "tab",
|
|
5193
|
+
"aria-selected": activeTab === "ai",
|
|
5194
|
+
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
5133
5195
|
children: [
|
|
5134
5196
|
/* @__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
5197
|
"AI Tools"
|
|
@@ -5144,7 +5206,7 @@ var ImageEditor = ({
|
|
|
5144
5206
|
type: "button",
|
|
5145
5207
|
disabled: !editor.canUndo,
|
|
5146
5208
|
onClick: () => editor.undo(),
|
|
5147
|
-
className:
|
|
5209
|
+
className: imageHeaderButtonClass,
|
|
5148
5210
|
title: "Undo",
|
|
5149
5211
|
children: "\u21A9"
|
|
5150
5212
|
}
|
|
@@ -5155,7 +5217,7 @@ var ImageEditor = ({
|
|
|
5155
5217
|
type: "button",
|
|
5156
5218
|
disabled: !editor.canRedo,
|
|
5157
5219
|
onClick: () => editor.redo(),
|
|
5158
|
-
className:
|
|
5220
|
+
className: imageHeaderButtonClass,
|
|
5159
5221
|
title: "Redo",
|
|
5160
5222
|
children: "\u21AA"
|
|
5161
5223
|
}
|
|
@@ -5165,22 +5227,22 @@ var ImageEditor = ({
|
|
|
5165
5227
|
{
|
|
5166
5228
|
type: "button",
|
|
5167
5229
|
onClick: () => editor.reset(),
|
|
5168
|
-
className:
|
|
5230
|
+
className: `${imageHeaderButtonClass} px-2 text-muted-foreground`,
|
|
5169
5231
|
children: "Reset"
|
|
5170
5232
|
}
|
|
5171
5233
|
),
|
|
5172
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "h-4 w-px bg-
|
|
5234
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
5173
5235
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5174
5236
|
"button",
|
|
5175
5237
|
{
|
|
5176
5238
|
type: "button",
|
|
5177
5239
|
onClick: () => editor.zoomOut(),
|
|
5178
|
-
className:
|
|
5240
|
+
className: imageHeaderButtonClass,
|
|
5179
5241
|
title: "Zoom Out",
|
|
5180
5242
|
children: "-"
|
|
5181
5243
|
}
|
|
5182
5244
|
),
|
|
5183
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono text-
|
|
5245
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
5184
5246
|
Math.round(state.zoom * 100),
|
|
5185
5247
|
"%"
|
|
5186
5248
|
] }),
|
|
@@ -5189,12 +5251,12 @@ var ImageEditor = ({
|
|
|
5189
5251
|
{
|
|
5190
5252
|
type: "button",
|
|
5191
5253
|
onClick: () => editor.zoomIn(),
|
|
5192
|
-
className:
|
|
5254
|
+
className: imageHeaderButtonClass,
|
|
5193
5255
|
title: "Zoom In",
|
|
5194
5256
|
children: "+"
|
|
5195
5257
|
}
|
|
5196
5258
|
),
|
|
5197
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "h-4 w-px bg-
|
|
5259
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
5198
5260
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5199
5261
|
"button",
|
|
5200
5262
|
{
|
|
@@ -5202,7 +5264,7 @@ var ImageEditor = ({
|
|
|
5202
5264
|
onMouseDown: () => editor.setComparing(true),
|
|
5203
5265
|
onMouseUp: () => editor.setComparing(false),
|
|
5204
5266
|
onMouseLeave: () => editor.setComparing(false),
|
|
5205
|
-
className: "px-2.5 py-1.5 rounded-lg border border-
|
|
5267
|
+
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
5268
|
children: "Hold Compare"
|
|
5207
5269
|
}
|
|
5208
5270
|
),
|
|
@@ -5211,14 +5273,14 @@ var ImageEditor = ({
|
|
|
5211
5273
|
{
|
|
5212
5274
|
type: "button",
|
|
5213
5275
|
onClick: handleExport,
|
|
5214
|
-
className:
|
|
5276
|
+
className: `${imagePrimaryButtonClass} px-4 py-1.5`,
|
|
5215
5277
|
children: "Export Image"
|
|
5216
5278
|
}
|
|
5217
5279
|
)
|
|
5218
5280
|
] })
|
|
5219
5281
|
] }),
|
|
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:
|
|
5282
|
+
transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
5283
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
5222
5284
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
5223
5285
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5224
5286
|
ImageEditorCanvas,
|
|
@@ -5241,12 +5303,12 @@ var ImageEditor = ({
|
|
|
5241
5303
|
onPlaybackReveal,
|
|
5242
5304
|
chromeRoot: rootRef,
|
|
5243
5305
|
open: openPanel,
|
|
5244
|
-
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-
|
|
5306
|
+
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
5245
5307
|
}
|
|
5246
5308
|
),
|
|
5247
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className:
|
|
5309
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: imageSidebarClass, children: [
|
|
5248
5310
|
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:
|
|
5311
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
5250
5312
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
5251
5313
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5252
5314
|
"button",
|
|
@@ -5256,7 +5318,7 @@ var ImageEditor = ({
|
|
|
5256
5318
|
setActiveCropRatio(null);
|
|
5257
5319
|
editor.applyCropPreset(null);
|
|
5258
5320
|
},
|
|
5259
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === null && state.crop ? "bg-
|
|
5321
|
+
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
5322
|
children: "Freeform"
|
|
5261
5323
|
}
|
|
5262
5324
|
),
|
|
@@ -5268,7 +5330,7 @@ var ImageEditor = ({
|
|
|
5268
5330
|
setActiveCropRatio(1);
|
|
5269
5331
|
editor.applyCropPreset(1);
|
|
5270
5332
|
},
|
|
5271
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 1 ? "bg-
|
|
5333
|
+
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
5334
|
children: "1:1 Square"
|
|
5273
5335
|
}
|
|
5274
5336
|
),
|
|
@@ -5280,7 +5342,7 @@ var ImageEditor = ({
|
|
|
5280
5342
|
setActiveCropRatio(4 / 3);
|
|
5281
5343
|
editor.applyCropPreset(4 / 3);
|
|
5282
5344
|
},
|
|
5283
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 4 / 3 ? "bg-
|
|
5345
|
+
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
5346
|
children: "4:3 Standard"
|
|
5285
5347
|
}
|
|
5286
5348
|
),
|
|
@@ -5292,7 +5354,7 @@ var ImageEditor = ({
|
|
|
5292
5354
|
setActiveCropRatio(16 / 9);
|
|
5293
5355
|
editor.applyCropPreset(16 / 9);
|
|
5294
5356
|
},
|
|
5295
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 16 / 9 ? "bg-
|
|
5357
|
+
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
5358
|
children: "16:9 Wide"
|
|
5297
5359
|
}
|
|
5298
5360
|
),
|
|
@@ -5304,7 +5366,7 @@ var ImageEditor = ({
|
|
|
5304
5366
|
setActiveCropRatio(3 / 2);
|
|
5305
5367
|
editor.applyCropPreset(3 / 2);
|
|
5306
5368
|
},
|
|
5307
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 3 / 2 ? "bg-
|
|
5369
|
+
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
5370
|
children: "3:2 Photo"
|
|
5309
5371
|
}
|
|
5310
5372
|
),
|
|
@@ -5316,20 +5378,20 @@ var ImageEditor = ({
|
|
|
5316
5378
|
setActiveCropRatio(null);
|
|
5317
5379
|
editor.resetCrop();
|
|
5318
5380
|
},
|
|
5319
|
-
className: "px-2.5 py-2 rounded-lg bg-
|
|
5381
|
+
className: "px-2.5 py-2 rounded-lg bg-destructive/10 hover:bg-destructive/20 text-destructive border border-destructive/40 font-medium",
|
|
5320
5382
|
children: "Clear Crop"
|
|
5321
5383
|
}
|
|
5322
5384
|
)
|
|
5323
5385
|
] }),
|
|
5324
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className:
|
|
5325
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className:
|
|
5386
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: imageDividerClass }),
|
|
5387
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
5326
5388
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
5327
5389
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5328
5390
|
"button",
|
|
5329
5391
|
{
|
|
5330
5392
|
type: "button",
|
|
5331
5393
|
onClick: () => editor.rotate(-90),
|
|
5332
|
-
className: "px-3 py-2 rounded-lg bg-
|
|
5394
|
+
className: "px-3 py-2 rounded-lg bg-muted hover:bg-accent text-foreground border border-border",
|
|
5333
5395
|
children: "Rotate -90\xB0"
|
|
5334
5396
|
}
|
|
5335
5397
|
),
|
|
@@ -5338,7 +5400,7 @@ var ImageEditor = ({
|
|
|
5338
5400
|
{
|
|
5339
5401
|
type: "button",
|
|
5340
5402
|
onClick: () => editor.rotate(90),
|
|
5341
|
-
className: "px-3 py-2 rounded-lg bg-
|
|
5403
|
+
className: "px-3 py-2 rounded-lg bg-muted hover:bg-accent text-foreground border border-border",
|
|
5342
5404
|
children: "Rotate +90\xB0"
|
|
5343
5405
|
}
|
|
5344
5406
|
),
|
|
@@ -5347,7 +5409,7 @@ var ImageEditor = ({
|
|
|
5347
5409
|
{
|
|
5348
5410
|
type: "button",
|
|
5349
5411
|
onClick: () => editor.flipHorizontal(),
|
|
5350
|
-
className: `px-3 py-2 rounded-lg border transition-colors ${state.transform.flipH ? "bg-
|
|
5412
|
+
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
5413
|
children: "Flip Horizontal"
|
|
5352
5414
|
}
|
|
5353
5415
|
),
|
|
@@ -5356,7 +5418,7 @@ var ImageEditor = ({
|
|
|
5356
5418
|
{
|
|
5357
5419
|
type: "button",
|
|
5358
5420
|
onClick: () => editor.flipVertical(),
|
|
5359
|
-
className: `px-3 py-2 rounded-lg border transition-colors ${state.transform.flipV ? "bg-
|
|
5421
|
+
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
5422
|
children: "Flip Vertical"
|
|
5361
5423
|
}
|
|
5362
5424
|
)
|
|
@@ -5364,13 +5426,13 @@ var ImageEditor = ({
|
|
|
5364
5426
|
] }),
|
|
5365
5427
|
activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5366
5428
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5367
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className:
|
|
5429
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
5368
5430
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5369
5431
|
"button",
|
|
5370
5432
|
{
|
|
5371
5433
|
type: "button",
|
|
5372
5434
|
onClick: () => editor.resetAdjustments(),
|
|
5373
|
-
className: "text-[10px] text-
|
|
5435
|
+
className: "text-[10px] text-destructive hover:underline",
|
|
5374
5436
|
children: "Reset Sliders"
|
|
5375
5437
|
}
|
|
5376
5438
|
)
|
|
@@ -5389,7 +5451,7 @@ var ImageEditor = ({
|
|
|
5389
5451
|
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
5390
5452
|
"div",
|
|
5391
5453
|
{
|
|
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-
|
|
5454
|
+
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
5455
|
"data-testid": "image-editor-process-notice",
|
|
5394
5456
|
children: [
|
|
5395
5457
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
@@ -5406,7 +5468,7 @@ var ImageEditor = ({
|
|
|
5406
5468
|
}
|
|
5407
5469
|
)
|
|
5408
5470
|
] }, spec.id)),
|
|
5409
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className:
|
|
5471
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5410
5472
|
AdjustmentLayersPanel,
|
|
5411
5473
|
{
|
|
5412
5474
|
controller,
|
|
@@ -5416,82 +5478,82 @@ var ImageEditor = ({
|
|
|
5416
5478
|
) })
|
|
5417
5479
|
] }),
|
|
5418
5480
|
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:
|
|
5481
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
5420
5482
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5421
5483
|
"button",
|
|
5422
5484
|
{
|
|
5423
5485
|
type: "button",
|
|
5424
5486
|
title: "Edit \u203A Free Transform (Ctrl/Cmd+T): the selected pixels, or the whole active layer",
|
|
5425
|
-
className:
|
|
5487
|
+
className: imageSmallButtonClass,
|
|
5426
5488
|
disabled: transformTool.active,
|
|
5427
5489
|
onClick: () => transformTool.begin(),
|
|
5428
5490
|
children: "Free Transform"
|
|
5429
5491
|
}
|
|
5430
5492
|
),
|
|
5431
5493
|
/* @__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:
|
|
5494
|
+
effectsShown && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
5495
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
5434
5496
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ColorProfilePanel, { controller })
|
|
5435
5497
|
] }),
|
|
5436
5498
|
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:
|
|
5499
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
5438
5500
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(BrushOptionsBar, { controller }),
|
|
5439
5501
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5440
5502
|
"button",
|
|
5441
5503
|
{
|
|
5442
5504
|
type: "button",
|
|
5443
5505
|
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-
|
|
5506
|
+
className: "px-2 py-1 rounded text-[11px] bg-muted text-foreground hover:bg-accent hover:text-accent-foreground self-start",
|
|
5445
5507
|
disabled: transformTool.active,
|
|
5446
5508
|
onClick: () => transformTool.begin(),
|
|
5447
5509
|
children: "Free Transform"
|
|
5448
5510
|
}
|
|
5449
5511
|
),
|
|
5450
|
-
paintError && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-
|
|
5451
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className:
|
|
5512
|
+
paintError && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
5513
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(LayersPanel, { controller }) })
|
|
5452
5514
|
] }),
|
|
5453
5515
|
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:
|
|
5516
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
|
|
5455
5517
|
/* @__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
5518
|
"button",
|
|
5457
5519
|
{
|
|
5458
5520
|
type: "button",
|
|
5459
5521
|
"aria-pressed": state.activeTool === t,
|
|
5460
5522
|
onClick: () => editor.setTool(t),
|
|
5461
|
-
className: `py-1.5 px-2 rounded-lg font-medium border transition-colors ${state.activeTool === t ? "bg-
|
|
5523
|
+
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
5524
|
children: t === "shape" ? "Shape" : "Type"
|
|
5463
5525
|
},
|
|
5464
5526
|
t
|
|
5465
5527
|
)) }),
|
|
5466
5528
|
state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
5467
5529
|
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:
|
|
5530
|
+
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" }),
|
|
5531
|
+
shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
5532
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: imageDividerClass }),
|
|
5533
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
5472
5534
|
/* @__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
5535
|
"button",
|
|
5474
5536
|
{
|
|
5475
5537
|
type: "button",
|
|
5476
5538
|
onClick: () => editor.setTool(t),
|
|
5477
|
-
className: `py-1.5 px-2 rounded-lg font-medium capitalize border transition-colors ${state.activeTool === t ? "bg-
|
|
5539
|
+
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
5540
|
children: t
|
|
5479
5541
|
},
|
|
5480
5542
|
t
|
|
5481
5543
|
)) }),
|
|
5482
5544
|
/* @__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-
|
|
5545
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
5484
5546
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5485
5547
|
"input",
|
|
5486
5548
|
{
|
|
5487
5549
|
type: "color",
|
|
5488
5550
|
value: activeColor,
|
|
5489
5551
|
onChange: (e) => setActiveColor(e.target.value),
|
|
5490
|
-
className: "w-8 h-8 rounded border border-
|
|
5552
|
+
className: "w-8 h-8 rounded border border-border cursor-pointer bg-transparent"
|
|
5491
5553
|
}
|
|
5492
5554
|
),
|
|
5493
5555
|
/* @__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-
|
|
5556
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
5495
5557
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Width:" }),
|
|
5496
5558
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
|
|
5497
5559
|
strokeWidth,
|
|
@@ -5506,13 +5568,13 @@ var ImageEditor = ({
|
|
|
5506
5568
|
max: "20",
|
|
5507
5569
|
value: strokeWidth,
|
|
5508
5570
|
onChange: (e) => setStrokeWidth(Number(e.target.value)),
|
|
5509
|
-
className:
|
|
5571
|
+
className: imageRangeClass
|
|
5510
5572
|
}
|
|
5511
5573
|
)
|
|
5512
5574
|
] })
|
|
5513
5575
|
] }),
|
|
5514
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className:
|
|
5515
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className:
|
|
5576
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: imageDividerClass }),
|
|
5577
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
5516
5578
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-2", children: [
|
|
5517
5579
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5518
5580
|
"input",
|
|
@@ -5522,7 +5584,7 @@ var ImageEditor = ({
|
|
|
5522
5584
|
value: textInput,
|
|
5523
5585
|
onChange: (e) => setTextInput(e.target.value),
|
|
5524
5586
|
onKeyDown: (e) => e.key === "Enter" && handleAddText(),
|
|
5525
|
-
className: "flex-1 bg-
|
|
5587
|
+
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
5588
|
}
|
|
5527
5589
|
),
|
|
5528
5590
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
@@ -5530,12 +5592,12 @@ var ImageEditor = ({
|
|
|
5530
5592
|
{
|
|
5531
5593
|
type: "button",
|
|
5532
5594
|
onClick: handleAddText,
|
|
5533
|
-
className: "px-3 py-1.5 rounded-lg bg-
|
|
5595
|
+
className: "px-3 py-1.5 rounded-lg bg-primary hover:bg-primary/90 text-primary-foreground font-medium shadow",
|
|
5534
5596
|
children: "Add"
|
|
5535
5597
|
}
|
|
5536
5598
|
)
|
|
5537
5599
|
] }),
|
|
5538
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between text-
|
|
5600
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
5539
5601
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Font Size:" }),
|
|
5540
5602
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
|
|
5541
5603
|
fontSize,
|
|
@@ -5550,12 +5612,12 @@ var ImageEditor = ({
|
|
|
5550
5612
|
max: "72",
|
|
5551
5613
|
value: fontSize,
|
|
5552
5614
|
onChange: (e) => setFontSize(Number(e.target.value)),
|
|
5553
|
-
className:
|
|
5615
|
+
className: imageRangeClass
|
|
5554
5616
|
}
|
|
5555
5617
|
),
|
|
5556
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className:
|
|
5618
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: imageDividerClass }),
|
|
5557
5619
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5558
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "text-
|
|
5620
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
5559
5621
|
"Layers (",
|
|
5560
5622
|
state.annotations.length,
|
|
5561
5623
|
")"
|
|
@@ -5565,7 +5627,7 @@ var ImageEditor = ({
|
|
|
5565
5627
|
{
|
|
5566
5628
|
type: "button",
|
|
5567
5629
|
onClick: () => editor.removeAnnotation(state.selectedAnnotationId),
|
|
5568
|
-
className: "text-
|
|
5630
|
+
className: "text-destructive hover:underline text-[11px]",
|
|
5569
5631
|
children: "Delete Selected"
|
|
5570
5632
|
}
|
|
5571
5633
|
),
|
|
@@ -5574,7 +5636,7 @@ var ImageEditor = ({
|
|
|
5574
5636
|
{
|
|
5575
5637
|
type: "button",
|
|
5576
5638
|
onClick: () => editor.clearAnnotations(),
|
|
5577
|
-
className: "text-
|
|
5639
|
+
className: "text-muted-foreground hover:text-foreground text-[11px]",
|
|
5578
5640
|
children: "Clear All"
|
|
5579
5641
|
}
|
|
5580
5642
|
)
|
|
@@ -5582,32 +5644,32 @@ var ImageEditor = ({
|
|
|
5582
5644
|
] }),
|
|
5583
5645
|
activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5584
5646
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5585
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className:
|
|
5647
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
5586
5648
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5587
5649
|
"button",
|
|
5588
5650
|
{
|
|
5589
5651
|
type: "button",
|
|
5590
5652
|
onClick: () => editor.resetDepthMask(),
|
|
5591
|
-
className: "text-[10px] text-
|
|
5653
|
+
className: "text-[10px] text-destructive hover:underline",
|
|
5592
5654
|
children: "Reset Mask"
|
|
5593
5655
|
}
|
|
5594
5656
|
)
|
|
5595
5657
|
] }),
|
|
5596
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-
|
|
5658
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
5597
5659
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5598
5660
|
"input",
|
|
5599
5661
|
{
|
|
5600
5662
|
type: "checkbox",
|
|
5601
5663
|
checked: state.depthMask.enabled,
|
|
5602
5664
|
onChange: (e) => editor.setDepthMask({ enabled: e.target.checked }),
|
|
5603
|
-
className: "rounded accent-
|
|
5665
|
+
className: "rounded accent-primary"
|
|
5604
5666
|
}
|
|
5605
5667
|
),
|
|
5606
5668
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Enable Depth / Alpha Mask" })
|
|
5607
5669
|
] }),
|
|
5608
5670
|
state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
5609
5671
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
|
|
5610
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("label", { className: "text-
|
|
5672
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
5611
5673
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5612
5674
|
"input",
|
|
5613
5675
|
{
|
|
@@ -5615,7 +5677,7 @@ var ImageEditor = ({
|
|
|
5615
5677
|
placeholder: "https://.../depthmap.png",
|
|
5616
5678
|
value: state.depthMask.maskSource || "",
|
|
5617
5679
|
onChange: (e) => editor.setDepthMask({ maskSource: e.target.value || null }),
|
|
5618
|
-
className: "w-full bg-
|
|
5680
|
+
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
5681
|
}
|
|
5620
5682
|
)
|
|
5621
5683
|
] }),
|
|
@@ -5625,7 +5687,7 @@ var ImageEditor = ({
|
|
|
5625
5687
|
{
|
|
5626
5688
|
type: "button",
|
|
5627
5689
|
onClick: () => editor.setDepthMask({ mode: "threshold" }),
|
|
5628
|
-
className: `flex-1 py-1.5 rounded-lg border text-xs font-medium ${state.depthMask.mode === "threshold" ? "bg-
|
|
5690
|
+
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
5691
|
children: "Threshold Mode"
|
|
5630
5692
|
}
|
|
5631
5693
|
),
|
|
@@ -5634,13 +5696,13 @@ var ImageEditor = ({
|
|
|
5634
5696
|
{
|
|
5635
5697
|
type: "button",
|
|
5636
5698
|
onClick: () => editor.setDepthMask({ mode: "brightness" }),
|
|
5637
|
-
className: `flex-1 py-1.5 rounded-lg border text-xs font-medium ${state.depthMask.mode === "brightness" ? "bg-
|
|
5699
|
+
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
5700
|
children: "Brightness Mode"
|
|
5639
5701
|
}
|
|
5640
5702
|
)
|
|
5641
5703
|
] }),
|
|
5642
5704
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
|
|
5643
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex justify-between text-
|
|
5705
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5644
5706
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Depth Start (Lower):" }),
|
|
5645
5707
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
5646
5708
|
] }),
|
|
@@ -5654,12 +5716,12 @@ var ImageEditor = ({
|
|
|
5654
5716
|
onChange: (e) => editor.setDepthMask({
|
|
5655
5717
|
depthRange: [Number(e.target.value), state.depthMask.depthRange[1]]
|
|
5656
5718
|
}),
|
|
5657
|
-
className:
|
|
5719
|
+
className: imageRangeClass
|
|
5658
5720
|
}
|
|
5659
5721
|
)
|
|
5660
5722
|
] }),
|
|
5661
5723
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
|
|
5662
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex justify-between text-
|
|
5724
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5663
5725
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Depth Stop (Upper):" }),
|
|
5664
5726
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
5665
5727
|
] }),
|
|
@@ -5673,12 +5735,12 @@ var ImageEditor = ({
|
|
|
5673
5735
|
onChange: (e) => editor.setDepthMask({
|
|
5674
5736
|
depthRange: [state.depthMask.depthRange[0], Number(e.target.value)]
|
|
5675
5737
|
}),
|
|
5676
|
-
className:
|
|
5738
|
+
className: imageRangeClass
|
|
5677
5739
|
}
|
|
5678
5740
|
)
|
|
5679
5741
|
] }),
|
|
5680
5742
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
|
|
5681
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex justify-between text-
|
|
5743
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5682
5744
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Softness:" }),
|
|
5683
5745
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
|
|
5684
5746
|
] }),
|
|
@@ -5690,18 +5752,18 @@ var ImageEditor = ({
|
|
|
5690
5752
|
max: "50",
|
|
5691
5753
|
value: state.depthMask.softness,
|
|
5692
5754
|
onChange: (e) => editor.setDepthMask({ softness: Number(e.target.value) }),
|
|
5693
|
-
className:
|
|
5755
|
+
className: imageRangeClass
|
|
5694
5756
|
}
|
|
5695
5757
|
)
|
|
5696
5758
|
] }),
|
|
5697
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-
|
|
5759
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
5698
5760
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5699
5761
|
"input",
|
|
5700
5762
|
{
|
|
5701
5763
|
type: "checkbox",
|
|
5702
5764
|
checked: state.depthMask.invert,
|
|
5703
5765
|
onChange: (e) => editor.setDepthMask({ invert: e.target.checked }),
|
|
5704
|
-
className: "rounded accent-
|
|
5766
|
+
className: "rounded accent-primary"
|
|
5705
5767
|
}
|
|
5706
5768
|
),
|
|
5707
5769
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Invert Mask" })
|
|
@@ -5719,14 +5781,14 @@ var ImageEditor = ({
|
|
|
5719
5781
|
quickMask: Boolean(state.quickMask)
|
|
5720
5782
|
}
|
|
5721
5783
|
),
|
|
5722
|
-
selectionError && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-
|
|
5784
|
+
selectionError && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
5723
5785
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-1", children: [
|
|
5724
5786
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5725
5787
|
"button",
|
|
5726
5788
|
{
|
|
5727
5789
|
type: "button",
|
|
5728
5790
|
title: "Select \u203A Transform Selection: the outline only",
|
|
5729
|
-
className:
|
|
5791
|
+
className: imageSmallButtonClass,
|
|
5730
5792
|
disabled: transformTool.active,
|
|
5731
5793
|
onClick: () => transformTool.begin({ content: "selection-outline" }),
|
|
5732
5794
|
children: "Transform Selection"
|
|
@@ -5737,7 +5799,7 @@ var ImageEditor = ({
|
|
|
5737
5799
|
{
|
|
5738
5800
|
type: "button",
|
|
5739
5801
|
title: "Edit \u203A Free Transform: the selected pixels of the active layer",
|
|
5740
|
-
className:
|
|
5802
|
+
className: imageSmallButtonClass,
|
|
5741
5803
|
disabled: transformTool.active,
|
|
5742
5804
|
onClick: () => transformTool.begin({ content: "selection" }),
|
|
5743
5805
|
children: "Free Transform Pixels"
|
|
@@ -5747,7 +5809,7 @@ var ImageEditor = ({
|
|
|
5747
5809
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers })
|
|
5748
5810
|
] }),
|
|
5749
5811
|
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-
|
|
5812
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
5751
5813
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Results go to" }),
|
|
5752
5814
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
5753
5815
|
"select",
|
|
@@ -5755,7 +5817,7 @@ var ImageEditor = ({
|
|
|
5755
5817
|
"aria-label": "AI result target",
|
|
5756
5818
|
value: aiTarget,
|
|
5757
5819
|
onChange: (e) => setAiTarget(e.target.value),
|
|
5758
|
-
className:
|
|
5820
|
+
className: imageSelectClass,
|
|
5759
5821
|
children: [
|
|
5760
5822
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
5761
5823
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
|
|
@@ -5764,24 +5826,24 @@ var ImageEditor = ({
|
|
|
5764
5826
|
}
|
|
5765
5827
|
)
|
|
5766
5828
|
] }),
|
|
5767
|
-
/* @__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: [
|
|
5768
5830
|
/* @__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-
|
|
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.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
5833
|
"Background Removal"
|
|
5772
5834
|
] }),
|
|
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-
|
|
5835
|
+
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
5836
|
] }),
|
|
5775
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-
|
|
5837
|
+
/* @__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
5838
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5777
5839
|
"button",
|
|
5778
5840
|
{
|
|
5779
5841
|
type: "button",
|
|
5780
5842
|
onClick: handleRemoveBackground,
|
|
5781
5843
|
disabled: isRemovingBg || isInpainting,
|
|
5782
|
-
className: "mt-1 px-3 py-2 rounded-lg bg-
|
|
5844
|
+
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
5845
|
children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
5784
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className:
|
|
5846
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: imageSpinnerClass }),
|
|
5785
5847
|
"Removing Background..."
|
|
5786
5848
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
5787
5849
|
/* @__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 +5852,20 @@ var ImageEditor = ({
|
|
|
5790
5852
|
}
|
|
5791
5853
|
)
|
|
5792
5854
|
] }),
|
|
5793
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "p-3 rounded-lg bg-
|
|
5855
|
+
/* @__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
5856
|
/* @__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-
|
|
5857
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
5858
|
+
/* @__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
5859
|
/* @__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
5860
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("path", { d: "m14 7 3 3" })
|
|
5799
5861
|
] }),
|
|
5800
5862
|
"Generative Inpainting"
|
|
5801
5863
|
] }),
|
|
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-
|
|
5864
|
+
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
5865
|
] }),
|
|
5804
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-
|
|
5866
|
+
/* @__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
5867
|
/* @__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-
|
|
5868
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
5807
5869
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5808
5870
|
"textarea",
|
|
5809
5871
|
{
|
|
@@ -5812,19 +5874,19 @@ var ImageEditor = ({
|
|
|
5812
5874
|
onChange: (e) => setInpaintPrompt(e.target.value),
|
|
5813
5875
|
placeholder: "e.g. replace sunglasses with steampunk goggles, remove person in background...",
|
|
5814
5876
|
rows: 3,
|
|
5815
|
-
className: "w-full bg-
|
|
5877
|
+
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
5878
|
}
|
|
5817
5879
|
)
|
|
5818
5880
|
] }),
|
|
5819
5881
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
5820
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-
|
|
5882
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
5821
5883
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
5822
5884
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
5823
5885
|
"button",
|
|
5824
5886
|
{
|
|
5825
5887
|
type: "button",
|
|
5826
5888
|
onClick: () => setInpaintMaskMode("annotations"),
|
|
5827
|
-
className: `px-2 py-1.5 rounded border text-[11px] font-medium text-left transition-colors ${inpaintMaskMode === "annotations" ? "bg-
|
|
5889
|
+
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
5890
|
children: [
|
|
5829
5891
|
"Drawn Shapes (",
|
|
5830
5892
|
state.annotations.length,
|
|
@@ -5837,7 +5899,7 @@ var ImageEditor = ({
|
|
|
5837
5899
|
{
|
|
5838
5900
|
type: "button",
|
|
5839
5901
|
onClick: () => setInpaintMaskMode("crop"),
|
|
5840
|
-
className: `px-2 py-1.5 rounded border text-[11px] font-medium text-left transition-colors ${inpaintMaskMode === "crop" ? "bg-
|
|
5902
|
+
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
5903
|
children: [
|
|
5842
5904
|
"Crop Box (",
|
|
5843
5905
|
state.crop ? "Selected" : "Full",
|
|
@@ -5853,9 +5915,9 @@ var ImageEditor = ({
|
|
|
5853
5915
|
type: "button",
|
|
5854
5916
|
onClick: handleInpaint,
|
|
5855
5917
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
5856
|
-
className: "mt-1 px-3 py-2 rounded-lg bg-
|
|
5918
|
+
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
5919
|
children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
5858
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className:
|
|
5920
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: imageSpinnerClass }),
|
|
5859
5921
|
"Generating Inpaint..."
|
|
5860
5922
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
5861
5923
|
/* @__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 +5926,8 @@ var ImageEditor = ({
|
|
|
5864
5926
|
}
|
|
5865
5927
|
)
|
|
5866
5928
|
] }),
|
|
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-
|
|
5929
|
+
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 }),
|
|
5930
|
+
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
5931
|
] })
|
|
5870
5932
|
] })
|
|
5871
5933
|
] })
|