@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
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
PresenceLayer,
|
|
12
12
|
useAgentPlayback,
|
|
13
13
|
usePlaybackSurface
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-GNO54NFG.js";
|
|
15
15
|
|
|
16
16
|
// src/image-editor/useImageEditor.ts
|
|
17
17
|
import { useRef, useState, useEffect, useCallback, useMemo } from "react";
|
|
@@ -174,11 +174,11 @@ function useImageEditor(options = {}) {
|
|
|
174
174
|
);
|
|
175
175
|
}
|
|
176
176
|
function useImageEffectsTools(registry, controller, options = {}) {
|
|
177
|
-
const { id, namespace, readOnly } = options;
|
|
177
|
+
const { id, namespace, readOnly, playbackSurface } = options;
|
|
178
178
|
useEffect(() => {
|
|
179
179
|
if (!registry) return;
|
|
180
|
-
return registry.register(createImageEffectsToolProvider(controller, { id, namespace, readOnly }));
|
|
181
|
-
}, [registry, controller, id, namespace, readOnly]);
|
|
180
|
+
return registry.register(createImageEffectsToolProvider(controller, { id, namespace, readOnly, playbackSurface }));
|
|
181
|
+
}, [registry, controller, id, namespace, readOnly, playbackSurface]);
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
// src/image-editor/ImageEditor.tsx
|
|
@@ -200,6 +200,7 @@ import {
|
|
|
200
200
|
canvasToImagePoint,
|
|
201
201
|
imageToCanvasPoint,
|
|
202
202
|
createImagePlaybackLocator,
|
|
203
|
+
agentDragDraft,
|
|
203
204
|
hitTestCrop,
|
|
204
205
|
getCropCursor,
|
|
205
206
|
calculateCropDrag,
|
|
@@ -216,6 +217,7 @@ import {
|
|
|
216
217
|
DEFAULT_SHAPE_TOOL_OPTIONS,
|
|
217
218
|
DEFAULT_TYPE_TOOL_OPTIONS
|
|
218
219
|
} from "@pixerate/editor/image-editor";
|
|
220
|
+
import { trackPresenceDrag } from "@pixerate/editor/tools";
|
|
219
221
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
220
222
|
var ImageEditorCanvas = ({
|
|
221
223
|
editor,
|
|
@@ -386,6 +388,29 @@ var ImageEditorCanvas = ({
|
|
|
386
388
|
},
|
|
387
389
|
[controller, mode, fit, transformTool]
|
|
388
390
|
);
|
|
391
|
+
useEffect2(() => {
|
|
392
|
+
let drafting = false;
|
|
393
|
+
return agentPresence.subscribe(
|
|
394
|
+
trackPresenceDrag({
|
|
395
|
+
onDrag: (box) => {
|
|
396
|
+
if (cropDragInfoRef.current || selectionGestureRef.current?.active) return;
|
|
397
|
+
const draft = agentDragDraft(modeRef.current, box, controller.getState().imageDimensions);
|
|
398
|
+
if (!draft) return;
|
|
399
|
+
drafting = true;
|
|
400
|
+
if ("crop" in draft) draftCropRef.current = draft.crop;
|
|
401
|
+
else selectionDraftRef.current = draft.selectionPath;
|
|
402
|
+
void renderCanvas();
|
|
403
|
+
},
|
|
404
|
+
onEnd: () => {
|
|
405
|
+
if (!drafting) return;
|
|
406
|
+
drafting = false;
|
|
407
|
+
draftCropRef.current = null;
|
|
408
|
+
selectionDraftRef.current = null;
|
|
409
|
+
void renderCanvas();
|
|
410
|
+
}
|
|
411
|
+
})
|
|
412
|
+
);
|
|
413
|
+
}, [agentPresence, controller, renderCanvas]);
|
|
389
414
|
useEffect2(() => typeSession?.subscribe(() => void renderCanvas()), [typeSession, renderCanvas]);
|
|
390
415
|
const finishTyping = () => {
|
|
391
416
|
typeToolRef.current?.finish();
|
|
@@ -925,11 +950,11 @@ var ImageEditorCanvas = ({
|
|
|
925
950
|
// src/image-editor/ControlSlider.tsx
|
|
926
951
|
import { controlTrackBackground, formatControlValue } from "@pixerate/editor/image-editor";
|
|
927
952
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
928
|
-
var ControlSlider = ({ spec, value, onChange, disabled, label }) => {
|
|
953
|
+
var ControlSlider = ({ spec, value, onChange, disabled, label, className }) => {
|
|
929
954
|
const name = label ?? spec.label;
|
|
930
955
|
const track = controlTrackBackground(spec);
|
|
931
|
-
return /* @__PURE__ */ jsxs2("div", { "data-control-id": spec.id, children: [
|
|
932
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex justify-between text-
|
|
956
|
+
return /* @__PURE__ */ jsxs2("div", { "data-control-id": spec.id, className, children: [
|
|
957
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
933
958
|
/* @__PURE__ */ jsx2("span", { children: name }),
|
|
934
959
|
/* @__PURE__ */ jsx2("span", { className: "font-mono", children: formatControlValue(spec, value) })
|
|
935
960
|
] }),
|
|
@@ -944,7 +969,7 @@ var ControlSlider = ({ spec, value, onChange, disabled, label }) => {
|
|
|
944
969
|
disabled,
|
|
945
970
|
value,
|
|
946
971
|
onChange: (e) => onChange(Number(e.target.value)),
|
|
947
|
-
className: "w-full accent-
|
|
972
|
+
className: "w-full accent-primary disabled:opacity-40"
|
|
948
973
|
}
|
|
949
974
|
),
|
|
950
975
|
track && /* @__PURE__ */ jsx2("div", { className: "h-0.5 rounded-full opacity-70", style: { background: track } })
|
|
@@ -979,7 +1004,7 @@ var Histogram = ({ histogram, channel = "rgb", height = 64, className = "", styl
|
|
|
979
1004
|
role: "img",
|
|
980
1005
|
"aria-label": histogram ? `Histogram of ${histogram.samples} pixels` : "Histogram (no data)",
|
|
981
1006
|
"data-testid": "image-editor-histogram",
|
|
982
|
-
className: `w-full rounded bg-
|
|
1007
|
+
className: `w-full rounded bg-muted/40 ${className}`,
|
|
983
1008
|
style: { height, ...style },
|
|
984
1009
|
children: [
|
|
985
1010
|
paths.map(({ c, d }) => /* @__PURE__ */ jsx3("path", { d, fill: FILL[c], stroke: "none" }, c)),
|
|
@@ -1023,8 +1048,8 @@ import {
|
|
|
1023
1048
|
} from "@pixerate/editor/image-editor";
|
|
1024
1049
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1025
1050
|
var BOX = 256;
|
|
1026
|
-
var STROKE = { master: "#e2e8f0", red: "#ef4444", green: "#22c55e", blue: "#3b82f6" };
|
|
1027
|
-
var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 200 }) => {
|
|
1051
|
+
var STROKE = { master: "var(--foreground, #e2e8f0)", red: "#ef4444", green: "#22c55e", blue: "#3b82f6" };
|
|
1052
|
+
var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 200, className = "" }) => {
|
|
1028
1053
|
const svgRef = useRef3(null);
|
|
1029
1054
|
const [drag, setDrag] = useState4(null);
|
|
1030
1055
|
const toBox = (e) => {
|
|
@@ -1065,7 +1090,7 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
1065
1090
|
role: "application",
|
|
1066
1091
|
"aria-label": `${channel} curve`,
|
|
1067
1092
|
"data-testid": "curves-editor",
|
|
1068
|
-
className:
|
|
1093
|
+
className: `rounded bg-muted/40 touch-none select-none cursor-crosshair ${className}`.trim(),
|
|
1069
1094
|
onPointerDown,
|
|
1070
1095
|
onPointerMove,
|
|
1071
1096
|
onPointerUp: () => setDrag(null),
|
|
@@ -1087,7 +1112,7 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
1087
1112
|
cx: b.x,
|
|
1088
1113
|
cy: b.y,
|
|
1089
1114
|
r: 5,
|
|
1090
|
-
fill: drag === i ? STROKE[channel] : "#0f172a",
|
|
1115
|
+
fill: drag === i ? STROKE[channel] : "var(--background, #0f172a)",
|
|
1091
1116
|
stroke: STROKE[channel],
|
|
1092
1117
|
strokeWidth: 2,
|
|
1093
1118
|
"aria-label": `Point ${p.input} to ${p.output}`
|
|
@@ -1100,6 +1125,28 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
1100
1125
|
);
|
|
1101
1126
|
};
|
|
1102
1127
|
|
|
1128
|
+
// src/image-editor/styles.ts
|
|
1129
|
+
var imageEditorFrameClass = "relative flex flex-col bg-background border border-border rounded-xl overflow-hidden shadow-sm text-foreground";
|
|
1130
|
+
var imageEditorHeaderClass = "flex flex-wrap items-center justify-between px-4 py-3 bg-muted/40 border-b border-border gap-3";
|
|
1131
|
+
var imageTabListClass = "flex items-center gap-1 bg-background p-1 rounded-lg border border-border text-xs";
|
|
1132
|
+
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"}`;
|
|
1133
|
+
var imageHeaderButtonClass = "p-1.5 rounded-lg border border-border bg-background text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed";
|
|
1134
|
+
var imagePrimaryButtonClass = "rounded-lg bg-primary hover:bg-primary/90 text-primary-foreground font-medium shadow transition-colors disabled:opacity-50";
|
|
1135
|
+
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]";
|
|
1136
|
+
var imageSectionTitleClass = "font-semibold text-foreground uppercase tracking-wider text-[11px]";
|
|
1137
|
+
var imageSectionClass = "border-t border-border pt-3";
|
|
1138
|
+
var imageDividerClass = "h-px bg-border my-1";
|
|
1139
|
+
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";
|
|
1140
|
+
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";
|
|
1141
|
+
var imageOutlineButtonClass = "rounded border border-border px-1.5 py-0.5 text-[11px] text-foreground hover:bg-muted disabled:opacity-40";
|
|
1142
|
+
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"}`;
|
|
1143
|
+
var imageFieldClass = "rounded border border-input bg-background px-1 py-0.5 text-foreground";
|
|
1144
|
+
var imageSelectClass = "rounded border border-input bg-background px-1.5 py-1 text-foreground";
|
|
1145
|
+
var imageColorInputClass = "h-6 w-8 rounded border border-border bg-transparent";
|
|
1146
|
+
var imageRangeClass = "w-full accent-primary";
|
|
1147
|
+
var imageErrorBannerClass = "border-b border-destructive/40 bg-destructive/10 px-4 py-1.5 text-xs text-destructive";
|
|
1148
|
+
var imageSpinnerClass = "w-3.5 h-3.5 border-2 border-primary-foreground/30 border-t-primary-foreground rounded-full animate-spin";
|
|
1149
|
+
|
|
1103
1150
|
// src/image-editor/AdjustmentLayersPanel.tsx
|
|
1104
1151
|
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1105
1152
|
var CHANNELS = [
|
|
@@ -1113,8 +1160,7 @@ var TONES = [
|
|
|
1113
1160
|
{ id: "midtones", label: "Midtones" },
|
|
1114
1161
|
{ id: "highlights", label: "Highlights" }
|
|
1115
1162
|
];
|
|
1116
|
-
var
|
|
1117
|
-
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"}`;
|
|
1163
|
+
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"}`;
|
|
1118
1164
|
var HueRangeStrip = ({ bounds }) => {
|
|
1119
1165
|
const pts = Array.from({ length: 73 }, (_, i) => `${i / 72 * 360},${20 - hueRangeWeight({ bounds }, i * 5) * 18}`).join(" ");
|
|
1120
1166
|
return /* @__PURE__ */ jsxs5("svg", { viewBox: "0 0 360 20", preserveAspectRatio: "none", className: "w-full h-4 rounded", "data-testid": "hue-range-strip", children: [
|
|
@@ -1123,7 +1169,7 @@ var HueRangeStrip = ({ bounds }) => {
|
|
|
1123
1169
|
/* @__PURE__ */ jsx5("polyline", { points: pts, fill: "none", stroke: "#fff", strokeWidth: 1.5 })
|
|
1124
1170
|
] });
|
|
1125
1171
|
};
|
|
1126
|
-
var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
1172
|
+
var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, className = "" }) => {
|
|
1127
1173
|
const follow = layersProp === void 0;
|
|
1128
1174
|
const [, setTick] = useState5(0);
|
|
1129
1175
|
useEffect4(() => follow ? controller.subscribe(() => setTick((n) => n + 1)) : void 0, [controller, follow]);
|
|
@@ -1147,14 +1193,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1147
1193
|
spec.id
|
|
1148
1194
|
);
|
|
1149
1195
|
const controlsOf = (layer, filter = () => true) => ADJUSTMENT_LAYER_CONTROLS[layer.kind].filter(filter);
|
|
1150
|
-
const checkbox = (layer, path, label) => /* @__PURE__ */ jsxs5("label", { className: "flex items-center gap-2 text-
|
|
1196
|
+
const checkbox = (layer, path, label) => /* @__PURE__ */ jsxs5("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
1151
1197
|
/* @__PURE__ */ jsx5(
|
|
1152
1198
|
"input",
|
|
1153
1199
|
{
|
|
1154
1200
|
type: "checkbox",
|
|
1155
1201
|
checked: Boolean(getControlPath(layer.params, path)),
|
|
1156
1202
|
onChange: (e) => setParam(layer, path, e.target.checked),
|
|
1157
|
-
className: "accent-
|
|
1203
|
+
className: "accent-primary"
|
|
1158
1204
|
}
|
|
1159
1205
|
),
|
|
1160
1206
|
label
|
|
@@ -1200,14 +1246,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1200
1246
|
case "blackWhite":
|
|
1201
1247
|
return /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2", children: [
|
|
1202
1248
|
controlsOf(layer).map((s) => slider(layer, s)),
|
|
1203
|
-
/* @__PURE__ */ jsxs5("label", { className: "flex items-center gap-2 text-
|
|
1249
|
+
/* @__PURE__ */ jsxs5("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
1204
1250
|
/* @__PURE__ */ jsx5(
|
|
1205
1251
|
"input",
|
|
1206
1252
|
{
|
|
1207
1253
|
type: "checkbox",
|
|
1208
1254
|
checked: layer.params.tint !== null,
|
|
1209
1255
|
onChange: (e) => setParam(layer, "tint", e.target.checked ? "#e1d3b3" : null),
|
|
1210
|
-
className: "accent-
|
|
1256
|
+
className: "accent-primary"
|
|
1211
1257
|
}
|
|
1212
1258
|
),
|
|
1213
1259
|
"Tint",
|
|
@@ -1225,7 +1271,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1225
1271
|
] });
|
|
1226
1272
|
case "photoFilter":
|
|
1227
1273
|
return /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2", children: [
|
|
1228
|
-
/* @__PURE__ */ jsxs5("label", { className: "flex items-center gap-2 text-
|
|
1274
|
+
/* @__PURE__ */ jsxs5("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
1229
1275
|
"Filter colour",
|
|
1230
1276
|
/* @__PURE__ */ jsx5(
|
|
1231
1277
|
"input",
|
|
@@ -1242,19 +1288,19 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1242
1288
|
checkbox(layer, "preserveLuminosity", "Preserve luminosity")
|
|
1243
1289
|
] });
|
|
1244
1290
|
case "invert":
|
|
1245
|
-
return /* @__PURE__ */ jsx5("p", { className: "text-
|
|
1291
|
+
return /* @__PURE__ */ jsx5("p", { className: "text-muted-foreground text-[11px]", children: "Invert has no settings." });
|
|
1246
1292
|
default:
|
|
1247
1293
|
return /* @__PURE__ */ jsx5("div", { className: "flex flex-col gap-2", children: controlsOf(layer).map((s) => slider(layer, s)) });
|
|
1248
1294
|
}
|
|
1249
1295
|
};
|
|
1250
|
-
return /* @__PURE__ */ jsxs5("div", { className:
|
|
1251
|
-
/* @__PURE__ */ jsx5("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsx5("span", { className:
|
|
1296
|
+
return /* @__PURE__ */ jsxs5("div", { className: `flex flex-col gap-2 text-xs ${className}`.trim(), "data-testid": "adjustment-layers-panel", children: [
|
|
1297
|
+
/* @__PURE__ */ jsx5("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsx5("span", { className: imageSectionTitleClass, children: "Adjustment Layers" }) }),
|
|
1252
1298
|
/* @__PURE__ */ jsxs5("div", { className: "flex gap-1.5", children: [
|
|
1253
1299
|
/* @__PURE__ */ jsx5(
|
|
1254
1300
|
"select",
|
|
1255
1301
|
{
|
|
1256
1302
|
"aria-label": "New adjustment layer kind",
|
|
1257
|
-
className: `${
|
|
1303
|
+
className: `${imageSelectClass} flex-1`,
|
|
1258
1304
|
value: newKind,
|
|
1259
1305
|
onChange: (e) => setNewKind(e.target.value),
|
|
1260
1306
|
children: ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ jsx5("option", { value: k.kind, children: k.label }, k.kind))
|
|
@@ -1264,7 +1310,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1264
1310
|
"button",
|
|
1265
1311
|
{
|
|
1266
1312
|
type: "button",
|
|
1267
|
-
className: "px-2 py-1 rounded bg-
|
|
1313
|
+
className: "px-2 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90",
|
|
1268
1314
|
onClick: () => {
|
|
1269
1315
|
setSelectedId(controller.addAdjustmentLayer(newKind));
|
|
1270
1316
|
setChannel("master");
|
|
@@ -1280,7 +1326,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1280
1326
|
return /* @__PURE__ */ jsxs5(
|
|
1281
1327
|
"li",
|
|
1282
1328
|
{
|
|
1283
|
-
className: `flex items-center gap-1.5 rounded px-1.5 py-1 ${layer.id === selectedId ? "bg-
|
|
1329
|
+
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"}`,
|
|
1284
1330
|
children: [
|
|
1285
1331
|
/* @__PURE__ */ jsx5(
|
|
1286
1332
|
"input",
|
|
@@ -1289,14 +1335,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1289
1335
|
"aria-label": `Show ${label}`,
|
|
1290
1336
|
checked: layer.enabled,
|
|
1291
1337
|
onChange: () => controller.toggleAdjustmentLayer(layer.id),
|
|
1292
|
-
className: "accent-
|
|
1338
|
+
className: "accent-primary"
|
|
1293
1339
|
}
|
|
1294
1340
|
),
|
|
1295
1341
|
/* @__PURE__ */ jsx5(
|
|
1296
1342
|
"button",
|
|
1297
1343
|
{
|
|
1298
1344
|
type: "button",
|
|
1299
|
-
className: `flex-1 text-left truncate ${layer.enabled ? "text-
|
|
1345
|
+
className: `flex-1 text-left truncate ${layer.enabled ? "text-foreground" : "text-muted-foreground line-through"}`,
|
|
1300
1346
|
onClick: () => setSelectedId(layer.id === selectedId ? null : layer.id),
|
|
1301
1347
|
"aria-pressed": layer.id === selectedId,
|
|
1302
1348
|
children: label
|
|
@@ -1309,7 +1355,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1309
1355
|
"aria-label": `Move ${label} up`,
|
|
1310
1356
|
disabled: index === layers.length - 1,
|
|
1311
1357
|
onClick: () => controller.moveAdjustmentLayer(layer.id, index + 1),
|
|
1312
|
-
className: "px-1 text-
|
|
1358
|
+
className: "px-1 text-muted-foreground hover:text-foreground disabled:opacity-30",
|
|
1313
1359
|
children: "\u2191"
|
|
1314
1360
|
}
|
|
1315
1361
|
),
|
|
@@ -1320,7 +1366,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1320
1366
|
"aria-label": `Move ${label} down`,
|
|
1321
1367
|
disabled: index === 0,
|
|
1322
1368
|
onClick: () => controller.moveAdjustmentLayer(layer.id, index - 1),
|
|
1323
|
-
className: "px-1 text-
|
|
1369
|
+
className: "px-1 text-muted-foreground hover:text-foreground disabled:opacity-30",
|
|
1324
1370
|
children: "\u2193"
|
|
1325
1371
|
}
|
|
1326
1372
|
),
|
|
@@ -1333,7 +1379,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1333
1379
|
controller.removeAdjustmentLayer(layer.id);
|
|
1334
1380
|
if (selectedId === layer.id) setSelectedId(null);
|
|
1335
1381
|
},
|
|
1336
|
-
className: "px-1 text-
|
|
1382
|
+
className: "px-1 text-destructive hover:text-destructive",
|
|
1337
1383
|
children: "\u2715"
|
|
1338
1384
|
}
|
|
1339
1385
|
)
|
|
@@ -1342,14 +1388,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1342
1388
|
layer.id
|
|
1343
1389
|
);
|
|
1344
1390
|
}) }),
|
|
1345
|
-
selected && /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2 rounded border border-
|
|
1391
|
+
selected && /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2 rounded border border-border p-2", "data-testid": "adjustment-layer-editor", children: [
|
|
1346
1392
|
/* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2", children: [
|
|
1347
|
-
/* @__PURE__ */ jsx5("span", { className: "text-
|
|
1393
|
+
/* @__PURE__ */ jsx5("span", { className: "text-muted-foreground", children: "Blend" }),
|
|
1348
1394
|
/* @__PURE__ */ jsx5(
|
|
1349
1395
|
"select",
|
|
1350
1396
|
{
|
|
1351
1397
|
"aria-label": "Blend mode",
|
|
1352
|
-
className: `${
|
|
1398
|
+
className: `${imageSelectClass} flex-1`,
|
|
1353
1399
|
value: selected.blend,
|
|
1354
1400
|
onChange: (e) => controller.updateAdjustmentLayer(selected.id, { blend: e.target.value }),
|
|
1355
1401
|
children: BLEND_MODES.map((m) => /* @__PURE__ */ jsx5("option", { value: m.id, children: m.label }, m.id))
|
|
@@ -1377,7 +1423,6 @@ import { useEffect as useEffect6, useRef as useRef5, useState as useState7 } fro
|
|
|
1377
1423
|
import { useEffect as useEffect5, useRef as useRef4, useState as useState6 } from "react";
|
|
1378
1424
|
import { LAYER_EFFECT_MENU, effectControlChange, layerEffectControls, layerEffectsPanel } from "@pixerate/editor/image-editor";
|
|
1379
1425
|
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1380
|
-
var button = "px-1.5 py-0.5 rounded text-[10px] bg-slate-800 text-slate-300 hover:text-white disabled:opacity-40";
|
|
1381
1426
|
var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
1382
1427
|
const [, setTick] = useState6(0);
|
|
1383
1428
|
useEffect5(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -1401,7 +1446,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1401
1446
|
onKeyDown: () => commitNext.current = true
|
|
1402
1447
|
};
|
|
1403
1448
|
if (!model.available || !id) {
|
|
1404
|
-
return /* @__PURE__ */ jsx6("div", { className: `text-xs text-
|
|
1449
|
+
return /* @__PURE__ */ jsx6("div", { className: `text-xs text-muted-foreground ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
|
|
1405
1450
|
}
|
|
1406
1451
|
const effects = controller.getLayerEffects(id);
|
|
1407
1452
|
const patterns = controller.getDocumentPatterns();
|
|
@@ -1417,7 +1462,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1417
1462
|
const k = c.percent ? 100 : 1;
|
|
1418
1463
|
const shown = Math.round(c.value * k * 100) / 100;
|
|
1419
1464
|
return /* @__PURE__ */ jsxs6("label", { className: "flex flex-col gap-0.5", children: [
|
|
1420
|
-
/* @__PURE__ */ jsxs6("span", { className: "text-
|
|
1465
|
+
/* @__PURE__ */ jsxs6("span", { className: "text-muted-foreground", children: [
|
|
1421
1466
|
label,
|
|
1422
1467
|
" ",
|
|
1423
1468
|
shown,
|
|
@@ -1435,24 +1480,24 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1435
1480
|
disabled: model.readOnly,
|
|
1436
1481
|
...sliderEvents,
|
|
1437
1482
|
onChange: (e) => change(effectId, c, Number(e.target.value) / k, true),
|
|
1438
|
-
className: "accent-
|
|
1483
|
+
className: "accent-primary"
|
|
1439
1484
|
}
|
|
1440
1485
|
)
|
|
1441
1486
|
] }, c.key);
|
|
1442
1487
|
}
|
|
1443
1488
|
case "color":
|
|
1444
|
-
return /* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-1.5 text-
|
|
1489
|
+
return /* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
1445
1490
|
/* @__PURE__ */ jsx6("input", { type: "color", "aria-label": label, value: c.value, disabled: model.readOnly, onChange: (e) => change(effectId, c, e.target.value) }),
|
|
1446
1491
|
label
|
|
1447
1492
|
] }, c.key);
|
|
1448
1493
|
case "checkbox":
|
|
1449
|
-
return /* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-1.5 text-
|
|
1450
|
-
/* @__PURE__ */ jsx6("input", { type: "checkbox", "aria-label": label, checked: c.value, disabled: model.readOnly, onChange: (e) => change(effectId, c, e.target.checked), className: "accent-
|
|
1494
|
+
return /* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
1495
|
+
/* @__PURE__ */ jsx6("input", { type: "checkbox", "aria-label": label, checked: c.value, disabled: model.readOnly, onChange: (e) => change(effectId, c, e.target.checked), className: "accent-primary" }),
|
|
1451
1496
|
label
|
|
1452
1497
|
] }, c.key);
|
|
1453
1498
|
case "select":
|
|
1454
1499
|
return /* @__PURE__ */ jsxs6("label", { className: "flex flex-col gap-0.5", children: [
|
|
1455
|
-
/* @__PURE__ */ jsx6("span", { className: "text-
|
|
1500
|
+
/* @__PURE__ */ jsx6("span", { className: "text-muted-foreground", children: label }),
|
|
1456
1501
|
/* @__PURE__ */ jsx6(
|
|
1457
1502
|
"select",
|
|
1458
1503
|
{
|
|
@@ -1460,17 +1505,17 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1460
1505
|
value: c.value,
|
|
1461
1506
|
disabled: model.readOnly,
|
|
1462
1507
|
onChange: (e) => change(effectId, c, e.target.value),
|
|
1463
|
-
className:
|
|
1508
|
+
className: imageSelectClass,
|
|
1464
1509
|
children: c.options.map((o) => /* @__PURE__ */ jsx6("option", { value: o.value, children: o.label }, o.value))
|
|
1465
1510
|
}
|
|
1466
1511
|
)
|
|
1467
1512
|
] }, c.key);
|
|
1468
1513
|
}
|
|
1469
1514
|
};
|
|
1470
|
-
return /* @__PURE__ */ jsxs6("div", { className: `flex flex-col gap-1.5 text-xs text-
|
|
1515
|
+
return /* @__PURE__ */ jsxs6("div", { className: `flex flex-col gap-1.5 text-xs text-foreground ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer effects", role: "group", children: [
|
|
1471
1516
|
/* @__PURE__ */ jsxs6("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
1472
|
-
/* @__PURE__ */ jsx6("span", { className: "font-semibold text-
|
|
1473
|
-
/* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-1 text-
|
|
1517
|
+
/* @__PURE__ */ jsx6("span", { className: "font-semibold text-foreground", children: "fx Effects" }),
|
|
1518
|
+
/* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-1 text-foreground", children: [
|
|
1474
1519
|
/* @__PURE__ */ jsx6(
|
|
1475
1520
|
"input",
|
|
1476
1521
|
{
|
|
@@ -1479,12 +1524,12 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1479
1524
|
checked: model.enabled,
|
|
1480
1525
|
disabled: model.readOnly,
|
|
1481
1526
|
onChange: (e) => attempt(() => controller.setLayerEffectsEnabled(id, e.target.checked)),
|
|
1482
|
-
className: "accent-
|
|
1527
|
+
className: "accent-primary"
|
|
1483
1528
|
}
|
|
1484
1529
|
),
|
|
1485
1530
|
"On"
|
|
1486
1531
|
] }),
|
|
1487
|
-
/* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-1 text-
|
|
1532
|
+
/* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
1488
1533
|
"Scale",
|
|
1489
1534
|
/* @__PURE__ */ jsx6(
|
|
1490
1535
|
"input",
|
|
@@ -1500,7 +1545,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1500
1545
|
const v = Number(e.target.value);
|
|
1501
1546
|
if (v >= 1 && v <= 1e3) attempt(() => controller.setLayerEffectsEnabled(id, model.enabled, v / 100));
|
|
1502
1547
|
},
|
|
1503
|
-
className: "w-14 bg-
|
|
1548
|
+
className: "w-14 bg-muted border border-border rounded px-1"
|
|
1504
1549
|
}
|
|
1505
1550
|
),
|
|
1506
1551
|
"%"
|
|
@@ -1516,7 +1561,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1516
1561
|
if (!kind) return;
|
|
1517
1562
|
attempt(() => setOpen(controller.addLayerEffect(id, kind).effect.id));
|
|
1518
1563
|
},
|
|
1519
|
-
className:
|
|
1564
|
+
className: imageSelectClass,
|
|
1520
1565
|
children: [
|
|
1521
1566
|
/* @__PURE__ */ jsx6("option", { value: "", children: "Add effect\u2026" }),
|
|
1522
1567
|
LAYER_EFFECT_MENU.map((m) => /* @__PURE__ */ jsx6("option", { value: m.kind, children: m.label }, m.kind))
|
|
@@ -1524,11 +1569,11 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1524
1569
|
}
|
|
1525
1570
|
)
|
|
1526
1571
|
] }),
|
|
1527
|
-
model.readOnly && model.reason && /* @__PURE__ */ jsx6("p", { className: "text-
|
|
1572
|
+
model.readOnly && model.reason && /* @__PURE__ */ jsx6("p", { className: "text-muted-foreground", children: model.reason }),
|
|
1528
1573
|
/* @__PURE__ */ jsx6("ul", { className: "flex flex-col gap-1", "aria-label": "Effects", children: model.rows.map((row) => {
|
|
1529
1574
|
const effect = effects.items.find((e) => e.id === row.id);
|
|
1530
1575
|
const expanded = open === row.id;
|
|
1531
|
-
return /* @__PURE__ */ jsxs6("li", { "data-effect-id": row.id, className: "rounded bg-
|
|
1576
|
+
return /* @__PURE__ */ jsxs6("li", { "data-effect-id": row.id, className: "rounded bg-background/60 ring-1 ring-border", children: [
|
|
1532
1577
|
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
|
|
1533
1578
|
/* @__PURE__ */ jsx6(
|
|
1534
1579
|
"input",
|
|
@@ -1538,7 +1583,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1538
1583
|
checked: row.enabled,
|
|
1539
1584
|
disabled: model.readOnly,
|
|
1540
1585
|
onChange: (e) => attempt(() => controller.updateLayerEffect(id, row.id, { enabled: e.target.checked })),
|
|
1541
|
-
className: "accent-
|
|
1586
|
+
className: "accent-primary"
|
|
1542
1587
|
}
|
|
1543
1588
|
),
|
|
1544
1589
|
/* @__PURE__ */ jsx6(
|
|
@@ -1546,17 +1591,17 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1546
1591
|
{
|
|
1547
1592
|
type: "button",
|
|
1548
1593
|
"aria-expanded": expanded,
|
|
1549
|
-
className: `flex-1 text-left ${row.enabled && model.enabled ? "" : "text-
|
|
1594
|
+
className: `flex-1 text-left ${row.enabled && model.enabled ? "" : "text-muted-foreground"}`,
|
|
1550
1595
|
onClick: () => setOpen(expanded ? null : row.id),
|
|
1551
1596
|
children: row.label
|
|
1552
1597
|
}
|
|
1553
1598
|
),
|
|
1554
|
-
/* @__PURE__ */ jsx6("button", { type: "button", className:
|
|
1599
|
+
/* @__PURE__ */ jsx6("button", { type: "button", className: imageIconButtonClass, "aria-label": `Remove ${row.label}`, disabled: model.readOnly, onClick: () => attempt(() => controller.removeLayerEffect(id, row.id)), children: "\u2715" })
|
|
1555
1600
|
] }),
|
|
1556
1601
|
expanded && /* @__PURE__ */ jsx6("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 px-1.5 pb-1.5", "data-testid": "effect-settings", children: layerEffectControls(effect, patterns).map((c) => renderControl(row.id, c)) })
|
|
1557
1602
|
] }, row.id);
|
|
1558
1603
|
}) }),
|
|
1559
|
-
error && /* @__PURE__ */ jsx6("p", { role: "alert", className: "text-
|
|
1604
|
+
error && /* @__PURE__ */ jsx6("p", { role: "alert", className: "text-destructive", children: error })
|
|
1560
1605
|
] });
|
|
1561
1606
|
};
|
|
1562
1607
|
|
|
@@ -1578,8 +1623,7 @@ import {
|
|
|
1578
1623
|
runLayerMenuAction
|
|
1579
1624
|
} from "@pixerate/editor/image-editor";
|
|
1580
1625
|
import { Fragment, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1581
|
-
var
|
|
1582
|
-
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"}`;
|
|
1626
|
+
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"}`;
|
|
1583
1627
|
var Thumbnail = ({
|
|
1584
1628
|
pixels,
|
|
1585
1629
|
size,
|
|
@@ -1608,7 +1652,7 @@ var Thumbnail = ({
|
|
|
1608
1652
|
"data-testid": testId,
|
|
1609
1653
|
onClick,
|
|
1610
1654
|
style: { width: size, height: size },
|
|
1611
|
-
className: `shrink-0 rounded bg-[repeating-conic-gradient(#334155_0%_25%,#1e293b_0%_50%)] [background-size:8px_8px] object-contain ${selected ? "ring-2 ring-
|
|
1655
|
+
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"}`
|
|
1612
1656
|
}
|
|
1613
1657
|
);
|
|
1614
1658
|
};
|
|
@@ -1667,18 +1711,18 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1667
1711
|
const thumb = (layer) => layerHasThumbnail(layer) ? controller.getLayerThumbnail(layer.id, { maxSide: 64 }) : null;
|
|
1668
1712
|
const maskThumb = (layer) => layer.mask && !layer.mask.source ? controller.getLayerThumbnail(layer.id, { maxSide: 64, mask: true }) : null;
|
|
1669
1713
|
const locked = (layer) => Boolean(layer.locks?.all || layer.locks?.pixels || layer.locks?.position || layer.locks?.transparency);
|
|
1670
|
-
return /* @__PURE__ */ jsxs7("div", { className: `flex flex-col gap-2 text-xs text-
|
|
1714
|
+
return /* @__PURE__ */ jsxs7("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "layers-panel", onClick: () => menu && setMenu(null), children: [
|
|
1671
1715
|
/* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap items-center gap-1", role: "toolbar", "aria-label": "Layer actions", children: [
|
|
1672
|
-
/* @__PURE__ */ jsx7("button", { type: "button", className:
|
|
1673
|
-
/* @__PURE__ */ jsx7("button", { type: "button", className:
|
|
1674
|
-
/* @__PURE__ */ jsx7("button", { type: "button", className:
|
|
1675
|
-
/* @__PURE__ */ jsx7("button", { type: "button", className:
|
|
1676
|
-
/* @__PURE__ */ jsx7("button", { type: "button", className:
|
|
1716
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-layer"), children: "New Layer" }),
|
|
1717
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-group"), children: "New Group" }),
|
|
1718
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("duplicate"), children: "Duplicate" }),
|
|
1719
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("add-mask"), children: "Add Mask" }),
|
|
1720
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("delete"), children: "Delete" }),
|
|
1677
1721
|
/* @__PURE__ */ jsx7(
|
|
1678
1722
|
"button",
|
|
1679
1723
|
{
|
|
1680
1724
|
type: "button",
|
|
1681
|
-
className:
|
|
1725
|
+
className: imageIconButtonClass,
|
|
1682
1726
|
"aria-label": "Layer menu",
|
|
1683
1727
|
"aria-haspopup": "menu",
|
|
1684
1728
|
onClick: (e) => {
|
|
@@ -1694,15 +1738,15 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1694
1738
|
{
|
|
1695
1739
|
"aria-label": "Bits per channel",
|
|
1696
1740
|
title: "Image \u203A Mode: bits per channel",
|
|
1697
|
-
className: "rounded bg-
|
|
1741
|
+
className: "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground",
|
|
1698
1742
|
value: controller.bitDepth,
|
|
1699
1743
|
onChange: (e) => attempt(() => controller.setBitDepth(Number(e.target.value))),
|
|
1700
1744
|
children: BIT_DEPTH_OPTIONS.map((o) => /* @__PURE__ */ jsx7("option", { value: o.depth, title: o.title, children: o.label }, o.depth))
|
|
1701
1745
|
}
|
|
1702
1746
|
),
|
|
1703
1747
|
psd && /* @__PURE__ */ jsxs7(Fragment, { children: [
|
|
1704
|
-
/* @__PURE__ */ jsx7("button", { type: "button", className:
|
|
1705
|
-
/* @__PURE__ */ jsx7("button", { type: "button", className:
|
|
1748
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: imageIconButtonClass, onClick: () => fileInput.current?.click(), children: "Open PSD\u2026" }),
|
|
1749
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: imageIconButtonClass, onClick: () => psdTask(async () => (await downloadPsd(controller, psdFileName)).warnings), children: "Export PSD" }),
|
|
1706
1750
|
/* @__PURE__ */ jsx7(
|
|
1707
1751
|
"input",
|
|
1708
1752
|
{
|
|
@@ -1721,13 +1765,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1721
1765
|
)
|
|
1722
1766
|
] })
|
|
1723
1767
|
] }),
|
|
1724
|
-
psdNotes.length > 0 && /* @__PURE__ */ jsxs7("ul", { className: "rounded bg-amber-
|
|
1768
|
+
psdNotes.length > 0 && /* @__PURE__ */ jsxs7("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: [
|
|
1725
1769
|
psdNotes.map((n) => /* @__PURE__ */ jsx7("li", { children: n }, n)),
|
|
1726
1770
|
/* @__PURE__ */ jsx7("li", { children: /* @__PURE__ */ jsx7("button", { type: "button", className: "underline", onClick: () => setPsdNotes([]), children: "Dismiss" }) })
|
|
1727
1771
|
] }),
|
|
1728
1772
|
active && /* @__PURE__ */ jsxs7("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 items-center", "data-testid": "layer-properties", children: [
|
|
1729
1773
|
/* @__PURE__ */ jsxs7("label", { className: "flex flex-col gap-0.5", children: [
|
|
1730
|
-
/* @__PURE__ */ jsxs7("span", { className: "text-
|
|
1774
|
+
/* @__PURE__ */ jsxs7("span", { className: "text-muted-foreground", children: [
|
|
1731
1775
|
"Opacity ",
|
|
1732
1776
|
Math.round(active.opacity * 100),
|
|
1733
1777
|
"%"
|
|
@@ -1742,12 +1786,12 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1742
1786
|
value: Math.round(active.opacity * 100),
|
|
1743
1787
|
...sliderEvents,
|
|
1744
1788
|
onChange: (e) => prop("opacity", Number(e.target.value) / 100),
|
|
1745
|
-
className: "accent-
|
|
1789
|
+
className: "accent-primary"
|
|
1746
1790
|
}
|
|
1747
1791
|
)
|
|
1748
1792
|
] }),
|
|
1749
1793
|
/* @__PURE__ */ jsxs7("label", { className: "flex flex-col gap-0.5", children: [
|
|
1750
|
-
/* @__PURE__ */ jsxs7("span", { className: "text-
|
|
1794
|
+
/* @__PURE__ */ jsxs7("span", { className: "text-muted-foreground", children: [
|
|
1751
1795
|
"Fill ",
|
|
1752
1796
|
Math.round(((active.type === "pixel" ? active.fillOpacity : void 0) ?? 1) * 100),
|
|
1753
1797
|
"%"
|
|
@@ -1763,7 +1807,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1763
1807
|
value: Math.round(((active.type === "pixel" ? active.fillOpacity : void 0) ?? 1) * 100),
|
|
1764
1808
|
...sliderEvents,
|
|
1765
1809
|
onChange: (e) => prop("fillOpacity", Number(e.target.value) / 100),
|
|
1766
|
-
className: "accent-
|
|
1810
|
+
className: "accent-primary disabled:opacity-40"
|
|
1767
1811
|
}
|
|
1768
1812
|
)
|
|
1769
1813
|
] }),
|
|
@@ -1771,7 +1815,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1771
1815
|
"select",
|
|
1772
1816
|
{
|
|
1773
1817
|
"aria-label": "Layer blend mode",
|
|
1774
|
-
className:
|
|
1818
|
+
className: imageSelectClass,
|
|
1775
1819
|
value: active.blend,
|
|
1776
1820
|
onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { blend: e.target.value })),
|
|
1777
1821
|
children: [
|
|
@@ -1780,7 +1824,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1780
1824
|
]
|
|
1781
1825
|
}
|
|
1782
1826
|
),
|
|
1783
|
-
/* @__PURE__ */ jsxs7("label", { className: "flex items-center gap-1.5 text-
|
|
1827
|
+
/* @__PURE__ */ jsxs7("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
1784
1828
|
/* @__PURE__ */ jsx7(
|
|
1785
1829
|
"input",
|
|
1786
1830
|
{
|
|
@@ -1788,12 +1832,12 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1788
1832
|
"aria-label": "Clip to layer below",
|
|
1789
1833
|
checked: Boolean(active.clipped),
|
|
1790
1834
|
onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { clipped: e.target.checked })),
|
|
1791
|
-
className: "accent-
|
|
1835
|
+
className: "accent-primary"
|
|
1792
1836
|
}
|
|
1793
1837
|
),
|
|
1794
1838
|
"Clip to below"
|
|
1795
1839
|
] }),
|
|
1796
|
-
/* @__PURE__ */ jsx7("div", { className: "col-span-2 flex flex-wrap gap-2 text-
|
|
1840
|
+
/* @__PURE__ */ jsx7("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__ */ jsxs7("label", { className: "flex items-center gap-1", children: [
|
|
1797
1841
|
/* @__PURE__ */ jsx7(
|
|
1798
1842
|
"input",
|
|
1799
1843
|
{
|
|
@@ -1801,13 +1845,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1801
1845
|
"aria-label": `Lock ${k}`,
|
|
1802
1846
|
checked: Boolean(active.locks?.[k]),
|
|
1803
1847
|
onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { locks: { ...active.locks, [k]: e.target.checked } })),
|
|
1804
|
-
className: "accent-
|
|
1848
|
+
className: "accent-primary"
|
|
1805
1849
|
}
|
|
1806
1850
|
),
|
|
1807
1851
|
k
|
|
1808
1852
|
] }, k)) })
|
|
1809
1853
|
] }),
|
|
1810
|
-
effects && active && active.type !== "adjustment" && /* @__PURE__ */ jsx7(LayerEffectsPanel, { controller, className: "border-t border-
|
|
1854
|
+
effects && active && active.type !== "adjustment" && /* @__PURE__ */ jsx7(LayerEffectsPanel, { controller, className: "border-t border-border pt-1.5" }),
|
|
1811
1855
|
/* @__PURE__ */ jsx7("ul", { className: "flex flex-col gap-0.5", role: "tree", "aria-label": "Layers", children: rows.map((row) => {
|
|
1812
1856
|
const { layer } = row;
|
|
1813
1857
|
return /* @__PURE__ */ jsxs7(
|
|
@@ -1846,7 +1890,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1846
1890
|
type: "button",
|
|
1847
1891
|
"aria-label": layer.visible ? `Hide ${row.label}` : `Show ${row.label}`,
|
|
1848
1892
|
"aria-pressed": layer.visible,
|
|
1849
|
-
className: "w-4 text-center text-
|
|
1893
|
+
className: "w-4 text-center text-foreground",
|
|
1850
1894
|
onClick: (e) => {
|
|
1851
1895
|
e.stopPropagation();
|
|
1852
1896
|
attempt(() => controller.setLayerProperties(layer.id, { visible: !layer.visible }));
|
|
@@ -1859,7 +1903,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1859
1903
|
{
|
|
1860
1904
|
type: "button",
|
|
1861
1905
|
"aria-label": layer.collapsed ? `Expand ${row.label}` : `Collapse ${row.label}`,
|
|
1862
|
-
className: "w-3 text-
|
|
1906
|
+
className: "w-3 text-muted-foreground",
|
|
1863
1907
|
onClick: (e) => {
|
|
1864
1908
|
e.stopPropagation();
|
|
1865
1909
|
attempt(() => controller.setLayerProperties(layer.id, { collapsed: !layer.collapsed }));
|
|
@@ -1867,7 +1911,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1867
1911
|
children: layer.collapsed ? "\u25B8" : "\u25BE"
|
|
1868
1912
|
}
|
|
1869
1913
|
),
|
|
1870
|
-
row.clipped && /* @__PURE__ */ jsx7("span", { className: "text-
|
|
1914
|
+
row.clipped && /* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", "aria-label": "Clipped", children: "\u21B3" }),
|
|
1871
1915
|
layerHasThumbnail(layer) ? /* @__PURE__ */ jsxs7("span", { className: "relative shrink-0", children: [
|
|
1872
1916
|
/* @__PURE__ */ jsx7(
|
|
1873
1917
|
Thumbnail,
|
|
@@ -1882,14 +1926,14 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1882
1926
|
"span",
|
|
1883
1927
|
{
|
|
1884
1928
|
"data-testid": "layer-kind-badge",
|
|
1885
|
-
className: "absolute -bottom-1 -right-1 rounded bg-
|
|
1929
|
+
className: "absolute -bottom-1 -right-1 rounded bg-accent px-0.5 text-[8px] font-bold leading-tight text-foreground ring-1 ring-background",
|
|
1886
1930
|
children: layerBadge(layer)
|
|
1887
1931
|
}
|
|
1888
1932
|
)
|
|
1889
1933
|
] }) : /* @__PURE__ */ jsx7(
|
|
1890
1934
|
"span",
|
|
1891
1935
|
{
|
|
1892
|
-
className: "shrink-0 grid place-items-center rounded bg-
|
|
1936
|
+
className: "shrink-0 grid place-items-center rounded bg-muted text-[9px] text-muted-foreground ring-1 ring-border",
|
|
1893
1937
|
style: { width: thumbnailSize, height: thumbnailSize },
|
|
1894
1938
|
children: layerBadge(layer)
|
|
1895
1939
|
}
|
|
@@ -1902,7 +1946,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1902
1946
|
"aria-pressed": layer.mask.linked !== false,
|
|
1903
1947
|
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.",
|
|
1904
1948
|
"data-testid": "layer-mask-link",
|
|
1905
|
-
className: `shrink-0 text-[10px] leading-none ${layer.mask.linked === false ? "text-
|
|
1949
|
+
className: `shrink-0 text-[10px] leading-none ${layer.mask.linked === false ? "text-muted-foreground/70" : "text-foreground"}`,
|
|
1906
1950
|
onClick: (e) => {
|
|
1907
1951
|
e.stopPropagation();
|
|
1908
1952
|
attempt(() => controller.setLayerMaskProps(layer.id, { linked: layer.mask.linked === false }));
|
|
@@ -1931,7 +1975,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1931
1975
|
autoFocus: true,
|
|
1932
1976
|
"aria-label": "Layer name",
|
|
1933
1977
|
defaultValue: layer.name || row.label,
|
|
1934
|
-
className: "flex-1 min-w-0 bg-
|
|
1978
|
+
className: "flex-1 min-w-0 bg-background border border-border rounded px-1",
|
|
1935
1979
|
onClick: (e) => e.stopPropagation(),
|
|
1936
1980
|
onBlur: (e) => {
|
|
1937
1981
|
setRenaming(null);
|
|
@@ -1945,7 +1989,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1945
1989
|
) : /* @__PURE__ */ jsx7(
|
|
1946
1990
|
"span",
|
|
1947
1991
|
{
|
|
1948
|
-
className: `flex-1 min-w-0 truncate ${layer.visible ? "" : "text-
|
|
1992
|
+
className: `flex-1 min-w-0 truncate ${layer.visible ? "" : "text-muted-foreground"}`,
|
|
1949
1993
|
onDoubleClick: (e) => {
|
|
1950
1994
|
e.stopPropagation();
|
|
1951
1995
|
setRenaming(layer.id);
|
|
@@ -1953,7 +1997,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1953
1997
|
children: row.label
|
|
1954
1998
|
}
|
|
1955
1999
|
),
|
|
1956
|
-
layerWarning(layer) && /* @__PURE__ */ jsx7("span", { role: "img", "data-testid": "layer-warning", "aria-label": layerWarning(layer), title: layerWarning(layer), className: "text-[10px] text-amber-
|
|
2000
|
+
layerWarning(layer) && /* @__PURE__ */ jsx7("span", { role: "img", "data-testid": "layer-warning", "aria-label": layerWarning(layer), title: layerWarning(layer), className: "text-[10px] text-amber-600", children: "\u26A0" }),
|
|
1957
2001
|
layerEffectsBadge(layer) && /* @__PURE__ */ jsx7(
|
|
1958
2002
|
"button",
|
|
1959
2003
|
{
|
|
@@ -1961,7 +2005,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1961
2005
|
"data-testid": "layer-fx-badge",
|
|
1962
2006
|
"aria-label": layerEffectsBadge(layer) === "on" ? `Turn effects off for ${row.label}` : `Turn effects on for ${row.label}`,
|
|
1963
2007
|
"aria-pressed": layerEffectsBadge(layer) === "on",
|
|
1964
|
-
className: `text-[9px] italic font-semibold ${layerEffectsBadge(layer) === "on" ? "text-
|
|
2008
|
+
className: `text-[9px] italic font-semibold ${layerEffectsBadge(layer) === "on" ? "text-primary" : "text-muted-foreground/70 line-through"}`,
|
|
1965
2009
|
onClick: (e) => {
|
|
1966
2010
|
e.stopPropagation();
|
|
1967
2011
|
attempt(() => controller.setLayerEffectsEnabled(layer.id, layerEffectsBadge(layer) !== "on"));
|
|
@@ -1969,20 +2013,20 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1969
2013
|
children: "fx"
|
|
1970
2014
|
}
|
|
1971
2015
|
),
|
|
1972
|
-
locked(layer) && /* @__PURE__ */ jsx7("span", { "aria-label": "Locked", className: "text-
|
|
1973
|
-
layer.blend !== "normal" && layer.blend !== "pass-through" && /* @__PURE__ */ jsx7("span", { className: "text-[9px] text-
|
|
2016
|
+
locked(layer) && /* @__PURE__ */ jsx7("span", { "aria-label": "Locked", className: "text-muted-foreground", children: "\u{1F512}" }),
|
|
2017
|
+
layer.blend !== "normal" && layer.blend !== "pass-through" && /* @__PURE__ */ jsx7("span", { className: "text-[9px] text-muted-foreground", children: layer.blend })
|
|
1974
2018
|
]
|
|
1975
2019
|
},
|
|
1976
2020
|
layer.id
|
|
1977
2021
|
);
|
|
1978
2022
|
}) }),
|
|
1979
|
-
error && /* @__PURE__ */ jsx7("p", { role: "alert", className: "text-
|
|
2023
|
+
error && /* @__PURE__ */ jsx7("p", { role: "alert", className: "text-destructive", children: error }),
|
|
1980
2024
|
menu && /* @__PURE__ */ jsx7(
|
|
1981
2025
|
"div",
|
|
1982
2026
|
{
|
|
1983
2027
|
role: "menu",
|
|
1984
2028
|
"aria-label": "Layer menu",
|
|
1985
|
-
className: "fixed z-50 min-w-44 rounded border border-
|
|
2029
|
+
className: "fixed z-50 min-w-44 rounded border border-border bg-background py-1 shadow-xl",
|
|
1986
2030
|
style: { left: menu.x, top: menu.y },
|
|
1987
2031
|
onClick: (e) => e.stopPropagation(),
|
|
1988
2032
|
onKeyDown: (e) => e.key === "Escape" && setMenu(null),
|
|
@@ -1992,7 +2036,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1992
2036
|
type: "button",
|
|
1993
2037
|
role: "menuitem",
|
|
1994
2038
|
disabled: !item.enabled,
|
|
1995
|
-
className: "block w-full px-3 py-1 text-left hover:bg-
|
|
2039
|
+
className: "block w-full px-3 py-1 text-left hover:bg-muted disabled:opacity-40",
|
|
1996
2040
|
onClick: () => run(item.action),
|
|
1997
2041
|
children: item.label
|
|
1998
2042
|
},
|
|
@@ -2009,21 +2053,22 @@ import { findLayer } from "@pixerate/editor/image-editor";
|
|
|
2009
2053
|
|
|
2010
2054
|
// src/image-editor/ImageEffectControls.tsx
|
|
2011
2055
|
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2012
|
-
function ImageEffectControls({ provider, effect, name, values, onChange, onPreset }) {
|
|
2056
|
+
function ImageEffectControls({ provider, effect, name, values, onChange, onPreset, className }) {
|
|
2013
2057
|
const { description, error } = useEffectDescription(provider, effect);
|
|
2014
|
-
|
|
2058
|
+
let body;
|
|
2059
|
+
if (!provider) body = /* @__PURE__ */ jsxs8("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
2015
2060
|
'No effects provider: "',
|
|
2016
2061
|
name ?? effect,
|
|
2017
2062
|
'" is kept but not drawn.'
|
|
2018
2063
|
] });
|
|
2019
|
-
if (error)
|
|
2020
|
-
if (!description)
|
|
2021
|
-
|
|
2064
|
+
else if (error) body = /* @__PURE__ */ jsx8("p", { className: "text-[11px] text-amber-600", children: error });
|
|
2065
|
+
else if (!description) body = /* @__PURE__ */ jsx8("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
|
|
2066
|
+
else body = /* @__PURE__ */ jsx8(EffectParameters, { description, values, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
|
|
2067
|
+
return /* @__PURE__ */ jsx8("div", { className, "data-testid": "image-effect-controls", children: body });
|
|
2022
2068
|
}
|
|
2023
2069
|
|
|
2024
2070
|
// src/image-editor/ImageProviderEffectsPanel.tsx
|
|
2025
2071
|
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2026
|
-
var btn = "rounded border border-slate-700 px-1.5 py-0.5 text-[11px] text-slate-300 hover:text-white disabled:opacity-40";
|
|
2027
2072
|
function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
2028
2073
|
const [, setTick] = useState8(0);
|
|
2029
2074
|
useEffect7(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -2053,17 +2098,17 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
2053
2098
|
const canFilter = !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
|
|
2054
2099
|
return /* @__PURE__ */ jsxs9("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Provider effects", "data-image-provider-effects": "", children: [
|
|
2055
2100
|
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1", children: [
|
|
2056
|
-
/* @__PURE__ */ jsx9("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-
|
|
2057
|
-
/* @__PURE__ */ jsx9("button", { type: "button", className:
|
|
2058
|
-
/* @__PURE__ */ jsx9("button", { type: "button", className:
|
|
2101
|
+
/* @__PURE__ */ jsx9("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Effects" }),
|
|
2102
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider || !canFilter, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Apply effect\u2026" }),
|
|
2103
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => setBrowse(browse === "layer" ? null : "layer"), children: "Effect layer\u2026" })
|
|
2059
2104
|
] }),
|
|
2060
|
-
!provider && /* @__PURE__ */ jsx9("p", { className: "text-[11px] text-
|
|
2105
|
+
!provider && /* @__PURE__ */ jsx9("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the document are kept." }),
|
|
2061
2106
|
browse === "filter" && layer && /* @__PURE__ */ jsx9(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id))) }),
|
|
2062
2107
|
browse === "layer" && /* @__PURE__ */ jsx9(EffectsBrowser, { provider, uses: ["generator", "overlay", "title"], title: "Generators and overlays", onPick: (e) => (setBrowse(null), run(() => controller.addEffectLayer(e.id))) }),
|
|
2063
2108
|
generator && layer && /* @__PURE__ */ jsxs9("div", { className: "space-y-1", "data-effect-part": "generator", children: [
|
|
2064
2109
|
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1", children: [
|
|
2065
|
-
/* @__PURE__ */ jsx9("span", { className: "flex-1 font-medium text-
|
|
2066
|
-
/* @__PURE__ */ jsx9("button", { type: "button", className:
|
|
2110
|
+
/* @__PURE__ */ jsx9("span", { className: "flex-1 font-medium text-foreground", children: generator.name ?? generator.effect }),
|
|
2111
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: imageOutlineButtonClass, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
|
|
2067
2112
|
] }),
|
|
2068
2113
|
/* @__PURE__ */ jsx9(
|
|
2069
2114
|
ImageEffectControls,
|
|
@@ -2082,20 +2127,20 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
2082
2127
|
const all = layer.smartFilters.filters;
|
|
2083
2128
|
const index = all.indexOf(f);
|
|
2084
2129
|
if (f.kind !== "effect") return null;
|
|
2085
|
-
return /* @__PURE__ */ jsxs9("li", { className: "rounded border border-
|
|
2130
|
+
return /* @__PURE__ */ jsxs9("li", { className: "rounded border border-border p-1", "data-smart-effect": f.id, children: [
|
|
2086
2131
|
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1", children: [
|
|
2087
2132
|
/* @__PURE__ */ jsx9("input", { type: "checkbox", checked: f.enabled, "aria-label": `${label} on`, onChange: (e) => {
|
|
2088
2133
|
const enabled = e.currentTarget.checked;
|
|
2089
2134
|
run(() => controller.updateEffectFilter(layer.id, f.id, { enabled }));
|
|
2090
2135
|
} }),
|
|
2091
|
-
/* @__PURE__ */ jsx9("button", { type: "button", className: "min-w-0 flex-1 truncate text-left text-
|
|
2092
|
-
/* @__PURE__ */ jsx9("button", { type: "button", className:
|
|
2093
|
-
/* @__PURE__ */ jsx9("button", { type: "button", className:
|
|
2094
|
-
/* @__PURE__ */ jsx9("button", { type: "button", className:
|
|
2136
|
+
/* @__PURE__ */ jsx9("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 }),
|
|
2137
|
+
/* @__PURE__ */ jsx9("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" }),
|
|
2138
|
+
/* @__PURE__ */ jsx9("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" }),
|
|
2139
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: imageOutlineButtonClass, "aria-label": `Remove ${label}`, onClick: () => run(() => controller.removeSmartFilter(layer.id, f.id)), children: "\u2715" })
|
|
2095
2140
|
] }),
|
|
2096
2141
|
open === f.id && /* @__PURE__ */ jsxs9("div", { className: "mt-1 space-y-2", children: [
|
|
2097
2142
|
/* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-1", children: [
|
|
2098
|
-
/* @__PURE__ */ jsx9("span", { className: "w-14 text-[11px] text-
|
|
2143
|
+
/* @__PURE__ */ jsx9("span", { className: "w-14 text-[11px] text-foreground", children: "Opacity" }),
|
|
2099
2144
|
/* @__PURE__ */ jsx9(
|
|
2100
2145
|
"input",
|
|
2101
2146
|
{
|
|
@@ -2127,8 +2172,8 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
2127
2172
|
] })
|
|
2128
2173
|
] }, f.id);
|
|
2129
2174
|
}) }),
|
|
2130
|
-
!layer && /* @__PURE__ */ jsx9("p", { className: "text-[11px] text-
|
|
2131
|
-
message && /* @__PURE__ */ jsx9("p", { role: "alert", className: "text-[11px] text-
|
|
2175
|
+
!layer && /* @__PURE__ */ jsx9("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
|
|
2176
|
+
message && /* @__PURE__ */ jsx9("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
2132
2177
|
] });
|
|
2133
2178
|
}
|
|
2134
2179
|
|
|
@@ -2159,7 +2204,6 @@ var PaintGradientEditor = (props) => /* @__PURE__ */ jsx10(PaintGradientEditorVi
|
|
|
2159
2204
|
|
|
2160
2205
|
// src/image-editor/BrushOptionsBar.tsx
|
|
2161
2206
|
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2162
|
-
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"}`;
|
|
2163
2207
|
var BrushOptionsBar = ({ controller, className }) => {
|
|
2164
2208
|
const [, setTick] = useState9(0);
|
|
2165
2209
|
useEffect8(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -2175,14 +2219,14 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2175
2219
|
setError(err instanceof Error ? err.message : String(err));
|
|
2176
2220
|
}
|
|
2177
2221
|
};
|
|
2178
|
-
return /* @__PURE__ */ jsxs10("div", { className: `flex flex-col gap-2 text-xs text-
|
|
2222
|
+
return /* @__PURE__ */ jsxs10("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "brush-options", children: [
|
|
2179
2223
|
/* @__PURE__ */ jsx11("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: PAINT_TOOLS.map((t) => /* @__PURE__ */ jsx11(
|
|
2180
2224
|
"button",
|
|
2181
2225
|
{
|
|
2182
2226
|
type: "button",
|
|
2183
2227
|
"aria-pressed": state.activeTool === t.id,
|
|
2184
2228
|
title: t.shortcut ? `${t.label} (${t.shortcut})` : t.label,
|
|
2185
|
-
className:
|
|
2229
|
+
className: imageChipClass(state.activeTool === t.id),
|
|
2186
2230
|
onClick: () => controller.setTool(t.id),
|
|
2187
2231
|
children: t.label
|
|
2188
2232
|
},
|
|
@@ -2197,10 +2241,10 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2197
2241
|
"aria-label": "Foreground colour",
|
|
2198
2242
|
value: foreground,
|
|
2199
2243
|
onChange: (e) => controller.setPaintOptions({ foreground: e.target.value }),
|
|
2200
|
-
className:
|
|
2244
|
+
className: imageColorInputClass
|
|
2201
2245
|
}
|
|
2202
2246
|
),
|
|
2203
|
-
/* @__PURE__ */ jsx11("span", { className: "text-
|
|
2247
|
+
/* @__PURE__ */ jsx11("span", { className: "text-muted-foreground", children: "FG" })
|
|
2204
2248
|
] }),
|
|
2205
2249
|
/* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-1", children: [
|
|
2206
2250
|
/* @__PURE__ */ jsx11(
|
|
@@ -2210,20 +2254,20 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2210
2254
|
"aria-label": "Background colour",
|
|
2211
2255
|
value: background,
|
|
2212
2256
|
onChange: (e) => controller.setPaintOptions({ background: e.target.value }),
|
|
2213
|
-
className:
|
|
2257
|
+
className: imageColorInputClass
|
|
2214
2258
|
}
|
|
2215
2259
|
),
|
|
2216
|
-
/* @__PURE__ */ jsx11("span", { className: "text-
|
|
2260
|
+
/* @__PURE__ */ jsx11("span", { className: "text-muted-foreground", children: "BG" })
|
|
2217
2261
|
] }),
|
|
2218
|
-
/* @__PURE__ */ jsx11("button", { type: "button", title: "Swap colours (X)", className:
|
|
2219
|
-
/* @__PURE__ */ jsx11("button", { type: "button", title: "Default colours (D)", className:
|
|
2262
|
+
/* @__PURE__ */ jsx11("button", { type: "button", title: "Swap colours (X)", className: imageChipClass(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
|
|
2263
|
+
/* @__PURE__ */ jsx11("button", { type: "button", title: "Default colours (D)", className: imageChipClass(false), onClick: () => controller.resetPaintColors(), children: "Default" }),
|
|
2220
2264
|
state.activeTool === "brush" && /* @__PURE__ */ jsx11(
|
|
2221
2265
|
"button",
|
|
2222
2266
|
{
|
|
2223
2267
|
type: "button",
|
|
2224
2268
|
"aria-pressed": paint.type === "gradient",
|
|
2225
2269
|
title: "Gradient paint: the brush changes colour as the stroke goes",
|
|
2226
|
-
className:
|
|
2270
|
+
className: imageChipClass(paint.type === "gradient"),
|
|
2227
2271
|
onClick: () => attempt(() => controller.setPaintOptions(paint.type === "gradient" ? { foreground } : { paint: DEFAULT_PAINT_GRADIENT })),
|
|
2228
2272
|
children: "Gradient"
|
|
2229
2273
|
}
|
|
@@ -2239,19 +2283,19 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2239
2283
|
},
|
|
2240
2284
|
spec.id
|
|
2241
2285
|
)),
|
|
2242
|
-
state.activeTool === "mixer" && /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-2 border-t border-
|
|
2286
|
+
state.activeTool === "mixer" && /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Mixer Brush", "data-testid": "mixer-options", children: [
|
|
2243
2287
|
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
2244
2288
|
/* @__PURE__ */ jsx11(
|
|
2245
2289
|
"span",
|
|
2246
2290
|
{
|
|
2247
2291
|
"aria-label": "Brush load",
|
|
2248
2292
|
title: mixerLoad.reservoir ? `Loaded ${rgbUnitToHex(mixerLoad.reservoir)}, ${Math.round(mixerLoad.amount * 100)}% left` : "Unloaded",
|
|
2249
|
-
className: "h-6 w-6 rounded border border-
|
|
2293
|
+
className: "h-6 w-6 rounded border border-border",
|
|
2250
2294
|
style: { background: mixerLoad.reservoir ? rgbUnitToHex(mixerLoad.reservoir) : "transparent" }
|
|
2251
2295
|
}
|
|
2252
2296
|
),
|
|
2253
|
-
/* @__PURE__ */ jsx11("button", { type: "button", title: "Fill the reservoir with the foreground colour", className:
|
|
2254
|
-
/* @__PURE__ */ jsx11("button", { type: "button", title: "Empty the picked-up colour", className:
|
|
2297
|
+
/* @__PURE__ */ jsx11("button", { type: "button", title: "Fill the reservoir with the foreground colour", className: imageChipClass(false), onClick: () => controller.loadMixerBrush(), children: "Load brush" }),
|
|
2298
|
+
/* @__PURE__ */ jsx11("button", { type: "button", title: "Empty the picked-up colour", className: imageChipClass(false), onClick: () => controller.cleanMixerBrush(), children: "Clean brush" })
|
|
2255
2299
|
] }),
|
|
2256
2300
|
/* @__PURE__ */ jsx11("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children: MIXER_MIXING_OPTIONS.map((m) => /* @__PURE__ */ jsx11(
|
|
2257
2301
|
"button",
|
|
@@ -2259,14 +2303,14 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2259
2303
|
type: "button",
|
|
2260
2304
|
"aria-pressed": mixer.mixing === m.id,
|
|
2261
2305
|
title: m.title,
|
|
2262
|
-
className:
|
|
2306
|
+
className: imageChipClass(mixer.mixing === m.id),
|
|
2263
2307
|
onClick: () => controller.setPaintOptions({ mixer: { mixing: m.id } }),
|
|
2264
2308
|
children: m.label
|
|
2265
2309
|
},
|
|
2266
2310
|
m.id
|
|
2267
2311
|
)) }),
|
|
2268
2312
|
MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ jsx11(ControlSlider, { spec, value: mixer[spec.id], onChange: (v) => controller.setPaintOptions({ mixer: { [spec.id]: v } }) }, spec.id)),
|
|
2269
|
-
/* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap gap-3 text-
|
|
2313
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap gap-3 text-foreground", children: [
|
|
2270
2314
|
/* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-1.5", children: [
|
|
2271
2315
|
/* @__PURE__ */ jsx11(
|
|
2272
2316
|
"input",
|
|
@@ -2275,7 +2319,7 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2275
2319
|
"aria-label": "Load the brush after each stroke",
|
|
2276
2320
|
checked: mixer.loadEachStroke,
|
|
2277
2321
|
onChange: (e) => controller.setPaintOptions({ mixer: { loadEachStroke: e.target.checked } }),
|
|
2278
|
-
className: "accent-
|
|
2322
|
+
className: "accent-primary"
|
|
2279
2323
|
}
|
|
2280
2324
|
),
|
|
2281
2325
|
"Load each stroke"
|
|
@@ -2288,35 +2332,35 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2288
2332
|
"aria-label": "Clean the brush after each stroke",
|
|
2289
2333
|
checked: mixer.cleanEachStroke,
|
|
2290
2334
|
onChange: (e) => controller.setPaintOptions({ mixer: { cleanEachStroke: e.target.checked } }),
|
|
2291
|
-
className: "accent-
|
|
2335
|
+
className: "accent-primary"
|
|
2292
2336
|
}
|
|
2293
2337
|
),
|
|
2294
2338
|
"Clean each stroke"
|
|
2295
2339
|
] })
|
|
2296
2340
|
] })
|
|
2297
2341
|
] }),
|
|
2298
|
-
isRetouchPaintTool(tool) && /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-2 border-t border-
|
|
2342
|
+
isRetouchPaintTool(tool) && /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Retouch options", "data-testid": "retouch-options", children: [
|
|
2299
2343
|
(tool === "clone" || tool === "heal") && /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
2300
|
-
/* @__PURE__ */ jsx11("span", { className: "text-
|
|
2301
|
-
cloneSource && /* @__PURE__ */ jsx11("button", { type: "button", title: "Forget the source point", className:
|
|
2344
|
+
/* @__PURE__ */ jsx11("span", { className: "text-muted-foreground", "data-testid": "clone-source", children: cloneSourceLabel(controller) }),
|
|
2345
|
+
cloneSource && /* @__PURE__ */ jsx11("button", { type: "button", title: "Forget the source point", className: imageChipClass(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
|
|
2302
2346
|
] }),
|
|
2303
2347
|
(tool === "clone" || tool === "heal") && /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-1", role: "group", "aria-label": "Clone source transform", "data-testid": "clone-transform", children: [
|
|
2304
2348
|
CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ jsx11(ControlSlider, { spec, value: cloneTransformView(controller)[spec.id], onChange: (v) => setCloneTransformValue(controller, spec.id, v) }, spec.id)),
|
|
2305
2349
|
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
|
|
2306
|
-
/* @__PURE__ */ jsx11("button", { type: "button", "aria-pressed": cloneTransformView(controller).flipH, title: "Mirror the source left to right", className:
|
|
2307
|
-
/* @__PURE__ */ jsx11("button", { type: "button", "aria-pressed": cloneTransformView(controller).flipV, title: "Mirror the source top to bottom", className:
|
|
2308
|
-
!cloneTransformView(controller).identity && /* @__PURE__ */ jsx11("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className:
|
|
2350
|
+
/* @__PURE__ */ jsx11("button", { type: "button", "aria-pressed": cloneTransformView(controller).flipH, title: "Mirror the source left to right", className: imageChipClass(cloneTransformView(controller).flipH), onClick: () => setCloneTransformValue(controller, "flipH"), children: "Flip H" }),
|
|
2351
|
+
/* @__PURE__ */ jsx11("button", { type: "button", "aria-pressed": cloneTransformView(controller).flipV, title: "Mirror the source top to bottom", className: imageChipClass(cloneTransformView(controller).flipV), onClick: () => setCloneTransformValue(controller, "flipV"), children: "Flip V" }),
|
|
2352
|
+
!cloneTransformView(controller).identity && /* @__PURE__ */ jsx11("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className: imageChipClass(false), onClick: () => controller.setCloneTransform(null), children: "Reset transform" })
|
|
2309
2353
|
] })
|
|
2310
2354
|
] }),
|
|
2311
2355
|
RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": choice.label, children: [
|
|
2312
|
-
/* @__PURE__ */ jsx11("span", { className: "text-
|
|
2356
|
+
/* @__PURE__ */ jsx11("span", { className: "text-muted-foreground", children: choice.label }),
|
|
2313
2357
|
choice.options.map((o) => /* @__PURE__ */ jsx11(
|
|
2314
2358
|
"button",
|
|
2315
2359
|
{
|
|
2316
2360
|
type: "button",
|
|
2317
2361
|
"aria-pressed": retouch[choice.id] === o.id,
|
|
2318
2362
|
title: o.title,
|
|
2319
|
-
className:
|
|
2363
|
+
className: imageChipClass(retouch[choice.id] === o.id),
|
|
2320
2364
|
onClick: () => setRetouchChoice(controller, choice.id, o.id),
|
|
2321
2365
|
children: o.label
|
|
2322
2366
|
},
|
|
@@ -2324,7 +2368,7 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2324
2368
|
))
|
|
2325
2369
|
] }, choice.id)),
|
|
2326
2370
|
RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ jsx11(ControlSlider, { spec, value: retouch[spec.id], onChange: (v) => controller.setPaintOptions({ retouch: { [spec.id]: v } }) }, spec.id)),
|
|
2327
|
-
/* @__PURE__ */ jsx11("div", { className: "flex flex-wrap gap-3 text-
|
|
2371
|
+
/* @__PURE__ */ jsx11("div", { className: "flex flex-wrap gap-3 text-foreground", children: RETOUCH_TOGGLES.filter((t) => t.tools.includes(tool)).map((t) => /* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-1.5", children: [
|
|
2328
2372
|
/* @__PURE__ */ jsx11(
|
|
2329
2373
|
"input",
|
|
2330
2374
|
{
|
|
@@ -2332,13 +2376,13 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2332
2376
|
"aria-label": t.label,
|
|
2333
2377
|
checked: retouch[t.id],
|
|
2334
2378
|
onChange: (e) => controller.setPaintOptions({ retouch: { [t.id]: e.target.checked } }),
|
|
2335
|
-
className: "accent-
|
|
2379
|
+
className: "accent-primary"
|
|
2336
2380
|
}
|
|
2337
2381
|
),
|
|
2338
2382
|
t.label
|
|
2339
2383
|
] }, t.id)) })
|
|
2340
2384
|
] }),
|
|
2341
|
-
/* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap gap-3 text-
|
|
2385
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap gap-3 text-foreground", role: "group", "aria-label": "Pressure", children: [
|
|
2342
2386
|
/* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-1.5", children: [
|
|
2343
2387
|
/* @__PURE__ */ jsx11(
|
|
2344
2388
|
"input",
|
|
@@ -2347,7 +2391,7 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2347
2391
|
"aria-label": "Pressure controls size",
|
|
2348
2392
|
checked: brush.pressureSize,
|
|
2349
2393
|
onChange: (e) => controller.setPaintOptions({ brush: { pressureSize: e.target.checked } }),
|
|
2350
|
-
className: "accent-
|
|
2394
|
+
className: "accent-primary"
|
|
2351
2395
|
}
|
|
2352
2396
|
),
|
|
2353
2397
|
"Pressure size"
|
|
@@ -2360,17 +2404,17 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2360
2404
|
"aria-label": "Pressure controls opacity",
|
|
2361
2405
|
checked: brush.pressureOpacity,
|
|
2362
2406
|
onChange: (e) => controller.setPaintOptions({ brush: { pressureOpacity: e.target.checked } }),
|
|
2363
|
-
className: "accent-
|
|
2407
|
+
className: "accent-primary"
|
|
2364
2408
|
}
|
|
2365
2409
|
),
|
|
2366
2410
|
"Pressure opacity"
|
|
2367
2411
|
] })
|
|
2368
2412
|
] }),
|
|
2369
2413
|
/* @__PURE__ */ jsxs10("div", { className: "flex gap-1", children: [
|
|
2370
|
-
/* @__PURE__ */ jsx11("button", { type: "button", className:
|
|
2371
|
-
/* @__PURE__ */ jsx11("button", { type: "button", className:
|
|
2414
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.fillPixels()), children: "Fill" }),
|
|
2415
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.clearPixels()), children: "Clear" })
|
|
2372
2416
|
] }),
|
|
2373
|
-
error && /* @__PURE__ */ jsx11("p", { role: "alert", className: "text-
|
|
2417
|
+
error && /* @__PURE__ */ jsx11("p", { role: "alert", className: "text-destructive", children: error })
|
|
2374
2418
|
] });
|
|
2375
2419
|
};
|
|
2376
2420
|
|
|
@@ -2378,8 +2422,8 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2378
2422
|
import { useEffect as useEffect9, useState as useState10 } from "react";
|
|
2379
2423
|
import { COLOR_MODE_OPTIONS, INTENT_OPTIONS, PROOF_PROFILE_OPTIONS, WORKING_SPACE_OPTIONS, colorPanelView } from "@pixerate/editor/image-editor";
|
|
2380
2424
|
import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2381
|
-
var
|
|
2382
|
-
var select = "rounded bg-
|
|
2425
|
+
var chip = imageChipClass(false);
|
|
2426
|
+
var select = "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground";
|
|
2383
2427
|
var ColorProfilePanel = ({ controller, className }) => {
|
|
2384
2428
|
const [, setTick] = useState10(0);
|
|
2385
2429
|
useEffect9(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -2408,28 +2452,28 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
2408
2452
|
})
|
|
2409
2453
|
);
|
|
2410
2454
|
};
|
|
2411
|
-
return /* @__PURE__ */ jsxs11("div", { className: `flex flex-col gap-2 text-xs text-
|
|
2455
|
+
return /* @__PURE__ */ jsxs11("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "color-profile-panel", children: [
|
|
2412
2456
|
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
2413
|
-
/* @__PURE__ */ jsx12("span", { className: "text-
|
|
2457
|
+
/* @__PURE__ */ jsx12("span", { className: "text-muted-foreground", children: "Profile" }),
|
|
2414
2458
|
/* @__PURE__ */ jsx12("span", { "data-testid": "color-profile-name", children: view.profileName })
|
|
2415
2459
|
] }),
|
|
2416
2460
|
/* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Colour mode", children: [
|
|
2417
|
-
/* @__PURE__ */ jsx12("span", { className: "text-
|
|
2461
|
+
/* @__PURE__ */ jsx12("span", { className: "text-muted-foreground", children: "Mode" }),
|
|
2418
2462
|
/* @__PURE__ */ jsx12("select", { "aria-label": "Colour mode", className: select, value: view.mode, onChange: (e) => attempt(() => controller.setColorMode(e.target.value)), children: COLOR_MODE_OPTIONS.map((o) => /* @__PURE__ */ jsx12("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
|
|
2419
|
-
view.cmykProfileName && /* @__PURE__ */ jsx12("span", { className: "text-
|
|
2463
|
+
view.cmykProfileName && /* @__PURE__ */ jsx12("span", { className: "text-muted-foreground", children: view.cmykProfileName })
|
|
2420
2464
|
] }),
|
|
2421
2465
|
/* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
|
|
2422
2466
|
/* @__PURE__ */ jsx12("select", { "aria-label": "Target profile", className: select, value: target, onChange: (e) => setTarget(e.target.value), children: WORKING_SPACE_OPTIONS.map((o) => /* @__PURE__ */ jsx12("option", { value: o.id, children: o.label }, o.id)) }),
|
|
2423
2467
|
/* @__PURE__ */ jsx12("select", { "aria-label": "Rendering intent", className: select, value: intent, onChange: (e) => setIntent(e.target.value), children: INTENT_OPTIONS.map((o) => /* @__PURE__ */ jsx12("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
|
|
2424
2468
|
/* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1", children: [
|
|
2425
|
-
/* @__PURE__ */ jsx12("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-
|
|
2469
|
+
/* @__PURE__ */ jsx12("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-primary" }),
|
|
2426
2470
|
"BPC"
|
|
2427
2471
|
] }),
|
|
2428
|
-
/* @__PURE__ */ jsx12("button", { type: "button", className:
|
|
2429
|
-
/* @__PURE__ */ jsx12("button", { type: "button", className:
|
|
2472
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: chip, title: "Edit \u203A Assign Profile: keep the numbers", onClick: () => attempt(() => controller.assignProfile(target)), children: "Assign" }),
|
|
2473
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: chip, title: "Edit \u203A Convert to Profile: keep the look", onClick: () => attempt(() => controller.convertToProfile(target, { intent, bpc })), children: "Convert" })
|
|
2430
2474
|
] }),
|
|
2431
2475
|
/* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Proof setup", children: [
|
|
2432
|
-
/* @__PURE__ */ jsx12("span", { className: "text-
|
|
2476
|
+
/* @__PURE__ */ jsx12("span", { className: "text-muted-foreground", children: "Proof" }),
|
|
2433
2477
|
/* @__PURE__ */ jsxs11(
|
|
2434
2478
|
"select",
|
|
2435
2479
|
{
|
|
@@ -2446,16 +2490,16 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
2446
2490
|
view.proof && /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
2447
2491
|
/* @__PURE__ */ jsx12("select", { "aria-label": "Proof intent", className: select, value: view.proof.intent, onChange: (e) => proofWith({ intent: e.target.value }), children: INTENT_OPTIONS.map((o) => /* @__PURE__ */ jsx12("option", { value: o.id, children: o.label }, o.id)) }),
|
|
2448
2492
|
/* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1", children: [
|
|
2449
|
-
/* @__PURE__ */ jsx12("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-
|
|
2493
|
+
/* @__PURE__ */ jsx12("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-primary" }),
|
|
2450
2494
|
"Paper"
|
|
2451
2495
|
] }),
|
|
2452
2496
|
/* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1", children: [
|
|
2453
|
-
/* @__PURE__ */ jsx12("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-
|
|
2497
|
+
/* @__PURE__ */ jsx12("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-primary" }),
|
|
2454
2498
|
"Gamut warning"
|
|
2455
2499
|
] })
|
|
2456
2500
|
] })
|
|
2457
2501
|
] }),
|
|
2458
|
-
error && /* @__PURE__ */ jsx12("p", { role: "alert", className: "text-
|
|
2502
|
+
error && /* @__PURE__ */ jsx12("p", { role: "alert", className: "text-destructive", children: error })
|
|
2459
2503
|
] });
|
|
2460
2504
|
};
|
|
2461
2505
|
|
|
@@ -2475,7 +2519,7 @@ var MODIFY_OPS = [
|
|
|
2475
2519
|
{ op: "border", label: "Border" },
|
|
2476
2520
|
{ op: "smooth", label: "Smooth" }
|
|
2477
2521
|
];
|
|
2478
|
-
var
|
|
2522
|
+
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"}`;
|
|
2479
2523
|
var SelectionOptionsBar = ({
|
|
2480
2524
|
controller,
|
|
2481
2525
|
options,
|
|
@@ -2489,11 +2533,11 @@ var SelectionOptionsBar = ({
|
|
|
2489
2533
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
2490
2534
|
const qm = quickMask ?? Boolean(controller.getState().quickMask);
|
|
2491
2535
|
return /* @__PURE__ */ jsxs12("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
2492
|
-
/* @__PURE__ */ jsx13("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: SELECTION_TOOLS.map((t) => /* @__PURE__ */ jsx13("button", { type: "button", "aria-pressed": options.tool === t.id, className:
|
|
2493
|
-
/* @__PURE__ */ jsx13("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: SELECTION_MODES.map((m) => /* @__PURE__ */ jsx13("button", { type: "button", "aria-pressed": options.mode === m, className:
|
|
2536
|
+
/* @__PURE__ */ jsx13("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: SELECTION_TOOLS.map((t) => /* @__PURE__ */ jsx13("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)) }),
|
|
2537
|
+
/* @__PURE__ */ jsx13("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: SELECTION_MODES.map((m) => /* @__PURE__ */ jsx13("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: SELECTION_MODE_LABELS[m] }, m)) }),
|
|
2494
2538
|
options.tool === "wand" && /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-2", children: [
|
|
2495
2539
|
/* @__PURE__ */ jsxs12("label", { className: "flex flex-col gap-1", children: [
|
|
2496
|
-
/* @__PURE__ */ jsxs12("span", { className: "flex justify-between text-
|
|
2540
|
+
/* @__PURE__ */ jsxs12("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
2497
2541
|
/* @__PURE__ */ jsx13("span", { children: "Tolerance" }),
|
|
2498
2542
|
/* @__PURE__ */ jsx13("span", { className: "font-mono", children: options.tolerance })
|
|
2499
2543
|
] }),
|
|
@@ -2507,19 +2551,19 @@ var SelectionOptionsBar = ({
|
|
|
2507
2551
|
"aria-label": "Tolerance",
|
|
2508
2552
|
value: options.tolerance,
|
|
2509
2553
|
onChange: (e) => set({ tolerance: Number(e.target.value) }),
|
|
2510
|
-
className:
|
|
2554
|
+
className: imageRangeClass
|
|
2511
2555
|
}
|
|
2512
2556
|
)
|
|
2513
2557
|
] }),
|
|
2514
|
-
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-
|
|
2558
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
2515
2559
|
/* @__PURE__ */ jsx13("input", { type: "checkbox", checked: options.contiguous, onChange: (e) => set({ contiguous: e.target.checked }) }),
|
|
2516
2560
|
"Contiguous"
|
|
2517
2561
|
] }),
|
|
2518
|
-
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-
|
|
2562
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
2519
2563
|
/* @__PURE__ */ jsx13("input", { type: "checkbox", checked: options.sampleMerged, onChange: (e) => set({ sampleMerged: e.target.checked }) }),
|
|
2520
2564
|
"Sample adjusted image"
|
|
2521
2565
|
] }),
|
|
2522
|
-
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-
|
|
2566
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
2523
2567
|
"Sample",
|
|
2524
2568
|
/* @__PURE__ */ jsxs12(
|
|
2525
2569
|
"select",
|
|
@@ -2527,7 +2571,7 @@ var SelectionOptionsBar = ({
|
|
|
2527
2571
|
"aria-label": "Sample from",
|
|
2528
2572
|
value: options.sample ?? "composite",
|
|
2529
2573
|
onChange: (e) => set({ sample: e.target.value }),
|
|
2530
|
-
className: "bg-
|
|
2574
|
+
className: "bg-muted border border-border rounded px-1 py-0.5",
|
|
2531
2575
|
children: [
|
|
2532
2576
|
/* @__PURE__ */ jsx13("option", { value: "composite", children: "All layers" }),
|
|
2533
2577
|
/* @__PURE__ */ jsx13("option", { value: "active-layer", children: "Active layer" })
|
|
@@ -2536,18 +2580,18 @@ var SelectionOptionsBar = ({
|
|
|
2536
2580
|
)
|
|
2537
2581
|
] })
|
|
2538
2582
|
] }),
|
|
2539
|
-
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-
|
|
2583
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
2540
2584
|
/* @__PURE__ */ jsx13("input", { type: "checkbox", checked: options.antiAlias, onChange: (e) => set({ antiAlias: e.target.checked }) }),
|
|
2541
2585
|
"Anti-alias"
|
|
2542
2586
|
] }),
|
|
2543
2587
|
/* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap gap-1", children: [
|
|
2544
|
-
/* @__PURE__ */ jsx13("button", { type: "button", className:
|
|
2545
|
-
/* @__PURE__ */ jsx13("button", { type: "button", className:
|
|
2546
|
-
/* @__PURE__ */ jsx13("button", { type: "button", className:
|
|
2547
|
-
/* @__PURE__ */ jsx13("button", { type: "button", "aria-pressed": qm, className:
|
|
2588
|
+
/* @__PURE__ */ jsx13("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
|
|
2589
|
+
/* @__PURE__ */ jsx13("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
|
|
2590
|
+
/* @__PURE__ */ jsx13("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
|
|
2591
|
+
/* @__PURE__ */ jsx13("button", { type: "button", "aria-pressed": qm, className: btn(qm), onClick: () => controller.setQuickMask(!qm), children: "Quick Mask" })
|
|
2548
2592
|
] }),
|
|
2549
2593
|
/* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2550
|
-
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1 text-
|
|
2594
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
2551
2595
|
"Radius",
|
|
2552
2596
|
/* @__PURE__ */ jsx13(
|
|
2553
2597
|
"input",
|
|
@@ -2559,13 +2603,13 @@ var SelectionOptionsBar = ({
|
|
|
2559
2603
|
"aria-label": "Modify radius",
|
|
2560
2604
|
value: radius,
|
|
2561
2605
|
onChange: (e) => setRadius(Math.max(0, Number(e.target.value) || 0)),
|
|
2562
|
-
className: "w-14 bg-
|
|
2606
|
+
className: "w-14 bg-background border border-border rounded px-1 py-0.5 text-foreground"
|
|
2563
2607
|
}
|
|
2564
2608
|
)
|
|
2565
2609
|
] }),
|
|
2566
|
-
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ jsx13("button", { type: "button", className:
|
|
2610
|
+
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ jsx13("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
|
|
2567
2611
|
] }),
|
|
2568
|
-
/* @__PURE__ */ jsx13("p", { "data-testid": "selection-status", className: "text-
|
|
2612
|
+
/* @__PURE__ */ jsx13("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: describeSelection(sel) })
|
|
2569
2613
|
] });
|
|
2570
2614
|
};
|
|
2571
2615
|
|
|
@@ -2579,7 +2623,7 @@ import {
|
|
|
2579
2623
|
} from "@pixerate/editor/image-editor";
|
|
2580
2624
|
import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2581
2625
|
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
2582
|
-
var
|
|
2626
|
+
var button = "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";
|
|
2583
2627
|
var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
2584
2628
|
const [params, setParams] = useState12(DEFAULT_PARAMS);
|
|
2585
2629
|
const [busy, setBusy] = useState12(false);
|
|
@@ -2601,9 +2645,9 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2601
2645
|
}
|
|
2602
2646
|
};
|
|
2603
2647
|
return /* @__PURE__ */ jsxs13("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
2604
|
-
/* @__PURE__ */ jsx14("span", { className:
|
|
2648
|
+
/* @__PURE__ */ jsx14("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
|
|
2605
2649
|
REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
|
|
2606
|
-
/* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-
|
|
2650
|
+
/* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
2607
2651
|
/* @__PURE__ */ jsx14("span", { children: c.label }),
|
|
2608
2652
|
/* @__PURE__ */ jsxs13("span", { className: "font-mono", children: [
|
|
2609
2653
|
params[c.id],
|
|
@@ -2620,20 +2664,20 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2620
2664
|
"aria-label": c.label,
|
|
2621
2665
|
value: params[c.id],
|
|
2622
2666
|
onChange: (e) => setParams({ ...params, [c.id]: Number(e.target.value) }),
|
|
2623
|
-
className:
|
|
2667
|
+
className: imageRangeClass
|
|
2624
2668
|
}
|
|
2625
2669
|
)
|
|
2626
2670
|
] }, c.id)),
|
|
2627
|
-
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-
|
|
2671
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
2628
2672
|
/* @__PURE__ */ jsx14("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
2629
2673
|
"Smart Radius"
|
|
2630
2674
|
] }),
|
|
2631
2675
|
/* @__PURE__ */ jsxs13("div", { className: "flex gap-1", children: [
|
|
2632
|
-
/* @__PURE__ */ jsx14("button", { type: "button", className:
|
|
2633
|
-
/* @__PURE__ */ jsx14("button", { type: "button", className:
|
|
2676
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: button, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
2677
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: button, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
|
2634
2678
|
] }),
|
|
2635
|
-
error && /* @__PURE__ */ jsx14("p", { role: "alert", className: "text-
|
|
2636
|
-
/* @__PURE__ */ jsx14("span", { className: "font-semibold text-
|
|
2679
|
+
error && /* @__PURE__ */ jsx14("p", { role: "alert", className: "text-destructive", children: error }),
|
|
2680
|
+
/* @__PURE__ */ jsx14("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
|
|
2637
2681
|
/* @__PURE__ */ jsxs13("div", { className: "flex gap-1 items-center", children: [
|
|
2638
2682
|
/* @__PURE__ */ jsx14(
|
|
2639
2683
|
"select",
|
|
@@ -2641,7 +2685,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2641
2685
|
"aria-label": "New masked layer kind",
|
|
2642
2686
|
value: newKind,
|
|
2643
2687
|
onChange: (e) => setNewKind(e.target.value),
|
|
2644
|
-
className: "flex-1 bg-
|
|
2688
|
+
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
2645
2689
|
children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */ jsx14("option", { value: k.kind, children: k.label }, k.kind))
|
|
2646
2690
|
}
|
|
2647
2691
|
),
|
|
@@ -2649,7 +2693,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2649
2693
|
"button",
|
|
2650
2694
|
{
|
|
2651
2695
|
type: "button",
|
|
2652
|
-
className:
|
|
2696
|
+
className: button,
|
|
2653
2697
|
disabled: !sel,
|
|
2654
2698
|
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: layerMaskFromSelection(sel) })),
|
|
2655
2699
|
children: "New Masked Layer"
|
|
@@ -2663,7 +2707,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2663
2707
|
"aria-label": "Mask layer",
|
|
2664
2708
|
value: target.id,
|
|
2665
2709
|
onChange: (e) => setLayerId(e.target.value),
|
|
2666
|
-
className: "bg-
|
|
2710
|
+
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
2667
2711
|
children: list.map((l) => /* @__PURE__ */ jsxs13("option", { value: l.id, children: [
|
|
2668
2712
|
l.name || adjustmentKindLabel2(l.kind),
|
|
2669
2713
|
l.mask ? " (masked)" : ""
|
|
@@ -2671,13 +2715,13 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2671
2715
|
}
|
|
2672
2716
|
),
|
|
2673
2717
|
/* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap gap-1", children: [
|
|
2674
|
-
/* @__PURE__ */ jsx14("button", { type: "button", className:
|
|
2675
|
-
/* @__PURE__ */ jsx14("button", { type: "button", className:
|
|
2676
|
-
/* @__PURE__ */ jsx14("button", { type: "button", className:
|
|
2718
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: button, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
|
|
2719
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: button, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
|
|
2720
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: button, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
|
|
2677
2721
|
] }),
|
|
2678
2722
|
target.mask && /* @__PURE__ */ jsxs13(Fragment3, { children: [
|
|
2679
2723
|
/* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
|
|
2680
|
-
/* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-
|
|
2724
|
+
/* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
2681
2725
|
/* @__PURE__ */ jsx14("span", { children: "Density" }),
|
|
2682
2726
|
/* @__PURE__ */ jsxs13("span", { className: "font-mono", children: [
|
|
2683
2727
|
Math.round((target.mask.density ?? 1) * 100),
|
|
@@ -2694,12 +2738,12 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2694
2738
|
"aria-label": "Mask density",
|
|
2695
2739
|
value: Math.round((target.mask.density ?? 1) * 100),
|
|
2696
2740
|
onChange: (e) => controller.setAdjustmentLayerMaskProps(target.id, { density: Number(e.target.value) / 100 }),
|
|
2697
|
-
className:
|
|
2741
|
+
className: imageRangeClass
|
|
2698
2742
|
}
|
|
2699
2743
|
)
|
|
2700
2744
|
] }),
|
|
2701
2745
|
/* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
|
|
2702
|
-
/* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-
|
|
2746
|
+
/* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
2703
2747
|
/* @__PURE__ */ jsx14("span", { children: "Mask Feather" }),
|
|
2704
2748
|
/* @__PURE__ */ jsxs13("span", { className: "font-mono", children: [
|
|
2705
2749
|
target.mask.feather ?? 0,
|
|
@@ -2716,7 +2760,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2716
2760
|
"aria-label": "Mask feather",
|
|
2717
2761
|
value: target.mask.feather ?? 0,
|
|
2718
2762
|
onChange: (e) => controller.setAdjustmentLayerMaskProps(target.id, { feather: Number(e.target.value) }),
|
|
2719
|
-
className:
|
|
2763
|
+
className: imageRangeClass
|
|
2720
2764
|
}
|
|
2721
2765
|
)
|
|
2722
2766
|
] })
|
|
@@ -2729,7 +2773,6 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2729
2773
|
import { useEffect as useEffect10, useState as useState13 } from "react";
|
|
2730
2774
|
import { FREE_TRANSFORM_FIELDS, FREE_TRANSFORM_MODE_OPTIONS, INTERPOLATIONS, TRANSFORM_ANCHORS, WARP_GRID_OPTIONS, WARP_STYLE_OPTIONS } from "@pixerate/editor/image-editor";
|
|
2731
2775
|
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2732
|
-
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"}`;
|
|
2733
2776
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
2734
2777
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
2735
2778
|
const [, setTick] = useState13(0);
|
|
@@ -2745,16 +2788,16 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2745
2788
|
const v = Number(raw);
|
|
2746
2789
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
2747
2790
|
};
|
|
2748
|
-
return /* @__PURE__ */ jsxs14("div", { className: `flex flex-wrap items-center gap-2 text-xs text-
|
|
2749
|
-
/* @__PURE__ */ jsx15("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ jsx15("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className:
|
|
2750
|
-
/* @__PURE__ */ jsx15("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ jsx15("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-
|
|
2791
|
+
return /* @__PURE__ */ jsxs14("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: [
|
|
2792
|
+
/* @__PURE__ */ jsx15("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ jsx15("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)) }),
|
|
2793
|
+
/* @__PURE__ */ jsx15("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ jsx15("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)) }),
|
|
2751
2794
|
tool.mode === "warp" && /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
2752
2795
|
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1", children: [
|
|
2753
|
-
/* @__PURE__ */ jsx15("span", { className: "text-
|
|
2754
|
-
/* @__PURE__ */ jsx15("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className:
|
|
2796
|
+
/* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
2797
|
+
/* @__PURE__ */ jsx15("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ jsx15("option", { value: o.id, children: o.label }, o.id)) })
|
|
2755
2798
|
] }),
|
|
2756
2799
|
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1", children: [
|
|
2757
|
-
/* @__PURE__ */ jsx15("span", { className: "text-
|
|
2800
|
+
/* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
2758
2801
|
/* @__PURE__ */ jsx15(
|
|
2759
2802
|
"input",
|
|
2760
2803
|
{
|
|
@@ -2764,7 +2807,7 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2764
2807
|
min: -100,
|
|
2765
2808
|
max: 100,
|
|
2766
2809
|
disabled: warp.style === "custom",
|
|
2767
|
-
className: "w-14 rounded border border-
|
|
2810
|
+
className: "w-14 rounded border border-border bg-background px-1 py-0.5 text-right disabled:opacity-40",
|
|
2768
2811
|
onBlur: (e) => warpNumber(k, e.currentTarget.value),
|
|
2769
2812
|
onKeyDown: (e) => {
|
|
2770
2813
|
if (e.key === "Enter") {
|
|
@@ -2776,7 +2819,7 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2776
2819
|
},
|
|
2777
2820
|
`${k}:${warp[k]}`
|
|
2778
2821
|
),
|
|
2779
|
-
/* @__PURE__ */ jsx15("span", { className: "text-
|
|
2822
|
+
/* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: "%" })
|
|
2780
2823
|
] }, k)),
|
|
2781
2824
|
/* @__PURE__ */ jsx15(
|
|
2782
2825
|
"button",
|
|
@@ -2785,13 +2828,13 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2785
2828
|
title: "Bend along the vertical axis",
|
|
2786
2829
|
"aria-pressed": warp.orientation === "vertical",
|
|
2787
2830
|
disabled: warp.style === "custom",
|
|
2788
|
-
className:
|
|
2831
|
+
className: imageChipClass(warp.orientation === "vertical"),
|
|
2789
2832
|
onClick: () => tool.setWarp({ orientation: warp.orientation === "vertical" ? "horizontal" : "vertical" }),
|
|
2790
2833
|
children: "Vertical"
|
|
2791
2834
|
}
|
|
2792
2835
|
),
|
|
2793
2836
|
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1", children: [
|
|
2794
|
-
/* @__PURE__ */ jsx15("span", { className: "text-
|
|
2837
|
+
/* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
2795
2838
|
/* @__PURE__ */ jsx15(
|
|
2796
2839
|
"select",
|
|
2797
2840
|
{
|
|
@@ -2801,14 +2844,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2801
2844
|
const g = WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
|
|
2802
2845
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
2803
2846
|
},
|
|
2804
|
-
className:
|
|
2847
|
+
className: imageFieldClass,
|
|
2805
2848
|
children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ jsx15("option", { value: g.id, children: g.label }, g.id))
|
|
2806
2849
|
}
|
|
2807
2850
|
)
|
|
2808
2851
|
] })
|
|
2809
2852
|
] }),
|
|
2810
2853
|
tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
2811
|
-
/* @__PURE__ */ jsx15("span", { className: "text-
|
|
2854
|
+
/* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: f.label }),
|
|
2812
2855
|
/* @__PURE__ */ jsx15(
|
|
2813
2856
|
"input",
|
|
2814
2857
|
{
|
|
@@ -2817,7 +2860,7 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2817
2860
|
defaultValue: round(bar[f.id], f.unit),
|
|
2818
2861
|
disabled: !bar.affine,
|
|
2819
2862
|
step: f.unit === "px" ? 1 : 0.1,
|
|
2820
|
-
className: "w-16 rounded border border-
|
|
2863
|
+
className: "w-16 rounded border border-border bg-background px-1 py-0.5 text-right disabled:opacity-40",
|
|
2821
2864
|
onBlur: (e) => apply(f.id, e.currentTarget.value),
|
|
2822
2865
|
onKeyDown: (e) => {
|
|
2823
2866
|
if (e.key === "Enter") {
|
|
@@ -2829,14 +2872,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2829
2872
|
},
|
|
2830
2873
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
2831
2874
|
),
|
|
2832
|
-
/* @__PURE__ */ jsx15("span", { className: "text-
|
|
2875
|
+
/* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: f.unit }),
|
|
2833
2876
|
f.id === "scaleX" && /* @__PURE__ */ jsx15(
|
|
2834
2877
|
"button",
|
|
2835
2878
|
{
|
|
2836
2879
|
type: "button",
|
|
2837
2880
|
"aria-label": "Keep width and height proportional",
|
|
2838
2881
|
"aria-pressed": tool.proportional,
|
|
2839
|
-
className:
|
|
2882
|
+
className: imageChipClass(tool.proportional),
|
|
2840
2883
|
onClick: () => {
|
|
2841
2884
|
tool.proportional = !tool.proportional;
|
|
2842
2885
|
setTick((n) => n + 1);
|
|
@@ -2846,21 +2889,21 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2846
2889
|
)
|
|
2847
2890
|
] }, f.id)),
|
|
2848
2891
|
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1", children: [
|
|
2849
|
-
/* @__PURE__ */ jsx15("span", { className: "text-
|
|
2892
|
+
/* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
2850
2893
|
/* @__PURE__ */ jsx15(
|
|
2851
2894
|
"select",
|
|
2852
2895
|
{
|
|
2853
2896
|
"aria-label": "Interpolation",
|
|
2854
2897
|
value: tool.interpolation,
|
|
2855
2898
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
2856
|
-
className:
|
|
2899
|
+
className: imageFieldClass,
|
|
2857
2900
|
children: INTERPOLATIONS.map((i) => /* @__PURE__ */ jsx15("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
2858
2901
|
}
|
|
2859
2902
|
)
|
|
2860
2903
|
] }),
|
|
2861
|
-
/* @__PURE__ */ jsx15("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-
|
|
2862
|
-
/* @__PURE__ */ jsx15("button", { type: "button", title: "Cancel (Esc)", className:
|
|
2863
|
-
tool.error && /* @__PURE__ */ jsx15("span", { role: "alert", className: "text-
|
|
2904
|
+
/* @__PURE__ */ jsx15("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" }),
|
|
2905
|
+
/* @__PURE__ */ jsx15("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
2906
|
+
tool.error && /* @__PURE__ */ jsx15("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
2864
2907
|
] });
|
|
2865
2908
|
};
|
|
2866
2909
|
|
|
@@ -2868,7 +2911,6 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2868
2911
|
import { useEffect as useEffect11, useState as useState14 } from "react";
|
|
2869
2912
|
import { LIVE_SHAPE_KINDS, SHAPE_KIND_LABELS, applyShapeOptions } from "@pixerate/editor/image-editor";
|
|
2870
2913
|
import { Fragment as Fragment4, jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2871
|
-
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"}`;
|
|
2872
2914
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
2873
2915
|
const [, setTick] = useState14(0);
|
|
2874
2916
|
useEffect11(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -2886,8 +2928,8 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2886
2928
|
}
|
|
2887
2929
|
};
|
|
2888
2930
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
2889
|
-
return /* @__PURE__ */ jsxs15("div", { className: `flex flex-col gap-2 text-xs text-
|
|
2890
|
-
/* @__PURE__ */ jsx16("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ jsx16("button", { type: "button", "aria-pressed": options.kind === k, className:
|
|
2931
|
+
return /* @__PURE__ */ jsxs15("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
2932
|
+
/* @__PURE__ */ jsx16("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ jsx16("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: SHAPE_KIND_LABELS[k] }, k)) }),
|
|
2891
2933
|
/* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
2892
2934
|
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", children: [
|
|
2893
2935
|
/* @__PURE__ */ jsx16("input", { type: "checkbox", "aria-label": "Fill", checked: options.fill !== null, onChange: (e) => set({ fill: e.target.checked ? "#4f46e5" : null }) }),
|
|
@@ -2900,7 +2942,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2900
2942
|
disabled: options.fill === null,
|
|
2901
2943
|
value: options.fill ?? "#4f46e5",
|
|
2902
2944
|
onChange: (e) => set({ fill: e.target.value }),
|
|
2903
|
-
className:
|
|
2945
|
+
className: imageColorInputClass
|
|
2904
2946
|
}
|
|
2905
2947
|
)
|
|
2906
2948
|
] }),
|
|
@@ -2915,7 +2957,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2915
2957
|
disabled: options.stroke === null,
|
|
2916
2958
|
value: options.stroke ?? "#000000",
|
|
2917
2959
|
onChange: (e) => set({ stroke: e.target.value }),
|
|
2918
|
-
className:
|
|
2960
|
+
className: imageColorInputClass
|
|
2919
2961
|
}
|
|
2920
2962
|
)
|
|
2921
2963
|
] }),
|
|
@@ -2930,7 +2972,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2930
2972
|
max: 200,
|
|
2931
2973
|
value: options.strokeWidth,
|
|
2932
2974
|
onChange: (e) => set({ strokeWidth: num(e.target.value, 0, 200) }),
|
|
2933
|
-
className:
|
|
2975
|
+
className: `w-14 ${imageFieldClass}`
|
|
2934
2976
|
}
|
|
2935
2977
|
)
|
|
2936
2978
|
] })
|
|
@@ -2938,16 +2980,16 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2938
2980
|
/* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
2939
2981
|
options.kind === "rect" && /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", children: [
|
|
2940
2982
|
"Radius",
|
|
2941
|
-
/* @__PURE__ */ jsx16("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:
|
|
2983
|
+
/* @__PURE__ */ jsx16("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}` })
|
|
2942
2984
|
] }),
|
|
2943
2985
|
options.kind === "polygon" && /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", children: [
|
|
2944
2986
|
"Sides",
|
|
2945
|
-
/* @__PURE__ */ jsx16("input", { type: "number", "aria-label": "Sides", min: 3, max: 100, value: options.sides, onChange: (e) => set({ sides: num(e.target.value, 3, 100) }), className:
|
|
2987
|
+
/* @__PURE__ */ jsx16("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}` })
|
|
2946
2988
|
] }),
|
|
2947
2989
|
options.kind === "star" && /* @__PURE__ */ jsxs15(Fragment4, { children: [
|
|
2948
2990
|
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", children: [
|
|
2949
2991
|
"Points",
|
|
2950
|
-
/* @__PURE__ */ jsx16("input", { type: "number", "aria-label": "Points", min: 3, max: 100, value: options.points, onChange: (e) => set({ points: num(e.target.value, 3, 100) }), className:
|
|
2992
|
+
/* @__PURE__ */ jsx16("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}` })
|
|
2951
2993
|
] }),
|
|
2952
2994
|
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", children: [
|
|
2953
2995
|
"Inner",
|
|
@@ -2961,7 +3003,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2961
3003
|
step: 0.05,
|
|
2962
3004
|
value: options.innerRatio,
|
|
2963
3005
|
onChange: (e) => set({ innerRatio: Number(e.target.value) }),
|
|
2964
|
-
className: "accent-
|
|
3006
|
+
className: "accent-primary"
|
|
2965
3007
|
}
|
|
2966
3008
|
)
|
|
2967
3009
|
] })
|
|
@@ -2969,7 +3011,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2969
3011
|
options.kind === "line" && /* @__PURE__ */ jsxs15(Fragment4, { children: [
|
|
2970
3012
|
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", children: [
|
|
2971
3013
|
"Weight",
|
|
2972
|
-
/* @__PURE__ */ jsx16("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:
|
|
3014
|
+
/* @__PURE__ */ jsx16("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}` })
|
|
2973
3015
|
] }),
|
|
2974
3016
|
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", children: [
|
|
2975
3017
|
/* @__PURE__ */ jsx16("input", { type: "checkbox", "aria-label": "Arrowhead", checked: options.arrow, onChange: (e) => set({ arrow: e.target.checked }) }),
|
|
@@ -2977,8 +3019,8 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2977
3019
|
] })
|
|
2978
3020
|
] })
|
|
2979
3021
|
] }),
|
|
2980
|
-
/* @__PURE__ */ jsx16("p", { className: "text-[10px] text-
|
|
2981
|
-
error && /* @__PURE__ */ jsx16("p", { role: "alert", className: "text-
|
|
3022
|
+
/* @__PURE__ */ jsx16("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." }),
|
|
3023
|
+
error && /* @__PURE__ */ jsx16("p", { role: "alert", className: "text-destructive", children: error })
|
|
2982
3024
|
] });
|
|
2983
3025
|
};
|
|
2984
3026
|
|
|
@@ -2986,7 +3028,6 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2986
3028
|
import { useEffect as useEffect12, useState as useState15 } from "react";
|
|
2987
3029
|
import { TEXT_ALIGNS } from "@pixerate/editor/image-editor";
|
|
2988
3030
|
import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2989
|
-
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"}`;
|
|
2990
3031
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
2991
3032
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
2992
3033
|
const [, setTick] = useState15(0);
|
|
@@ -3024,7 +3065,7 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
3024
3065
|
setError(e instanceof Error ? e.message : String(e));
|
|
3025
3066
|
}
|
|
3026
3067
|
};
|
|
3027
|
-
return /* @__PURE__ */ jsxs16("div", { className: `flex flex-col gap-2 text-xs text-
|
|
3068
|
+
return /* @__PURE__ */ jsxs16("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
|
|
3028
3069
|
/* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
3029
3070
|
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
|
|
3030
3071
|
"Font",
|
|
@@ -3035,7 +3076,7 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
3035
3076
|
"aria-label": "Font family",
|
|
3036
3077
|
value: shown.fontFamily,
|
|
3037
3078
|
onChange: (e) => e.target.value.trim() && style({ fontFamily: e.target.value }),
|
|
3038
|
-
className: "w-32 rounded border border-
|
|
3079
|
+
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
3039
3080
|
}
|
|
3040
3081
|
),
|
|
3041
3082
|
/* @__PURE__ */ jsx17("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ jsx17("option", { value: f }, f)) })
|
|
@@ -3051,23 +3092,23 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
3051
3092
|
max: 2e3,
|
|
3052
3093
|
value: Math.round(shown.fontSize * 10) / 10,
|
|
3053
3094
|
onChange: (e) => Number(e.target.value) > 0 && style({ fontSize: Number(e.target.value) }),
|
|
3054
|
-
className: "w-16 rounded border border-
|
|
3095
|
+
className: "w-16 rounded border border-border bg-background px-1 py-0.5"
|
|
3055
3096
|
}
|
|
3056
3097
|
)
|
|
3057
3098
|
] }),
|
|
3058
|
-
/* @__PURE__ */ jsx17("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${
|
|
3059
|
-
/* @__PURE__ */ jsx17("button", { type: "button", "aria-pressed": shown.italic, className: `${
|
|
3060
|
-
/* @__PURE__ */ jsx17("input", { type: "color", "aria-label": "Text colour", value: shown.color, onChange: (e) => style({ color: e.target.value }), className:
|
|
3099
|
+
/* @__PURE__ */ jsx17("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" }),
|
|
3100
|
+
/* @__PURE__ */ jsx17("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
3101
|
+
/* @__PURE__ */ jsx17("input", { type: "color", "aria-label": "Text colour", value: shown.color, onChange: (e) => style({ color: e.target.value }), className: imageColorInputClass })
|
|
3061
3102
|
] }),
|
|
3062
|
-
/* @__PURE__ */ jsx17("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: TEXT_ALIGNS.map((a) => /* @__PURE__ */ jsx17("button", { type: "button", "aria-pressed": options.align === a, className:
|
|
3063
|
-
/* @__PURE__ */ jsx17("p", { className: "text-[10px] text-
|
|
3064
|
-
missing.length > 0 && /* @__PURE__ */ jsxs16("p", { role: "status", className: "text-amber-
|
|
3103
|
+
/* @__PURE__ */ jsx17("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: TEXT_ALIGNS.map((a) => /* @__PURE__ */ jsx17("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
3104
|
+
/* @__PURE__ */ jsx17("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." }),
|
|
3105
|
+
missing.length > 0 && /* @__PURE__ */ jsxs16("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
3065
3106
|
"Missing ",
|
|
3066
3107
|
missing.length === 1 ? "font" : "fonts",
|
|
3067
3108
|
": ",
|
|
3068
3109
|
missing.join(", ")
|
|
3069
3110
|
] }),
|
|
3070
|
-
error && /* @__PURE__ */ jsx17("p", { role: "alert", className: "text-
|
|
3111
|
+
error && /* @__PURE__ */ jsx17("p", { role: "alert", className: "text-destructive", children: error })
|
|
3071
3112
|
] });
|
|
3072
3113
|
};
|
|
3073
3114
|
|
|
@@ -3239,11 +3280,11 @@ var ImageEditor = ({
|
|
|
3239
3280
|
"div",
|
|
3240
3281
|
{
|
|
3241
3282
|
ref: rootRef,
|
|
3242
|
-
className:
|
|
3283
|
+
className: `${imageEditorFrameClass} ${className}`,
|
|
3243
3284
|
style,
|
|
3244
3285
|
children: [
|
|
3245
|
-
/* @__PURE__ */ jsxs17("div", { className:
|
|
3246
|
-
/* @__PURE__ */ jsxs17("div", {
|
|
3286
|
+
/* @__PURE__ */ jsxs17("div", { className: imageEditorHeaderClass, children: [
|
|
3287
|
+
/* @__PURE__ */ jsxs17("div", { role: "tablist", className: imageTabListClass, children: [
|
|
3247
3288
|
/* @__PURE__ */ jsx18(
|
|
3248
3289
|
"button",
|
|
3249
3290
|
{
|
|
@@ -3253,7 +3294,9 @@ var ImageEditor = ({
|
|
|
3253
3294
|
setActiveTab("crop");
|
|
3254
3295
|
editor.setTool("crop");
|
|
3255
3296
|
},
|
|
3256
|
-
|
|
3297
|
+
role: "tab",
|
|
3298
|
+
"aria-selected": activeTab === "crop",
|
|
3299
|
+
className: `${imageTabClass(activeTab === "crop")}`,
|
|
3257
3300
|
children: "Transform & Crop"
|
|
3258
3301
|
}
|
|
3259
3302
|
),
|
|
@@ -3266,7 +3309,9 @@ var ImageEditor = ({
|
|
|
3266
3309
|
setActiveTab("adjust");
|
|
3267
3310
|
editor.setTool("select");
|
|
3268
3311
|
},
|
|
3269
|
-
|
|
3312
|
+
role: "tab",
|
|
3313
|
+
"aria-selected": activeTab === "adjust",
|
|
3314
|
+
className: `${imageTabClass(activeTab === "adjust")}`,
|
|
3270
3315
|
children: "Adjustments"
|
|
3271
3316
|
}
|
|
3272
3317
|
),
|
|
@@ -3279,7 +3324,9 @@ var ImageEditor = ({
|
|
|
3279
3324
|
setActiveTab("layers");
|
|
3280
3325
|
editor.setTool("select");
|
|
3281
3326
|
},
|
|
3282
|
-
|
|
3327
|
+
role: "tab",
|
|
3328
|
+
"aria-selected": activeTab === "layers",
|
|
3329
|
+
className: `${imageTabClass(activeTab === "layers")}`,
|
|
3283
3330
|
children: "Layers"
|
|
3284
3331
|
}
|
|
3285
3332
|
),
|
|
@@ -3292,7 +3339,9 @@ var ImageEditor = ({
|
|
|
3292
3339
|
setActiveTab("paint");
|
|
3293
3340
|
editor.setTool("brush");
|
|
3294
3341
|
},
|
|
3295
|
-
|
|
3342
|
+
role: "tab",
|
|
3343
|
+
"aria-selected": activeTab === "paint",
|
|
3344
|
+
className: `${imageTabClass(activeTab === "paint")}`,
|
|
3296
3345
|
children: "Paint"
|
|
3297
3346
|
}
|
|
3298
3347
|
),
|
|
@@ -3305,7 +3354,9 @@ var ImageEditor = ({
|
|
|
3305
3354
|
setActiveTab("select");
|
|
3306
3355
|
editor.setTool("select");
|
|
3307
3356
|
},
|
|
3308
|
-
|
|
3357
|
+
role: "tab",
|
|
3358
|
+
"aria-selected": activeTab === "select",
|
|
3359
|
+
className: `${imageTabClass(activeTab === "select")}`,
|
|
3309
3360
|
children: "Select & Mask"
|
|
3310
3361
|
}
|
|
3311
3362
|
),
|
|
@@ -3318,7 +3369,9 @@ var ImageEditor = ({
|
|
|
3318
3369
|
setActiveTab("annotate");
|
|
3319
3370
|
editor.setTool("pen");
|
|
3320
3371
|
},
|
|
3321
|
-
|
|
3372
|
+
role: "tab",
|
|
3373
|
+
"aria-selected": activeTab === "annotate",
|
|
3374
|
+
className: `${imageTabClass(activeTab === "annotate")}`,
|
|
3322
3375
|
children: "Annotations"
|
|
3323
3376
|
}
|
|
3324
3377
|
),
|
|
@@ -3331,7 +3384,9 @@ var ImageEditor = ({
|
|
|
3331
3384
|
setActiveTab("depth");
|
|
3332
3385
|
editor.setTool("select");
|
|
3333
3386
|
},
|
|
3334
|
-
|
|
3387
|
+
role: "tab",
|
|
3388
|
+
"aria-selected": activeTab === "depth",
|
|
3389
|
+
className: `${imageTabClass(activeTab === "depth")}`,
|
|
3335
3390
|
children: "Depth Mask"
|
|
3336
3391
|
}
|
|
3337
3392
|
),
|
|
@@ -3344,7 +3399,9 @@ var ImageEditor = ({
|
|
|
3344
3399
|
setActiveTab("ai");
|
|
3345
3400
|
editor.setTool("select");
|
|
3346
3401
|
},
|
|
3347
|
-
|
|
3402
|
+
role: "tab",
|
|
3403
|
+
"aria-selected": activeTab === "ai",
|
|
3404
|
+
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
3348
3405
|
children: [
|
|
3349
3406
|
/* @__PURE__ */ jsx18("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx18("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" }) }),
|
|
3350
3407
|
"AI Tools"
|
|
@@ -3359,7 +3416,7 @@ var ImageEditor = ({
|
|
|
3359
3416
|
type: "button",
|
|
3360
3417
|
disabled: !editor.canUndo,
|
|
3361
3418
|
onClick: () => editor.undo(),
|
|
3362
|
-
className:
|
|
3419
|
+
className: imageHeaderButtonClass,
|
|
3363
3420
|
title: "Undo",
|
|
3364
3421
|
children: "\u21A9"
|
|
3365
3422
|
}
|
|
@@ -3370,7 +3427,7 @@ var ImageEditor = ({
|
|
|
3370
3427
|
type: "button",
|
|
3371
3428
|
disabled: !editor.canRedo,
|
|
3372
3429
|
onClick: () => editor.redo(),
|
|
3373
|
-
className:
|
|
3430
|
+
className: imageHeaderButtonClass,
|
|
3374
3431
|
title: "Redo",
|
|
3375
3432
|
children: "\u21AA"
|
|
3376
3433
|
}
|
|
@@ -3380,22 +3437,22 @@ var ImageEditor = ({
|
|
|
3380
3437
|
{
|
|
3381
3438
|
type: "button",
|
|
3382
3439
|
onClick: () => editor.reset(),
|
|
3383
|
-
className:
|
|
3440
|
+
className: `${imageHeaderButtonClass} px-2 text-muted-foreground`,
|
|
3384
3441
|
children: "Reset"
|
|
3385
3442
|
}
|
|
3386
3443
|
),
|
|
3387
|
-
/* @__PURE__ */ jsx18("div", { className: "h-4 w-px bg-
|
|
3444
|
+
/* @__PURE__ */ jsx18("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
3388
3445
|
/* @__PURE__ */ jsx18(
|
|
3389
3446
|
"button",
|
|
3390
3447
|
{
|
|
3391
3448
|
type: "button",
|
|
3392
3449
|
onClick: () => editor.zoomOut(),
|
|
3393
|
-
className:
|
|
3450
|
+
className: imageHeaderButtonClass,
|
|
3394
3451
|
title: "Zoom Out",
|
|
3395
3452
|
children: "-"
|
|
3396
3453
|
}
|
|
3397
3454
|
),
|
|
3398
|
-
/* @__PURE__ */ jsxs17("span", { className: "font-mono text-
|
|
3455
|
+
/* @__PURE__ */ jsxs17("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
3399
3456
|
Math.round(state.zoom * 100),
|
|
3400
3457
|
"%"
|
|
3401
3458
|
] }),
|
|
@@ -3404,12 +3461,12 @@ var ImageEditor = ({
|
|
|
3404
3461
|
{
|
|
3405
3462
|
type: "button",
|
|
3406
3463
|
onClick: () => editor.zoomIn(),
|
|
3407
|
-
className:
|
|
3464
|
+
className: imageHeaderButtonClass,
|
|
3408
3465
|
title: "Zoom In",
|
|
3409
3466
|
children: "+"
|
|
3410
3467
|
}
|
|
3411
3468
|
),
|
|
3412
|
-
/* @__PURE__ */ jsx18("div", { className: "h-4 w-px bg-
|
|
3469
|
+
/* @__PURE__ */ jsx18("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
3413
3470
|
/* @__PURE__ */ jsx18(
|
|
3414
3471
|
"button",
|
|
3415
3472
|
{
|
|
@@ -3417,7 +3474,7 @@ var ImageEditor = ({
|
|
|
3417
3474
|
onMouseDown: () => editor.setComparing(true),
|
|
3418
3475
|
onMouseUp: () => editor.setComparing(false),
|
|
3419
3476
|
onMouseLeave: () => editor.setComparing(false),
|
|
3420
|
-
className: "px-2.5 py-1.5 rounded-lg border border-
|
|
3477
|
+
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",
|
|
3421
3478
|
children: "Hold Compare"
|
|
3422
3479
|
}
|
|
3423
3480
|
),
|
|
@@ -3426,14 +3483,14 @@ var ImageEditor = ({
|
|
|
3426
3483
|
{
|
|
3427
3484
|
type: "button",
|
|
3428
3485
|
onClick: handleExport,
|
|
3429
|
-
className:
|
|
3486
|
+
className: `${imagePrimaryButtonClass} px-4 py-1.5`,
|
|
3430
3487
|
children: "Export Image"
|
|
3431
3488
|
}
|
|
3432
3489
|
)
|
|
3433
3490
|
] })
|
|
3434
3491
|
] }),
|
|
3435
|
-
transformTool.active && /* @__PURE__ */ jsx18(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-
|
|
3436
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */ jsx18("div", { role: "alert", className:
|
|
3492
|
+
transformTool.active && /* @__PURE__ */ jsx18(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
3493
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ jsx18("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
3437
3494
|
/* @__PURE__ */ jsxs17("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
3438
3495
|
/* @__PURE__ */ jsx18(
|
|
3439
3496
|
ImageEditorCanvas,
|
|
@@ -3456,12 +3513,12 @@ var ImageEditor = ({
|
|
|
3456
3513
|
onPlaybackReveal,
|
|
3457
3514
|
chromeRoot: rootRef,
|
|
3458
3515
|
open: openPanel,
|
|
3459
|
-
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-
|
|
3516
|
+
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
3460
3517
|
}
|
|
3461
3518
|
),
|
|
3462
|
-
/* @__PURE__ */ jsxs17("div", { className:
|
|
3519
|
+
/* @__PURE__ */ jsxs17("div", { className: imageSidebarClass, children: [
|
|
3463
3520
|
activeTab === "crop" && /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
3464
|
-
/* @__PURE__ */ jsx18("span", { className:
|
|
3521
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
3465
3522
|
/* @__PURE__ */ jsxs17("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
3466
3523
|
/* @__PURE__ */ jsx18(
|
|
3467
3524
|
"button",
|
|
@@ -3471,7 +3528,7 @@ var ImageEditor = ({
|
|
|
3471
3528
|
setActiveCropRatio(null);
|
|
3472
3529
|
editor.applyCropPreset(null);
|
|
3473
3530
|
},
|
|
3474
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === null && state.crop ? "bg-
|
|
3531
|
+
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"}`,
|
|
3475
3532
|
children: "Freeform"
|
|
3476
3533
|
}
|
|
3477
3534
|
),
|
|
@@ -3483,7 +3540,7 @@ var ImageEditor = ({
|
|
|
3483
3540
|
setActiveCropRatio(1);
|
|
3484
3541
|
editor.applyCropPreset(1);
|
|
3485
3542
|
},
|
|
3486
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 1 ? "bg-
|
|
3543
|
+
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"}`,
|
|
3487
3544
|
children: "1:1 Square"
|
|
3488
3545
|
}
|
|
3489
3546
|
),
|
|
@@ -3495,7 +3552,7 @@ var ImageEditor = ({
|
|
|
3495
3552
|
setActiveCropRatio(4 / 3);
|
|
3496
3553
|
editor.applyCropPreset(4 / 3);
|
|
3497
3554
|
},
|
|
3498
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 4 / 3 ? "bg-
|
|
3555
|
+
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"}`,
|
|
3499
3556
|
children: "4:3 Standard"
|
|
3500
3557
|
}
|
|
3501
3558
|
),
|
|
@@ -3507,7 +3564,7 @@ var ImageEditor = ({
|
|
|
3507
3564
|
setActiveCropRatio(16 / 9);
|
|
3508
3565
|
editor.applyCropPreset(16 / 9);
|
|
3509
3566
|
},
|
|
3510
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 16 / 9 ? "bg-
|
|
3567
|
+
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"}`,
|
|
3511
3568
|
children: "16:9 Wide"
|
|
3512
3569
|
}
|
|
3513
3570
|
),
|
|
@@ -3519,7 +3576,7 @@ var ImageEditor = ({
|
|
|
3519
3576
|
setActiveCropRatio(3 / 2);
|
|
3520
3577
|
editor.applyCropPreset(3 / 2);
|
|
3521
3578
|
},
|
|
3522
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 3 / 2 ? "bg-
|
|
3579
|
+
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"}`,
|
|
3523
3580
|
children: "3:2 Photo"
|
|
3524
3581
|
}
|
|
3525
3582
|
),
|
|
@@ -3531,20 +3588,20 @@ var ImageEditor = ({
|
|
|
3531
3588
|
setActiveCropRatio(null);
|
|
3532
3589
|
editor.resetCrop();
|
|
3533
3590
|
},
|
|
3534
|
-
className: "px-2.5 py-2 rounded-lg bg-
|
|
3591
|
+
className: "px-2.5 py-2 rounded-lg bg-destructive/10 hover:bg-destructive/20 text-destructive border border-destructive/40 font-medium",
|
|
3535
3592
|
children: "Clear Crop"
|
|
3536
3593
|
}
|
|
3537
3594
|
)
|
|
3538
3595
|
] }),
|
|
3539
|
-
/* @__PURE__ */ jsx18("div", { className:
|
|
3540
|
-
/* @__PURE__ */ jsx18("span", { className:
|
|
3596
|
+
/* @__PURE__ */ jsx18("div", { className: imageDividerClass }),
|
|
3597
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
3541
3598
|
/* @__PURE__ */ jsxs17("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
3542
3599
|
/* @__PURE__ */ jsx18(
|
|
3543
3600
|
"button",
|
|
3544
3601
|
{
|
|
3545
3602
|
type: "button",
|
|
3546
3603
|
onClick: () => editor.rotate(-90),
|
|
3547
|
-
className: "px-3 py-2 rounded-lg bg-
|
|
3604
|
+
className: "px-3 py-2 rounded-lg bg-muted hover:bg-accent text-foreground border border-border",
|
|
3548
3605
|
children: "Rotate -90\xB0"
|
|
3549
3606
|
}
|
|
3550
3607
|
),
|
|
@@ -3553,7 +3610,7 @@ var ImageEditor = ({
|
|
|
3553
3610
|
{
|
|
3554
3611
|
type: "button",
|
|
3555
3612
|
onClick: () => editor.rotate(90),
|
|
3556
|
-
className: "px-3 py-2 rounded-lg bg-
|
|
3613
|
+
className: "px-3 py-2 rounded-lg bg-muted hover:bg-accent text-foreground border border-border",
|
|
3557
3614
|
children: "Rotate +90\xB0"
|
|
3558
3615
|
}
|
|
3559
3616
|
),
|
|
@@ -3562,7 +3619,7 @@ var ImageEditor = ({
|
|
|
3562
3619
|
{
|
|
3563
3620
|
type: "button",
|
|
3564
3621
|
onClick: () => editor.flipHorizontal(),
|
|
3565
|
-
className: `px-3 py-2 rounded-lg border transition-colors ${state.transform.flipH ? "bg-
|
|
3622
|
+
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"}`,
|
|
3566
3623
|
children: "Flip Horizontal"
|
|
3567
3624
|
}
|
|
3568
3625
|
),
|
|
@@ -3571,7 +3628,7 @@ var ImageEditor = ({
|
|
|
3571
3628
|
{
|
|
3572
3629
|
type: "button",
|
|
3573
3630
|
onClick: () => editor.flipVertical(),
|
|
3574
|
-
className: `px-3 py-2 rounded-lg border transition-colors ${state.transform.flipV ? "bg-
|
|
3631
|
+
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"}`,
|
|
3575
3632
|
children: "Flip Vertical"
|
|
3576
3633
|
}
|
|
3577
3634
|
)
|
|
@@ -3579,13 +3636,13 @@ var ImageEditor = ({
|
|
|
3579
3636
|
] }),
|
|
3580
3637
|
activeTab === "adjust" && /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
3581
3638
|
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between", children: [
|
|
3582
|
-
/* @__PURE__ */ jsx18("span", { className:
|
|
3639
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
3583
3640
|
/* @__PURE__ */ jsx18(
|
|
3584
3641
|
"button",
|
|
3585
3642
|
{
|
|
3586
3643
|
type: "button",
|
|
3587
3644
|
onClick: () => editor.resetAdjustments(),
|
|
3588
|
-
className: "text-[10px] text-
|
|
3645
|
+
className: "text-[10px] text-destructive hover:underline",
|
|
3589
3646
|
children: "Reset Sliders"
|
|
3590
3647
|
}
|
|
3591
3648
|
)
|
|
@@ -3604,7 +3661,7 @@ var ImageEditor = ({
|
|
|
3604
3661
|
spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs17(
|
|
3605
3662
|
"div",
|
|
3606
3663
|
{
|
|
3607
|
-
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-
|
|
3664
|
+
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",
|
|
3608
3665
|
"data-testid": "image-editor-process-notice",
|
|
3609
3666
|
children: [
|
|
3610
3667
|
/* @__PURE__ */ jsx18("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
@@ -3621,7 +3678,7 @@ var ImageEditor = ({
|
|
|
3621
3678
|
}
|
|
3622
3679
|
)
|
|
3623
3680
|
] }, spec.id)),
|
|
3624
|
-
/* @__PURE__ */ jsx18("div", { className:
|
|
3681
|
+
/* @__PURE__ */ jsx18("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx18(
|
|
3625
3682
|
AdjustmentLayersPanel,
|
|
3626
3683
|
{
|
|
3627
3684
|
controller,
|
|
@@ -3631,82 +3688,82 @@ var ImageEditor = ({
|
|
|
3631
3688
|
) })
|
|
3632
3689
|
] }),
|
|
3633
3690
|
activeTab === "layers" && /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
3634
|
-
/* @__PURE__ */ jsx18("span", { className:
|
|
3691
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
3635
3692
|
/* @__PURE__ */ jsx18(
|
|
3636
3693
|
"button",
|
|
3637
3694
|
{
|
|
3638
3695
|
type: "button",
|
|
3639
3696
|
title: "Edit \u203A Free Transform (Ctrl/Cmd+T): the selected pixels, or the whole active layer",
|
|
3640
|
-
className:
|
|
3697
|
+
className: imageSmallButtonClass,
|
|
3641
3698
|
disabled: transformTool.active,
|
|
3642
3699
|
onClick: () => transformTool.begin(),
|
|
3643
3700
|
children: "Free Transform"
|
|
3644
3701
|
}
|
|
3645
3702
|
),
|
|
3646
3703
|
/* @__PURE__ */ jsx18(LayersPanel, { controller }),
|
|
3647
|
-
effectsShown && /* @__PURE__ */ jsx18(ImageProviderEffectsPanel, { controller, className:
|
|
3648
|
-
/* @__PURE__ */ jsx18("span", { className:
|
|
3704
|
+
effectsShown && /* @__PURE__ */ jsx18(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
3705
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
3649
3706
|
/* @__PURE__ */ jsx18(ColorProfilePanel, { controller })
|
|
3650
3707
|
] }),
|
|
3651
3708
|
activeTab === "paint" && /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
3652
|
-
/* @__PURE__ */ jsx18("span", { className:
|
|
3709
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
3653
3710
|
/* @__PURE__ */ jsx18(BrushOptionsBar, { controller }),
|
|
3654
3711
|
/* @__PURE__ */ jsx18(
|
|
3655
3712
|
"button",
|
|
3656
3713
|
{
|
|
3657
3714
|
type: "button",
|
|
3658
3715
|
title: "Edit \u203A Free Transform (Ctrl/Cmd+T): the selected pixels, or the whole active layer",
|
|
3659
|
-
className: "px-2 py-1 rounded text-[11px] bg-
|
|
3716
|
+
className: "px-2 py-1 rounded text-[11px] bg-muted text-foreground hover:bg-accent hover:text-accent-foreground self-start",
|
|
3660
3717
|
disabled: transformTool.active,
|
|
3661
3718
|
onClick: () => transformTool.begin(),
|
|
3662
3719
|
children: "Free Transform"
|
|
3663
3720
|
}
|
|
3664
3721
|
),
|
|
3665
|
-
paintError && /* @__PURE__ */ jsx18("p", { role: "alert", className: "text-
|
|
3666
|
-
/* @__PURE__ */ jsx18("div", { className:
|
|
3722
|
+
paintError && /* @__PURE__ */ jsx18("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
3723
|
+
/* @__PURE__ */ jsx18("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx18(LayersPanel, { controller }) })
|
|
3667
3724
|
] }),
|
|
3668
3725
|
activeTab === "annotate" && /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
3669
|
-
/* @__PURE__ */ jsx18("span", { className:
|
|
3726
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
|
|
3670
3727
|
/* @__PURE__ */ jsx18("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ jsx18(
|
|
3671
3728
|
"button",
|
|
3672
3729
|
{
|
|
3673
3730
|
type: "button",
|
|
3674
3731
|
"aria-pressed": state.activeTool === t,
|
|
3675
3732
|
onClick: () => editor.setTool(t),
|
|
3676
|
-
className: `py-1.5 px-2 rounded-lg font-medium border transition-colors ${state.activeTool === t ? "bg-
|
|
3733
|
+
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"}`,
|
|
3677
3734
|
children: t === "shape" ? "Shape" : "Type"
|
|
3678
3735
|
},
|
|
3679
3736
|
t
|
|
3680
3737
|
)) }),
|
|
3681
3738
|
state.activeTool === "shape" && /* @__PURE__ */ jsx18(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
3682
3739
|
state.activeTool === "type" && /* @__PURE__ */ jsx18(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
|
|
3683
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */ jsx18("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-
|
|
3684
|
-
shapeTypeError && /* @__PURE__ */ jsx18("p", { role: "alert", className: "text-
|
|
3685
|
-
/* @__PURE__ */ jsx18("div", { className:
|
|
3686
|
-
/* @__PURE__ */ jsx18("span", { className:
|
|
3740
|
+
state.activeTool === "type" && typeSession && /* @__PURE__ */ jsx18("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" }),
|
|
3741
|
+
shapeTypeError && /* @__PURE__ */ jsx18("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
3742
|
+
/* @__PURE__ */ jsx18("div", { className: imageDividerClass }),
|
|
3743
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
3687
3744
|
/* @__PURE__ */ jsx18("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ jsx18(
|
|
3688
3745
|
"button",
|
|
3689
3746
|
{
|
|
3690
3747
|
type: "button",
|
|
3691
3748
|
onClick: () => editor.setTool(t),
|
|
3692
|
-
className: `py-1.5 px-2 rounded-lg font-medium capitalize border transition-colors ${state.activeTool === t ? "bg-
|
|
3749
|
+
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"}`,
|
|
3693
3750
|
children: t
|
|
3694
3751
|
},
|
|
3695
3752
|
t
|
|
3696
3753
|
)) }),
|
|
3697
3754
|
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
3698
|
-
/* @__PURE__ */ jsx18("label", { className: "text-
|
|
3755
|
+
/* @__PURE__ */ jsx18("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
3699
3756
|
/* @__PURE__ */ jsx18(
|
|
3700
3757
|
"input",
|
|
3701
3758
|
{
|
|
3702
3759
|
type: "color",
|
|
3703
3760
|
value: activeColor,
|
|
3704
3761
|
onChange: (e) => setActiveColor(e.target.value),
|
|
3705
|
-
className: "w-8 h-8 rounded border border-
|
|
3762
|
+
className: "w-8 h-8 rounded border border-border cursor-pointer bg-transparent"
|
|
3706
3763
|
}
|
|
3707
3764
|
),
|
|
3708
3765
|
/* @__PURE__ */ jsxs17("div", { className: "flex-1 ml-2", children: [
|
|
3709
|
-
/* @__PURE__ */ jsxs17("div", { className: "flex justify-between text-
|
|
3766
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
3710
3767
|
/* @__PURE__ */ jsx18("span", { children: "Width:" }),
|
|
3711
3768
|
/* @__PURE__ */ jsxs17("span", { className: "font-mono", children: [
|
|
3712
3769
|
strokeWidth,
|
|
@@ -3721,13 +3778,13 @@ var ImageEditor = ({
|
|
|
3721
3778
|
max: "20",
|
|
3722
3779
|
value: strokeWidth,
|
|
3723
3780
|
onChange: (e) => setStrokeWidth(Number(e.target.value)),
|
|
3724
|
-
className:
|
|
3781
|
+
className: imageRangeClass
|
|
3725
3782
|
}
|
|
3726
3783
|
)
|
|
3727
3784
|
] })
|
|
3728
3785
|
] }),
|
|
3729
|
-
/* @__PURE__ */ jsx18("div", { className:
|
|
3730
|
-
/* @__PURE__ */ jsx18("span", { className:
|
|
3786
|
+
/* @__PURE__ */ jsx18("div", { className: imageDividerClass }),
|
|
3787
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
3731
3788
|
/* @__PURE__ */ jsxs17("div", { className: "flex gap-2", children: [
|
|
3732
3789
|
/* @__PURE__ */ jsx18(
|
|
3733
3790
|
"input",
|
|
@@ -3737,7 +3794,7 @@ var ImageEditor = ({
|
|
|
3737
3794
|
value: textInput,
|
|
3738
3795
|
onChange: (e) => setTextInput(e.target.value),
|
|
3739
3796
|
onKeyDown: (e) => e.key === "Enter" && handleAddText(),
|
|
3740
|
-
className: "flex-1 bg-
|
|
3797
|
+
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"
|
|
3741
3798
|
}
|
|
3742
3799
|
),
|
|
3743
3800
|
/* @__PURE__ */ jsx18(
|
|
@@ -3745,12 +3802,12 @@ var ImageEditor = ({
|
|
|
3745
3802
|
{
|
|
3746
3803
|
type: "button",
|
|
3747
3804
|
onClick: handleAddText,
|
|
3748
|
-
className: "px-3 py-1.5 rounded-lg bg-
|
|
3805
|
+
className: "px-3 py-1.5 rounded-lg bg-primary hover:bg-primary/90 text-primary-foreground font-medium shadow",
|
|
3749
3806
|
children: "Add"
|
|
3750
3807
|
}
|
|
3751
3808
|
)
|
|
3752
3809
|
] }),
|
|
3753
|
-
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between text-
|
|
3810
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
3754
3811
|
/* @__PURE__ */ jsx18("span", { children: "Font Size:" }),
|
|
3755
3812
|
/* @__PURE__ */ jsxs17("span", { className: "font-mono", children: [
|
|
3756
3813
|
fontSize,
|
|
@@ -3765,12 +3822,12 @@ var ImageEditor = ({
|
|
|
3765
3822
|
max: "72",
|
|
3766
3823
|
value: fontSize,
|
|
3767
3824
|
onChange: (e) => setFontSize(Number(e.target.value)),
|
|
3768
|
-
className:
|
|
3825
|
+
className: imageRangeClass
|
|
3769
3826
|
}
|
|
3770
3827
|
),
|
|
3771
|
-
/* @__PURE__ */ jsx18("div", { className:
|
|
3828
|
+
/* @__PURE__ */ jsx18("div", { className: imageDividerClass }),
|
|
3772
3829
|
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between", children: [
|
|
3773
|
-
/* @__PURE__ */ jsxs17("span", { className: "text-
|
|
3830
|
+
/* @__PURE__ */ jsxs17("span", { className: "text-muted-foreground", children: [
|
|
3774
3831
|
"Layers (",
|
|
3775
3832
|
state.annotations.length,
|
|
3776
3833
|
")"
|
|
@@ -3780,7 +3837,7 @@ var ImageEditor = ({
|
|
|
3780
3837
|
{
|
|
3781
3838
|
type: "button",
|
|
3782
3839
|
onClick: () => editor.removeAnnotation(state.selectedAnnotationId),
|
|
3783
|
-
className: "text-
|
|
3840
|
+
className: "text-destructive hover:underline text-[11px]",
|
|
3784
3841
|
children: "Delete Selected"
|
|
3785
3842
|
}
|
|
3786
3843
|
),
|
|
@@ -3789,7 +3846,7 @@ var ImageEditor = ({
|
|
|
3789
3846
|
{
|
|
3790
3847
|
type: "button",
|
|
3791
3848
|
onClick: () => editor.clearAnnotations(),
|
|
3792
|
-
className: "text-
|
|
3849
|
+
className: "text-muted-foreground hover:text-foreground text-[11px]",
|
|
3793
3850
|
children: "Clear All"
|
|
3794
3851
|
}
|
|
3795
3852
|
)
|
|
@@ -3797,32 +3854,32 @@ var ImageEditor = ({
|
|
|
3797
3854
|
] }),
|
|
3798
3855
|
activeTab === "depth" && /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
3799
3856
|
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between", children: [
|
|
3800
|
-
/* @__PURE__ */ jsx18("span", { className:
|
|
3857
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
3801
3858
|
/* @__PURE__ */ jsx18(
|
|
3802
3859
|
"button",
|
|
3803
3860
|
{
|
|
3804
3861
|
type: "button",
|
|
3805
3862
|
onClick: () => editor.resetDepthMask(),
|
|
3806
|
-
className: "text-[10px] text-
|
|
3863
|
+
className: "text-[10px] text-destructive hover:underline",
|
|
3807
3864
|
children: "Reset Mask"
|
|
3808
3865
|
}
|
|
3809
3866
|
)
|
|
3810
3867
|
] }),
|
|
3811
|
-
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 cursor-pointer text-
|
|
3868
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
3812
3869
|
/* @__PURE__ */ jsx18(
|
|
3813
3870
|
"input",
|
|
3814
3871
|
{
|
|
3815
3872
|
type: "checkbox",
|
|
3816
3873
|
checked: state.depthMask.enabled,
|
|
3817
3874
|
onChange: (e) => editor.setDepthMask({ enabled: e.target.checked }),
|
|
3818
|
-
className: "rounded accent-
|
|
3875
|
+
className: "rounded accent-primary"
|
|
3819
3876
|
}
|
|
3820
3877
|
),
|
|
3821
3878
|
/* @__PURE__ */ jsx18("span", { children: "Enable Depth / Alpha Mask" })
|
|
3822
3879
|
] }),
|
|
3823
3880
|
state.depthMask.enabled && /* @__PURE__ */ jsxs17(Fragment5, { children: [
|
|
3824
3881
|
/* @__PURE__ */ jsxs17("div", { children: [
|
|
3825
|
-
/* @__PURE__ */ jsx18("label", { className: "text-
|
|
3882
|
+
/* @__PURE__ */ jsx18("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
3826
3883
|
/* @__PURE__ */ jsx18(
|
|
3827
3884
|
"input",
|
|
3828
3885
|
{
|
|
@@ -3830,7 +3887,7 @@ var ImageEditor = ({
|
|
|
3830
3887
|
placeholder: "https://.../depthmap.png",
|
|
3831
3888
|
value: state.depthMask.maskSource || "",
|
|
3832
3889
|
onChange: (e) => editor.setDepthMask({ maskSource: e.target.value || null }),
|
|
3833
|
-
className: "w-full bg-
|
|
3890
|
+
className: "w-full bg-background border border-border rounded-lg px-2.5 py-1.5 text-xs text-foreground placeholder:text-muted-foreground"
|
|
3834
3891
|
}
|
|
3835
3892
|
)
|
|
3836
3893
|
] }),
|
|
@@ -3840,7 +3897,7 @@ var ImageEditor = ({
|
|
|
3840
3897
|
{
|
|
3841
3898
|
type: "button",
|
|
3842
3899
|
onClick: () => editor.setDepthMask({ mode: "threshold" }),
|
|
3843
|
-
className: `flex-1 py-1.5 rounded-lg border text-xs font-medium ${state.depthMask.mode === "threshold" ? "bg-
|
|
3900
|
+
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"}`,
|
|
3844
3901
|
children: "Threshold Mode"
|
|
3845
3902
|
}
|
|
3846
3903
|
),
|
|
@@ -3849,13 +3906,13 @@ var ImageEditor = ({
|
|
|
3849
3906
|
{
|
|
3850
3907
|
type: "button",
|
|
3851
3908
|
onClick: () => editor.setDepthMask({ mode: "brightness" }),
|
|
3852
|
-
className: `flex-1 py-1.5 rounded-lg border text-xs font-medium ${state.depthMask.mode === "brightness" ? "bg-
|
|
3909
|
+
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"}`,
|
|
3853
3910
|
children: "Brightness Mode"
|
|
3854
3911
|
}
|
|
3855
3912
|
)
|
|
3856
3913
|
] }),
|
|
3857
3914
|
/* @__PURE__ */ jsxs17("div", { children: [
|
|
3858
|
-
/* @__PURE__ */ jsxs17("div", { className: "flex justify-between text-
|
|
3915
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
3859
3916
|
/* @__PURE__ */ jsx18("span", { children: "Depth Start (Lower):" }),
|
|
3860
3917
|
/* @__PURE__ */ jsx18("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
3861
3918
|
] }),
|
|
@@ -3869,12 +3926,12 @@ var ImageEditor = ({
|
|
|
3869
3926
|
onChange: (e) => editor.setDepthMask({
|
|
3870
3927
|
depthRange: [Number(e.target.value), state.depthMask.depthRange[1]]
|
|
3871
3928
|
}),
|
|
3872
|
-
className:
|
|
3929
|
+
className: imageRangeClass
|
|
3873
3930
|
}
|
|
3874
3931
|
)
|
|
3875
3932
|
] }),
|
|
3876
3933
|
/* @__PURE__ */ jsxs17("div", { children: [
|
|
3877
|
-
/* @__PURE__ */ jsxs17("div", { className: "flex justify-between text-
|
|
3934
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
3878
3935
|
/* @__PURE__ */ jsx18("span", { children: "Depth Stop (Upper):" }),
|
|
3879
3936
|
/* @__PURE__ */ jsx18("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
3880
3937
|
] }),
|
|
@@ -3888,12 +3945,12 @@ var ImageEditor = ({
|
|
|
3888
3945
|
onChange: (e) => editor.setDepthMask({
|
|
3889
3946
|
depthRange: [state.depthMask.depthRange[0], Number(e.target.value)]
|
|
3890
3947
|
}),
|
|
3891
|
-
className:
|
|
3948
|
+
className: imageRangeClass
|
|
3892
3949
|
}
|
|
3893
3950
|
)
|
|
3894
3951
|
] }),
|
|
3895
3952
|
/* @__PURE__ */ jsxs17("div", { children: [
|
|
3896
|
-
/* @__PURE__ */ jsxs17("div", { className: "flex justify-between text-
|
|
3953
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
3897
3954
|
/* @__PURE__ */ jsx18("span", { children: "Softness:" }),
|
|
3898
3955
|
/* @__PURE__ */ jsx18("span", { className: "font-mono", children: state.depthMask.softness })
|
|
3899
3956
|
] }),
|
|
@@ -3905,18 +3962,18 @@ var ImageEditor = ({
|
|
|
3905
3962
|
max: "50",
|
|
3906
3963
|
value: state.depthMask.softness,
|
|
3907
3964
|
onChange: (e) => editor.setDepthMask({ softness: Number(e.target.value) }),
|
|
3908
|
-
className:
|
|
3965
|
+
className: imageRangeClass
|
|
3909
3966
|
}
|
|
3910
3967
|
)
|
|
3911
3968
|
] }),
|
|
3912
|
-
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 cursor-pointer text-
|
|
3969
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
3913
3970
|
/* @__PURE__ */ jsx18(
|
|
3914
3971
|
"input",
|
|
3915
3972
|
{
|
|
3916
3973
|
type: "checkbox",
|
|
3917
3974
|
checked: state.depthMask.invert,
|
|
3918
3975
|
onChange: (e) => editor.setDepthMask({ invert: e.target.checked }),
|
|
3919
|
-
className: "rounded accent-
|
|
3976
|
+
className: "rounded accent-primary"
|
|
3920
3977
|
}
|
|
3921
3978
|
),
|
|
3922
3979
|
/* @__PURE__ */ jsx18("span", { children: "Invert Mask" })
|
|
@@ -3934,14 +3991,14 @@ var ImageEditor = ({
|
|
|
3934
3991
|
quickMask: Boolean(state.quickMask)
|
|
3935
3992
|
}
|
|
3936
3993
|
),
|
|
3937
|
-
selectionError && /* @__PURE__ */ jsx18("p", { role: "alert", className: "text-
|
|
3994
|
+
selectionError && /* @__PURE__ */ jsx18("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
3938
3995
|
/* @__PURE__ */ jsxs17("div", { className: "flex gap-1", children: [
|
|
3939
3996
|
/* @__PURE__ */ jsx18(
|
|
3940
3997
|
"button",
|
|
3941
3998
|
{
|
|
3942
3999
|
type: "button",
|
|
3943
4000
|
title: "Select \u203A Transform Selection: the outline only",
|
|
3944
|
-
className:
|
|
4001
|
+
className: imageSmallButtonClass,
|
|
3945
4002
|
disabled: transformTool.active,
|
|
3946
4003
|
onClick: () => transformTool.begin({ content: "selection-outline" }),
|
|
3947
4004
|
children: "Transform Selection"
|
|
@@ -3952,7 +4009,7 @@ var ImageEditor = ({
|
|
|
3952
4009
|
{
|
|
3953
4010
|
type: "button",
|
|
3954
4011
|
title: "Edit \u203A Free Transform: the selected pixels of the active layer",
|
|
3955
|
-
className:
|
|
4012
|
+
className: imageSmallButtonClass,
|
|
3956
4013
|
disabled: transformTool.active,
|
|
3957
4014
|
onClick: () => transformTool.begin({ content: "selection" }),
|
|
3958
4015
|
children: "Free Transform Pixels"
|
|
@@ -3962,7 +4019,7 @@ var ImageEditor = ({
|
|
|
3962
4019
|
/* @__PURE__ */ jsx18(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers })
|
|
3963
4020
|
] }),
|
|
3964
4021
|
activeTab === "ai" && /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
3965
|
-
/* @__PURE__ */ jsxs17("label", { className: "flex items-center justify-between gap-2 text-
|
|
4022
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
3966
4023
|
/* @__PURE__ */ jsx18("span", { children: "Results go to" }),
|
|
3967
4024
|
/* @__PURE__ */ jsxs17(
|
|
3968
4025
|
"select",
|
|
@@ -3970,7 +4027,7 @@ var ImageEditor = ({
|
|
|
3970
4027
|
"aria-label": "AI result target",
|
|
3971
4028
|
value: aiTarget,
|
|
3972
4029
|
onChange: (e) => setAiTarget(e.target.value),
|
|
3973
|
-
className:
|
|
4030
|
+
className: imageSelectClass,
|
|
3974
4031
|
children: [
|
|
3975
4032
|
/* @__PURE__ */ jsx18("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
3976
4033
|
/* @__PURE__ */ jsx18("option", { value: "new-layer", children: "New layer / mask" }),
|
|
@@ -3979,24 +4036,24 @@ var ImageEditor = ({
|
|
|
3979
4036
|
}
|
|
3980
4037
|
)
|
|
3981
4038
|
] }),
|
|
3982
|
-
/* @__PURE__ */ jsxs17("div", { className: "p-3 rounded-lg bg-
|
|
4039
|
+
/* @__PURE__ */ jsxs17("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
3983
4040
|
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between", children: [
|
|
3984
|
-
/* @__PURE__ */ jsxs17("span", { className: "font-semibold text-
|
|
3985
|
-
/* @__PURE__ */ jsx18("svg", { className: "w-3.5 h-3.5 text-
|
|
4041
|
+
/* @__PURE__ */ jsxs17("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
4042
|
+
/* @__PURE__ */ jsx18("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx18("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" }) }),
|
|
3986
4043
|
"Background Removal"
|
|
3987
4044
|
] }),
|
|
3988
|
-
isRemovingBg && /* @__PURE__ */ jsx18("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-
|
|
4045
|
+
isRemovingBg && /* @__PURE__ */ jsx18("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..." })
|
|
3989
4046
|
] }),
|
|
3990
|
-
/* @__PURE__ */ jsx18("p", { className: "text-
|
|
4047
|
+
/* @__PURE__ */ jsx18("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
3991
4048
|
/* @__PURE__ */ jsx18(
|
|
3992
4049
|
"button",
|
|
3993
4050
|
{
|
|
3994
4051
|
type: "button",
|
|
3995
4052
|
onClick: handleRemoveBackground,
|
|
3996
4053
|
disabled: isRemovingBg || isInpainting,
|
|
3997
|
-
className: "mt-1 px-3 py-2 rounded-lg bg-
|
|
4054
|
+
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",
|
|
3998
4055
|
children: isRemovingBg ? /* @__PURE__ */ jsxs17(Fragment5, { children: [
|
|
3999
|
-
/* @__PURE__ */ jsx18("div", { className:
|
|
4056
|
+
/* @__PURE__ */ jsx18("div", { className: imageSpinnerClass }),
|
|
4000
4057
|
"Removing Background..."
|
|
4001
4058
|
] }) : /* @__PURE__ */ jsxs17(Fragment5, { children: [
|
|
4002
4059
|
/* @__PURE__ */ jsx18("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx18("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" }) }),
|
|
@@ -4005,20 +4062,20 @@ var ImageEditor = ({
|
|
|
4005
4062
|
}
|
|
4006
4063
|
)
|
|
4007
4064
|
] }),
|
|
4008
|
-
/* @__PURE__ */ jsxs17("div", { className: "p-3 rounded-lg bg-
|
|
4065
|
+
/* @__PURE__ */ jsxs17("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
4009
4066
|
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between", children: [
|
|
4010
|
-
/* @__PURE__ */ jsxs17("span", { className: "font-semibold text-
|
|
4011
|
-
/* @__PURE__ */ jsxs17("svg", { className: "w-3.5 h-3.5 text-
|
|
4067
|
+
/* @__PURE__ */ jsxs17("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
4068
|
+
/* @__PURE__ */ jsxs17("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
4012
4069
|
/* @__PURE__ */ jsx18("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" }),
|
|
4013
4070
|
/* @__PURE__ */ jsx18("path", { d: "m14 7 3 3" })
|
|
4014
4071
|
] }),
|
|
4015
4072
|
"Generative Inpainting"
|
|
4016
4073
|
] }),
|
|
4017
|
-
isInpainting && /* @__PURE__ */ jsx18("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-
|
|
4074
|
+
isInpainting && /* @__PURE__ */ jsx18("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..." })
|
|
4018
4075
|
] }),
|
|
4019
|
-
/* @__PURE__ */ jsx18("p", { className: "text-
|
|
4076
|
+
/* @__PURE__ */ jsx18("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
|
|
4020
4077
|
/* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-1", children: [
|
|
4021
|
-
/* @__PURE__ */ jsx18("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-
|
|
4078
|
+
/* @__PURE__ */ jsx18("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
4022
4079
|
/* @__PURE__ */ jsx18(
|
|
4023
4080
|
"textarea",
|
|
4024
4081
|
{
|
|
@@ -4027,19 +4084,19 @@ var ImageEditor = ({
|
|
|
4027
4084
|
onChange: (e) => setInpaintPrompt(e.target.value),
|
|
4028
4085
|
placeholder: "e.g. replace sunglasses with steampunk goggles, remove person in background...",
|
|
4029
4086
|
rows: 3,
|
|
4030
|
-
className: "w-full bg-
|
|
4087
|
+
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"
|
|
4031
4088
|
}
|
|
4032
4089
|
)
|
|
4033
4090
|
] }),
|
|
4034
4091
|
/* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-1", children: [
|
|
4035
|
-
/* @__PURE__ */ jsx18("span", { className: "text-
|
|
4092
|
+
/* @__PURE__ */ jsx18("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
4036
4093
|
/* @__PURE__ */ jsxs17("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
4037
4094
|
/* @__PURE__ */ jsxs17(
|
|
4038
4095
|
"button",
|
|
4039
4096
|
{
|
|
4040
4097
|
type: "button",
|
|
4041
4098
|
onClick: () => setInpaintMaskMode("annotations"),
|
|
4042
|
-
className: `px-2 py-1.5 rounded border text-[11px] font-medium text-left transition-colors ${inpaintMaskMode === "annotations" ? "bg-
|
|
4099
|
+
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"}`,
|
|
4043
4100
|
children: [
|
|
4044
4101
|
"Drawn Shapes (",
|
|
4045
4102
|
state.annotations.length,
|
|
@@ -4052,7 +4109,7 @@ var ImageEditor = ({
|
|
|
4052
4109
|
{
|
|
4053
4110
|
type: "button",
|
|
4054
4111
|
onClick: () => setInpaintMaskMode("crop"),
|
|
4055
|
-
className: `px-2 py-1.5 rounded border text-[11px] font-medium text-left transition-colors ${inpaintMaskMode === "crop" ? "bg-
|
|
4112
|
+
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"}`,
|
|
4056
4113
|
children: [
|
|
4057
4114
|
"Crop Box (",
|
|
4058
4115
|
state.crop ? "Selected" : "Full",
|
|
@@ -4068,9 +4125,9 @@ var ImageEditor = ({
|
|
|
4068
4125
|
type: "button",
|
|
4069
4126
|
onClick: handleInpaint,
|
|
4070
4127
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
4071
|
-
className: "mt-1 px-3 py-2 rounded-lg bg-
|
|
4128
|
+
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",
|
|
4072
4129
|
children: isInpainting ? /* @__PURE__ */ jsxs17(Fragment5, { children: [
|
|
4073
|
-
/* @__PURE__ */ jsx18("div", { className:
|
|
4130
|
+
/* @__PURE__ */ jsx18("div", { className: imageSpinnerClass }),
|
|
4074
4131
|
"Generating Inpaint..."
|
|
4075
4132
|
] }) : /* @__PURE__ */ jsxs17(Fragment5, { children: [
|
|
4076
4133
|
/* @__PURE__ */ jsx18("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx18("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" }) }),
|
|
@@ -4079,8 +4136,8 @@ var ImageEditor = ({
|
|
|
4079
4136
|
}
|
|
4080
4137
|
)
|
|
4081
4138
|
] }),
|
|
4082
|
-
aiError && /* @__PURE__ */ jsx18("div", { className: "p-2.5 rounded-lg bg-
|
|
4083
|
-
aiSuccess && /* @__PURE__ */ jsx18("div", { className: "p-2.5 rounded-lg bg-emerald-
|
|
4139
|
+
aiError && /* @__PURE__ */ jsx18("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
|
|
4140
|
+
aiSuccess && /* @__PURE__ */ jsx18("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
|
|
4084
4141
|
] })
|
|
4085
4142
|
] })
|
|
4086
4143
|
] })
|