@pixerate/editor-react 0.98.0 → 0.99.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animation-editor/index.cjs +11 -7
- package/dist/animation-editor/index.js +7 -7
- package/dist/canvas/index.cjs +20 -11
- package/dist/canvas/index.js +14 -9
- package/dist/canvas/useCanvasPlaybackSurface.d.cts +8 -2
- package/dist/canvas/useCanvasPlaybackSurface.d.ts +8 -2
- package/dist/chart/index.cjs +8 -4
- package/dist/chart/index.js +2 -2
- package/dist/{chunk-TFEKLNC7.js → chunk-EFF4YWJK.js} +390 -358
- package/dist/{chunk-S6C2W5JW.js → chunk-EP6MSQN4.js} +1 -1
- package/dist/{chunk-AILJ4JOW.js → chunk-GDPWLGPD.js} +3 -3
- package/dist/{chunk-SI2V7XPZ.js → chunk-GNO54NFG.js} +5 -1
- package/dist/{chunk-NEQI2ZIU.js → chunk-V2YC5T4R.js} +14 -8
- package/dist/image-editor/AdjustmentLayersPanel.d.cts +2 -0
- package/dist/image-editor/AdjustmentLayersPanel.d.ts +2 -0
- package/dist/image-editor/ControlSlider.d.cts +2 -0
- package/dist/image-editor/ControlSlider.d.ts +2 -0
- package/dist/image-editor/CurvesEditor.d.cts +2 -0
- package/dist/image-editor/CurvesEditor.d.ts +2 -0
- package/dist/image-editor/ImageEffectControls.d.cts +3 -1
- package/dist/image-editor/ImageEffectControls.d.ts +3 -1
- package/dist/image-editor/index.cjs +397 -361
- package/dist/image-editor/index.js +2 -2
- package/dist/image-editor/styles.d.cts +51 -0
- package/dist/image-editor/styles.d.ts +51 -0
- package/dist/index.cjs +437 -395
- package/dist/index.js +5 -5
- package/dist/paint-editor/index.cjs +8 -4
- package/dist/paint-editor/index.js +4 -4
- package/dist/parameters/index.cjs +18 -8
- package/dist/parameters/index.js +2 -2
- package/dist/playback/useElementPlaybackSurface.d.cts +5 -4
- package/dist/playback/useElementPlaybackSurface.d.ts +5 -4
- package/dist/spreadsheet/index.cjs +5 -1
- package/dist/spreadsheet/index.js +2 -2
- package/dist/vector/index.cjs +5 -1
- package/dist/vector/index.js +1 -1
- package/dist/video-editor/index.cjs +11 -7
- package/dist/video-editor/index.js +7 -7
- package/package.json +3 -3
|
@@ -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
|
|
@@ -925,11 +925,11 @@ var ImageEditorCanvas = ({
|
|
|
925
925
|
// src/image-editor/ControlSlider.tsx
|
|
926
926
|
import { controlTrackBackground, formatControlValue } from "@pixerate/editor/image-editor";
|
|
927
927
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
928
|
-
var ControlSlider = ({ spec, value, onChange, disabled, label }) => {
|
|
928
|
+
var ControlSlider = ({ spec, value, onChange, disabled, label, className }) => {
|
|
929
929
|
const name = label ?? spec.label;
|
|
930
930
|
const track = controlTrackBackground(spec);
|
|
931
|
-
return /* @__PURE__ */ jsxs2("div", { "data-control-id": spec.id, children: [
|
|
932
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex justify-between text-
|
|
931
|
+
return /* @__PURE__ */ jsxs2("div", { "data-control-id": spec.id, className, children: [
|
|
932
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
933
933
|
/* @__PURE__ */ jsx2("span", { children: name }),
|
|
934
934
|
/* @__PURE__ */ jsx2("span", { className: "font-mono", children: formatControlValue(spec, value) })
|
|
935
935
|
] }),
|
|
@@ -944,7 +944,7 @@ var ControlSlider = ({ spec, value, onChange, disabled, label }) => {
|
|
|
944
944
|
disabled,
|
|
945
945
|
value,
|
|
946
946
|
onChange: (e) => onChange(Number(e.target.value)),
|
|
947
|
-
className: "w-full accent-
|
|
947
|
+
className: "w-full accent-primary disabled:opacity-40"
|
|
948
948
|
}
|
|
949
949
|
),
|
|
950
950
|
track && /* @__PURE__ */ jsx2("div", { className: "h-0.5 rounded-full opacity-70", style: { background: track } })
|
|
@@ -979,7 +979,7 @@ var Histogram = ({ histogram, channel = "rgb", height = 64, className = "", styl
|
|
|
979
979
|
role: "img",
|
|
980
980
|
"aria-label": histogram ? `Histogram of ${histogram.samples} pixels` : "Histogram (no data)",
|
|
981
981
|
"data-testid": "image-editor-histogram",
|
|
982
|
-
className: `w-full rounded bg-
|
|
982
|
+
className: `w-full rounded bg-muted/40 ${className}`,
|
|
983
983
|
style: { height, ...style },
|
|
984
984
|
children: [
|
|
985
985
|
paths.map(({ c, d }) => /* @__PURE__ */ jsx3("path", { d, fill: FILL[c], stroke: "none" }, c)),
|
|
@@ -1023,8 +1023,8 @@ import {
|
|
|
1023
1023
|
} from "@pixerate/editor/image-editor";
|
|
1024
1024
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1025
1025
|
var BOX = 256;
|
|
1026
|
-
var STROKE = { master: "#e2e8f0", red: "#ef4444", green: "#22c55e", blue: "#3b82f6" };
|
|
1027
|
-
var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 200 }) => {
|
|
1026
|
+
var STROKE = { master: "var(--foreground, #e2e8f0)", red: "#ef4444", green: "#22c55e", blue: "#3b82f6" };
|
|
1027
|
+
var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 200, className = "" }) => {
|
|
1028
1028
|
const svgRef = useRef3(null);
|
|
1029
1029
|
const [drag, setDrag] = useState4(null);
|
|
1030
1030
|
const toBox = (e) => {
|
|
@@ -1065,7 +1065,7 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
1065
1065
|
role: "application",
|
|
1066
1066
|
"aria-label": `${channel} curve`,
|
|
1067
1067
|
"data-testid": "curves-editor",
|
|
1068
|
-
className:
|
|
1068
|
+
className: `rounded bg-muted/40 touch-none select-none cursor-crosshair ${className}`.trim(),
|
|
1069
1069
|
onPointerDown,
|
|
1070
1070
|
onPointerMove,
|
|
1071
1071
|
onPointerUp: () => setDrag(null),
|
|
@@ -1087,7 +1087,7 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
1087
1087
|
cx: b.x,
|
|
1088
1088
|
cy: b.y,
|
|
1089
1089
|
r: 5,
|
|
1090
|
-
fill: drag === i ? STROKE[channel] : "#0f172a",
|
|
1090
|
+
fill: drag === i ? STROKE[channel] : "var(--background, #0f172a)",
|
|
1091
1091
|
stroke: STROKE[channel],
|
|
1092
1092
|
strokeWidth: 2,
|
|
1093
1093
|
"aria-label": `Point ${p.input} to ${p.output}`
|
|
@@ -1100,6 +1100,28 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
1100
1100
|
);
|
|
1101
1101
|
};
|
|
1102
1102
|
|
|
1103
|
+
// src/image-editor/styles.ts
|
|
1104
|
+
var imageEditorFrameClass = "relative flex flex-col bg-background border border-border rounded-xl overflow-hidden shadow-sm text-foreground";
|
|
1105
|
+
var imageEditorHeaderClass = "flex flex-wrap items-center justify-between px-4 py-3 bg-muted/40 border-b border-border gap-3";
|
|
1106
|
+
var imageTabListClass = "flex items-center gap-1 bg-background p-1 rounded-lg border border-border text-xs";
|
|
1107
|
+
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"}`;
|
|
1108
|
+
var imageHeaderButtonClass = "p-1.5 rounded-lg border border-border bg-background text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed";
|
|
1109
|
+
var imagePrimaryButtonClass = "rounded-lg bg-primary hover:bg-primary/90 text-primary-foreground font-medium shadow transition-colors disabled:opacity-50";
|
|
1110
|
+
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]";
|
|
1111
|
+
var imageSectionTitleClass = "font-semibold text-foreground uppercase tracking-wider text-[11px]";
|
|
1112
|
+
var imageSectionClass = "border-t border-border pt-3";
|
|
1113
|
+
var imageDividerClass = "h-px bg-border my-1";
|
|
1114
|
+
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";
|
|
1115
|
+
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";
|
|
1116
|
+
var imageOutlineButtonClass = "rounded border border-border px-1.5 py-0.5 text-[11px] text-foreground hover:bg-muted disabled:opacity-40";
|
|
1117
|
+
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"}`;
|
|
1118
|
+
var imageFieldClass = "rounded border border-input bg-background px-1 py-0.5 text-foreground";
|
|
1119
|
+
var imageSelectClass = "rounded border border-input bg-background px-1.5 py-1 text-foreground";
|
|
1120
|
+
var imageColorInputClass = "h-6 w-8 rounded border border-border bg-transparent";
|
|
1121
|
+
var imageRangeClass = "w-full accent-primary";
|
|
1122
|
+
var imageErrorBannerClass = "border-b border-destructive/40 bg-destructive/10 px-4 py-1.5 text-xs text-destructive";
|
|
1123
|
+
var imageSpinnerClass = "w-3.5 h-3.5 border-2 border-primary-foreground/30 border-t-primary-foreground rounded-full animate-spin";
|
|
1124
|
+
|
|
1103
1125
|
// src/image-editor/AdjustmentLayersPanel.tsx
|
|
1104
1126
|
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1105
1127
|
var CHANNELS = [
|
|
@@ -1113,8 +1135,7 @@ var TONES = [
|
|
|
1113
1135
|
{ id: "midtones", label: "Midtones" },
|
|
1114
1136
|
{ id: "highlights", label: "Highlights" }
|
|
1115
1137
|
];
|
|
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"}`;
|
|
1138
|
+
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
1139
|
var HueRangeStrip = ({ bounds }) => {
|
|
1119
1140
|
const pts = Array.from({ length: 73 }, (_, i) => `${i / 72 * 360},${20 - hueRangeWeight({ bounds }, i * 5) * 18}`).join(" ");
|
|
1120
1141
|
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 +1144,7 @@ var HueRangeStrip = ({ bounds }) => {
|
|
|
1123
1144
|
/* @__PURE__ */ jsx5("polyline", { points: pts, fill: "none", stroke: "#fff", strokeWidth: 1.5 })
|
|
1124
1145
|
] });
|
|
1125
1146
|
};
|
|
1126
|
-
var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
1147
|
+
var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, className = "" }) => {
|
|
1127
1148
|
const follow = layersProp === void 0;
|
|
1128
1149
|
const [, setTick] = useState5(0);
|
|
1129
1150
|
useEffect4(() => follow ? controller.subscribe(() => setTick((n) => n + 1)) : void 0, [controller, follow]);
|
|
@@ -1147,14 +1168,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1147
1168
|
spec.id
|
|
1148
1169
|
);
|
|
1149
1170
|
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-
|
|
1171
|
+
const checkbox = (layer, path, label) => /* @__PURE__ */ jsxs5("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
1151
1172
|
/* @__PURE__ */ jsx5(
|
|
1152
1173
|
"input",
|
|
1153
1174
|
{
|
|
1154
1175
|
type: "checkbox",
|
|
1155
1176
|
checked: Boolean(getControlPath(layer.params, path)),
|
|
1156
1177
|
onChange: (e) => setParam(layer, path, e.target.checked),
|
|
1157
|
-
className: "accent-
|
|
1178
|
+
className: "accent-primary"
|
|
1158
1179
|
}
|
|
1159
1180
|
),
|
|
1160
1181
|
label
|
|
@@ -1200,14 +1221,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1200
1221
|
case "blackWhite":
|
|
1201
1222
|
return /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2", children: [
|
|
1202
1223
|
controlsOf(layer).map((s) => slider(layer, s)),
|
|
1203
|
-
/* @__PURE__ */ jsxs5("label", { className: "flex items-center gap-2 text-
|
|
1224
|
+
/* @__PURE__ */ jsxs5("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
1204
1225
|
/* @__PURE__ */ jsx5(
|
|
1205
1226
|
"input",
|
|
1206
1227
|
{
|
|
1207
1228
|
type: "checkbox",
|
|
1208
1229
|
checked: layer.params.tint !== null,
|
|
1209
1230
|
onChange: (e) => setParam(layer, "tint", e.target.checked ? "#e1d3b3" : null),
|
|
1210
|
-
className: "accent-
|
|
1231
|
+
className: "accent-primary"
|
|
1211
1232
|
}
|
|
1212
1233
|
),
|
|
1213
1234
|
"Tint",
|
|
@@ -1225,7 +1246,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1225
1246
|
] });
|
|
1226
1247
|
case "photoFilter":
|
|
1227
1248
|
return /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2", children: [
|
|
1228
|
-
/* @__PURE__ */ jsxs5("label", { className: "flex items-center gap-2 text-
|
|
1249
|
+
/* @__PURE__ */ jsxs5("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
1229
1250
|
"Filter colour",
|
|
1230
1251
|
/* @__PURE__ */ jsx5(
|
|
1231
1252
|
"input",
|
|
@@ -1242,19 +1263,19 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1242
1263
|
checkbox(layer, "preserveLuminosity", "Preserve luminosity")
|
|
1243
1264
|
] });
|
|
1244
1265
|
case "invert":
|
|
1245
|
-
return /* @__PURE__ */ jsx5("p", { className: "text-
|
|
1266
|
+
return /* @__PURE__ */ jsx5("p", { className: "text-muted-foreground text-[11px]", children: "Invert has no settings." });
|
|
1246
1267
|
default:
|
|
1247
1268
|
return /* @__PURE__ */ jsx5("div", { className: "flex flex-col gap-2", children: controlsOf(layer).map((s) => slider(layer, s)) });
|
|
1248
1269
|
}
|
|
1249
1270
|
};
|
|
1250
|
-
return /* @__PURE__ */ jsxs5("div", { className:
|
|
1251
|
-
/* @__PURE__ */ jsx5("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsx5("span", { className:
|
|
1271
|
+
return /* @__PURE__ */ jsxs5("div", { className: `flex flex-col gap-2 text-xs ${className}`.trim(), "data-testid": "adjustment-layers-panel", children: [
|
|
1272
|
+
/* @__PURE__ */ jsx5("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsx5("span", { className: imageSectionTitleClass, children: "Adjustment Layers" }) }),
|
|
1252
1273
|
/* @__PURE__ */ jsxs5("div", { className: "flex gap-1.5", children: [
|
|
1253
1274
|
/* @__PURE__ */ jsx5(
|
|
1254
1275
|
"select",
|
|
1255
1276
|
{
|
|
1256
1277
|
"aria-label": "New adjustment layer kind",
|
|
1257
|
-
className: `${
|
|
1278
|
+
className: `${imageSelectClass} flex-1`,
|
|
1258
1279
|
value: newKind,
|
|
1259
1280
|
onChange: (e) => setNewKind(e.target.value),
|
|
1260
1281
|
children: ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ jsx5("option", { value: k.kind, children: k.label }, k.kind))
|
|
@@ -1264,7 +1285,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1264
1285
|
"button",
|
|
1265
1286
|
{
|
|
1266
1287
|
type: "button",
|
|
1267
|
-
className: "px-2 py-1 rounded bg-
|
|
1288
|
+
className: "px-2 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90",
|
|
1268
1289
|
onClick: () => {
|
|
1269
1290
|
setSelectedId(controller.addAdjustmentLayer(newKind));
|
|
1270
1291
|
setChannel("master");
|
|
@@ -1280,7 +1301,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1280
1301
|
return /* @__PURE__ */ jsxs5(
|
|
1281
1302
|
"li",
|
|
1282
1303
|
{
|
|
1283
|
-
className: `flex items-center gap-1.5 rounded px-1.5 py-1 ${layer.id === selectedId ? "bg-
|
|
1304
|
+
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
1305
|
children: [
|
|
1285
1306
|
/* @__PURE__ */ jsx5(
|
|
1286
1307
|
"input",
|
|
@@ -1289,14 +1310,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1289
1310
|
"aria-label": `Show ${label}`,
|
|
1290
1311
|
checked: layer.enabled,
|
|
1291
1312
|
onChange: () => controller.toggleAdjustmentLayer(layer.id),
|
|
1292
|
-
className: "accent-
|
|
1313
|
+
className: "accent-primary"
|
|
1293
1314
|
}
|
|
1294
1315
|
),
|
|
1295
1316
|
/* @__PURE__ */ jsx5(
|
|
1296
1317
|
"button",
|
|
1297
1318
|
{
|
|
1298
1319
|
type: "button",
|
|
1299
|
-
className: `flex-1 text-left truncate ${layer.enabled ? "text-
|
|
1320
|
+
className: `flex-1 text-left truncate ${layer.enabled ? "text-foreground" : "text-muted-foreground line-through"}`,
|
|
1300
1321
|
onClick: () => setSelectedId(layer.id === selectedId ? null : layer.id),
|
|
1301
1322
|
"aria-pressed": layer.id === selectedId,
|
|
1302
1323
|
children: label
|
|
@@ -1309,7 +1330,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1309
1330
|
"aria-label": `Move ${label} up`,
|
|
1310
1331
|
disabled: index === layers.length - 1,
|
|
1311
1332
|
onClick: () => controller.moveAdjustmentLayer(layer.id, index + 1),
|
|
1312
|
-
className: "px-1 text-
|
|
1333
|
+
className: "px-1 text-muted-foreground hover:text-foreground disabled:opacity-30",
|
|
1313
1334
|
children: "\u2191"
|
|
1314
1335
|
}
|
|
1315
1336
|
),
|
|
@@ -1320,7 +1341,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1320
1341
|
"aria-label": `Move ${label} down`,
|
|
1321
1342
|
disabled: index === 0,
|
|
1322
1343
|
onClick: () => controller.moveAdjustmentLayer(layer.id, index - 1),
|
|
1323
|
-
className: "px-1 text-
|
|
1344
|
+
className: "px-1 text-muted-foreground hover:text-foreground disabled:opacity-30",
|
|
1324
1345
|
children: "\u2193"
|
|
1325
1346
|
}
|
|
1326
1347
|
),
|
|
@@ -1333,7 +1354,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1333
1354
|
controller.removeAdjustmentLayer(layer.id);
|
|
1334
1355
|
if (selectedId === layer.id) setSelectedId(null);
|
|
1335
1356
|
},
|
|
1336
|
-
className: "px-1 text-
|
|
1357
|
+
className: "px-1 text-destructive hover:text-destructive",
|
|
1337
1358
|
children: "\u2715"
|
|
1338
1359
|
}
|
|
1339
1360
|
)
|
|
@@ -1342,14 +1363,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1342
1363
|
layer.id
|
|
1343
1364
|
);
|
|
1344
1365
|
}) }),
|
|
1345
|
-
selected && /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2 rounded border border-
|
|
1366
|
+
selected && /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2 rounded border border-border p-2", "data-testid": "adjustment-layer-editor", children: [
|
|
1346
1367
|
/* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2", children: [
|
|
1347
|
-
/* @__PURE__ */ jsx5("span", { className: "text-
|
|
1368
|
+
/* @__PURE__ */ jsx5("span", { className: "text-muted-foreground", children: "Blend" }),
|
|
1348
1369
|
/* @__PURE__ */ jsx5(
|
|
1349
1370
|
"select",
|
|
1350
1371
|
{
|
|
1351
1372
|
"aria-label": "Blend mode",
|
|
1352
|
-
className: `${
|
|
1373
|
+
className: `${imageSelectClass} flex-1`,
|
|
1353
1374
|
value: selected.blend,
|
|
1354
1375
|
onChange: (e) => controller.updateAdjustmentLayer(selected.id, { blend: e.target.value }),
|
|
1355
1376
|
children: BLEND_MODES.map((m) => /* @__PURE__ */ jsx5("option", { value: m.id, children: m.label }, m.id))
|
|
@@ -1377,7 +1398,6 @@ import { useEffect as useEffect6, useRef as useRef5, useState as useState7 } fro
|
|
|
1377
1398
|
import { useEffect as useEffect5, useRef as useRef4, useState as useState6 } from "react";
|
|
1378
1399
|
import { LAYER_EFFECT_MENU, effectControlChange, layerEffectControls, layerEffectsPanel } from "@pixerate/editor/image-editor";
|
|
1379
1400
|
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
1401
|
var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
1382
1402
|
const [, setTick] = useState6(0);
|
|
1383
1403
|
useEffect5(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -1401,7 +1421,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1401
1421
|
onKeyDown: () => commitNext.current = true
|
|
1402
1422
|
};
|
|
1403
1423
|
if (!model.available || !id) {
|
|
1404
|
-
return /* @__PURE__ */ jsx6("div", { className: `text-xs text-
|
|
1424
|
+
return /* @__PURE__ */ jsx6("div", { className: `text-xs text-muted-foreground ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
|
|
1405
1425
|
}
|
|
1406
1426
|
const effects = controller.getLayerEffects(id);
|
|
1407
1427
|
const patterns = controller.getDocumentPatterns();
|
|
@@ -1417,7 +1437,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1417
1437
|
const k = c.percent ? 100 : 1;
|
|
1418
1438
|
const shown = Math.round(c.value * k * 100) / 100;
|
|
1419
1439
|
return /* @__PURE__ */ jsxs6("label", { className: "flex flex-col gap-0.5", children: [
|
|
1420
|
-
/* @__PURE__ */ jsxs6("span", { className: "text-
|
|
1440
|
+
/* @__PURE__ */ jsxs6("span", { className: "text-muted-foreground", children: [
|
|
1421
1441
|
label,
|
|
1422
1442
|
" ",
|
|
1423
1443
|
shown,
|
|
@@ -1435,24 +1455,24 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1435
1455
|
disabled: model.readOnly,
|
|
1436
1456
|
...sliderEvents,
|
|
1437
1457
|
onChange: (e) => change(effectId, c, Number(e.target.value) / k, true),
|
|
1438
|
-
className: "accent-
|
|
1458
|
+
className: "accent-primary"
|
|
1439
1459
|
}
|
|
1440
1460
|
)
|
|
1441
1461
|
] }, c.key);
|
|
1442
1462
|
}
|
|
1443
1463
|
case "color":
|
|
1444
|
-
return /* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-1.5 text-
|
|
1464
|
+
return /* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
1445
1465
|
/* @__PURE__ */ jsx6("input", { type: "color", "aria-label": label, value: c.value, disabled: model.readOnly, onChange: (e) => change(effectId, c, e.target.value) }),
|
|
1446
1466
|
label
|
|
1447
1467
|
] }, c.key);
|
|
1448
1468
|
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-
|
|
1469
|
+
return /* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
1470
|
+
/* @__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
1471
|
label
|
|
1452
1472
|
] }, c.key);
|
|
1453
1473
|
case "select":
|
|
1454
1474
|
return /* @__PURE__ */ jsxs6("label", { className: "flex flex-col gap-0.5", children: [
|
|
1455
|
-
/* @__PURE__ */ jsx6("span", { className: "text-
|
|
1475
|
+
/* @__PURE__ */ jsx6("span", { className: "text-muted-foreground", children: label }),
|
|
1456
1476
|
/* @__PURE__ */ jsx6(
|
|
1457
1477
|
"select",
|
|
1458
1478
|
{
|
|
@@ -1460,17 +1480,17 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1460
1480
|
value: c.value,
|
|
1461
1481
|
disabled: model.readOnly,
|
|
1462
1482
|
onChange: (e) => change(effectId, c, e.target.value),
|
|
1463
|
-
className:
|
|
1483
|
+
className: imageSelectClass,
|
|
1464
1484
|
children: c.options.map((o) => /* @__PURE__ */ jsx6("option", { value: o.value, children: o.label }, o.value))
|
|
1465
1485
|
}
|
|
1466
1486
|
)
|
|
1467
1487
|
] }, c.key);
|
|
1468
1488
|
}
|
|
1469
1489
|
};
|
|
1470
|
-
return /* @__PURE__ */ jsxs6("div", { className: `flex flex-col gap-1.5 text-xs text-
|
|
1490
|
+
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
1491
|
/* @__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-
|
|
1492
|
+
/* @__PURE__ */ jsx6("span", { className: "font-semibold text-foreground", children: "fx Effects" }),
|
|
1493
|
+
/* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-1 text-foreground", children: [
|
|
1474
1494
|
/* @__PURE__ */ jsx6(
|
|
1475
1495
|
"input",
|
|
1476
1496
|
{
|
|
@@ -1479,12 +1499,12 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1479
1499
|
checked: model.enabled,
|
|
1480
1500
|
disabled: model.readOnly,
|
|
1481
1501
|
onChange: (e) => attempt(() => controller.setLayerEffectsEnabled(id, e.target.checked)),
|
|
1482
|
-
className: "accent-
|
|
1502
|
+
className: "accent-primary"
|
|
1483
1503
|
}
|
|
1484
1504
|
),
|
|
1485
1505
|
"On"
|
|
1486
1506
|
] }),
|
|
1487
|
-
/* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-1 text-
|
|
1507
|
+
/* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
1488
1508
|
"Scale",
|
|
1489
1509
|
/* @__PURE__ */ jsx6(
|
|
1490
1510
|
"input",
|
|
@@ -1500,7 +1520,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1500
1520
|
const v = Number(e.target.value);
|
|
1501
1521
|
if (v >= 1 && v <= 1e3) attempt(() => controller.setLayerEffectsEnabled(id, model.enabled, v / 100));
|
|
1502
1522
|
},
|
|
1503
|
-
className: "w-14 bg-
|
|
1523
|
+
className: "w-14 bg-muted border border-border rounded px-1"
|
|
1504
1524
|
}
|
|
1505
1525
|
),
|
|
1506
1526
|
"%"
|
|
@@ -1516,7 +1536,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1516
1536
|
if (!kind) return;
|
|
1517
1537
|
attempt(() => setOpen(controller.addLayerEffect(id, kind).effect.id));
|
|
1518
1538
|
},
|
|
1519
|
-
className:
|
|
1539
|
+
className: imageSelectClass,
|
|
1520
1540
|
children: [
|
|
1521
1541
|
/* @__PURE__ */ jsx6("option", { value: "", children: "Add effect\u2026" }),
|
|
1522
1542
|
LAYER_EFFECT_MENU.map((m) => /* @__PURE__ */ jsx6("option", { value: m.kind, children: m.label }, m.kind))
|
|
@@ -1524,11 +1544,11 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1524
1544
|
}
|
|
1525
1545
|
)
|
|
1526
1546
|
] }),
|
|
1527
|
-
model.readOnly && model.reason && /* @__PURE__ */ jsx6("p", { className: "text-
|
|
1547
|
+
model.readOnly && model.reason && /* @__PURE__ */ jsx6("p", { className: "text-muted-foreground", children: model.reason }),
|
|
1528
1548
|
/* @__PURE__ */ jsx6("ul", { className: "flex flex-col gap-1", "aria-label": "Effects", children: model.rows.map((row) => {
|
|
1529
1549
|
const effect = effects.items.find((e) => e.id === row.id);
|
|
1530
1550
|
const expanded = open === row.id;
|
|
1531
|
-
return /* @__PURE__ */ jsxs6("li", { "data-effect-id": row.id, className: "rounded bg-
|
|
1551
|
+
return /* @__PURE__ */ jsxs6("li", { "data-effect-id": row.id, className: "rounded bg-background/60 ring-1 ring-border", children: [
|
|
1532
1552
|
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
|
|
1533
1553
|
/* @__PURE__ */ jsx6(
|
|
1534
1554
|
"input",
|
|
@@ -1538,7 +1558,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1538
1558
|
checked: row.enabled,
|
|
1539
1559
|
disabled: model.readOnly,
|
|
1540
1560
|
onChange: (e) => attempt(() => controller.updateLayerEffect(id, row.id, { enabled: e.target.checked })),
|
|
1541
|
-
className: "accent-
|
|
1561
|
+
className: "accent-primary"
|
|
1542
1562
|
}
|
|
1543
1563
|
),
|
|
1544
1564
|
/* @__PURE__ */ jsx6(
|
|
@@ -1546,17 +1566,17 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1546
1566
|
{
|
|
1547
1567
|
type: "button",
|
|
1548
1568
|
"aria-expanded": expanded,
|
|
1549
|
-
className: `flex-1 text-left ${row.enabled && model.enabled ? "" : "text-
|
|
1569
|
+
className: `flex-1 text-left ${row.enabled && model.enabled ? "" : "text-muted-foreground"}`,
|
|
1550
1570
|
onClick: () => setOpen(expanded ? null : row.id),
|
|
1551
1571
|
children: row.label
|
|
1552
1572
|
}
|
|
1553
1573
|
),
|
|
1554
|
-
/* @__PURE__ */ jsx6("button", { type: "button", className:
|
|
1574
|
+
/* @__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
1575
|
] }),
|
|
1556
1576
|
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
1577
|
] }, row.id);
|
|
1558
1578
|
}) }),
|
|
1559
|
-
error && /* @__PURE__ */ jsx6("p", { role: "alert", className: "text-
|
|
1579
|
+
error && /* @__PURE__ */ jsx6("p", { role: "alert", className: "text-destructive", children: error })
|
|
1560
1580
|
] });
|
|
1561
1581
|
};
|
|
1562
1582
|
|
|
@@ -1578,8 +1598,7 @@ import {
|
|
|
1578
1598
|
runLayerMenuAction
|
|
1579
1599
|
} from "@pixerate/editor/image-editor";
|
|
1580
1600
|
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"}`;
|
|
1601
|
+
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
1602
|
var Thumbnail = ({
|
|
1584
1603
|
pixels,
|
|
1585
1604
|
size,
|
|
@@ -1608,7 +1627,7 @@ var Thumbnail = ({
|
|
|
1608
1627
|
"data-testid": testId,
|
|
1609
1628
|
onClick,
|
|
1610
1629
|
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-
|
|
1630
|
+
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
1631
|
}
|
|
1613
1632
|
);
|
|
1614
1633
|
};
|
|
@@ -1667,18 +1686,18 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1667
1686
|
const thumb = (layer) => layerHasThumbnail(layer) ? controller.getLayerThumbnail(layer.id, { maxSide: 64 }) : null;
|
|
1668
1687
|
const maskThumb = (layer) => layer.mask && !layer.mask.source ? controller.getLayerThumbnail(layer.id, { maxSide: 64, mask: true }) : null;
|
|
1669
1688
|
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-
|
|
1689
|
+
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
1690
|
/* @__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:
|
|
1691
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-layer"), children: "New Layer" }),
|
|
1692
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-group"), children: "New Group" }),
|
|
1693
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("duplicate"), children: "Duplicate" }),
|
|
1694
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("add-mask"), children: "Add Mask" }),
|
|
1695
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("delete"), children: "Delete" }),
|
|
1677
1696
|
/* @__PURE__ */ jsx7(
|
|
1678
1697
|
"button",
|
|
1679
1698
|
{
|
|
1680
1699
|
type: "button",
|
|
1681
|
-
className:
|
|
1700
|
+
className: imageIconButtonClass,
|
|
1682
1701
|
"aria-label": "Layer menu",
|
|
1683
1702
|
"aria-haspopup": "menu",
|
|
1684
1703
|
onClick: (e) => {
|
|
@@ -1694,15 +1713,15 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1694
1713
|
{
|
|
1695
1714
|
"aria-label": "Bits per channel",
|
|
1696
1715
|
title: "Image \u203A Mode: bits per channel",
|
|
1697
|
-
className: "rounded bg-
|
|
1716
|
+
className: "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground",
|
|
1698
1717
|
value: controller.bitDepth,
|
|
1699
1718
|
onChange: (e) => attempt(() => controller.setBitDepth(Number(e.target.value))),
|
|
1700
1719
|
children: BIT_DEPTH_OPTIONS.map((o) => /* @__PURE__ */ jsx7("option", { value: o.depth, title: o.title, children: o.label }, o.depth))
|
|
1701
1720
|
}
|
|
1702
1721
|
),
|
|
1703
1722
|
psd && /* @__PURE__ */ jsxs7(Fragment, { children: [
|
|
1704
|
-
/* @__PURE__ */ jsx7("button", { type: "button", className:
|
|
1705
|
-
/* @__PURE__ */ jsx7("button", { type: "button", className:
|
|
1723
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: imageIconButtonClass, onClick: () => fileInput.current?.click(), children: "Open PSD\u2026" }),
|
|
1724
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: imageIconButtonClass, onClick: () => psdTask(async () => (await downloadPsd(controller, psdFileName)).warnings), children: "Export PSD" }),
|
|
1706
1725
|
/* @__PURE__ */ jsx7(
|
|
1707
1726
|
"input",
|
|
1708
1727
|
{
|
|
@@ -1721,13 +1740,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1721
1740
|
)
|
|
1722
1741
|
] })
|
|
1723
1742
|
] }),
|
|
1724
|
-
psdNotes.length > 0 && /* @__PURE__ */ jsxs7("ul", { className: "rounded bg-amber-
|
|
1743
|
+
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
1744
|
psdNotes.map((n) => /* @__PURE__ */ jsx7("li", { children: n }, n)),
|
|
1726
1745
|
/* @__PURE__ */ jsx7("li", { children: /* @__PURE__ */ jsx7("button", { type: "button", className: "underline", onClick: () => setPsdNotes([]), children: "Dismiss" }) })
|
|
1727
1746
|
] }),
|
|
1728
1747
|
active && /* @__PURE__ */ jsxs7("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 items-center", "data-testid": "layer-properties", children: [
|
|
1729
1748
|
/* @__PURE__ */ jsxs7("label", { className: "flex flex-col gap-0.5", children: [
|
|
1730
|
-
/* @__PURE__ */ jsxs7("span", { className: "text-
|
|
1749
|
+
/* @__PURE__ */ jsxs7("span", { className: "text-muted-foreground", children: [
|
|
1731
1750
|
"Opacity ",
|
|
1732
1751
|
Math.round(active.opacity * 100),
|
|
1733
1752
|
"%"
|
|
@@ -1742,12 +1761,12 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1742
1761
|
value: Math.round(active.opacity * 100),
|
|
1743
1762
|
...sliderEvents,
|
|
1744
1763
|
onChange: (e) => prop("opacity", Number(e.target.value) / 100),
|
|
1745
|
-
className: "accent-
|
|
1764
|
+
className: "accent-primary"
|
|
1746
1765
|
}
|
|
1747
1766
|
)
|
|
1748
1767
|
] }),
|
|
1749
1768
|
/* @__PURE__ */ jsxs7("label", { className: "flex flex-col gap-0.5", children: [
|
|
1750
|
-
/* @__PURE__ */ jsxs7("span", { className: "text-
|
|
1769
|
+
/* @__PURE__ */ jsxs7("span", { className: "text-muted-foreground", children: [
|
|
1751
1770
|
"Fill ",
|
|
1752
1771
|
Math.round(((active.type === "pixel" ? active.fillOpacity : void 0) ?? 1) * 100),
|
|
1753
1772
|
"%"
|
|
@@ -1763,7 +1782,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1763
1782
|
value: Math.round(((active.type === "pixel" ? active.fillOpacity : void 0) ?? 1) * 100),
|
|
1764
1783
|
...sliderEvents,
|
|
1765
1784
|
onChange: (e) => prop("fillOpacity", Number(e.target.value) / 100),
|
|
1766
|
-
className: "accent-
|
|
1785
|
+
className: "accent-primary disabled:opacity-40"
|
|
1767
1786
|
}
|
|
1768
1787
|
)
|
|
1769
1788
|
] }),
|
|
@@ -1771,7 +1790,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1771
1790
|
"select",
|
|
1772
1791
|
{
|
|
1773
1792
|
"aria-label": "Layer blend mode",
|
|
1774
|
-
className:
|
|
1793
|
+
className: imageSelectClass,
|
|
1775
1794
|
value: active.blend,
|
|
1776
1795
|
onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { blend: e.target.value })),
|
|
1777
1796
|
children: [
|
|
@@ -1780,7 +1799,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1780
1799
|
]
|
|
1781
1800
|
}
|
|
1782
1801
|
),
|
|
1783
|
-
/* @__PURE__ */ jsxs7("label", { className: "flex items-center gap-1.5 text-
|
|
1802
|
+
/* @__PURE__ */ jsxs7("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
1784
1803
|
/* @__PURE__ */ jsx7(
|
|
1785
1804
|
"input",
|
|
1786
1805
|
{
|
|
@@ -1788,12 +1807,12 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1788
1807
|
"aria-label": "Clip to layer below",
|
|
1789
1808
|
checked: Boolean(active.clipped),
|
|
1790
1809
|
onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { clipped: e.target.checked })),
|
|
1791
|
-
className: "accent-
|
|
1810
|
+
className: "accent-primary"
|
|
1792
1811
|
}
|
|
1793
1812
|
),
|
|
1794
1813
|
"Clip to below"
|
|
1795
1814
|
] }),
|
|
1796
|
-
/* @__PURE__ */ jsx7("div", { className: "col-span-2 flex flex-wrap gap-2 text-
|
|
1815
|
+
/* @__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
1816
|
/* @__PURE__ */ jsx7(
|
|
1798
1817
|
"input",
|
|
1799
1818
|
{
|
|
@@ -1801,13 +1820,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1801
1820
|
"aria-label": `Lock ${k}`,
|
|
1802
1821
|
checked: Boolean(active.locks?.[k]),
|
|
1803
1822
|
onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { locks: { ...active.locks, [k]: e.target.checked } })),
|
|
1804
|
-
className: "accent-
|
|
1823
|
+
className: "accent-primary"
|
|
1805
1824
|
}
|
|
1806
1825
|
),
|
|
1807
1826
|
k
|
|
1808
1827
|
] }, k)) })
|
|
1809
1828
|
] }),
|
|
1810
|
-
effects && active && active.type !== "adjustment" && /* @__PURE__ */ jsx7(LayerEffectsPanel, { controller, className: "border-t border-
|
|
1829
|
+
effects && active && active.type !== "adjustment" && /* @__PURE__ */ jsx7(LayerEffectsPanel, { controller, className: "border-t border-border pt-1.5" }),
|
|
1811
1830
|
/* @__PURE__ */ jsx7("ul", { className: "flex flex-col gap-0.5", role: "tree", "aria-label": "Layers", children: rows.map((row) => {
|
|
1812
1831
|
const { layer } = row;
|
|
1813
1832
|
return /* @__PURE__ */ jsxs7(
|
|
@@ -1846,7 +1865,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1846
1865
|
type: "button",
|
|
1847
1866
|
"aria-label": layer.visible ? `Hide ${row.label}` : `Show ${row.label}`,
|
|
1848
1867
|
"aria-pressed": layer.visible,
|
|
1849
|
-
className: "w-4 text-center text-
|
|
1868
|
+
className: "w-4 text-center text-foreground",
|
|
1850
1869
|
onClick: (e) => {
|
|
1851
1870
|
e.stopPropagation();
|
|
1852
1871
|
attempt(() => controller.setLayerProperties(layer.id, { visible: !layer.visible }));
|
|
@@ -1859,7 +1878,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1859
1878
|
{
|
|
1860
1879
|
type: "button",
|
|
1861
1880
|
"aria-label": layer.collapsed ? `Expand ${row.label}` : `Collapse ${row.label}`,
|
|
1862
|
-
className: "w-3 text-
|
|
1881
|
+
className: "w-3 text-muted-foreground",
|
|
1863
1882
|
onClick: (e) => {
|
|
1864
1883
|
e.stopPropagation();
|
|
1865
1884
|
attempt(() => controller.setLayerProperties(layer.id, { collapsed: !layer.collapsed }));
|
|
@@ -1867,7 +1886,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1867
1886
|
children: layer.collapsed ? "\u25B8" : "\u25BE"
|
|
1868
1887
|
}
|
|
1869
1888
|
),
|
|
1870
|
-
row.clipped && /* @__PURE__ */ jsx7("span", { className: "text-
|
|
1889
|
+
row.clipped && /* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", "aria-label": "Clipped", children: "\u21B3" }),
|
|
1871
1890
|
layerHasThumbnail(layer) ? /* @__PURE__ */ jsxs7("span", { className: "relative shrink-0", children: [
|
|
1872
1891
|
/* @__PURE__ */ jsx7(
|
|
1873
1892
|
Thumbnail,
|
|
@@ -1882,14 +1901,14 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1882
1901
|
"span",
|
|
1883
1902
|
{
|
|
1884
1903
|
"data-testid": "layer-kind-badge",
|
|
1885
|
-
className: "absolute -bottom-1 -right-1 rounded bg-
|
|
1904
|
+
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
1905
|
children: layerBadge(layer)
|
|
1887
1906
|
}
|
|
1888
1907
|
)
|
|
1889
1908
|
] }) : /* @__PURE__ */ jsx7(
|
|
1890
1909
|
"span",
|
|
1891
1910
|
{
|
|
1892
|
-
className: "shrink-0 grid place-items-center rounded bg-
|
|
1911
|
+
className: "shrink-0 grid place-items-center rounded bg-muted text-[9px] text-muted-foreground ring-1 ring-border",
|
|
1893
1912
|
style: { width: thumbnailSize, height: thumbnailSize },
|
|
1894
1913
|
children: layerBadge(layer)
|
|
1895
1914
|
}
|
|
@@ -1902,7 +1921,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1902
1921
|
"aria-pressed": layer.mask.linked !== false,
|
|
1903
1922
|
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
1923
|
"data-testid": "layer-mask-link",
|
|
1905
|
-
className: `shrink-0 text-[10px] leading-none ${layer.mask.linked === false ? "text-
|
|
1924
|
+
className: `shrink-0 text-[10px] leading-none ${layer.mask.linked === false ? "text-muted-foreground/70" : "text-foreground"}`,
|
|
1906
1925
|
onClick: (e) => {
|
|
1907
1926
|
e.stopPropagation();
|
|
1908
1927
|
attempt(() => controller.setLayerMaskProps(layer.id, { linked: layer.mask.linked === false }));
|
|
@@ -1931,7 +1950,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1931
1950
|
autoFocus: true,
|
|
1932
1951
|
"aria-label": "Layer name",
|
|
1933
1952
|
defaultValue: layer.name || row.label,
|
|
1934
|
-
className: "flex-1 min-w-0 bg-
|
|
1953
|
+
className: "flex-1 min-w-0 bg-background border border-border rounded px-1",
|
|
1935
1954
|
onClick: (e) => e.stopPropagation(),
|
|
1936
1955
|
onBlur: (e) => {
|
|
1937
1956
|
setRenaming(null);
|
|
@@ -1945,7 +1964,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1945
1964
|
) : /* @__PURE__ */ jsx7(
|
|
1946
1965
|
"span",
|
|
1947
1966
|
{
|
|
1948
|
-
className: `flex-1 min-w-0 truncate ${layer.visible ? "" : "text-
|
|
1967
|
+
className: `flex-1 min-w-0 truncate ${layer.visible ? "" : "text-muted-foreground"}`,
|
|
1949
1968
|
onDoubleClick: (e) => {
|
|
1950
1969
|
e.stopPropagation();
|
|
1951
1970
|
setRenaming(layer.id);
|
|
@@ -1953,7 +1972,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1953
1972
|
children: row.label
|
|
1954
1973
|
}
|
|
1955
1974
|
),
|
|
1956
|
-
layerWarning(layer) && /* @__PURE__ */ jsx7("span", { role: "img", "data-testid": "layer-warning", "aria-label": layerWarning(layer), title: layerWarning(layer), className: "text-[10px] text-amber-
|
|
1975
|
+
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
1976
|
layerEffectsBadge(layer) && /* @__PURE__ */ jsx7(
|
|
1958
1977
|
"button",
|
|
1959
1978
|
{
|
|
@@ -1961,7 +1980,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1961
1980
|
"data-testid": "layer-fx-badge",
|
|
1962
1981
|
"aria-label": layerEffectsBadge(layer) === "on" ? `Turn effects off for ${row.label}` : `Turn effects on for ${row.label}`,
|
|
1963
1982
|
"aria-pressed": layerEffectsBadge(layer) === "on",
|
|
1964
|
-
className: `text-[9px] italic font-semibold ${layerEffectsBadge(layer) === "on" ? "text-
|
|
1983
|
+
className: `text-[9px] italic font-semibold ${layerEffectsBadge(layer) === "on" ? "text-primary" : "text-muted-foreground/70 line-through"}`,
|
|
1965
1984
|
onClick: (e) => {
|
|
1966
1985
|
e.stopPropagation();
|
|
1967
1986
|
attempt(() => controller.setLayerEffectsEnabled(layer.id, layerEffectsBadge(layer) !== "on"));
|
|
@@ -1969,20 +1988,20 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1969
1988
|
children: "fx"
|
|
1970
1989
|
}
|
|
1971
1990
|
),
|
|
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-
|
|
1991
|
+
locked(layer) && /* @__PURE__ */ jsx7("span", { "aria-label": "Locked", className: "text-muted-foreground", children: "\u{1F512}" }),
|
|
1992
|
+
layer.blend !== "normal" && layer.blend !== "pass-through" && /* @__PURE__ */ jsx7("span", { className: "text-[9px] text-muted-foreground", children: layer.blend })
|
|
1974
1993
|
]
|
|
1975
1994
|
},
|
|
1976
1995
|
layer.id
|
|
1977
1996
|
);
|
|
1978
1997
|
}) }),
|
|
1979
|
-
error && /* @__PURE__ */ jsx7("p", { role: "alert", className: "text-
|
|
1998
|
+
error && /* @__PURE__ */ jsx7("p", { role: "alert", className: "text-destructive", children: error }),
|
|
1980
1999
|
menu && /* @__PURE__ */ jsx7(
|
|
1981
2000
|
"div",
|
|
1982
2001
|
{
|
|
1983
2002
|
role: "menu",
|
|
1984
2003
|
"aria-label": "Layer menu",
|
|
1985
|
-
className: "fixed z-50 min-w-44 rounded border border-
|
|
2004
|
+
className: "fixed z-50 min-w-44 rounded border border-border bg-background py-1 shadow-xl",
|
|
1986
2005
|
style: { left: menu.x, top: menu.y },
|
|
1987
2006
|
onClick: (e) => e.stopPropagation(),
|
|
1988
2007
|
onKeyDown: (e) => e.key === "Escape" && setMenu(null),
|
|
@@ -1992,7 +2011,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1992
2011
|
type: "button",
|
|
1993
2012
|
role: "menuitem",
|
|
1994
2013
|
disabled: !item.enabled,
|
|
1995
|
-
className: "block w-full px-3 py-1 text-left hover:bg-
|
|
2014
|
+
className: "block w-full px-3 py-1 text-left hover:bg-muted disabled:opacity-40",
|
|
1996
2015
|
onClick: () => run(item.action),
|
|
1997
2016
|
children: item.label
|
|
1998
2017
|
},
|
|
@@ -2009,21 +2028,22 @@ import { findLayer } from "@pixerate/editor/image-editor";
|
|
|
2009
2028
|
|
|
2010
2029
|
// src/image-editor/ImageEffectControls.tsx
|
|
2011
2030
|
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2012
|
-
function ImageEffectControls({ provider, effect, name, values, onChange, onPreset }) {
|
|
2031
|
+
function ImageEffectControls({ provider, effect, name, values, onChange, onPreset, className }) {
|
|
2013
2032
|
const { description, error } = useEffectDescription(provider, effect);
|
|
2014
|
-
|
|
2033
|
+
let body;
|
|
2034
|
+
if (!provider) body = /* @__PURE__ */ jsxs8("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
2015
2035
|
'No effects provider: "',
|
|
2016
2036
|
name ?? effect,
|
|
2017
2037
|
'" is kept but not drawn.'
|
|
2018
2038
|
] });
|
|
2019
|
-
if (error)
|
|
2020
|
-
if (!description)
|
|
2021
|
-
|
|
2039
|
+
else if (error) body = /* @__PURE__ */ jsx8("p", { className: "text-[11px] text-amber-600", children: error });
|
|
2040
|
+
else if (!description) body = /* @__PURE__ */ jsx8("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
|
|
2041
|
+
else body = /* @__PURE__ */ jsx8(EffectParameters, { description, values, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
|
|
2042
|
+
return /* @__PURE__ */ jsx8("div", { className, "data-testid": "image-effect-controls", children: body });
|
|
2022
2043
|
}
|
|
2023
2044
|
|
|
2024
2045
|
// src/image-editor/ImageProviderEffectsPanel.tsx
|
|
2025
2046
|
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
2047
|
function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
2028
2048
|
const [, setTick] = useState8(0);
|
|
2029
2049
|
useEffect7(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -2053,17 +2073,17 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
2053
2073
|
const canFilter = !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
|
|
2054
2074
|
return /* @__PURE__ */ jsxs9("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Provider effects", "data-image-provider-effects": "", children: [
|
|
2055
2075
|
/* @__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:
|
|
2076
|
+
/* @__PURE__ */ jsx9("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Effects" }),
|
|
2077
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider || !canFilter, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Apply effect\u2026" }),
|
|
2078
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => setBrowse(browse === "layer" ? null : "layer"), children: "Effect layer\u2026" })
|
|
2059
2079
|
] }),
|
|
2060
|
-
!provider && /* @__PURE__ */ jsx9("p", { className: "text-[11px] text-
|
|
2080
|
+
!provider && /* @__PURE__ */ jsx9("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the document are kept." }),
|
|
2061
2081
|
browse === "filter" && layer && /* @__PURE__ */ jsx9(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id))) }),
|
|
2062
2082
|
browse === "layer" && /* @__PURE__ */ jsx9(EffectsBrowser, { provider, uses: ["generator", "overlay", "title"], title: "Generators and overlays", onPick: (e) => (setBrowse(null), run(() => controller.addEffectLayer(e.id))) }),
|
|
2063
2083
|
generator && layer && /* @__PURE__ */ jsxs9("div", { className: "space-y-1", "data-effect-part": "generator", children: [
|
|
2064
2084
|
/* @__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:
|
|
2085
|
+
/* @__PURE__ */ jsx9("span", { className: "flex-1 font-medium text-foreground", children: generator.name ?? generator.effect }),
|
|
2086
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: imageOutlineButtonClass, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
|
|
2067
2087
|
] }),
|
|
2068
2088
|
/* @__PURE__ */ jsx9(
|
|
2069
2089
|
ImageEffectControls,
|
|
@@ -2082,20 +2102,20 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
2082
2102
|
const all = layer.smartFilters.filters;
|
|
2083
2103
|
const index = all.indexOf(f);
|
|
2084
2104
|
if (f.kind !== "effect") return null;
|
|
2085
|
-
return /* @__PURE__ */ jsxs9("li", { className: "rounded border border-
|
|
2105
|
+
return /* @__PURE__ */ jsxs9("li", { className: "rounded border border-border p-1", "data-smart-effect": f.id, children: [
|
|
2086
2106
|
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1", children: [
|
|
2087
2107
|
/* @__PURE__ */ jsx9("input", { type: "checkbox", checked: f.enabled, "aria-label": `${label} on`, onChange: (e) => {
|
|
2088
2108
|
const enabled = e.currentTarget.checked;
|
|
2089
2109
|
run(() => controller.updateEffectFilter(layer.id, f.id, { enabled }));
|
|
2090
2110
|
} }),
|
|
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:
|
|
2111
|
+
/* @__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 }),
|
|
2112
|
+
/* @__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" }),
|
|
2113
|
+
/* @__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" }),
|
|
2114
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: imageOutlineButtonClass, "aria-label": `Remove ${label}`, onClick: () => run(() => controller.removeSmartFilter(layer.id, f.id)), children: "\u2715" })
|
|
2095
2115
|
] }),
|
|
2096
2116
|
open === f.id && /* @__PURE__ */ jsxs9("div", { className: "mt-1 space-y-2", children: [
|
|
2097
2117
|
/* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-1", children: [
|
|
2098
|
-
/* @__PURE__ */ jsx9("span", { className: "w-14 text-[11px] text-
|
|
2118
|
+
/* @__PURE__ */ jsx9("span", { className: "w-14 text-[11px] text-foreground", children: "Opacity" }),
|
|
2099
2119
|
/* @__PURE__ */ jsx9(
|
|
2100
2120
|
"input",
|
|
2101
2121
|
{
|
|
@@ -2127,8 +2147,8 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
2127
2147
|
] })
|
|
2128
2148
|
] }, f.id);
|
|
2129
2149
|
}) }),
|
|
2130
|
-
!layer && /* @__PURE__ */ jsx9("p", { className: "text-[11px] text-
|
|
2131
|
-
message && /* @__PURE__ */ jsx9("p", { role: "alert", className: "text-[11px] text-
|
|
2150
|
+
!layer && /* @__PURE__ */ jsx9("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
|
|
2151
|
+
message && /* @__PURE__ */ jsx9("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
2132
2152
|
] });
|
|
2133
2153
|
}
|
|
2134
2154
|
|
|
@@ -2159,7 +2179,6 @@ var PaintGradientEditor = (props) => /* @__PURE__ */ jsx10(PaintGradientEditorVi
|
|
|
2159
2179
|
|
|
2160
2180
|
// src/image-editor/BrushOptionsBar.tsx
|
|
2161
2181
|
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
2182
|
var BrushOptionsBar = ({ controller, className }) => {
|
|
2164
2183
|
const [, setTick] = useState9(0);
|
|
2165
2184
|
useEffect8(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -2175,14 +2194,14 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2175
2194
|
setError(err instanceof Error ? err.message : String(err));
|
|
2176
2195
|
}
|
|
2177
2196
|
};
|
|
2178
|
-
return /* @__PURE__ */ jsxs10("div", { className: `flex flex-col gap-2 text-xs text-
|
|
2197
|
+
return /* @__PURE__ */ jsxs10("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "brush-options", children: [
|
|
2179
2198
|
/* @__PURE__ */ jsx11("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: PAINT_TOOLS.map((t) => /* @__PURE__ */ jsx11(
|
|
2180
2199
|
"button",
|
|
2181
2200
|
{
|
|
2182
2201
|
type: "button",
|
|
2183
2202
|
"aria-pressed": state.activeTool === t.id,
|
|
2184
2203
|
title: t.shortcut ? `${t.label} (${t.shortcut})` : t.label,
|
|
2185
|
-
className:
|
|
2204
|
+
className: imageChipClass(state.activeTool === t.id),
|
|
2186
2205
|
onClick: () => controller.setTool(t.id),
|
|
2187
2206
|
children: t.label
|
|
2188
2207
|
},
|
|
@@ -2197,10 +2216,10 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2197
2216
|
"aria-label": "Foreground colour",
|
|
2198
2217
|
value: foreground,
|
|
2199
2218
|
onChange: (e) => controller.setPaintOptions({ foreground: e.target.value }),
|
|
2200
|
-
className:
|
|
2219
|
+
className: imageColorInputClass
|
|
2201
2220
|
}
|
|
2202
2221
|
),
|
|
2203
|
-
/* @__PURE__ */ jsx11("span", { className: "text-
|
|
2222
|
+
/* @__PURE__ */ jsx11("span", { className: "text-muted-foreground", children: "FG" })
|
|
2204
2223
|
] }),
|
|
2205
2224
|
/* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-1", children: [
|
|
2206
2225
|
/* @__PURE__ */ jsx11(
|
|
@@ -2210,20 +2229,20 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2210
2229
|
"aria-label": "Background colour",
|
|
2211
2230
|
value: background,
|
|
2212
2231
|
onChange: (e) => controller.setPaintOptions({ background: e.target.value }),
|
|
2213
|
-
className:
|
|
2232
|
+
className: imageColorInputClass
|
|
2214
2233
|
}
|
|
2215
2234
|
),
|
|
2216
|
-
/* @__PURE__ */ jsx11("span", { className: "text-
|
|
2235
|
+
/* @__PURE__ */ jsx11("span", { className: "text-muted-foreground", children: "BG" })
|
|
2217
2236
|
] }),
|
|
2218
|
-
/* @__PURE__ */ jsx11("button", { type: "button", title: "Swap colours (X)", className:
|
|
2219
|
-
/* @__PURE__ */ jsx11("button", { type: "button", title: "Default colours (D)", className:
|
|
2237
|
+
/* @__PURE__ */ jsx11("button", { type: "button", title: "Swap colours (X)", className: imageChipClass(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
|
|
2238
|
+
/* @__PURE__ */ jsx11("button", { type: "button", title: "Default colours (D)", className: imageChipClass(false), onClick: () => controller.resetPaintColors(), children: "Default" }),
|
|
2220
2239
|
state.activeTool === "brush" && /* @__PURE__ */ jsx11(
|
|
2221
2240
|
"button",
|
|
2222
2241
|
{
|
|
2223
2242
|
type: "button",
|
|
2224
2243
|
"aria-pressed": paint.type === "gradient",
|
|
2225
2244
|
title: "Gradient paint: the brush changes colour as the stroke goes",
|
|
2226
|
-
className:
|
|
2245
|
+
className: imageChipClass(paint.type === "gradient"),
|
|
2227
2246
|
onClick: () => attempt(() => controller.setPaintOptions(paint.type === "gradient" ? { foreground } : { paint: DEFAULT_PAINT_GRADIENT })),
|
|
2228
2247
|
children: "Gradient"
|
|
2229
2248
|
}
|
|
@@ -2239,19 +2258,19 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2239
2258
|
},
|
|
2240
2259
|
spec.id
|
|
2241
2260
|
)),
|
|
2242
|
-
state.activeTool === "mixer" && /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-2 border-t border-
|
|
2261
|
+
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
2262
|
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
2244
2263
|
/* @__PURE__ */ jsx11(
|
|
2245
2264
|
"span",
|
|
2246
2265
|
{
|
|
2247
2266
|
"aria-label": "Brush load",
|
|
2248
2267
|
title: mixerLoad.reservoir ? `Loaded ${rgbUnitToHex(mixerLoad.reservoir)}, ${Math.round(mixerLoad.amount * 100)}% left` : "Unloaded",
|
|
2249
|
-
className: "h-6 w-6 rounded border border-
|
|
2268
|
+
className: "h-6 w-6 rounded border border-border",
|
|
2250
2269
|
style: { background: mixerLoad.reservoir ? rgbUnitToHex(mixerLoad.reservoir) : "transparent" }
|
|
2251
2270
|
}
|
|
2252
2271
|
),
|
|
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:
|
|
2272
|
+
/* @__PURE__ */ jsx11("button", { type: "button", title: "Fill the reservoir with the foreground colour", className: imageChipClass(false), onClick: () => controller.loadMixerBrush(), children: "Load brush" }),
|
|
2273
|
+
/* @__PURE__ */ jsx11("button", { type: "button", title: "Empty the picked-up colour", className: imageChipClass(false), onClick: () => controller.cleanMixerBrush(), children: "Clean brush" })
|
|
2255
2274
|
] }),
|
|
2256
2275
|
/* @__PURE__ */ jsx11("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children: MIXER_MIXING_OPTIONS.map((m) => /* @__PURE__ */ jsx11(
|
|
2257
2276
|
"button",
|
|
@@ -2259,14 +2278,14 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2259
2278
|
type: "button",
|
|
2260
2279
|
"aria-pressed": mixer.mixing === m.id,
|
|
2261
2280
|
title: m.title,
|
|
2262
|
-
className:
|
|
2281
|
+
className: imageChipClass(mixer.mixing === m.id),
|
|
2263
2282
|
onClick: () => controller.setPaintOptions({ mixer: { mixing: m.id } }),
|
|
2264
2283
|
children: m.label
|
|
2265
2284
|
},
|
|
2266
2285
|
m.id
|
|
2267
2286
|
)) }),
|
|
2268
2287
|
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-
|
|
2288
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap gap-3 text-foreground", children: [
|
|
2270
2289
|
/* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-1.5", children: [
|
|
2271
2290
|
/* @__PURE__ */ jsx11(
|
|
2272
2291
|
"input",
|
|
@@ -2275,7 +2294,7 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2275
2294
|
"aria-label": "Load the brush after each stroke",
|
|
2276
2295
|
checked: mixer.loadEachStroke,
|
|
2277
2296
|
onChange: (e) => controller.setPaintOptions({ mixer: { loadEachStroke: e.target.checked } }),
|
|
2278
|
-
className: "accent-
|
|
2297
|
+
className: "accent-primary"
|
|
2279
2298
|
}
|
|
2280
2299
|
),
|
|
2281
2300
|
"Load each stroke"
|
|
@@ -2288,35 +2307,35 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2288
2307
|
"aria-label": "Clean the brush after each stroke",
|
|
2289
2308
|
checked: mixer.cleanEachStroke,
|
|
2290
2309
|
onChange: (e) => controller.setPaintOptions({ mixer: { cleanEachStroke: e.target.checked } }),
|
|
2291
|
-
className: "accent-
|
|
2310
|
+
className: "accent-primary"
|
|
2292
2311
|
}
|
|
2293
2312
|
),
|
|
2294
2313
|
"Clean each stroke"
|
|
2295
2314
|
] })
|
|
2296
2315
|
] })
|
|
2297
2316
|
] }),
|
|
2298
|
-
isRetouchPaintTool(tool) && /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-2 border-t border-
|
|
2317
|
+
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
2318
|
(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:
|
|
2319
|
+
/* @__PURE__ */ jsx11("span", { className: "text-muted-foreground", "data-testid": "clone-source", children: cloneSourceLabel(controller) }),
|
|
2320
|
+
cloneSource && /* @__PURE__ */ jsx11("button", { type: "button", title: "Forget the source point", className: imageChipClass(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
|
|
2302
2321
|
] }),
|
|
2303
2322
|
(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
2323
|
CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ jsx11(ControlSlider, { spec, value: cloneTransformView(controller)[spec.id], onChange: (v) => setCloneTransformValue(controller, spec.id, v) }, spec.id)),
|
|
2305
2324
|
/* @__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:
|
|
2325
|
+
/* @__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" }),
|
|
2326
|
+
/* @__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" }),
|
|
2327
|
+
!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
2328
|
] })
|
|
2310
2329
|
] }),
|
|
2311
2330
|
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-
|
|
2331
|
+
/* @__PURE__ */ jsx11("span", { className: "text-muted-foreground", children: choice.label }),
|
|
2313
2332
|
choice.options.map((o) => /* @__PURE__ */ jsx11(
|
|
2314
2333
|
"button",
|
|
2315
2334
|
{
|
|
2316
2335
|
type: "button",
|
|
2317
2336
|
"aria-pressed": retouch[choice.id] === o.id,
|
|
2318
2337
|
title: o.title,
|
|
2319
|
-
className:
|
|
2338
|
+
className: imageChipClass(retouch[choice.id] === o.id),
|
|
2320
2339
|
onClick: () => setRetouchChoice(controller, choice.id, o.id),
|
|
2321
2340
|
children: o.label
|
|
2322
2341
|
},
|
|
@@ -2324,7 +2343,7 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2324
2343
|
))
|
|
2325
2344
|
] }, choice.id)),
|
|
2326
2345
|
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-
|
|
2346
|
+
/* @__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
2347
|
/* @__PURE__ */ jsx11(
|
|
2329
2348
|
"input",
|
|
2330
2349
|
{
|
|
@@ -2332,13 +2351,13 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2332
2351
|
"aria-label": t.label,
|
|
2333
2352
|
checked: retouch[t.id],
|
|
2334
2353
|
onChange: (e) => controller.setPaintOptions({ retouch: { [t.id]: e.target.checked } }),
|
|
2335
|
-
className: "accent-
|
|
2354
|
+
className: "accent-primary"
|
|
2336
2355
|
}
|
|
2337
2356
|
),
|
|
2338
2357
|
t.label
|
|
2339
2358
|
] }, t.id)) })
|
|
2340
2359
|
] }),
|
|
2341
|
-
/* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap gap-3 text-
|
|
2360
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap gap-3 text-foreground", role: "group", "aria-label": "Pressure", children: [
|
|
2342
2361
|
/* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-1.5", children: [
|
|
2343
2362
|
/* @__PURE__ */ jsx11(
|
|
2344
2363
|
"input",
|
|
@@ -2347,7 +2366,7 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2347
2366
|
"aria-label": "Pressure controls size",
|
|
2348
2367
|
checked: brush.pressureSize,
|
|
2349
2368
|
onChange: (e) => controller.setPaintOptions({ brush: { pressureSize: e.target.checked } }),
|
|
2350
|
-
className: "accent-
|
|
2369
|
+
className: "accent-primary"
|
|
2351
2370
|
}
|
|
2352
2371
|
),
|
|
2353
2372
|
"Pressure size"
|
|
@@ -2360,17 +2379,17 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2360
2379
|
"aria-label": "Pressure controls opacity",
|
|
2361
2380
|
checked: brush.pressureOpacity,
|
|
2362
2381
|
onChange: (e) => controller.setPaintOptions({ brush: { pressureOpacity: e.target.checked } }),
|
|
2363
|
-
className: "accent-
|
|
2382
|
+
className: "accent-primary"
|
|
2364
2383
|
}
|
|
2365
2384
|
),
|
|
2366
2385
|
"Pressure opacity"
|
|
2367
2386
|
] })
|
|
2368
2387
|
] }),
|
|
2369
2388
|
/* @__PURE__ */ jsxs10("div", { className: "flex gap-1", children: [
|
|
2370
|
-
/* @__PURE__ */ jsx11("button", { type: "button", className:
|
|
2371
|
-
/* @__PURE__ */ jsx11("button", { type: "button", className:
|
|
2389
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.fillPixels()), children: "Fill" }),
|
|
2390
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.clearPixels()), children: "Clear" })
|
|
2372
2391
|
] }),
|
|
2373
|
-
error && /* @__PURE__ */ jsx11("p", { role: "alert", className: "text-
|
|
2392
|
+
error && /* @__PURE__ */ jsx11("p", { role: "alert", className: "text-destructive", children: error })
|
|
2374
2393
|
] });
|
|
2375
2394
|
};
|
|
2376
2395
|
|
|
@@ -2378,8 +2397,8 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2378
2397
|
import { useEffect as useEffect9, useState as useState10 } from "react";
|
|
2379
2398
|
import { COLOR_MODE_OPTIONS, INTENT_OPTIONS, PROOF_PROFILE_OPTIONS, WORKING_SPACE_OPTIONS, colorPanelView } from "@pixerate/editor/image-editor";
|
|
2380
2399
|
import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2381
|
-
var
|
|
2382
|
-
var select = "rounded bg-
|
|
2400
|
+
var chip = imageChipClass(false);
|
|
2401
|
+
var select = "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground";
|
|
2383
2402
|
var ColorProfilePanel = ({ controller, className }) => {
|
|
2384
2403
|
const [, setTick] = useState10(0);
|
|
2385
2404
|
useEffect9(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -2408,28 +2427,28 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
2408
2427
|
})
|
|
2409
2428
|
);
|
|
2410
2429
|
};
|
|
2411
|
-
return /* @__PURE__ */ jsxs11("div", { className: `flex flex-col gap-2 text-xs text-
|
|
2430
|
+
return /* @__PURE__ */ jsxs11("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "color-profile-panel", children: [
|
|
2412
2431
|
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
2413
|
-
/* @__PURE__ */ jsx12("span", { className: "text-
|
|
2432
|
+
/* @__PURE__ */ jsx12("span", { className: "text-muted-foreground", children: "Profile" }),
|
|
2414
2433
|
/* @__PURE__ */ jsx12("span", { "data-testid": "color-profile-name", children: view.profileName })
|
|
2415
2434
|
] }),
|
|
2416
2435
|
/* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Colour mode", children: [
|
|
2417
|
-
/* @__PURE__ */ jsx12("span", { className: "text-
|
|
2436
|
+
/* @__PURE__ */ jsx12("span", { className: "text-muted-foreground", children: "Mode" }),
|
|
2418
2437
|
/* @__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-
|
|
2438
|
+
view.cmykProfileName && /* @__PURE__ */ jsx12("span", { className: "text-muted-foreground", children: view.cmykProfileName })
|
|
2420
2439
|
] }),
|
|
2421
2440
|
/* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
|
|
2422
2441
|
/* @__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
2442
|
/* @__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
2443
|
/* @__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-
|
|
2444
|
+
/* @__PURE__ */ jsx12("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-primary" }),
|
|
2426
2445
|
"BPC"
|
|
2427
2446
|
] }),
|
|
2428
|
-
/* @__PURE__ */ jsx12("button", { type: "button", className:
|
|
2429
|
-
/* @__PURE__ */ jsx12("button", { type: "button", className:
|
|
2447
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: chip, title: "Edit \u203A Assign Profile: keep the numbers", onClick: () => attempt(() => controller.assignProfile(target)), children: "Assign" }),
|
|
2448
|
+
/* @__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
2449
|
] }),
|
|
2431
2450
|
/* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Proof setup", children: [
|
|
2432
|
-
/* @__PURE__ */ jsx12("span", { className: "text-
|
|
2451
|
+
/* @__PURE__ */ jsx12("span", { className: "text-muted-foreground", children: "Proof" }),
|
|
2433
2452
|
/* @__PURE__ */ jsxs11(
|
|
2434
2453
|
"select",
|
|
2435
2454
|
{
|
|
@@ -2446,16 +2465,16 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
2446
2465
|
view.proof && /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
2447
2466
|
/* @__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
2467
|
/* @__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-
|
|
2468
|
+
/* @__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
2469
|
"Paper"
|
|
2451
2470
|
] }),
|
|
2452
2471
|
/* @__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-
|
|
2472
|
+
/* @__PURE__ */ jsx12("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-primary" }),
|
|
2454
2473
|
"Gamut warning"
|
|
2455
2474
|
] })
|
|
2456
2475
|
] })
|
|
2457
2476
|
] }),
|
|
2458
|
-
error && /* @__PURE__ */ jsx12("p", { role: "alert", className: "text-
|
|
2477
|
+
error && /* @__PURE__ */ jsx12("p", { role: "alert", className: "text-destructive", children: error })
|
|
2459
2478
|
] });
|
|
2460
2479
|
};
|
|
2461
2480
|
|
|
@@ -2475,7 +2494,7 @@ var MODIFY_OPS = [
|
|
|
2475
2494
|
{ op: "border", label: "Border" },
|
|
2476
2495
|
{ op: "smooth", label: "Smooth" }
|
|
2477
2496
|
];
|
|
2478
|
-
var
|
|
2497
|
+
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
2498
|
var SelectionOptionsBar = ({
|
|
2480
2499
|
controller,
|
|
2481
2500
|
options,
|
|
@@ -2489,11 +2508,11 @@ var SelectionOptionsBar = ({
|
|
|
2489
2508
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
2490
2509
|
const qm = quickMask ?? Boolean(controller.getState().quickMask);
|
|
2491
2510
|
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:
|
|
2511
|
+
/* @__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)) }),
|
|
2512
|
+
/* @__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
2513
|
options.tool === "wand" && /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-2", children: [
|
|
2495
2514
|
/* @__PURE__ */ jsxs12("label", { className: "flex flex-col gap-1", children: [
|
|
2496
|
-
/* @__PURE__ */ jsxs12("span", { className: "flex justify-between text-
|
|
2515
|
+
/* @__PURE__ */ jsxs12("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
2497
2516
|
/* @__PURE__ */ jsx13("span", { children: "Tolerance" }),
|
|
2498
2517
|
/* @__PURE__ */ jsx13("span", { className: "font-mono", children: options.tolerance })
|
|
2499
2518
|
] }),
|
|
@@ -2507,19 +2526,19 @@ var SelectionOptionsBar = ({
|
|
|
2507
2526
|
"aria-label": "Tolerance",
|
|
2508
2527
|
value: options.tolerance,
|
|
2509
2528
|
onChange: (e) => set({ tolerance: Number(e.target.value) }),
|
|
2510
|
-
className:
|
|
2529
|
+
className: imageRangeClass
|
|
2511
2530
|
}
|
|
2512
2531
|
)
|
|
2513
2532
|
] }),
|
|
2514
|
-
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-
|
|
2533
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
2515
2534
|
/* @__PURE__ */ jsx13("input", { type: "checkbox", checked: options.contiguous, onChange: (e) => set({ contiguous: e.target.checked }) }),
|
|
2516
2535
|
"Contiguous"
|
|
2517
2536
|
] }),
|
|
2518
|
-
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-
|
|
2537
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
2519
2538
|
/* @__PURE__ */ jsx13("input", { type: "checkbox", checked: options.sampleMerged, onChange: (e) => set({ sampleMerged: e.target.checked }) }),
|
|
2520
2539
|
"Sample adjusted image"
|
|
2521
2540
|
] }),
|
|
2522
|
-
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-
|
|
2541
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
2523
2542
|
"Sample",
|
|
2524
2543
|
/* @__PURE__ */ jsxs12(
|
|
2525
2544
|
"select",
|
|
@@ -2527,7 +2546,7 @@ var SelectionOptionsBar = ({
|
|
|
2527
2546
|
"aria-label": "Sample from",
|
|
2528
2547
|
value: options.sample ?? "composite",
|
|
2529
2548
|
onChange: (e) => set({ sample: e.target.value }),
|
|
2530
|
-
className: "bg-
|
|
2549
|
+
className: "bg-muted border border-border rounded px-1 py-0.5",
|
|
2531
2550
|
children: [
|
|
2532
2551
|
/* @__PURE__ */ jsx13("option", { value: "composite", children: "All layers" }),
|
|
2533
2552
|
/* @__PURE__ */ jsx13("option", { value: "active-layer", children: "Active layer" })
|
|
@@ -2536,18 +2555,18 @@ var SelectionOptionsBar = ({
|
|
|
2536
2555
|
)
|
|
2537
2556
|
] })
|
|
2538
2557
|
] }),
|
|
2539
|
-
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-
|
|
2558
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
2540
2559
|
/* @__PURE__ */ jsx13("input", { type: "checkbox", checked: options.antiAlias, onChange: (e) => set({ antiAlias: e.target.checked }) }),
|
|
2541
2560
|
"Anti-alias"
|
|
2542
2561
|
] }),
|
|
2543
2562
|
/* @__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:
|
|
2563
|
+
/* @__PURE__ */ jsx13("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
|
|
2564
|
+
/* @__PURE__ */ jsx13("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
|
|
2565
|
+
/* @__PURE__ */ jsx13("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
|
|
2566
|
+
/* @__PURE__ */ jsx13("button", { type: "button", "aria-pressed": qm, className: btn(qm), onClick: () => controller.setQuickMask(!qm), children: "Quick Mask" })
|
|
2548
2567
|
] }),
|
|
2549
2568
|
/* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2550
|
-
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1 text-
|
|
2569
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
2551
2570
|
"Radius",
|
|
2552
2571
|
/* @__PURE__ */ jsx13(
|
|
2553
2572
|
"input",
|
|
@@ -2559,13 +2578,13 @@ var SelectionOptionsBar = ({
|
|
|
2559
2578
|
"aria-label": "Modify radius",
|
|
2560
2579
|
value: radius,
|
|
2561
2580
|
onChange: (e) => setRadius(Math.max(0, Number(e.target.value) || 0)),
|
|
2562
|
-
className: "w-14 bg-
|
|
2581
|
+
className: "w-14 bg-background border border-border rounded px-1 py-0.5 text-foreground"
|
|
2563
2582
|
}
|
|
2564
2583
|
)
|
|
2565
2584
|
] }),
|
|
2566
|
-
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ jsx13("button", { type: "button", className:
|
|
2585
|
+
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ jsx13("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
|
|
2567
2586
|
] }),
|
|
2568
|
-
/* @__PURE__ */ jsx13("p", { "data-testid": "selection-status", className: "text-
|
|
2587
|
+
/* @__PURE__ */ jsx13("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: describeSelection(sel) })
|
|
2569
2588
|
] });
|
|
2570
2589
|
};
|
|
2571
2590
|
|
|
@@ -2579,7 +2598,7 @@ import {
|
|
|
2579
2598
|
} from "@pixerate/editor/image-editor";
|
|
2580
2599
|
import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2581
2600
|
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
2582
|
-
var
|
|
2601
|
+
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
2602
|
var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
2584
2603
|
const [params, setParams] = useState12(DEFAULT_PARAMS);
|
|
2585
2604
|
const [busy, setBusy] = useState12(false);
|
|
@@ -2601,9 +2620,9 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2601
2620
|
}
|
|
2602
2621
|
};
|
|
2603
2622
|
return /* @__PURE__ */ jsxs13("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
2604
|
-
/* @__PURE__ */ jsx14("span", { className:
|
|
2623
|
+
/* @__PURE__ */ jsx14("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
|
|
2605
2624
|
REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
|
|
2606
|
-
/* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-
|
|
2625
|
+
/* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
2607
2626
|
/* @__PURE__ */ jsx14("span", { children: c.label }),
|
|
2608
2627
|
/* @__PURE__ */ jsxs13("span", { className: "font-mono", children: [
|
|
2609
2628
|
params[c.id],
|
|
@@ -2620,20 +2639,20 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2620
2639
|
"aria-label": c.label,
|
|
2621
2640
|
value: params[c.id],
|
|
2622
2641
|
onChange: (e) => setParams({ ...params, [c.id]: Number(e.target.value) }),
|
|
2623
|
-
className:
|
|
2642
|
+
className: imageRangeClass
|
|
2624
2643
|
}
|
|
2625
2644
|
)
|
|
2626
2645
|
] }, c.id)),
|
|
2627
|
-
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-
|
|
2646
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
2628
2647
|
/* @__PURE__ */ jsx14("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
2629
2648
|
"Smart Radius"
|
|
2630
2649
|
] }),
|
|
2631
2650
|
/* @__PURE__ */ jsxs13("div", { className: "flex gap-1", children: [
|
|
2632
|
-
/* @__PURE__ */ jsx14("button", { type: "button", className:
|
|
2633
|
-
/* @__PURE__ */ jsx14("button", { type: "button", className:
|
|
2651
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: button, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
2652
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: button, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
|
2634
2653
|
] }),
|
|
2635
|
-
error && /* @__PURE__ */ jsx14("p", { role: "alert", className: "text-
|
|
2636
|
-
/* @__PURE__ */ jsx14("span", { className: "font-semibold text-
|
|
2654
|
+
error && /* @__PURE__ */ jsx14("p", { role: "alert", className: "text-destructive", children: error }),
|
|
2655
|
+
/* @__PURE__ */ jsx14("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
|
|
2637
2656
|
/* @__PURE__ */ jsxs13("div", { className: "flex gap-1 items-center", children: [
|
|
2638
2657
|
/* @__PURE__ */ jsx14(
|
|
2639
2658
|
"select",
|
|
@@ -2641,7 +2660,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2641
2660
|
"aria-label": "New masked layer kind",
|
|
2642
2661
|
value: newKind,
|
|
2643
2662
|
onChange: (e) => setNewKind(e.target.value),
|
|
2644
|
-
className: "flex-1 bg-
|
|
2663
|
+
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
2645
2664
|
children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */ jsx14("option", { value: k.kind, children: k.label }, k.kind))
|
|
2646
2665
|
}
|
|
2647
2666
|
),
|
|
@@ -2649,7 +2668,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2649
2668
|
"button",
|
|
2650
2669
|
{
|
|
2651
2670
|
type: "button",
|
|
2652
|
-
className:
|
|
2671
|
+
className: button,
|
|
2653
2672
|
disabled: !sel,
|
|
2654
2673
|
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: layerMaskFromSelection(sel) })),
|
|
2655
2674
|
children: "New Masked Layer"
|
|
@@ -2663,7 +2682,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2663
2682
|
"aria-label": "Mask layer",
|
|
2664
2683
|
value: target.id,
|
|
2665
2684
|
onChange: (e) => setLayerId(e.target.value),
|
|
2666
|
-
className: "bg-
|
|
2685
|
+
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
2667
2686
|
children: list.map((l) => /* @__PURE__ */ jsxs13("option", { value: l.id, children: [
|
|
2668
2687
|
l.name || adjustmentKindLabel2(l.kind),
|
|
2669
2688
|
l.mask ? " (masked)" : ""
|
|
@@ -2671,13 +2690,13 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2671
2690
|
}
|
|
2672
2691
|
),
|
|
2673
2692
|
/* @__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:
|
|
2693
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: button, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
|
|
2694
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: button, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
|
|
2695
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: button, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
|
|
2677
2696
|
] }),
|
|
2678
2697
|
target.mask && /* @__PURE__ */ jsxs13(Fragment3, { children: [
|
|
2679
2698
|
/* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
|
|
2680
|
-
/* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-
|
|
2699
|
+
/* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
2681
2700
|
/* @__PURE__ */ jsx14("span", { children: "Density" }),
|
|
2682
2701
|
/* @__PURE__ */ jsxs13("span", { className: "font-mono", children: [
|
|
2683
2702
|
Math.round((target.mask.density ?? 1) * 100),
|
|
@@ -2694,12 +2713,12 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2694
2713
|
"aria-label": "Mask density",
|
|
2695
2714
|
value: Math.round((target.mask.density ?? 1) * 100),
|
|
2696
2715
|
onChange: (e) => controller.setAdjustmentLayerMaskProps(target.id, { density: Number(e.target.value) / 100 }),
|
|
2697
|
-
className:
|
|
2716
|
+
className: imageRangeClass
|
|
2698
2717
|
}
|
|
2699
2718
|
)
|
|
2700
2719
|
] }),
|
|
2701
2720
|
/* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
|
|
2702
|
-
/* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-
|
|
2721
|
+
/* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
2703
2722
|
/* @__PURE__ */ jsx14("span", { children: "Mask Feather" }),
|
|
2704
2723
|
/* @__PURE__ */ jsxs13("span", { className: "font-mono", children: [
|
|
2705
2724
|
target.mask.feather ?? 0,
|
|
@@ -2716,7 +2735,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2716
2735
|
"aria-label": "Mask feather",
|
|
2717
2736
|
value: target.mask.feather ?? 0,
|
|
2718
2737
|
onChange: (e) => controller.setAdjustmentLayerMaskProps(target.id, { feather: Number(e.target.value) }),
|
|
2719
|
-
className:
|
|
2738
|
+
className: imageRangeClass
|
|
2720
2739
|
}
|
|
2721
2740
|
)
|
|
2722
2741
|
] })
|
|
@@ -2729,7 +2748,6 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2729
2748
|
import { useEffect as useEffect10, useState as useState13 } from "react";
|
|
2730
2749
|
import { FREE_TRANSFORM_FIELDS, FREE_TRANSFORM_MODE_OPTIONS, INTERPOLATIONS, TRANSFORM_ANCHORS, WARP_GRID_OPTIONS, WARP_STYLE_OPTIONS } from "@pixerate/editor/image-editor";
|
|
2731
2750
|
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
2751
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
2734
2752
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
2735
2753
|
const [, setTick] = useState13(0);
|
|
@@ -2745,16 +2763,16 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2745
2763
|
const v = Number(raw);
|
|
2746
2764
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
2747
2765
|
};
|
|
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-
|
|
2766
|
+
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: [
|
|
2767
|
+
/* @__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)) }),
|
|
2768
|
+
/* @__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
2769
|
tool.mode === "warp" && /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
2752
2770
|
/* @__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:
|
|
2771
|
+
/* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
2772
|
+
/* @__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
2773
|
] }),
|
|
2756
2774
|
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1", children: [
|
|
2757
|
-
/* @__PURE__ */ jsx15("span", { className: "text-
|
|
2775
|
+
/* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
2758
2776
|
/* @__PURE__ */ jsx15(
|
|
2759
2777
|
"input",
|
|
2760
2778
|
{
|
|
@@ -2764,7 +2782,7 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2764
2782
|
min: -100,
|
|
2765
2783
|
max: 100,
|
|
2766
2784
|
disabled: warp.style === "custom",
|
|
2767
|
-
className: "w-14 rounded border border-
|
|
2785
|
+
className: "w-14 rounded border border-border bg-background px-1 py-0.5 text-right disabled:opacity-40",
|
|
2768
2786
|
onBlur: (e) => warpNumber(k, e.currentTarget.value),
|
|
2769
2787
|
onKeyDown: (e) => {
|
|
2770
2788
|
if (e.key === "Enter") {
|
|
@@ -2776,7 +2794,7 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2776
2794
|
},
|
|
2777
2795
|
`${k}:${warp[k]}`
|
|
2778
2796
|
),
|
|
2779
|
-
/* @__PURE__ */ jsx15("span", { className: "text-
|
|
2797
|
+
/* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: "%" })
|
|
2780
2798
|
] }, k)),
|
|
2781
2799
|
/* @__PURE__ */ jsx15(
|
|
2782
2800
|
"button",
|
|
@@ -2785,13 +2803,13 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2785
2803
|
title: "Bend along the vertical axis",
|
|
2786
2804
|
"aria-pressed": warp.orientation === "vertical",
|
|
2787
2805
|
disabled: warp.style === "custom",
|
|
2788
|
-
className:
|
|
2806
|
+
className: imageChipClass(warp.orientation === "vertical"),
|
|
2789
2807
|
onClick: () => tool.setWarp({ orientation: warp.orientation === "vertical" ? "horizontal" : "vertical" }),
|
|
2790
2808
|
children: "Vertical"
|
|
2791
2809
|
}
|
|
2792
2810
|
),
|
|
2793
2811
|
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1", children: [
|
|
2794
|
-
/* @__PURE__ */ jsx15("span", { className: "text-
|
|
2812
|
+
/* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
2795
2813
|
/* @__PURE__ */ jsx15(
|
|
2796
2814
|
"select",
|
|
2797
2815
|
{
|
|
@@ -2801,14 +2819,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2801
2819
|
const g = WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
|
|
2802
2820
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
2803
2821
|
},
|
|
2804
|
-
className:
|
|
2822
|
+
className: imageFieldClass,
|
|
2805
2823
|
children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ jsx15("option", { value: g.id, children: g.label }, g.id))
|
|
2806
2824
|
}
|
|
2807
2825
|
)
|
|
2808
2826
|
] })
|
|
2809
2827
|
] }),
|
|
2810
2828
|
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-
|
|
2829
|
+
/* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: f.label }),
|
|
2812
2830
|
/* @__PURE__ */ jsx15(
|
|
2813
2831
|
"input",
|
|
2814
2832
|
{
|
|
@@ -2817,7 +2835,7 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2817
2835
|
defaultValue: round(bar[f.id], f.unit),
|
|
2818
2836
|
disabled: !bar.affine,
|
|
2819
2837
|
step: f.unit === "px" ? 1 : 0.1,
|
|
2820
|
-
className: "w-16 rounded border border-
|
|
2838
|
+
className: "w-16 rounded border border-border bg-background px-1 py-0.5 text-right disabled:opacity-40",
|
|
2821
2839
|
onBlur: (e) => apply(f.id, e.currentTarget.value),
|
|
2822
2840
|
onKeyDown: (e) => {
|
|
2823
2841
|
if (e.key === "Enter") {
|
|
@@ -2829,14 +2847,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2829
2847
|
},
|
|
2830
2848
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
2831
2849
|
),
|
|
2832
|
-
/* @__PURE__ */ jsx15("span", { className: "text-
|
|
2850
|
+
/* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: f.unit }),
|
|
2833
2851
|
f.id === "scaleX" && /* @__PURE__ */ jsx15(
|
|
2834
2852
|
"button",
|
|
2835
2853
|
{
|
|
2836
2854
|
type: "button",
|
|
2837
2855
|
"aria-label": "Keep width and height proportional",
|
|
2838
2856
|
"aria-pressed": tool.proportional,
|
|
2839
|
-
className:
|
|
2857
|
+
className: imageChipClass(tool.proportional),
|
|
2840
2858
|
onClick: () => {
|
|
2841
2859
|
tool.proportional = !tool.proportional;
|
|
2842
2860
|
setTick((n) => n + 1);
|
|
@@ -2846,21 +2864,21 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2846
2864
|
)
|
|
2847
2865
|
] }, f.id)),
|
|
2848
2866
|
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1", children: [
|
|
2849
|
-
/* @__PURE__ */ jsx15("span", { className: "text-
|
|
2867
|
+
/* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
2850
2868
|
/* @__PURE__ */ jsx15(
|
|
2851
2869
|
"select",
|
|
2852
2870
|
{
|
|
2853
2871
|
"aria-label": "Interpolation",
|
|
2854
2872
|
value: tool.interpolation,
|
|
2855
2873
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
2856
|
-
className:
|
|
2874
|
+
className: imageFieldClass,
|
|
2857
2875
|
children: INTERPOLATIONS.map((i) => /* @__PURE__ */ jsx15("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
2858
2876
|
}
|
|
2859
2877
|
)
|
|
2860
2878
|
] }),
|
|
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-
|
|
2879
|
+
/* @__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" }),
|
|
2880
|
+
/* @__PURE__ */ jsx15("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
2881
|
+
tool.error && /* @__PURE__ */ jsx15("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
2864
2882
|
] });
|
|
2865
2883
|
};
|
|
2866
2884
|
|
|
@@ -2868,7 +2886,6 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2868
2886
|
import { useEffect as useEffect11, useState as useState14 } from "react";
|
|
2869
2887
|
import { LIVE_SHAPE_KINDS, SHAPE_KIND_LABELS, applyShapeOptions } from "@pixerate/editor/image-editor";
|
|
2870
2888
|
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
2889
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
2873
2890
|
const [, setTick] = useState14(0);
|
|
2874
2891
|
useEffect11(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -2886,8 +2903,8 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2886
2903
|
}
|
|
2887
2904
|
};
|
|
2888
2905
|
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:
|
|
2906
|
+
return /* @__PURE__ */ jsxs15("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
2907
|
+
/* @__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
2908
|
/* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
2892
2909
|
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", children: [
|
|
2893
2910
|
/* @__PURE__ */ jsx16("input", { type: "checkbox", "aria-label": "Fill", checked: options.fill !== null, onChange: (e) => set({ fill: e.target.checked ? "#4f46e5" : null }) }),
|
|
@@ -2900,7 +2917,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2900
2917
|
disabled: options.fill === null,
|
|
2901
2918
|
value: options.fill ?? "#4f46e5",
|
|
2902
2919
|
onChange: (e) => set({ fill: e.target.value }),
|
|
2903
|
-
className:
|
|
2920
|
+
className: imageColorInputClass
|
|
2904
2921
|
}
|
|
2905
2922
|
)
|
|
2906
2923
|
] }),
|
|
@@ -2915,7 +2932,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2915
2932
|
disabled: options.stroke === null,
|
|
2916
2933
|
value: options.stroke ?? "#000000",
|
|
2917
2934
|
onChange: (e) => set({ stroke: e.target.value }),
|
|
2918
|
-
className:
|
|
2935
|
+
className: imageColorInputClass
|
|
2919
2936
|
}
|
|
2920
2937
|
)
|
|
2921
2938
|
] }),
|
|
@@ -2930,7 +2947,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2930
2947
|
max: 200,
|
|
2931
2948
|
value: options.strokeWidth,
|
|
2932
2949
|
onChange: (e) => set({ strokeWidth: num(e.target.value, 0, 200) }),
|
|
2933
|
-
className:
|
|
2950
|
+
className: `w-14 ${imageFieldClass}`
|
|
2934
2951
|
}
|
|
2935
2952
|
)
|
|
2936
2953
|
] })
|
|
@@ -2938,16 +2955,16 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2938
2955
|
/* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
2939
2956
|
options.kind === "rect" && /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", children: [
|
|
2940
2957
|
"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:
|
|
2958
|
+
/* @__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
2959
|
] }),
|
|
2943
2960
|
options.kind === "polygon" && /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", children: [
|
|
2944
2961
|
"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:
|
|
2962
|
+
/* @__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
2963
|
] }),
|
|
2947
2964
|
options.kind === "star" && /* @__PURE__ */ jsxs15(Fragment4, { children: [
|
|
2948
2965
|
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", children: [
|
|
2949
2966
|
"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:
|
|
2967
|
+
/* @__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
2968
|
] }),
|
|
2952
2969
|
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", children: [
|
|
2953
2970
|
"Inner",
|
|
@@ -2961,7 +2978,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2961
2978
|
step: 0.05,
|
|
2962
2979
|
value: options.innerRatio,
|
|
2963
2980
|
onChange: (e) => set({ innerRatio: Number(e.target.value) }),
|
|
2964
|
-
className: "accent-
|
|
2981
|
+
className: "accent-primary"
|
|
2965
2982
|
}
|
|
2966
2983
|
)
|
|
2967
2984
|
] })
|
|
@@ -2969,7 +2986,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2969
2986
|
options.kind === "line" && /* @__PURE__ */ jsxs15(Fragment4, { children: [
|
|
2970
2987
|
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", children: [
|
|
2971
2988
|
"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:
|
|
2989
|
+
/* @__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
2990
|
] }),
|
|
2974
2991
|
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", children: [
|
|
2975
2992
|
/* @__PURE__ */ jsx16("input", { type: "checkbox", "aria-label": "Arrowhead", checked: options.arrow, onChange: (e) => set({ arrow: e.target.checked }) }),
|
|
@@ -2977,8 +2994,8 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2977
2994
|
] })
|
|
2978
2995
|
] })
|
|
2979
2996
|
] }),
|
|
2980
|
-
/* @__PURE__ */ jsx16("p", { className: "text-[10px] text-
|
|
2981
|
-
error && /* @__PURE__ */ jsx16("p", { role: "alert", className: "text-
|
|
2997
|
+
/* @__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." }),
|
|
2998
|
+
error && /* @__PURE__ */ jsx16("p", { role: "alert", className: "text-destructive", children: error })
|
|
2982
2999
|
] });
|
|
2983
3000
|
};
|
|
2984
3001
|
|
|
@@ -2986,7 +3003,6 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2986
3003
|
import { useEffect as useEffect12, useState as useState15 } from "react";
|
|
2987
3004
|
import { TEXT_ALIGNS } from "@pixerate/editor/image-editor";
|
|
2988
3005
|
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
3006
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
2991
3007
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
2992
3008
|
const [, setTick] = useState15(0);
|
|
@@ -3024,7 +3040,7 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
3024
3040
|
setError(e instanceof Error ? e.message : String(e));
|
|
3025
3041
|
}
|
|
3026
3042
|
};
|
|
3027
|
-
return /* @__PURE__ */ jsxs16("div", { className: `flex flex-col gap-2 text-xs text-
|
|
3043
|
+
return /* @__PURE__ */ jsxs16("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
|
|
3028
3044
|
/* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
3029
3045
|
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
|
|
3030
3046
|
"Font",
|
|
@@ -3035,7 +3051,7 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
3035
3051
|
"aria-label": "Font family",
|
|
3036
3052
|
value: shown.fontFamily,
|
|
3037
3053
|
onChange: (e) => e.target.value.trim() && style({ fontFamily: e.target.value }),
|
|
3038
|
-
className: "w-32 rounded border border-
|
|
3054
|
+
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
3039
3055
|
}
|
|
3040
3056
|
),
|
|
3041
3057
|
/* @__PURE__ */ jsx17("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ jsx17("option", { value: f }, f)) })
|
|
@@ -3051,23 +3067,23 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
3051
3067
|
max: 2e3,
|
|
3052
3068
|
value: Math.round(shown.fontSize * 10) / 10,
|
|
3053
3069
|
onChange: (e) => Number(e.target.value) > 0 && style({ fontSize: Number(e.target.value) }),
|
|
3054
|
-
className: "w-16 rounded border border-
|
|
3070
|
+
className: "w-16 rounded border border-border bg-background px-1 py-0.5"
|
|
3055
3071
|
}
|
|
3056
3072
|
)
|
|
3057
3073
|
] }),
|
|
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:
|
|
3074
|
+
/* @__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" }),
|
|
3075
|
+
/* @__PURE__ */ jsx17("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
3076
|
+
/* @__PURE__ */ jsx17("input", { type: "color", "aria-label": "Text colour", value: shown.color, onChange: (e) => style({ color: e.target.value }), className: imageColorInputClass })
|
|
3061
3077
|
] }),
|
|
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-
|
|
3078
|
+
/* @__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)) }),
|
|
3079
|
+
/* @__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." }),
|
|
3080
|
+
missing.length > 0 && /* @__PURE__ */ jsxs16("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
3065
3081
|
"Missing ",
|
|
3066
3082
|
missing.length === 1 ? "font" : "fonts",
|
|
3067
3083
|
": ",
|
|
3068
3084
|
missing.join(", ")
|
|
3069
3085
|
] }),
|
|
3070
|
-
error && /* @__PURE__ */ jsx17("p", { role: "alert", className: "text-
|
|
3086
|
+
error && /* @__PURE__ */ jsx17("p", { role: "alert", className: "text-destructive", children: error })
|
|
3071
3087
|
] });
|
|
3072
3088
|
};
|
|
3073
3089
|
|
|
@@ -3239,11 +3255,11 @@ var ImageEditor = ({
|
|
|
3239
3255
|
"div",
|
|
3240
3256
|
{
|
|
3241
3257
|
ref: rootRef,
|
|
3242
|
-
className:
|
|
3258
|
+
className: `${imageEditorFrameClass} ${className}`,
|
|
3243
3259
|
style,
|
|
3244
3260
|
children: [
|
|
3245
|
-
/* @__PURE__ */ jsxs17("div", { className:
|
|
3246
|
-
/* @__PURE__ */ jsxs17("div", {
|
|
3261
|
+
/* @__PURE__ */ jsxs17("div", { className: imageEditorHeaderClass, children: [
|
|
3262
|
+
/* @__PURE__ */ jsxs17("div", { role: "tablist", className: imageTabListClass, children: [
|
|
3247
3263
|
/* @__PURE__ */ jsx18(
|
|
3248
3264
|
"button",
|
|
3249
3265
|
{
|
|
@@ -3253,7 +3269,9 @@ var ImageEditor = ({
|
|
|
3253
3269
|
setActiveTab("crop");
|
|
3254
3270
|
editor.setTool("crop");
|
|
3255
3271
|
},
|
|
3256
|
-
|
|
3272
|
+
role: "tab",
|
|
3273
|
+
"aria-selected": activeTab === "crop",
|
|
3274
|
+
className: `${imageTabClass(activeTab === "crop")}`,
|
|
3257
3275
|
children: "Transform & Crop"
|
|
3258
3276
|
}
|
|
3259
3277
|
),
|
|
@@ -3266,7 +3284,9 @@ var ImageEditor = ({
|
|
|
3266
3284
|
setActiveTab("adjust");
|
|
3267
3285
|
editor.setTool("select");
|
|
3268
3286
|
},
|
|
3269
|
-
|
|
3287
|
+
role: "tab",
|
|
3288
|
+
"aria-selected": activeTab === "adjust",
|
|
3289
|
+
className: `${imageTabClass(activeTab === "adjust")}`,
|
|
3270
3290
|
children: "Adjustments"
|
|
3271
3291
|
}
|
|
3272
3292
|
),
|
|
@@ -3279,7 +3299,9 @@ var ImageEditor = ({
|
|
|
3279
3299
|
setActiveTab("layers");
|
|
3280
3300
|
editor.setTool("select");
|
|
3281
3301
|
},
|
|
3282
|
-
|
|
3302
|
+
role: "tab",
|
|
3303
|
+
"aria-selected": activeTab === "layers",
|
|
3304
|
+
className: `${imageTabClass(activeTab === "layers")}`,
|
|
3283
3305
|
children: "Layers"
|
|
3284
3306
|
}
|
|
3285
3307
|
),
|
|
@@ -3292,7 +3314,9 @@ var ImageEditor = ({
|
|
|
3292
3314
|
setActiveTab("paint");
|
|
3293
3315
|
editor.setTool("brush");
|
|
3294
3316
|
},
|
|
3295
|
-
|
|
3317
|
+
role: "tab",
|
|
3318
|
+
"aria-selected": activeTab === "paint",
|
|
3319
|
+
className: `${imageTabClass(activeTab === "paint")}`,
|
|
3296
3320
|
children: "Paint"
|
|
3297
3321
|
}
|
|
3298
3322
|
),
|
|
@@ -3305,7 +3329,9 @@ var ImageEditor = ({
|
|
|
3305
3329
|
setActiveTab("select");
|
|
3306
3330
|
editor.setTool("select");
|
|
3307
3331
|
},
|
|
3308
|
-
|
|
3332
|
+
role: "tab",
|
|
3333
|
+
"aria-selected": activeTab === "select",
|
|
3334
|
+
className: `${imageTabClass(activeTab === "select")}`,
|
|
3309
3335
|
children: "Select & Mask"
|
|
3310
3336
|
}
|
|
3311
3337
|
),
|
|
@@ -3318,7 +3344,9 @@ var ImageEditor = ({
|
|
|
3318
3344
|
setActiveTab("annotate");
|
|
3319
3345
|
editor.setTool("pen");
|
|
3320
3346
|
},
|
|
3321
|
-
|
|
3347
|
+
role: "tab",
|
|
3348
|
+
"aria-selected": activeTab === "annotate",
|
|
3349
|
+
className: `${imageTabClass(activeTab === "annotate")}`,
|
|
3322
3350
|
children: "Annotations"
|
|
3323
3351
|
}
|
|
3324
3352
|
),
|
|
@@ -3331,7 +3359,9 @@ var ImageEditor = ({
|
|
|
3331
3359
|
setActiveTab("depth");
|
|
3332
3360
|
editor.setTool("select");
|
|
3333
3361
|
},
|
|
3334
|
-
|
|
3362
|
+
role: "tab",
|
|
3363
|
+
"aria-selected": activeTab === "depth",
|
|
3364
|
+
className: `${imageTabClass(activeTab === "depth")}`,
|
|
3335
3365
|
children: "Depth Mask"
|
|
3336
3366
|
}
|
|
3337
3367
|
),
|
|
@@ -3344,7 +3374,9 @@ var ImageEditor = ({
|
|
|
3344
3374
|
setActiveTab("ai");
|
|
3345
3375
|
editor.setTool("select");
|
|
3346
3376
|
},
|
|
3347
|
-
|
|
3377
|
+
role: "tab",
|
|
3378
|
+
"aria-selected": activeTab === "ai",
|
|
3379
|
+
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
3348
3380
|
children: [
|
|
3349
3381
|
/* @__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
3382
|
"AI Tools"
|
|
@@ -3359,7 +3391,7 @@ var ImageEditor = ({
|
|
|
3359
3391
|
type: "button",
|
|
3360
3392
|
disabled: !editor.canUndo,
|
|
3361
3393
|
onClick: () => editor.undo(),
|
|
3362
|
-
className:
|
|
3394
|
+
className: imageHeaderButtonClass,
|
|
3363
3395
|
title: "Undo",
|
|
3364
3396
|
children: "\u21A9"
|
|
3365
3397
|
}
|
|
@@ -3370,7 +3402,7 @@ var ImageEditor = ({
|
|
|
3370
3402
|
type: "button",
|
|
3371
3403
|
disabled: !editor.canRedo,
|
|
3372
3404
|
onClick: () => editor.redo(),
|
|
3373
|
-
className:
|
|
3405
|
+
className: imageHeaderButtonClass,
|
|
3374
3406
|
title: "Redo",
|
|
3375
3407
|
children: "\u21AA"
|
|
3376
3408
|
}
|
|
@@ -3380,22 +3412,22 @@ var ImageEditor = ({
|
|
|
3380
3412
|
{
|
|
3381
3413
|
type: "button",
|
|
3382
3414
|
onClick: () => editor.reset(),
|
|
3383
|
-
className:
|
|
3415
|
+
className: `${imageHeaderButtonClass} px-2 text-muted-foreground`,
|
|
3384
3416
|
children: "Reset"
|
|
3385
3417
|
}
|
|
3386
3418
|
),
|
|
3387
|
-
/* @__PURE__ */ jsx18("div", { className: "h-4 w-px bg-
|
|
3419
|
+
/* @__PURE__ */ jsx18("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
3388
3420
|
/* @__PURE__ */ jsx18(
|
|
3389
3421
|
"button",
|
|
3390
3422
|
{
|
|
3391
3423
|
type: "button",
|
|
3392
3424
|
onClick: () => editor.zoomOut(),
|
|
3393
|
-
className:
|
|
3425
|
+
className: imageHeaderButtonClass,
|
|
3394
3426
|
title: "Zoom Out",
|
|
3395
3427
|
children: "-"
|
|
3396
3428
|
}
|
|
3397
3429
|
),
|
|
3398
|
-
/* @__PURE__ */ jsxs17("span", { className: "font-mono text-
|
|
3430
|
+
/* @__PURE__ */ jsxs17("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
3399
3431
|
Math.round(state.zoom * 100),
|
|
3400
3432
|
"%"
|
|
3401
3433
|
] }),
|
|
@@ -3404,12 +3436,12 @@ var ImageEditor = ({
|
|
|
3404
3436
|
{
|
|
3405
3437
|
type: "button",
|
|
3406
3438
|
onClick: () => editor.zoomIn(),
|
|
3407
|
-
className:
|
|
3439
|
+
className: imageHeaderButtonClass,
|
|
3408
3440
|
title: "Zoom In",
|
|
3409
3441
|
children: "+"
|
|
3410
3442
|
}
|
|
3411
3443
|
),
|
|
3412
|
-
/* @__PURE__ */ jsx18("div", { className: "h-4 w-px bg-
|
|
3444
|
+
/* @__PURE__ */ jsx18("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
3413
3445
|
/* @__PURE__ */ jsx18(
|
|
3414
3446
|
"button",
|
|
3415
3447
|
{
|
|
@@ -3417,7 +3449,7 @@ var ImageEditor = ({
|
|
|
3417
3449
|
onMouseDown: () => editor.setComparing(true),
|
|
3418
3450
|
onMouseUp: () => editor.setComparing(false),
|
|
3419
3451
|
onMouseLeave: () => editor.setComparing(false),
|
|
3420
|
-
className: "px-2.5 py-1.5 rounded-lg border border-
|
|
3452
|
+
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
3453
|
children: "Hold Compare"
|
|
3422
3454
|
}
|
|
3423
3455
|
),
|
|
@@ -3426,14 +3458,14 @@ var ImageEditor = ({
|
|
|
3426
3458
|
{
|
|
3427
3459
|
type: "button",
|
|
3428
3460
|
onClick: handleExport,
|
|
3429
|
-
className:
|
|
3461
|
+
className: `${imagePrimaryButtonClass} px-4 py-1.5`,
|
|
3430
3462
|
children: "Export Image"
|
|
3431
3463
|
}
|
|
3432
3464
|
)
|
|
3433
3465
|
] })
|
|
3434
3466
|
] }),
|
|
3435
|
-
transformTool.active && /* @__PURE__ */ jsx18(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-
|
|
3436
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */ jsx18("div", { role: "alert", className:
|
|
3467
|
+
transformTool.active && /* @__PURE__ */ jsx18(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
3468
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ jsx18("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
3437
3469
|
/* @__PURE__ */ jsxs17("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
3438
3470
|
/* @__PURE__ */ jsx18(
|
|
3439
3471
|
ImageEditorCanvas,
|
|
@@ -3456,12 +3488,12 @@ var ImageEditor = ({
|
|
|
3456
3488
|
onPlaybackReveal,
|
|
3457
3489
|
chromeRoot: rootRef,
|
|
3458
3490
|
open: openPanel,
|
|
3459
|
-
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-
|
|
3491
|
+
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
3460
3492
|
}
|
|
3461
3493
|
),
|
|
3462
|
-
/* @__PURE__ */ jsxs17("div", { className:
|
|
3494
|
+
/* @__PURE__ */ jsxs17("div", { className: imageSidebarClass, children: [
|
|
3463
3495
|
activeTab === "crop" && /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
3464
|
-
/* @__PURE__ */ jsx18("span", { className:
|
|
3496
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
3465
3497
|
/* @__PURE__ */ jsxs17("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
3466
3498
|
/* @__PURE__ */ jsx18(
|
|
3467
3499
|
"button",
|
|
@@ -3471,7 +3503,7 @@ var ImageEditor = ({
|
|
|
3471
3503
|
setActiveCropRatio(null);
|
|
3472
3504
|
editor.applyCropPreset(null);
|
|
3473
3505
|
},
|
|
3474
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === null && state.crop ? "bg-
|
|
3506
|
+
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
3507
|
children: "Freeform"
|
|
3476
3508
|
}
|
|
3477
3509
|
),
|
|
@@ -3483,7 +3515,7 @@ var ImageEditor = ({
|
|
|
3483
3515
|
setActiveCropRatio(1);
|
|
3484
3516
|
editor.applyCropPreset(1);
|
|
3485
3517
|
},
|
|
3486
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 1 ? "bg-
|
|
3518
|
+
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
3519
|
children: "1:1 Square"
|
|
3488
3520
|
}
|
|
3489
3521
|
),
|
|
@@ -3495,7 +3527,7 @@ var ImageEditor = ({
|
|
|
3495
3527
|
setActiveCropRatio(4 / 3);
|
|
3496
3528
|
editor.applyCropPreset(4 / 3);
|
|
3497
3529
|
},
|
|
3498
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 4 / 3 ? "bg-
|
|
3530
|
+
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
3531
|
children: "4:3 Standard"
|
|
3500
3532
|
}
|
|
3501
3533
|
),
|
|
@@ -3507,7 +3539,7 @@ var ImageEditor = ({
|
|
|
3507
3539
|
setActiveCropRatio(16 / 9);
|
|
3508
3540
|
editor.applyCropPreset(16 / 9);
|
|
3509
3541
|
},
|
|
3510
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 16 / 9 ? "bg-
|
|
3542
|
+
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
3543
|
children: "16:9 Wide"
|
|
3512
3544
|
}
|
|
3513
3545
|
),
|
|
@@ -3519,7 +3551,7 @@ var ImageEditor = ({
|
|
|
3519
3551
|
setActiveCropRatio(3 / 2);
|
|
3520
3552
|
editor.applyCropPreset(3 / 2);
|
|
3521
3553
|
},
|
|
3522
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 3 / 2 ? "bg-
|
|
3554
|
+
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
3555
|
children: "3:2 Photo"
|
|
3524
3556
|
}
|
|
3525
3557
|
),
|
|
@@ -3531,20 +3563,20 @@ var ImageEditor = ({
|
|
|
3531
3563
|
setActiveCropRatio(null);
|
|
3532
3564
|
editor.resetCrop();
|
|
3533
3565
|
},
|
|
3534
|
-
className: "px-2.5 py-2 rounded-lg bg-
|
|
3566
|
+
className: "px-2.5 py-2 rounded-lg bg-destructive/10 hover:bg-destructive/20 text-destructive border border-destructive/40 font-medium",
|
|
3535
3567
|
children: "Clear Crop"
|
|
3536
3568
|
}
|
|
3537
3569
|
)
|
|
3538
3570
|
] }),
|
|
3539
|
-
/* @__PURE__ */ jsx18("div", { className:
|
|
3540
|
-
/* @__PURE__ */ jsx18("span", { className:
|
|
3571
|
+
/* @__PURE__ */ jsx18("div", { className: imageDividerClass }),
|
|
3572
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
3541
3573
|
/* @__PURE__ */ jsxs17("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
3542
3574
|
/* @__PURE__ */ jsx18(
|
|
3543
3575
|
"button",
|
|
3544
3576
|
{
|
|
3545
3577
|
type: "button",
|
|
3546
3578
|
onClick: () => editor.rotate(-90),
|
|
3547
|
-
className: "px-3 py-2 rounded-lg bg-
|
|
3579
|
+
className: "px-3 py-2 rounded-lg bg-muted hover:bg-accent text-foreground border border-border",
|
|
3548
3580
|
children: "Rotate -90\xB0"
|
|
3549
3581
|
}
|
|
3550
3582
|
),
|
|
@@ -3553,7 +3585,7 @@ var ImageEditor = ({
|
|
|
3553
3585
|
{
|
|
3554
3586
|
type: "button",
|
|
3555
3587
|
onClick: () => editor.rotate(90),
|
|
3556
|
-
className: "px-3 py-2 rounded-lg bg-
|
|
3588
|
+
className: "px-3 py-2 rounded-lg bg-muted hover:bg-accent text-foreground border border-border",
|
|
3557
3589
|
children: "Rotate +90\xB0"
|
|
3558
3590
|
}
|
|
3559
3591
|
),
|
|
@@ -3562,7 +3594,7 @@ var ImageEditor = ({
|
|
|
3562
3594
|
{
|
|
3563
3595
|
type: "button",
|
|
3564
3596
|
onClick: () => editor.flipHorizontal(),
|
|
3565
|
-
className: `px-3 py-2 rounded-lg border transition-colors ${state.transform.flipH ? "bg-
|
|
3597
|
+
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
3598
|
children: "Flip Horizontal"
|
|
3567
3599
|
}
|
|
3568
3600
|
),
|
|
@@ -3571,7 +3603,7 @@ var ImageEditor = ({
|
|
|
3571
3603
|
{
|
|
3572
3604
|
type: "button",
|
|
3573
3605
|
onClick: () => editor.flipVertical(),
|
|
3574
|
-
className: `px-3 py-2 rounded-lg border transition-colors ${state.transform.flipV ? "bg-
|
|
3606
|
+
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
3607
|
children: "Flip Vertical"
|
|
3576
3608
|
}
|
|
3577
3609
|
)
|
|
@@ -3579,13 +3611,13 @@ var ImageEditor = ({
|
|
|
3579
3611
|
] }),
|
|
3580
3612
|
activeTab === "adjust" && /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
3581
3613
|
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between", children: [
|
|
3582
|
-
/* @__PURE__ */ jsx18("span", { className:
|
|
3614
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
3583
3615
|
/* @__PURE__ */ jsx18(
|
|
3584
3616
|
"button",
|
|
3585
3617
|
{
|
|
3586
3618
|
type: "button",
|
|
3587
3619
|
onClick: () => editor.resetAdjustments(),
|
|
3588
|
-
className: "text-[10px] text-
|
|
3620
|
+
className: "text-[10px] text-destructive hover:underline",
|
|
3589
3621
|
children: "Reset Sliders"
|
|
3590
3622
|
}
|
|
3591
3623
|
)
|
|
@@ -3604,7 +3636,7 @@ var ImageEditor = ({
|
|
|
3604
3636
|
spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs17(
|
|
3605
3637
|
"div",
|
|
3606
3638
|
{
|
|
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-
|
|
3639
|
+
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
3640
|
"data-testid": "image-editor-process-notice",
|
|
3609
3641
|
children: [
|
|
3610
3642
|
/* @__PURE__ */ jsx18("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
@@ -3621,7 +3653,7 @@ var ImageEditor = ({
|
|
|
3621
3653
|
}
|
|
3622
3654
|
)
|
|
3623
3655
|
] }, spec.id)),
|
|
3624
|
-
/* @__PURE__ */ jsx18("div", { className:
|
|
3656
|
+
/* @__PURE__ */ jsx18("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx18(
|
|
3625
3657
|
AdjustmentLayersPanel,
|
|
3626
3658
|
{
|
|
3627
3659
|
controller,
|
|
@@ -3631,82 +3663,82 @@ var ImageEditor = ({
|
|
|
3631
3663
|
) })
|
|
3632
3664
|
] }),
|
|
3633
3665
|
activeTab === "layers" && /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
3634
|
-
/* @__PURE__ */ jsx18("span", { className:
|
|
3666
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
3635
3667
|
/* @__PURE__ */ jsx18(
|
|
3636
3668
|
"button",
|
|
3637
3669
|
{
|
|
3638
3670
|
type: "button",
|
|
3639
3671
|
title: "Edit \u203A Free Transform (Ctrl/Cmd+T): the selected pixels, or the whole active layer",
|
|
3640
|
-
className:
|
|
3672
|
+
className: imageSmallButtonClass,
|
|
3641
3673
|
disabled: transformTool.active,
|
|
3642
3674
|
onClick: () => transformTool.begin(),
|
|
3643
3675
|
children: "Free Transform"
|
|
3644
3676
|
}
|
|
3645
3677
|
),
|
|
3646
3678
|
/* @__PURE__ */ jsx18(LayersPanel, { controller }),
|
|
3647
|
-
effectsShown && /* @__PURE__ */ jsx18(ImageProviderEffectsPanel, { controller, className:
|
|
3648
|
-
/* @__PURE__ */ jsx18("span", { className:
|
|
3679
|
+
effectsShown && /* @__PURE__ */ jsx18(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
3680
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
3649
3681
|
/* @__PURE__ */ jsx18(ColorProfilePanel, { controller })
|
|
3650
3682
|
] }),
|
|
3651
3683
|
activeTab === "paint" && /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
3652
|
-
/* @__PURE__ */ jsx18("span", { className:
|
|
3684
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
3653
3685
|
/* @__PURE__ */ jsx18(BrushOptionsBar, { controller }),
|
|
3654
3686
|
/* @__PURE__ */ jsx18(
|
|
3655
3687
|
"button",
|
|
3656
3688
|
{
|
|
3657
3689
|
type: "button",
|
|
3658
3690
|
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-
|
|
3691
|
+
className: "px-2 py-1 rounded text-[11px] bg-muted text-foreground hover:bg-accent hover:text-accent-foreground self-start",
|
|
3660
3692
|
disabled: transformTool.active,
|
|
3661
3693
|
onClick: () => transformTool.begin(),
|
|
3662
3694
|
children: "Free Transform"
|
|
3663
3695
|
}
|
|
3664
3696
|
),
|
|
3665
|
-
paintError && /* @__PURE__ */ jsx18("p", { role: "alert", className: "text-
|
|
3666
|
-
/* @__PURE__ */ jsx18("div", { className:
|
|
3697
|
+
paintError && /* @__PURE__ */ jsx18("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
3698
|
+
/* @__PURE__ */ jsx18("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx18(LayersPanel, { controller }) })
|
|
3667
3699
|
] }),
|
|
3668
3700
|
activeTab === "annotate" && /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
3669
|
-
/* @__PURE__ */ jsx18("span", { className:
|
|
3701
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
|
|
3670
3702
|
/* @__PURE__ */ jsx18("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ jsx18(
|
|
3671
3703
|
"button",
|
|
3672
3704
|
{
|
|
3673
3705
|
type: "button",
|
|
3674
3706
|
"aria-pressed": state.activeTool === t,
|
|
3675
3707
|
onClick: () => editor.setTool(t),
|
|
3676
|
-
className: `py-1.5 px-2 rounded-lg font-medium border transition-colors ${state.activeTool === t ? "bg-
|
|
3708
|
+
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
3709
|
children: t === "shape" ? "Shape" : "Type"
|
|
3678
3710
|
},
|
|
3679
3711
|
t
|
|
3680
3712
|
)) }),
|
|
3681
3713
|
state.activeTool === "shape" && /* @__PURE__ */ jsx18(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
3682
3714
|
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:
|
|
3715
|
+
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" }),
|
|
3716
|
+
shapeTypeError && /* @__PURE__ */ jsx18("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
3717
|
+
/* @__PURE__ */ jsx18("div", { className: imageDividerClass }),
|
|
3718
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
3687
3719
|
/* @__PURE__ */ jsx18("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ jsx18(
|
|
3688
3720
|
"button",
|
|
3689
3721
|
{
|
|
3690
3722
|
type: "button",
|
|
3691
3723
|
onClick: () => editor.setTool(t),
|
|
3692
|
-
className: `py-1.5 px-2 rounded-lg font-medium capitalize border transition-colors ${state.activeTool === t ? "bg-
|
|
3724
|
+
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
3725
|
children: t
|
|
3694
3726
|
},
|
|
3695
3727
|
t
|
|
3696
3728
|
)) }),
|
|
3697
3729
|
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
3698
|
-
/* @__PURE__ */ jsx18("label", { className: "text-
|
|
3730
|
+
/* @__PURE__ */ jsx18("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
3699
3731
|
/* @__PURE__ */ jsx18(
|
|
3700
3732
|
"input",
|
|
3701
3733
|
{
|
|
3702
3734
|
type: "color",
|
|
3703
3735
|
value: activeColor,
|
|
3704
3736
|
onChange: (e) => setActiveColor(e.target.value),
|
|
3705
|
-
className: "w-8 h-8 rounded border border-
|
|
3737
|
+
className: "w-8 h-8 rounded border border-border cursor-pointer bg-transparent"
|
|
3706
3738
|
}
|
|
3707
3739
|
),
|
|
3708
3740
|
/* @__PURE__ */ jsxs17("div", { className: "flex-1 ml-2", children: [
|
|
3709
|
-
/* @__PURE__ */ jsxs17("div", { className: "flex justify-between text-
|
|
3741
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
3710
3742
|
/* @__PURE__ */ jsx18("span", { children: "Width:" }),
|
|
3711
3743
|
/* @__PURE__ */ jsxs17("span", { className: "font-mono", children: [
|
|
3712
3744
|
strokeWidth,
|
|
@@ -3721,13 +3753,13 @@ var ImageEditor = ({
|
|
|
3721
3753
|
max: "20",
|
|
3722
3754
|
value: strokeWidth,
|
|
3723
3755
|
onChange: (e) => setStrokeWidth(Number(e.target.value)),
|
|
3724
|
-
className:
|
|
3756
|
+
className: imageRangeClass
|
|
3725
3757
|
}
|
|
3726
3758
|
)
|
|
3727
3759
|
] })
|
|
3728
3760
|
] }),
|
|
3729
|
-
/* @__PURE__ */ jsx18("div", { className:
|
|
3730
|
-
/* @__PURE__ */ jsx18("span", { className:
|
|
3761
|
+
/* @__PURE__ */ jsx18("div", { className: imageDividerClass }),
|
|
3762
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
3731
3763
|
/* @__PURE__ */ jsxs17("div", { className: "flex gap-2", children: [
|
|
3732
3764
|
/* @__PURE__ */ jsx18(
|
|
3733
3765
|
"input",
|
|
@@ -3737,7 +3769,7 @@ var ImageEditor = ({
|
|
|
3737
3769
|
value: textInput,
|
|
3738
3770
|
onChange: (e) => setTextInput(e.target.value),
|
|
3739
3771
|
onKeyDown: (e) => e.key === "Enter" && handleAddText(),
|
|
3740
|
-
className: "flex-1 bg-
|
|
3772
|
+
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
3773
|
}
|
|
3742
3774
|
),
|
|
3743
3775
|
/* @__PURE__ */ jsx18(
|
|
@@ -3745,12 +3777,12 @@ var ImageEditor = ({
|
|
|
3745
3777
|
{
|
|
3746
3778
|
type: "button",
|
|
3747
3779
|
onClick: handleAddText,
|
|
3748
|
-
className: "px-3 py-1.5 rounded-lg bg-
|
|
3780
|
+
className: "px-3 py-1.5 rounded-lg bg-primary hover:bg-primary/90 text-primary-foreground font-medium shadow",
|
|
3749
3781
|
children: "Add"
|
|
3750
3782
|
}
|
|
3751
3783
|
)
|
|
3752
3784
|
] }),
|
|
3753
|
-
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between text-
|
|
3785
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
3754
3786
|
/* @__PURE__ */ jsx18("span", { children: "Font Size:" }),
|
|
3755
3787
|
/* @__PURE__ */ jsxs17("span", { className: "font-mono", children: [
|
|
3756
3788
|
fontSize,
|
|
@@ -3765,12 +3797,12 @@ var ImageEditor = ({
|
|
|
3765
3797
|
max: "72",
|
|
3766
3798
|
value: fontSize,
|
|
3767
3799
|
onChange: (e) => setFontSize(Number(e.target.value)),
|
|
3768
|
-
className:
|
|
3800
|
+
className: imageRangeClass
|
|
3769
3801
|
}
|
|
3770
3802
|
),
|
|
3771
|
-
/* @__PURE__ */ jsx18("div", { className:
|
|
3803
|
+
/* @__PURE__ */ jsx18("div", { className: imageDividerClass }),
|
|
3772
3804
|
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between", children: [
|
|
3773
|
-
/* @__PURE__ */ jsxs17("span", { className: "text-
|
|
3805
|
+
/* @__PURE__ */ jsxs17("span", { className: "text-muted-foreground", children: [
|
|
3774
3806
|
"Layers (",
|
|
3775
3807
|
state.annotations.length,
|
|
3776
3808
|
")"
|
|
@@ -3780,7 +3812,7 @@ var ImageEditor = ({
|
|
|
3780
3812
|
{
|
|
3781
3813
|
type: "button",
|
|
3782
3814
|
onClick: () => editor.removeAnnotation(state.selectedAnnotationId),
|
|
3783
|
-
className: "text-
|
|
3815
|
+
className: "text-destructive hover:underline text-[11px]",
|
|
3784
3816
|
children: "Delete Selected"
|
|
3785
3817
|
}
|
|
3786
3818
|
),
|
|
@@ -3789,7 +3821,7 @@ var ImageEditor = ({
|
|
|
3789
3821
|
{
|
|
3790
3822
|
type: "button",
|
|
3791
3823
|
onClick: () => editor.clearAnnotations(),
|
|
3792
|
-
className: "text-
|
|
3824
|
+
className: "text-muted-foreground hover:text-foreground text-[11px]",
|
|
3793
3825
|
children: "Clear All"
|
|
3794
3826
|
}
|
|
3795
3827
|
)
|
|
@@ -3797,32 +3829,32 @@ var ImageEditor = ({
|
|
|
3797
3829
|
] }),
|
|
3798
3830
|
activeTab === "depth" && /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
3799
3831
|
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between", children: [
|
|
3800
|
-
/* @__PURE__ */ jsx18("span", { className:
|
|
3832
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
3801
3833
|
/* @__PURE__ */ jsx18(
|
|
3802
3834
|
"button",
|
|
3803
3835
|
{
|
|
3804
3836
|
type: "button",
|
|
3805
3837
|
onClick: () => editor.resetDepthMask(),
|
|
3806
|
-
className: "text-[10px] text-
|
|
3838
|
+
className: "text-[10px] text-destructive hover:underline",
|
|
3807
3839
|
children: "Reset Mask"
|
|
3808
3840
|
}
|
|
3809
3841
|
)
|
|
3810
3842
|
] }),
|
|
3811
|
-
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 cursor-pointer text-
|
|
3843
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
3812
3844
|
/* @__PURE__ */ jsx18(
|
|
3813
3845
|
"input",
|
|
3814
3846
|
{
|
|
3815
3847
|
type: "checkbox",
|
|
3816
3848
|
checked: state.depthMask.enabled,
|
|
3817
3849
|
onChange: (e) => editor.setDepthMask({ enabled: e.target.checked }),
|
|
3818
|
-
className: "rounded accent-
|
|
3850
|
+
className: "rounded accent-primary"
|
|
3819
3851
|
}
|
|
3820
3852
|
),
|
|
3821
3853
|
/* @__PURE__ */ jsx18("span", { children: "Enable Depth / Alpha Mask" })
|
|
3822
3854
|
] }),
|
|
3823
3855
|
state.depthMask.enabled && /* @__PURE__ */ jsxs17(Fragment5, { children: [
|
|
3824
3856
|
/* @__PURE__ */ jsxs17("div", { children: [
|
|
3825
|
-
/* @__PURE__ */ jsx18("label", { className: "text-
|
|
3857
|
+
/* @__PURE__ */ jsx18("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
3826
3858
|
/* @__PURE__ */ jsx18(
|
|
3827
3859
|
"input",
|
|
3828
3860
|
{
|
|
@@ -3830,7 +3862,7 @@ var ImageEditor = ({
|
|
|
3830
3862
|
placeholder: "https://.../depthmap.png",
|
|
3831
3863
|
value: state.depthMask.maskSource || "",
|
|
3832
3864
|
onChange: (e) => editor.setDepthMask({ maskSource: e.target.value || null }),
|
|
3833
|
-
className: "w-full bg-
|
|
3865
|
+
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
3866
|
}
|
|
3835
3867
|
)
|
|
3836
3868
|
] }),
|
|
@@ -3840,7 +3872,7 @@ var ImageEditor = ({
|
|
|
3840
3872
|
{
|
|
3841
3873
|
type: "button",
|
|
3842
3874
|
onClick: () => editor.setDepthMask({ mode: "threshold" }),
|
|
3843
|
-
className: `flex-1 py-1.5 rounded-lg border text-xs font-medium ${state.depthMask.mode === "threshold" ? "bg-
|
|
3875
|
+
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
3876
|
children: "Threshold Mode"
|
|
3845
3877
|
}
|
|
3846
3878
|
),
|
|
@@ -3849,13 +3881,13 @@ var ImageEditor = ({
|
|
|
3849
3881
|
{
|
|
3850
3882
|
type: "button",
|
|
3851
3883
|
onClick: () => editor.setDepthMask({ mode: "brightness" }),
|
|
3852
|
-
className: `flex-1 py-1.5 rounded-lg border text-xs font-medium ${state.depthMask.mode === "brightness" ? "bg-
|
|
3884
|
+
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
3885
|
children: "Brightness Mode"
|
|
3854
3886
|
}
|
|
3855
3887
|
)
|
|
3856
3888
|
] }),
|
|
3857
3889
|
/* @__PURE__ */ jsxs17("div", { children: [
|
|
3858
|
-
/* @__PURE__ */ jsxs17("div", { className: "flex justify-between text-
|
|
3890
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
3859
3891
|
/* @__PURE__ */ jsx18("span", { children: "Depth Start (Lower):" }),
|
|
3860
3892
|
/* @__PURE__ */ jsx18("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
3861
3893
|
] }),
|
|
@@ -3869,12 +3901,12 @@ var ImageEditor = ({
|
|
|
3869
3901
|
onChange: (e) => editor.setDepthMask({
|
|
3870
3902
|
depthRange: [Number(e.target.value), state.depthMask.depthRange[1]]
|
|
3871
3903
|
}),
|
|
3872
|
-
className:
|
|
3904
|
+
className: imageRangeClass
|
|
3873
3905
|
}
|
|
3874
3906
|
)
|
|
3875
3907
|
] }),
|
|
3876
3908
|
/* @__PURE__ */ jsxs17("div", { children: [
|
|
3877
|
-
/* @__PURE__ */ jsxs17("div", { className: "flex justify-between text-
|
|
3909
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
3878
3910
|
/* @__PURE__ */ jsx18("span", { children: "Depth Stop (Upper):" }),
|
|
3879
3911
|
/* @__PURE__ */ jsx18("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
3880
3912
|
] }),
|
|
@@ -3888,12 +3920,12 @@ var ImageEditor = ({
|
|
|
3888
3920
|
onChange: (e) => editor.setDepthMask({
|
|
3889
3921
|
depthRange: [state.depthMask.depthRange[0], Number(e.target.value)]
|
|
3890
3922
|
}),
|
|
3891
|
-
className:
|
|
3923
|
+
className: imageRangeClass
|
|
3892
3924
|
}
|
|
3893
3925
|
)
|
|
3894
3926
|
] }),
|
|
3895
3927
|
/* @__PURE__ */ jsxs17("div", { children: [
|
|
3896
|
-
/* @__PURE__ */ jsxs17("div", { className: "flex justify-between text-
|
|
3928
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
3897
3929
|
/* @__PURE__ */ jsx18("span", { children: "Softness:" }),
|
|
3898
3930
|
/* @__PURE__ */ jsx18("span", { className: "font-mono", children: state.depthMask.softness })
|
|
3899
3931
|
] }),
|
|
@@ -3905,18 +3937,18 @@ var ImageEditor = ({
|
|
|
3905
3937
|
max: "50",
|
|
3906
3938
|
value: state.depthMask.softness,
|
|
3907
3939
|
onChange: (e) => editor.setDepthMask({ softness: Number(e.target.value) }),
|
|
3908
|
-
className:
|
|
3940
|
+
className: imageRangeClass
|
|
3909
3941
|
}
|
|
3910
3942
|
)
|
|
3911
3943
|
] }),
|
|
3912
|
-
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 cursor-pointer text-
|
|
3944
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
3913
3945
|
/* @__PURE__ */ jsx18(
|
|
3914
3946
|
"input",
|
|
3915
3947
|
{
|
|
3916
3948
|
type: "checkbox",
|
|
3917
3949
|
checked: state.depthMask.invert,
|
|
3918
3950
|
onChange: (e) => editor.setDepthMask({ invert: e.target.checked }),
|
|
3919
|
-
className: "rounded accent-
|
|
3951
|
+
className: "rounded accent-primary"
|
|
3920
3952
|
}
|
|
3921
3953
|
),
|
|
3922
3954
|
/* @__PURE__ */ jsx18("span", { children: "Invert Mask" })
|
|
@@ -3934,14 +3966,14 @@ var ImageEditor = ({
|
|
|
3934
3966
|
quickMask: Boolean(state.quickMask)
|
|
3935
3967
|
}
|
|
3936
3968
|
),
|
|
3937
|
-
selectionError && /* @__PURE__ */ jsx18("p", { role: "alert", className: "text-
|
|
3969
|
+
selectionError && /* @__PURE__ */ jsx18("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
3938
3970
|
/* @__PURE__ */ jsxs17("div", { className: "flex gap-1", children: [
|
|
3939
3971
|
/* @__PURE__ */ jsx18(
|
|
3940
3972
|
"button",
|
|
3941
3973
|
{
|
|
3942
3974
|
type: "button",
|
|
3943
3975
|
title: "Select \u203A Transform Selection: the outline only",
|
|
3944
|
-
className:
|
|
3976
|
+
className: imageSmallButtonClass,
|
|
3945
3977
|
disabled: transformTool.active,
|
|
3946
3978
|
onClick: () => transformTool.begin({ content: "selection-outline" }),
|
|
3947
3979
|
children: "Transform Selection"
|
|
@@ -3952,7 +3984,7 @@ var ImageEditor = ({
|
|
|
3952
3984
|
{
|
|
3953
3985
|
type: "button",
|
|
3954
3986
|
title: "Edit \u203A Free Transform: the selected pixels of the active layer",
|
|
3955
|
-
className:
|
|
3987
|
+
className: imageSmallButtonClass,
|
|
3956
3988
|
disabled: transformTool.active,
|
|
3957
3989
|
onClick: () => transformTool.begin({ content: "selection" }),
|
|
3958
3990
|
children: "Free Transform Pixels"
|
|
@@ -3962,7 +3994,7 @@ var ImageEditor = ({
|
|
|
3962
3994
|
/* @__PURE__ */ jsx18(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers })
|
|
3963
3995
|
] }),
|
|
3964
3996
|
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-
|
|
3997
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
3966
3998
|
/* @__PURE__ */ jsx18("span", { children: "Results go to" }),
|
|
3967
3999
|
/* @__PURE__ */ jsxs17(
|
|
3968
4000
|
"select",
|
|
@@ -3970,7 +4002,7 @@ var ImageEditor = ({
|
|
|
3970
4002
|
"aria-label": "AI result target",
|
|
3971
4003
|
value: aiTarget,
|
|
3972
4004
|
onChange: (e) => setAiTarget(e.target.value),
|
|
3973
|
-
className:
|
|
4005
|
+
className: imageSelectClass,
|
|
3974
4006
|
children: [
|
|
3975
4007
|
/* @__PURE__ */ jsx18("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
3976
4008
|
/* @__PURE__ */ jsx18("option", { value: "new-layer", children: "New layer / mask" }),
|
|
@@ -3979,24 +4011,24 @@ var ImageEditor = ({
|
|
|
3979
4011
|
}
|
|
3980
4012
|
)
|
|
3981
4013
|
] }),
|
|
3982
|
-
/* @__PURE__ */ jsxs17("div", { className: "p-3 rounded-lg bg-
|
|
4014
|
+
/* @__PURE__ */ jsxs17("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
3983
4015
|
/* @__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-
|
|
4016
|
+
/* @__PURE__ */ jsxs17("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
4017
|
+
/* @__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
4018
|
"Background Removal"
|
|
3987
4019
|
] }),
|
|
3988
|
-
isRemovingBg && /* @__PURE__ */ jsx18("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-
|
|
4020
|
+
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
4021
|
] }),
|
|
3990
|
-
/* @__PURE__ */ jsx18("p", { className: "text-
|
|
4022
|
+
/* @__PURE__ */ jsx18("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
3991
4023
|
/* @__PURE__ */ jsx18(
|
|
3992
4024
|
"button",
|
|
3993
4025
|
{
|
|
3994
4026
|
type: "button",
|
|
3995
4027
|
onClick: handleRemoveBackground,
|
|
3996
4028
|
disabled: isRemovingBg || isInpainting,
|
|
3997
|
-
className: "mt-1 px-3 py-2 rounded-lg bg-
|
|
4029
|
+
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
4030
|
children: isRemovingBg ? /* @__PURE__ */ jsxs17(Fragment5, { children: [
|
|
3999
|
-
/* @__PURE__ */ jsx18("div", { className:
|
|
4031
|
+
/* @__PURE__ */ jsx18("div", { className: imageSpinnerClass }),
|
|
4000
4032
|
"Removing Background..."
|
|
4001
4033
|
] }) : /* @__PURE__ */ jsxs17(Fragment5, { children: [
|
|
4002
4034
|
/* @__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 +4037,20 @@ var ImageEditor = ({
|
|
|
4005
4037
|
}
|
|
4006
4038
|
)
|
|
4007
4039
|
] }),
|
|
4008
|
-
/* @__PURE__ */ jsxs17("div", { className: "p-3 rounded-lg bg-
|
|
4040
|
+
/* @__PURE__ */ jsxs17("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
4009
4041
|
/* @__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-
|
|
4042
|
+
/* @__PURE__ */ jsxs17("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
4043
|
+
/* @__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
4044
|
/* @__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
4045
|
/* @__PURE__ */ jsx18("path", { d: "m14 7 3 3" })
|
|
4014
4046
|
] }),
|
|
4015
4047
|
"Generative Inpainting"
|
|
4016
4048
|
] }),
|
|
4017
|
-
isInpainting && /* @__PURE__ */ jsx18("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-
|
|
4049
|
+
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
4050
|
] }),
|
|
4019
|
-
/* @__PURE__ */ jsx18("p", { className: "text-
|
|
4051
|
+
/* @__PURE__ */ jsx18("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
|
|
4020
4052
|
/* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-1", children: [
|
|
4021
|
-
/* @__PURE__ */ jsx18("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-
|
|
4053
|
+
/* @__PURE__ */ jsx18("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
4022
4054
|
/* @__PURE__ */ jsx18(
|
|
4023
4055
|
"textarea",
|
|
4024
4056
|
{
|
|
@@ -4027,19 +4059,19 @@ var ImageEditor = ({
|
|
|
4027
4059
|
onChange: (e) => setInpaintPrompt(e.target.value),
|
|
4028
4060
|
placeholder: "e.g. replace sunglasses with steampunk goggles, remove person in background...",
|
|
4029
4061
|
rows: 3,
|
|
4030
|
-
className: "w-full bg-
|
|
4062
|
+
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
4063
|
}
|
|
4032
4064
|
)
|
|
4033
4065
|
] }),
|
|
4034
4066
|
/* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-1", children: [
|
|
4035
|
-
/* @__PURE__ */ jsx18("span", { className: "text-
|
|
4067
|
+
/* @__PURE__ */ jsx18("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
4036
4068
|
/* @__PURE__ */ jsxs17("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
4037
4069
|
/* @__PURE__ */ jsxs17(
|
|
4038
4070
|
"button",
|
|
4039
4071
|
{
|
|
4040
4072
|
type: "button",
|
|
4041
4073
|
onClick: () => setInpaintMaskMode("annotations"),
|
|
4042
|
-
className: `px-2 py-1.5 rounded border text-[11px] font-medium text-left transition-colors ${inpaintMaskMode === "annotations" ? "bg-
|
|
4074
|
+
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
4075
|
children: [
|
|
4044
4076
|
"Drawn Shapes (",
|
|
4045
4077
|
state.annotations.length,
|
|
@@ -4052,7 +4084,7 @@ var ImageEditor = ({
|
|
|
4052
4084
|
{
|
|
4053
4085
|
type: "button",
|
|
4054
4086
|
onClick: () => setInpaintMaskMode("crop"),
|
|
4055
|
-
className: `px-2 py-1.5 rounded border text-[11px] font-medium text-left transition-colors ${inpaintMaskMode === "crop" ? "bg-
|
|
4087
|
+
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
4088
|
children: [
|
|
4057
4089
|
"Crop Box (",
|
|
4058
4090
|
state.crop ? "Selected" : "Full",
|
|
@@ -4068,9 +4100,9 @@ var ImageEditor = ({
|
|
|
4068
4100
|
type: "button",
|
|
4069
4101
|
onClick: handleInpaint,
|
|
4070
4102
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
4071
|
-
className: "mt-1 px-3 py-2 rounded-lg bg-
|
|
4103
|
+
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
4104
|
children: isInpainting ? /* @__PURE__ */ jsxs17(Fragment5, { children: [
|
|
4073
|
-
/* @__PURE__ */ jsx18("div", { className:
|
|
4105
|
+
/* @__PURE__ */ jsx18("div", { className: imageSpinnerClass }),
|
|
4074
4106
|
"Generating Inpaint..."
|
|
4075
4107
|
] }) : /* @__PURE__ */ jsxs17(Fragment5, { children: [
|
|
4076
4108
|
/* @__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 +4111,8 @@ var ImageEditor = ({
|
|
|
4079
4111
|
}
|
|
4080
4112
|
)
|
|
4081
4113
|
] }),
|
|
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-
|
|
4114
|
+
aiError && /* @__PURE__ */ jsx18("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
|
|
4115
|
+
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
4116
|
] })
|
|
4085
4117
|
] })
|
|
4086
4118
|
] })
|