@pixerate/editor-react 0.112.1 → 0.113.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-X2AGIMF3.js → chunk-CVYTRTFT.js} +710 -779
- package/dist/image-editor/controls/controls.d.cts +66 -0
- package/dist/image-editor/controls/controls.d.ts +66 -0
- package/dist/image-editor/index.cjs +1042 -1106
- package/dist/image-editor/index.d.cts +1 -0
- package/dist/image-editor/index.d.ts +1 -0
- package/dist/image-editor/index.js +11 -1
- package/dist/index.cjs +1551 -1615
- package/dist/index.js +11 -1
- package/package.json +3 -3
|
@@ -382,6 +382,7 @@ var ImageEditorCanvas = ({
|
|
|
382
382
|
viewportWidth: viewport.width,
|
|
383
383
|
viewportHeight: viewport.height,
|
|
384
384
|
pixelRatio: viewport.pixelRatio,
|
|
385
|
+
hostScale: viewport.hostScale,
|
|
385
386
|
fit,
|
|
386
387
|
showCropOverlay: mode === "crop",
|
|
387
388
|
showSelectionOverlay: true,
|
|
@@ -949,37 +950,109 @@ var ImageEditorCanvas = ({
|
|
|
949
950
|
|
|
950
951
|
// src/image-editor/ControlSlider.tsx
|
|
951
952
|
import { controlTrackBackground, formatControlValue } from "@pixerate/editor/image-editor";
|
|
953
|
+
|
|
954
|
+
// src/image-editor/controls/controls.tsx
|
|
955
|
+
import { createContext, useContext } from "react";
|
|
956
|
+
|
|
957
|
+
// src/image-editor/styles.ts
|
|
958
|
+
var imageEditorFrameClass = "relative flex flex-col bg-background border border-border rounded-xl overflow-hidden shadow-sm text-foreground";
|
|
959
|
+
var imageEditorHeaderClass = "flex flex-wrap items-center justify-between px-4 py-3 bg-muted/40 border-b border-border gap-3";
|
|
960
|
+
var imageTabListClass = "flex items-center gap-1 bg-background p-1 rounded-lg border border-border text-xs";
|
|
961
|
+
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"}`;
|
|
962
|
+
var imageHeaderButtonClass = "p-1.5 rounded-lg border border-border bg-background text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed";
|
|
963
|
+
var imagePrimaryButtonClass = "rounded-lg bg-primary hover:bg-primary/90 text-primary-foreground font-medium shadow transition-colors disabled:opacity-50";
|
|
964
|
+
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]";
|
|
965
|
+
var imageSectionTitleClass = "font-semibold text-foreground uppercase tracking-wider text-[11px]";
|
|
966
|
+
var imageSectionClass = "border-t border-border pt-3";
|
|
967
|
+
var imageDividerClass = "h-px bg-border my-1";
|
|
968
|
+
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";
|
|
969
|
+
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";
|
|
970
|
+
var imageOutlineButtonClass = "rounded border border-border px-1.5 py-0.5 text-[11px] text-foreground hover:bg-muted disabled:opacity-40";
|
|
971
|
+
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"}`;
|
|
972
|
+
var imageFieldClass = "rounded border border-input bg-background px-1 py-0.5 text-foreground";
|
|
973
|
+
var imageSelectClass = "rounded border border-input bg-background px-1.5 py-1 text-foreground";
|
|
974
|
+
var imageColorInputClass = "h-6 w-8 rounded border border-border bg-transparent";
|
|
975
|
+
var imageRangeClass = "w-full accent-primary";
|
|
976
|
+
var imageErrorBannerClass = "border-b border-destructive/40 bg-destructive/10 px-4 py-1.5 text-xs text-destructive";
|
|
977
|
+
var imageSpinnerClass = "w-3.5 h-3.5 border-2 border-primary-foreground/30 border-t-primary-foreground rounded-full animate-spin";
|
|
978
|
+
|
|
979
|
+
// src/image-editor/controls/controls.tsx
|
|
952
980
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
981
|
+
var ControlsContext = createContext({});
|
|
982
|
+
function ImageEditorControlsProvider({ controls, children }) {
|
|
983
|
+
return /* @__PURE__ */ jsx2(ControlsContext.Provider, { value: controls, children });
|
|
984
|
+
}
|
|
985
|
+
function useImageEditorControls() {
|
|
986
|
+
return useContext(ControlsContext);
|
|
987
|
+
}
|
|
988
|
+
function ImageCheckbox(props) {
|
|
989
|
+
const Host = useImageEditorControls().Checkbox;
|
|
990
|
+
if (Host) return /* @__PURE__ */ jsx2(Host, { ...props });
|
|
991
|
+
const { checked, label, disabled, onChange, className = "" } = props;
|
|
992
|
+
return /* @__PURE__ */ jsx2(
|
|
993
|
+
"input",
|
|
994
|
+
{
|
|
995
|
+
type: "checkbox",
|
|
996
|
+
"aria-label": label,
|
|
997
|
+
checked,
|
|
998
|
+
disabled,
|
|
999
|
+
onChange: (e) => onChange(e.target.checked),
|
|
1000
|
+
className: `accent-primary ${className}`
|
|
1001
|
+
}
|
|
1002
|
+
);
|
|
1003
|
+
}
|
|
1004
|
+
function ImageRange(props) {
|
|
1005
|
+
const Host = useImageEditorControls().Range;
|
|
1006
|
+
if (Host) return /* @__PURE__ */ jsx2(Host, { ...props });
|
|
1007
|
+
const { value, min, max, step, label, disabled, onChange, onStart, onEnd, className = "" } = props;
|
|
1008
|
+
return /* @__PURE__ */ jsx2(
|
|
1009
|
+
"input",
|
|
1010
|
+
{
|
|
1011
|
+
type: "range",
|
|
1012
|
+
"aria-label": label,
|
|
1013
|
+
min,
|
|
1014
|
+
max,
|
|
1015
|
+
step,
|
|
1016
|
+
value,
|
|
1017
|
+
disabled,
|
|
1018
|
+
onPointerDown: () => onStart?.(),
|
|
1019
|
+
onPointerUp: () => onEnd?.(),
|
|
1020
|
+
onKeyDown: () => onStart?.(),
|
|
1021
|
+
onKeyUp: () => onEnd?.(),
|
|
1022
|
+
onChange: (e) => onChange(Number(e.target.value)),
|
|
1023
|
+
className: `w-full accent-primary disabled:opacity-40 ${className}`
|
|
1024
|
+
}
|
|
1025
|
+
);
|
|
1026
|
+
}
|
|
1027
|
+
function ImageSelect(props) {
|
|
1028
|
+
const Host = useImageEditorControls().Select;
|
|
1029
|
+
if (Host) return /* @__PURE__ */ jsx2(Host, { ...props });
|
|
1030
|
+
const { value, options, label, placeholder, disabled, onChange, className = "" } = props;
|
|
1031
|
+
return /* @__PURE__ */ jsxs2("select", { "aria-label": label, value, disabled, onChange: (e) => onChange(e.target.value), className: `${imageSelectClass} ${className}`, children: [
|
|
1032
|
+
placeholder !== void 0 && /* @__PURE__ */ jsx2("option", { value: "", children: placeholder }),
|
|
1033
|
+
options.map((o) => /* @__PURE__ */ jsx2("option", { value: o.value, children: o.label }, o.value))
|
|
1034
|
+
] });
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
// src/image-editor/ControlSlider.tsx
|
|
1038
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
953
1039
|
var ControlSlider = ({ spec, value, onChange, disabled, label, className }) => {
|
|
954
1040
|
const name = label ?? spec.label;
|
|
955
1041
|
const track = controlTrackBackground(spec);
|
|
956
|
-
return /* @__PURE__ */
|
|
957
|
-
/* @__PURE__ */
|
|
958
|
-
/* @__PURE__ */
|
|
959
|
-
/* @__PURE__ */
|
|
1042
|
+
return /* @__PURE__ */ jsxs3("div", { "data-control-id": spec.id, className, children: [
|
|
1043
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
1044
|
+
/* @__PURE__ */ jsx3("span", { children: name }),
|
|
1045
|
+
/* @__PURE__ */ jsx3("span", { className: "font-mono", children: formatControlValue(spec, value) })
|
|
960
1046
|
] }),
|
|
961
|
-
/* @__PURE__ */
|
|
962
|
-
|
|
963
|
-
{
|
|
964
|
-
type: "range",
|
|
965
|
-
min: spec.min,
|
|
966
|
-
max: spec.max,
|
|
967
|
-
step: spec.step,
|
|
968
|
-
"aria-label": name,
|
|
969
|
-
disabled,
|
|
970
|
-
value,
|
|
971
|
-
onChange: (e) => onChange(Number(e.target.value)),
|
|
972
|
-
className: "w-full accent-primary disabled:opacity-40"
|
|
973
|
-
}
|
|
974
|
-
),
|
|
975
|
-
track && /* @__PURE__ */ jsx2("div", { className: "h-0.5 rounded-full opacity-70", style: { background: track } })
|
|
1047
|
+
/* @__PURE__ */ jsx3(ImageRange, { min: spec.min, max: spec.max, step: spec.step, label: name, disabled, value, onChange }),
|
|
1048
|
+
track && /* @__PURE__ */ jsx3("div", { className: "h-0.5 rounded-full opacity-70", style: { background: track } })
|
|
976
1049
|
] });
|
|
977
1050
|
};
|
|
978
1051
|
|
|
979
1052
|
// src/image-editor/Histogram.tsx
|
|
980
1053
|
import { useEffect as useEffect3, useMemo as useMemo3, useState as useState3 } from "react";
|
|
981
1054
|
import { histogramPath } from "@pixerate/editor/image-editor";
|
|
982
|
-
import { jsx as
|
|
1055
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
983
1056
|
var FILL = {
|
|
984
1057
|
luminance: "rgba(148, 163, 184, 0.45)",
|
|
985
1058
|
red: "rgba(239, 68, 68, 0.45)",
|
|
@@ -996,7 +1069,7 @@ var Histogram = ({ histogram, channel = "rgb", height = 64, className = "", styl
|
|
|
996
1069
|
);
|
|
997
1070
|
const clipLow = histogram && histogram.samples ? Math.max(...histogram.shadows) / histogram.samples : 0;
|
|
998
1071
|
const clipHigh = histogram && histogram.samples ? Math.max(...histogram.highlights) / histogram.samples : 0;
|
|
999
|
-
return /* @__PURE__ */
|
|
1072
|
+
return /* @__PURE__ */ jsxs4(
|
|
1000
1073
|
"svg",
|
|
1001
1074
|
{
|
|
1002
1075
|
viewBox: `0 0 ${W} ${height}`,
|
|
@@ -1007,9 +1080,9 @@ var Histogram = ({ histogram, channel = "rgb", height = 64, className = "", styl
|
|
|
1007
1080
|
className: `w-full rounded bg-muted/40 ${className}`,
|
|
1008
1081
|
style: { height, ...style },
|
|
1009
1082
|
children: [
|
|
1010
|
-
paths.map(({ c, d }) => /* @__PURE__ */
|
|
1011
|
-
clipLow > 5e-3 && /* @__PURE__ */
|
|
1012
|
-
clipHigh > 5e-3 && /* @__PURE__ */
|
|
1083
|
+
paths.map(({ c, d }) => /* @__PURE__ */ jsx4("path", { d, fill: FILL[c], stroke: "none" }, c)),
|
|
1084
|
+
clipLow > 5e-3 && /* @__PURE__ */ jsx4("rect", { x: 0, y: 0, width: 3, height, fill: "#3b82f6", "data-testid": "histogram-clip-shadows" }),
|
|
1085
|
+
clipHigh > 5e-3 && /* @__PURE__ */ jsx4("rect", { x: W - 3, y: 0, width: 3, height, fill: "#ef4444", "data-testid": "histogram-clip-highlights" })
|
|
1013
1086
|
]
|
|
1014
1087
|
}
|
|
1015
1088
|
);
|
|
@@ -1046,7 +1119,7 @@ import {
|
|
|
1046
1119
|
moveCurvePoint,
|
|
1047
1120
|
removeCurvePoint
|
|
1048
1121
|
} from "@pixerate/editor/image-editor";
|
|
1049
|
-
import { jsx as
|
|
1122
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1050
1123
|
var BOX = 256;
|
|
1051
1124
|
var STROKE = { master: "var(--foreground, #e2e8f0)", red: "#ef4444", green: "#22c55e", blue: "#3b82f6" };
|
|
1052
1125
|
var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 200, className = "" }) => {
|
|
@@ -1080,7 +1153,7 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
1080
1153
|
if (index !== -1 && points.length > 2) onChange(removeCurvePoint(points, index), true);
|
|
1081
1154
|
};
|
|
1082
1155
|
const histChannel = channel === "master" ? "luminance" : channel;
|
|
1083
|
-
return /* @__PURE__ */
|
|
1156
|
+
return /* @__PURE__ */ jsxs5(
|
|
1084
1157
|
"svg",
|
|
1085
1158
|
{
|
|
1086
1159
|
ref: svgRef,
|
|
@@ -1097,16 +1170,16 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
1097
1170
|
onPointerCancel: () => setDrag(null),
|
|
1098
1171
|
onDoubleClick,
|
|
1099
1172
|
children: [
|
|
1100
|
-
histogram && histogram.samples > 0 && /* @__PURE__ */
|
|
1101
|
-
[64, 128, 192].map((v) => /* @__PURE__ */
|
|
1102
|
-
/* @__PURE__ */
|
|
1103
|
-
/* @__PURE__ */
|
|
1173
|
+
histogram && histogram.samples > 0 && /* @__PURE__ */ jsx5("path", { d: histogramPath2(histogram, histChannel, BOX, BOX), fill: "rgba(148, 163, 184, 0.25)" }),
|
|
1174
|
+
[64, 128, 192].map((v) => /* @__PURE__ */ jsxs5("g", { stroke: "rgba(148, 163, 184, 0.2)", strokeWidth: 1, children: [
|
|
1175
|
+
/* @__PURE__ */ jsx5("line", { x1: v, y1: 0, x2: v, y2: BOX }),
|
|
1176
|
+
/* @__PURE__ */ jsx5("line", { x1: 0, y1: v, x2: BOX, y2: v })
|
|
1104
1177
|
] }, v)),
|
|
1105
|
-
/* @__PURE__ */
|
|
1106
|
-
/* @__PURE__ */
|
|
1178
|
+
/* @__PURE__ */ jsx5("line", { x1: 0, y1: BOX, x2: BOX, y2: 0, stroke: "rgba(148, 163, 184, 0.35)", strokeDasharray: "4 4" }),
|
|
1179
|
+
/* @__PURE__ */ jsx5("path", { d: curveSvgPath(points, BOX, BOX), fill: "none", stroke: STROKE[channel], strokeWidth: 2 }),
|
|
1107
1180
|
points.map((p, i) => {
|
|
1108
1181
|
const b = curvePointToBox(p, BOX, BOX);
|
|
1109
|
-
return /* @__PURE__ */
|
|
1182
|
+
return /* @__PURE__ */ jsx5(
|
|
1110
1183
|
"circle",
|
|
1111
1184
|
{
|
|
1112
1185
|
cx: b.x,
|
|
@@ -1125,30 +1198,8 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
1125
1198
|
);
|
|
1126
1199
|
};
|
|
1127
1200
|
|
|
1128
|
-
// src/image-editor/styles.ts
|
|
1129
|
-
var imageEditorFrameClass = "relative flex flex-col bg-background border border-border rounded-xl overflow-hidden shadow-sm text-foreground";
|
|
1130
|
-
var imageEditorHeaderClass = "flex flex-wrap items-center justify-between px-4 py-3 bg-muted/40 border-b border-border gap-3";
|
|
1131
|
-
var imageTabListClass = "flex items-center gap-1 bg-background p-1 rounded-lg border border-border text-xs";
|
|
1132
|
-
var imageTabClass = (active) => `px-3 py-1.5 rounded-md font-medium transition-colors ${active ? "bg-primary text-primary-foreground shadow" : "text-muted-foreground hover:text-foreground hover:bg-muted"}`;
|
|
1133
|
-
var imageHeaderButtonClass = "p-1.5 rounded-lg border border-border bg-background text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed";
|
|
1134
|
-
var imagePrimaryButtonClass = "rounded-lg bg-primary hover:bg-primary/90 text-primary-foreground font-medium shadow transition-colors disabled:opacity-50";
|
|
1135
|
-
var imageSidebarClass = "w-full md:w-80 bg-background border-t md:border-t-0 md:border-l border-border p-4 overflow-y-auto h-auto md:h-full md:max-h-[560px]";
|
|
1136
|
-
var imageSectionTitleClass = "font-semibold text-foreground uppercase tracking-wider text-[11px]";
|
|
1137
|
-
var imageSectionClass = "border-t border-border pt-3";
|
|
1138
|
-
var imageDividerClass = "h-px bg-border my-1";
|
|
1139
|
-
var imageSmallButtonClass = "px-2 py-1 rounded text-[11px] bg-muted text-foreground hover:bg-accent hover:text-accent-foreground self-start disabled:opacity-40";
|
|
1140
|
-
var imageIconButtonClass = "px-1.5 py-0.5 rounded text-[10px] bg-muted text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
|
|
1141
|
-
var imageOutlineButtonClass = "rounded border border-border px-1.5 py-0.5 text-[11px] text-foreground hover:bg-muted disabled:opacity-40";
|
|
1142
|
-
var imageChipClass = (on) => `px-2 py-1 rounded text-[11px] ${on ? "bg-primary text-primary-foreground" : "bg-muted text-foreground hover:bg-accent hover:text-accent-foreground"}`;
|
|
1143
|
-
var imageFieldClass = "rounded border border-input bg-background px-1 py-0.5 text-foreground";
|
|
1144
|
-
var imageSelectClass = "rounded border border-input bg-background px-1.5 py-1 text-foreground";
|
|
1145
|
-
var imageColorInputClass = "h-6 w-8 rounded border border-border bg-transparent";
|
|
1146
|
-
var imageRangeClass = "w-full accent-primary";
|
|
1147
|
-
var imageErrorBannerClass = "border-b border-destructive/40 bg-destructive/10 px-4 py-1.5 text-xs text-destructive";
|
|
1148
|
-
var imageSpinnerClass = "w-3.5 h-3.5 border-2 border-primary-foreground/30 border-t-primary-foreground rounded-full animate-spin";
|
|
1149
|
-
|
|
1150
1201
|
// src/image-editor/AdjustmentLayersPanel.tsx
|
|
1151
|
-
import { jsx as
|
|
1202
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1152
1203
|
var CHANNELS = [
|
|
1153
1204
|
{ id: "master", label: "RGB" },
|
|
1154
1205
|
{ id: "red", label: "Red" },
|
|
@@ -1163,10 +1214,10 @@ var TONES = [
|
|
|
1163
1214
|
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"}`;
|
|
1164
1215
|
var HueRangeStrip = ({ bounds }) => {
|
|
1165
1216
|
const pts = Array.from({ length: 73 }, (_, i) => `${i / 72 * 360},${20 - hueRangeWeight({ bounds }, i * 5) * 18}`).join(" ");
|
|
1166
|
-
return /* @__PURE__ */
|
|
1167
|
-
/* @__PURE__ */
|
|
1168
|
-
/* @__PURE__ */
|
|
1169
|
-
/* @__PURE__ */
|
|
1217
|
+
return /* @__PURE__ */ jsxs6("svg", { viewBox: "0 0 360 20", preserveAspectRatio: "none", className: "w-full h-4 rounded", "data-testid": "hue-range-strip", children: [
|
|
1218
|
+
/* @__PURE__ */ jsx6("defs", { children: /* @__PURE__ */ jsx6("linearGradient", { id: "pixerate-hue-strip", children: [0, 60, 120, 180, 240, 300, 360].map((h) => /* @__PURE__ */ jsx6("stop", { offset: `${h / 360 * 100}%`, stopColor: `hsl(${h}, 90%, 50%)` }, h)) }) }),
|
|
1219
|
+
/* @__PURE__ */ jsx6("rect", { width: 360, height: 20, fill: "url(#pixerate-hue-strip)", opacity: 0.6 }),
|
|
1220
|
+
/* @__PURE__ */ jsx6("polyline", { points: pts, fill: "none", stroke: "#fff", strokeWidth: 1.5 })
|
|
1170
1221
|
] });
|
|
1171
1222
|
};
|
|
1172
1223
|
var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, className = "" }) => {
|
|
@@ -1182,7 +1233,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
|
|
|
1182
1233
|
const selected = layers.find((l) => l.id === selectedId) ?? null;
|
|
1183
1234
|
const topFirst = [...layers].reverse();
|
|
1184
1235
|
const setParam = (layer, path, value, commit = true) => controller.updateAdjustmentLayer(layer.id, { params: setControlPath(layer.params, path, value) }, commit);
|
|
1185
|
-
const slider = (layer, spec, label) => /* @__PURE__ */
|
|
1236
|
+
const slider = (layer, spec, label) => /* @__PURE__ */ jsx6(
|
|
1186
1237
|
ControlSlider,
|
|
1187
1238
|
{
|
|
1188
1239
|
spec,
|
|
@@ -1193,24 +1244,16 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
|
|
|
1193
1244
|
spec.id
|
|
1194
1245
|
);
|
|
1195
1246
|
const controlsOf = (layer, filter = () => true) => ADJUSTMENT_LAYER_CONTROLS[layer.kind].filter(filter);
|
|
1196
|
-
const checkbox = (layer, path, label) => /* @__PURE__ */
|
|
1197
|
-
/* @__PURE__ */
|
|
1198
|
-
"input",
|
|
1199
|
-
{
|
|
1200
|
-
type: "checkbox",
|
|
1201
|
-
checked: Boolean(getControlPath(layer.params, path)),
|
|
1202
|
-
onChange: (e) => setParam(layer, path, e.target.checked),
|
|
1203
|
-
className: "accent-primary"
|
|
1204
|
-
}
|
|
1205
|
-
),
|
|
1247
|
+
const checkbox = (layer, path, label) => /* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
1248
|
+
/* @__PURE__ */ jsx6(ImageCheckbox, { label, checked: Boolean(getControlPath(layer.params, path)), onChange: (on) => setParam(layer, path, on) }),
|
|
1206
1249
|
label
|
|
1207
1250
|
] });
|
|
1208
1251
|
const editor = (layer) => {
|
|
1209
1252
|
switch (layer.kind) {
|
|
1210
1253
|
case "curves":
|
|
1211
|
-
return /* @__PURE__ */
|
|
1212
|
-
/* @__PURE__ */
|
|
1213
|
-
/* @__PURE__ */
|
|
1254
|
+
return /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-2", children: [
|
|
1255
|
+
/* @__PURE__ */ jsx6("div", { className: "flex gap-1", role: "group", "aria-label": "Curve channel", children: CHANNELS.map((c) => /* @__PURE__ */ jsx6("button", { type: "button", className: chipClass(channel === c.id), onClick: () => setChannel(c.id), children: c.label }, c.id)) }),
|
|
1256
|
+
/* @__PURE__ */ jsx6(
|
|
1214
1257
|
CurvesEditor,
|
|
1215
1258
|
{
|
|
1216
1259
|
points: layer.params[channel],
|
|
@@ -1221,43 +1264,35 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
|
|
|
1221
1264
|
)
|
|
1222
1265
|
] });
|
|
1223
1266
|
case "levels":
|
|
1224
|
-
return /* @__PURE__ */
|
|
1225
|
-
/* @__PURE__ */
|
|
1267
|
+
return /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-2", children: [
|
|
1268
|
+
/* @__PURE__ */ jsx6("div", { className: "flex gap-1", role: "group", "aria-label": "Levels channel", children: CHANNELS.map((c) => /* @__PURE__ */ jsx6("button", { type: "button", className: chipClass(channel === c.id), onClick: () => setChannel(c.id), children: c.label }, c.id)) }),
|
|
1226
1269
|
controlsOf(layer, (s) => s.id.startsWith(`${channel}.`)).map((s) => slider(layer, s))
|
|
1227
1270
|
] });
|
|
1228
1271
|
case "hueSaturation":
|
|
1229
|
-
return /* @__PURE__ */
|
|
1230
|
-
/* @__PURE__ */
|
|
1231
|
-
/* @__PURE__ */
|
|
1232
|
-
HUE_RANGE_LABELS.map((name, i) => /* @__PURE__ */
|
|
1272
|
+
return /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-2", children: [
|
|
1273
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex flex-wrap gap-1", role: "group", "aria-label": "Hue range", children: [
|
|
1274
|
+
/* @__PURE__ */ jsx6("button", { type: "button", className: chipClass(range === -1), onClick: () => setRange(-1), children: "Master" }),
|
|
1275
|
+
HUE_RANGE_LABELS.map((name, i) => /* @__PURE__ */ jsx6("button", { type: "button", className: chipClass(range === i), onClick: () => setRange(i), disabled: layer.params.colorize, children: name }, name))
|
|
1233
1276
|
] }),
|
|
1234
|
-
range >= 0 && !layer.params.colorize && /* @__PURE__ */
|
|
1277
|
+
range >= 0 && !layer.params.colorize && /* @__PURE__ */ jsx6(HueRangeStrip, { bounds: layer.params.ranges[range].bounds }),
|
|
1235
1278
|
controlsOf(layer, (s) => range === -1 || layer.params.colorize ? !s.id.startsWith("ranges.") : s.id.startsWith(`ranges.${range}.`)).map(
|
|
1236
1279
|
(s) => slider(layer, s)
|
|
1237
1280
|
),
|
|
1238
1281
|
range === -1 && checkbox(layer, "colorize", "Colorize")
|
|
1239
1282
|
] });
|
|
1240
1283
|
case "colorBalance":
|
|
1241
|
-
return /* @__PURE__ */
|
|
1242
|
-
/* @__PURE__ */
|
|
1284
|
+
return /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-2", children: [
|
|
1285
|
+
/* @__PURE__ */ jsx6("div", { className: "flex gap-1", role: "group", "aria-label": "Tone", children: TONES.map((t) => /* @__PURE__ */ jsx6("button", { type: "button", className: chipClass(tone === t.id), onClick: () => setTone(t.id), children: t.label }, t.id)) }),
|
|
1243
1286
|
controlsOf(layer, (s) => s.id.startsWith(`${tone}.`)).map((s) => slider(layer, s)),
|
|
1244
1287
|
checkbox(layer, "preserveLuminosity", "Preserve luminosity")
|
|
1245
1288
|
] });
|
|
1246
1289
|
case "blackWhite":
|
|
1247
|
-
return /* @__PURE__ */
|
|
1290
|
+
return /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-2", children: [
|
|
1248
1291
|
controlsOf(layer).map((s) => slider(layer, s)),
|
|
1249
|
-
/* @__PURE__ */
|
|
1250
|
-
/* @__PURE__ */
|
|
1251
|
-
"input",
|
|
1252
|
-
{
|
|
1253
|
-
type: "checkbox",
|
|
1254
|
-
checked: layer.params.tint !== null,
|
|
1255
|
-
onChange: (e) => setParam(layer, "tint", e.target.checked ? "#e1d3b3" : null),
|
|
1256
|
-
className: "accent-primary"
|
|
1257
|
-
}
|
|
1258
|
-
),
|
|
1292
|
+
/* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
1293
|
+
/* @__PURE__ */ jsx6(ImageCheckbox, { label: "Tint", checked: layer.params.tint !== null, onChange: (on) => setParam(layer, "tint", on ? "#e1d3b3" : null) }),
|
|
1259
1294
|
"Tint",
|
|
1260
|
-
layer.params.tint && /* @__PURE__ */
|
|
1295
|
+
layer.params.tint && /* @__PURE__ */ jsx6(
|
|
1261
1296
|
"input",
|
|
1262
1297
|
{
|
|
1263
1298
|
type: "color",
|
|
@@ -1270,10 +1305,10 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
|
|
|
1270
1305
|
] })
|
|
1271
1306
|
] });
|
|
1272
1307
|
case "photoFilter":
|
|
1273
|
-
return /* @__PURE__ */
|
|
1274
|
-
/* @__PURE__ */
|
|
1308
|
+
return /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-2", children: [
|
|
1309
|
+
/* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
1275
1310
|
"Filter colour",
|
|
1276
|
-
/* @__PURE__ */
|
|
1311
|
+
/* @__PURE__ */ jsx6(
|
|
1277
1312
|
"input",
|
|
1278
1313
|
{
|
|
1279
1314
|
type: "color",
|
|
@@ -1288,25 +1323,25 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
|
|
|
1288
1323
|
checkbox(layer, "preserveLuminosity", "Preserve luminosity")
|
|
1289
1324
|
] });
|
|
1290
1325
|
case "invert":
|
|
1291
|
-
return /* @__PURE__ */
|
|
1326
|
+
return /* @__PURE__ */ jsx6("p", { className: "text-muted-foreground text-[11px]", children: "Invert has no settings." });
|
|
1292
1327
|
default:
|
|
1293
|
-
return /* @__PURE__ */
|
|
1328
|
+
return /* @__PURE__ */ jsx6("div", { className: "flex flex-col gap-2", children: controlsOf(layer).map((s) => slider(layer, s)) });
|
|
1294
1329
|
}
|
|
1295
1330
|
};
|
|
1296
|
-
return /* @__PURE__ */
|
|
1297
|
-
/* @__PURE__ */
|
|
1298
|
-
/* @__PURE__ */
|
|
1299
|
-
/* @__PURE__ */
|
|
1300
|
-
|
|
1331
|
+
return /* @__PURE__ */ jsxs6("div", { className: `flex flex-col gap-2 text-xs ${className}`.trim(), "data-testid": "adjustment-layers-panel", children: [
|
|
1332
|
+
/* @__PURE__ */ jsx6("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsx6("span", { className: imageSectionTitleClass, children: "Adjustment Layers" }) }),
|
|
1333
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex gap-1.5", children: [
|
|
1334
|
+
/* @__PURE__ */ jsx6(
|
|
1335
|
+
ImageSelect,
|
|
1301
1336
|
{
|
|
1302
|
-
|
|
1303
|
-
className:
|
|
1337
|
+
label: "New adjustment layer kind",
|
|
1338
|
+
className: "flex-1",
|
|
1304
1339
|
value: newKind,
|
|
1305
|
-
|
|
1306
|
-
|
|
1340
|
+
options: ADJUSTMENT_KINDS.map((k) => ({ value: k.kind, label: k.label })),
|
|
1341
|
+
onChange: (v) => setNewKind(v)
|
|
1307
1342
|
}
|
|
1308
1343
|
),
|
|
1309
|
-
/* @__PURE__ */
|
|
1344
|
+
/* @__PURE__ */ jsx6(
|
|
1310
1345
|
"button",
|
|
1311
1346
|
{
|
|
1312
1347
|
type: "button",
|
|
@@ -1320,25 +1355,16 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
|
|
|
1320
1355
|
}
|
|
1321
1356
|
)
|
|
1322
1357
|
] }),
|
|
1323
|
-
topFirst.length > 0 && /* @__PURE__ */
|
|
1358
|
+
topFirst.length > 0 && /* @__PURE__ */ jsx6("ul", { className: "flex flex-col gap-1", "aria-label": "Adjustment layers", children: topFirst.map((layer) => {
|
|
1324
1359
|
const index = layers.indexOf(layer);
|
|
1325
1360
|
const label = layer.name || adjustmentKindLabel(layer.kind);
|
|
1326
|
-
return /* @__PURE__ */
|
|
1361
|
+
return /* @__PURE__ */ jsxs6(
|
|
1327
1362
|
"li",
|
|
1328
1363
|
{
|
|
1329
1364
|
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"}`,
|
|
1330
1365
|
children: [
|
|
1331
|
-
/* @__PURE__ */
|
|
1332
|
-
|
|
1333
|
-
{
|
|
1334
|
-
type: "checkbox",
|
|
1335
|
-
"aria-label": `Show ${label}`,
|
|
1336
|
-
checked: layer.enabled,
|
|
1337
|
-
onChange: () => controller.toggleAdjustmentLayer(layer.id),
|
|
1338
|
-
className: "accent-primary"
|
|
1339
|
-
}
|
|
1340
|
-
),
|
|
1341
|
-
/* @__PURE__ */ jsx5(
|
|
1366
|
+
/* @__PURE__ */ jsx6(ImageCheckbox, { label: `Show ${label}`, checked: layer.enabled, onChange: () => controller.toggleAdjustmentLayer(layer.id) }),
|
|
1367
|
+
/* @__PURE__ */ jsx6(
|
|
1342
1368
|
"button",
|
|
1343
1369
|
{
|
|
1344
1370
|
type: "button",
|
|
@@ -1348,7 +1374,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
|
|
|
1348
1374
|
children: label
|
|
1349
1375
|
}
|
|
1350
1376
|
),
|
|
1351
|
-
/* @__PURE__ */
|
|
1377
|
+
/* @__PURE__ */ jsx6(
|
|
1352
1378
|
"button",
|
|
1353
1379
|
{
|
|
1354
1380
|
type: "button",
|
|
@@ -1359,7 +1385,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
|
|
|
1359
1385
|
children: "\u2191"
|
|
1360
1386
|
}
|
|
1361
1387
|
),
|
|
1362
|
-
/* @__PURE__ */
|
|
1388
|
+
/* @__PURE__ */ jsx6(
|
|
1363
1389
|
"button",
|
|
1364
1390
|
{
|
|
1365
1391
|
type: "button",
|
|
@@ -1370,7 +1396,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
|
|
|
1370
1396
|
children: "\u2193"
|
|
1371
1397
|
}
|
|
1372
1398
|
),
|
|
1373
|
-
/* @__PURE__ */
|
|
1399
|
+
/* @__PURE__ */ jsx6(
|
|
1374
1400
|
"button",
|
|
1375
1401
|
{
|
|
1376
1402
|
type: "button",
|
|
@@ -1388,21 +1414,21 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
|
|
|
1388
1414
|
layer.id
|
|
1389
1415
|
);
|
|
1390
1416
|
}) }),
|
|
1391
|
-
selected && /* @__PURE__ */
|
|
1392
|
-
/* @__PURE__ */
|
|
1393
|
-
/* @__PURE__ */
|
|
1394
|
-
/* @__PURE__ */
|
|
1395
|
-
|
|
1417
|
+
selected && /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-2 rounded border border-border p-2", "data-testid": "adjustment-layer-editor", children: [
|
|
1418
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
|
|
1419
|
+
/* @__PURE__ */ jsx6("span", { className: "text-muted-foreground", children: "Blend" }),
|
|
1420
|
+
/* @__PURE__ */ jsx6(
|
|
1421
|
+
ImageSelect,
|
|
1396
1422
|
{
|
|
1397
|
-
|
|
1398
|
-
className:
|
|
1423
|
+
label: "Blend mode",
|
|
1424
|
+
className: "flex-1",
|
|
1399
1425
|
value: selected.blend,
|
|
1400
|
-
|
|
1401
|
-
|
|
1426
|
+
options: BLEND_MODES.map((m) => ({ value: m.id, label: m.label })),
|
|
1427
|
+
onChange: (v) => controller.updateAdjustmentLayer(selected.id, { blend: v })
|
|
1402
1428
|
}
|
|
1403
1429
|
)
|
|
1404
1430
|
] }),
|
|
1405
|
-
/* @__PURE__ */
|
|
1431
|
+
/* @__PURE__ */ jsx6(
|
|
1406
1432
|
ControlSlider,
|
|
1407
1433
|
{
|
|
1408
1434
|
spec: ADJUSTMENT_LAYER_OPACITY_CONTROL,
|
|
@@ -1422,7 +1448,7 @@ import { useEffect as useEffect6, useRef as useRef5, useState as useState7 } fro
|
|
|
1422
1448
|
// src/image-editor/LayerEffectsPanel.tsx
|
|
1423
1449
|
import { useEffect as useEffect5, useRef as useRef4, useState as useState6 } from "react";
|
|
1424
1450
|
import { LAYER_EFFECT_MENU, effectControlChange, layerEffectControls, layerEffectsPanel } from "@pixerate/editor/image-editor";
|
|
1425
|
-
import { jsx as
|
|
1451
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1426
1452
|
var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
1427
1453
|
const [, setTick] = useState6(0);
|
|
1428
1454
|
useEffect5(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -1440,13 +1466,8 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1440
1466
|
setError(err instanceof Error ? err.message : String(err));
|
|
1441
1467
|
}
|
|
1442
1468
|
};
|
|
1443
|
-
const sliderEvents = {
|
|
1444
|
-
onPointerDown: () => commitNext.current = true,
|
|
1445
|
-
onPointerUp: () => commitNext.current = true,
|
|
1446
|
-
onKeyDown: () => commitNext.current = true
|
|
1447
|
-
};
|
|
1448
1469
|
if (!model.available || !id) {
|
|
1449
|
-
return /* @__PURE__ */
|
|
1470
|
+
return /* @__PURE__ */ jsx7("div", { className: `text-xs text-muted-foreground ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
|
|
1450
1471
|
}
|
|
1451
1472
|
const effects = controller.getLayerEffects(id);
|
|
1452
1473
|
const patterns = controller.getDocumentPatterns();
|
|
@@ -1461,77 +1482,65 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1461
1482
|
case "range": {
|
|
1462
1483
|
const k = c.percent ? 100 : 1;
|
|
1463
1484
|
const shown = Math.round(c.value * k * 100) / 100;
|
|
1464
|
-
return /* @__PURE__ */
|
|
1465
|
-
/* @__PURE__ */
|
|
1485
|
+
return /* @__PURE__ */ jsxs7("label", { className: "flex flex-col gap-0.5", children: [
|
|
1486
|
+
/* @__PURE__ */ jsxs7("span", { className: "text-muted-foreground", children: [
|
|
1466
1487
|
label,
|
|
1467
1488
|
" ",
|
|
1468
1489
|
shown,
|
|
1469
1490
|
c.unit
|
|
1470
1491
|
] }),
|
|
1471
|
-
/* @__PURE__ */
|
|
1472
|
-
|
|
1492
|
+
/* @__PURE__ */ jsx7(
|
|
1493
|
+
ImageRange,
|
|
1473
1494
|
{
|
|
1474
|
-
|
|
1475
|
-
"aria-label": label,
|
|
1495
|
+
label,
|
|
1476
1496
|
min: c.min * k,
|
|
1477
1497
|
max: c.max * k,
|
|
1478
1498
|
step: c.step * k,
|
|
1479
1499
|
value: shown,
|
|
1480
1500
|
disabled: model.readOnly,
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1501
|
+
onStart: () => commitNext.current = true,
|
|
1502
|
+
onEnd: () => commitNext.current = true,
|
|
1503
|
+
onChange: (v) => change(effectId, c, v / k, true)
|
|
1484
1504
|
}
|
|
1485
1505
|
)
|
|
1486
1506
|
] }, c.key);
|
|
1487
1507
|
}
|
|
1488
1508
|
case "color":
|
|
1489
|
-
return /* @__PURE__ */
|
|
1490
|
-
/* @__PURE__ */
|
|
1509
|
+
return /* @__PURE__ */ jsxs7("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
1510
|
+
/* @__PURE__ */ jsx7("input", { type: "color", "aria-label": label, value: c.value, disabled: model.readOnly, onChange: (e) => change(effectId, c, e.target.value) }),
|
|
1491
1511
|
label
|
|
1492
1512
|
] }, c.key);
|
|
1493
1513
|
case "checkbox":
|
|
1494
|
-
return /* @__PURE__ */
|
|
1495
|
-
/* @__PURE__ */
|
|
1514
|
+
return /* @__PURE__ */ jsxs7("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
1515
|
+
/* @__PURE__ */ jsx7(ImageCheckbox, { label, checked: c.value, disabled: model.readOnly, onChange: (on) => change(effectId, c, on) }),
|
|
1496
1516
|
label
|
|
1497
1517
|
] }, c.key);
|
|
1498
1518
|
case "select":
|
|
1499
|
-
return /* @__PURE__ */
|
|
1500
|
-
/* @__PURE__ */
|
|
1501
|
-
/* @__PURE__ */
|
|
1502
|
-
|
|
1519
|
+
return /* @__PURE__ */ jsxs7("label", { className: "flex flex-col gap-0.5", children: [
|
|
1520
|
+
/* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: label }),
|
|
1521
|
+
/* @__PURE__ */ jsx7(
|
|
1522
|
+
ImageSelect,
|
|
1503
1523
|
{
|
|
1504
|
-
|
|
1505
|
-
value: c.value,
|
|
1524
|
+
label,
|
|
1525
|
+
value: String(c.value),
|
|
1506
1526
|
disabled: model.readOnly,
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
children: c.options.map((o) => /* @__PURE__ */ jsx6("option", { value: o.value, children: o.label }, o.value))
|
|
1527
|
+
options: c.options.map((o) => ({ value: String(o.value), label: o.label })),
|
|
1528
|
+
onChange: (v) => change(effectId, c, v)
|
|
1510
1529
|
}
|
|
1511
1530
|
)
|
|
1512
1531
|
] }, c.key);
|
|
1513
1532
|
}
|
|
1514
1533
|
};
|
|
1515
|
-
return /* @__PURE__ */
|
|
1516
|
-
/* @__PURE__ */
|
|
1517
|
-
/* @__PURE__ */
|
|
1518
|
-
/* @__PURE__ */
|
|
1519
|
-
/* @__PURE__ */
|
|
1520
|
-
"input",
|
|
1521
|
-
{
|
|
1522
|
-
type: "checkbox",
|
|
1523
|
-
"aria-label": "Effects on",
|
|
1524
|
-
checked: model.enabled,
|
|
1525
|
-
disabled: model.readOnly,
|
|
1526
|
-
onChange: (e) => attempt(() => controller.setLayerEffectsEnabled(id, e.target.checked)),
|
|
1527
|
-
className: "accent-primary"
|
|
1528
|
-
}
|
|
1529
|
-
),
|
|
1534
|
+
return /* @__PURE__ */ jsxs7("div", { className: `flex flex-col gap-1.5 text-xs text-foreground ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer effects", role: "group", children: [
|
|
1535
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
1536
|
+
/* @__PURE__ */ jsx7("span", { className: "font-semibold text-foreground", children: "fx Effects" }),
|
|
1537
|
+
/* @__PURE__ */ jsxs7("label", { className: "flex items-center gap-1 text-foreground", children: [
|
|
1538
|
+
/* @__PURE__ */ jsx7(ImageCheckbox, { label: "Effects on", checked: model.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.setLayerEffectsEnabled(id, on)) }),
|
|
1530
1539
|
"On"
|
|
1531
1540
|
] }),
|
|
1532
|
-
/* @__PURE__ */
|
|
1541
|
+
/* @__PURE__ */ jsxs7("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
1533
1542
|
"Scale",
|
|
1534
|
-
/* @__PURE__ */
|
|
1543
|
+
/* @__PURE__ */ jsx7(
|
|
1535
1544
|
"input",
|
|
1536
1545
|
{
|
|
1537
1546
|
type: "number",
|
|
@@ -1550,43 +1559,30 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1550
1559
|
),
|
|
1551
1560
|
"%"
|
|
1552
1561
|
] }),
|
|
1553
|
-
/* @__PURE__ */
|
|
1554
|
-
|
|
1562
|
+
/* @__PURE__ */ jsx7(
|
|
1563
|
+
ImageSelect,
|
|
1555
1564
|
{
|
|
1556
|
-
|
|
1565
|
+
label: "Add effect",
|
|
1557
1566
|
value: "",
|
|
1567
|
+
placeholder: "Add effect\u2026",
|
|
1558
1568
|
disabled: model.readOnly,
|
|
1559
|
-
|
|
1560
|
-
|
|
1569
|
+
options: LAYER_EFFECT_MENU.map((m) => ({ value: m.kind, label: m.label })),
|
|
1570
|
+
onChange: (v) => {
|
|
1571
|
+
const kind = v;
|
|
1561
1572
|
if (!kind) return;
|
|
1562
1573
|
attempt(() => setOpen(controller.addLayerEffect(id, kind).effect.id));
|
|
1563
|
-
}
|
|
1564
|
-
className: imageSelectClass,
|
|
1565
|
-
children: [
|
|
1566
|
-
/* @__PURE__ */ jsx6("option", { value: "", children: "Add effect\u2026" }),
|
|
1567
|
-
LAYER_EFFECT_MENU.map((m) => /* @__PURE__ */ jsx6("option", { value: m.kind, children: m.label }, m.kind))
|
|
1568
|
-
]
|
|
1574
|
+
}
|
|
1569
1575
|
}
|
|
1570
1576
|
)
|
|
1571
1577
|
] }),
|
|
1572
|
-
model.readOnly && model.reason && /* @__PURE__ */
|
|
1573
|
-
/* @__PURE__ */
|
|
1578
|
+
model.readOnly && model.reason && /* @__PURE__ */ jsx7("p", { className: "text-muted-foreground", children: model.reason }),
|
|
1579
|
+
/* @__PURE__ */ jsx7("ul", { className: "flex flex-col gap-1", "aria-label": "Effects", children: model.rows.map((row) => {
|
|
1574
1580
|
const effect = effects.items.find((e) => e.id === row.id);
|
|
1575
1581
|
const expanded = open === row.id;
|
|
1576
|
-
return /* @__PURE__ */
|
|
1577
|
-
/* @__PURE__ */
|
|
1578
|
-
/* @__PURE__ */
|
|
1579
|
-
|
|
1580
|
-
{
|
|
1581
|
-
type: "checkbox",
|
|
1582
|
-
"aria-label": `${row.label} on`,
|
|
1583
|
-
checked: row.enabled,
|
|
1584
|
-
disabled: model.readOnly,
|
|
1585
|
-
onChange: (e) => attempt(() => controller.updateLayerEffect(id, row.id, { enabled: e.target.checked })),
|
|
1586
|
-
className: "accent-primary"
|
|
1587
|
-
}
|
|
1588
|
-
),
|
|
1589
|
-
/* @__PURE__ */ jsx6(
|
|
1582
|
+
return /* @__PURE__ */ jsxs7("li", { "data-effect-id": row.id, className: "rounded bg-background/60 ring-1 ring-border", children: [
|
|
1583
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
|
|
1584
|
+
/* @__PURE__ */ jsx7(ImageCheckbox, { label: `${row.label} on`, checked: row.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.updateLayerEffect(id, row.id, { enabled: on })) }),
|
|
1585
|
+
/* @__PURE__ */ jsx7(
|
|
1590
1586
|
"button",
|
|
1591
1587
|
{
|
|
1592
1588
|
type: "button",
|
|
@@ -1596,12 +1592,12 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1596
1592
|
children: row.label
|
|
1597
1593
|
}
|
|
1598
1594
|
),
|
|
1599
|
-
/* @__PURE__ */
|
|
1595
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: imageIconButtonClass, "aria-label": `Remove ${row.label}`, disabled: model.readOnly, onClick: () => attempt(() => controller.removeLayerEffect(id, row.id)), children: "\u2715" })
|
|
1600
1596
|
] }),
|
|
1601
|
-
expanded && /* @__PURE__ */
|
|
1597
|
+
expanded && /* @__PURE__ */ jsx7("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)) })
|
|
1602
1598
|
] }, row.id);
|
|
1603
1599
|
}) }),
|
|
1604
|
-
error && /* @__PURE__ */
|
|
1600
|
+
error && /* @__PURE__ */ jsx7("p", { role: "alert", className: "text-destructive", children: error })
|
|
1605
1601
|
] });
|
|
1606
1602
|
};
|
|
1607
1603
|
|
|
@@ -1622,7 +1618,7 @@ import {
|
|
|
1622
1618
|
layerPanelRows,
|
|
1623
1619
|
runLayerMenuAction
|
|
1624
1620
|
} from "@pixerate/editor/image-editor";
|
|
1625
|
-
import { Fragment, jsx as
|
|
1621
|
+
import { Fragment, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1626
1622
|
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"}`;
|
|
1627
1623
|
var Thumbnail = ({
|
|
1628
1624
|
pixels,
|
|
@@ -1643,7 +1639,7 @@ var Thumbnail = ({
|
|
|
1643
1639
|
img.data.set(pixels.data);
|
|
1644
1640
|
ctx.putImageData(img, 0, 0);
|
|
1645
1641
|
}, [pixels]);
|
|
1646
|
-
return /* @__PURE__ */
|
|
1642
|
+
return /* @__PURE__ */ jsx8(
|
|
1647
1643
|
"canvas",
|
|
1648
1644
|
{
|
|
1649
1645
|
ref,
|
|
@@ -1711,14 +1707,14 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1711
1707
|
const thumb = (layer) => layerHasThumbnail(layer) ? controller.getLayerThumbnail(layer.id, { maxSide: 64 }) : null;
|
|
1712
1708
|
const maskThumb = (layer) => layer.mask && !layer.mask.source ? controller.getLayerThumbnail(layer.id, { maxSide: 64, mask: true }) : null;
|
|
1713
1709
|
const locked = (layer) => Boolean(layer.locks?.all || layer.locks?.pixels || layer.locks?.position || layer.locks?.transparency);
|
|
1714
|
-
return /* @__PURE__ */
|
|
1715
|
-
/* @__PURE__ */
|
|
1716
|
-
/* @__PURE__ */
|
|
1717
|
-
/* @__PURE__ */
|
|
1718
|
-
/* @__PURE__ */
|
|
1719
|
-
/* @__PURE__ */
|
|
1720
|
-
/* @__PURE__ */
|
|
1721
|
-
/* @__PURE__ */
|
|
1710
|
+
return /* @__PURE__ */ jsxs8("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "layers-panel", onClick: () => menu && setMenu(null), children: [
|
|
1711
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap items-center gap-1", role: "toolbar", "aria-label": "Layer actions", children: [
|
|
1712
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-layer"), children: "New Layer" }),
|
|
1713
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-group"), children: "New Group" }),
|
|
1714
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("duplicate"), children: "Duplicate" }),
|
|
1715
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("add-mask"), children: "Add Mask" }),
|
|
1716
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("delete"), children: "Delete" }),
|
|
1717
|
+
/* @__PURE__ */ jsx8(
|
|
1722
1718
|
"button",
|
|
1723
1719
|
{
|
|
1724
1720
|
type: "button",
|
|
@@ -1733,7 +1729,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1733
1729
|
children: "\u22EF"
|
|
1734
1730
|
}
|
|
1735
1731
|
),
|
|
1736
|
-
/* @__PURE__ */
|
|
1732
|
+
/* @__PURE__ */ jsx8(
|
|
1737
1733
|
"select",
|
|
1738
1734
|
{
|
|
1739
1735
|
"aria-label": "Bits per channel",
|
|
@@ -1741,13 +1737,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1741
1737
|
className: "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground",
|
|
1742
1738
|
value: controller.bitDepth,
|
|
1743
1739
|
onChange: (e) => attempt(() => controller.setBitDepth(Number(e.target.value))),
|
|
1744
|
-
children: BIT_DEPTH_OPTIONS.map((o) => /* @__PURE__ */
|
|
1740
|
+
children: BIT_DEPTH_OPTIONS.map((o) => /* @__PURE__ */ jsx8("option", { value: o.depth, title: o.title, children: o.label }, o.depth))
|
|
1745
1741
|
}
|
|
1746
1742
|
),
|
|
1747
|
-
psd && /* @__PURE__ */
|
|
1748
|
-
/* @__PURE__ */
|
|
1749
|
-
/* @__PURE__ */
|
|
1750
|
-
/* @__PURE__ */
|
|
1743
|
+
psd && /* @__PURE__ */ jsxs8(Fragment, { children: [
|
|
1744
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: imageIconButtonClass, onClick: () => fileInput.current?.click(), children: "Open PSD\u2026" }),
|
|
1745
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: imageIconButtonClass, onClick: () => psdTask(async () => (await downloadPsd(controller, psdFileName)).warnings), children: "Export PSD" }),
|
|
1746
|
+
/* @__PURE__ */ jsx8(
|
|
1751
1747
|
"input",
|
|
1752
1748
|
{
|
|
1753
1749
|
ref: fileInput,
|
|
@@ -1765,18 +1761,18 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1765
1761
|
)
|
|
1766
1762
|
] })
|
|
1767
1763
|
] }),
|
|
1768
|
-
psdNotes.length > 0 && /* @__PURE__ */
|
|
1769
|
-
psdNotes.map((n) => /* @__PURE__ */
|
|
1770
|
-
/* @__PURE__ */
|
|
1764
|
+
psdNotes.length > 0 && /* @__PURE__ */ jsxs8("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: [
|
|
1765
|
+
psdNotes.map((n) => /* @__PURE__ */ jsx8("li", { children: n }, n)),
|
|
1766
|
+
/* @__PURE__ */ jsx8("li", { children: /* @__PURE__ */ jsx8("button", { type: "button", className: "underline", onClick: () => setPsdNotes([]), children: "Dismiss" }) })
|
|
1771
1767
|
] }),
|
|
1772
|
-
active && /* @__PURE__ */
|
|
1773
|
-
/* @__PURE__ */
|
|
1774
|
-
/* @__PURE__ */
|
|
1768
|
+
active && /* @__PURE__ */ jsxs8("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 items-center", "data-testid": "layer-properties", children: [
|
|
1769
|
+
/* @__PURE__ */ jsxs8("label", { className: "flex flex-col gap-0.5", children: [
|
|
1770
|
+
/* @__PURE__ */ jsxs8("span", { className: "text-muted-foreground", children: [
|
|
1775
1771
|
"Opacity ",
|
|
1776
1772
|
Math.round(active.opacity * 100),
|
|
1777
1773
|
"%"
|
|
1778
1774
|
] }),
|
|
1779
|
-
/* @__PURE__ */
|
|
1775
|
+
/* @__PURE__ */ jsx8(
|
|
1780
1776
|
"input",
|
|
1781
1777
|
{
|
|
1782
1778
|
type: "range",
|
|
@@ -1790,13 +1786,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1790
1786
|
}
|
|
1791
1787
|
)
|
|
1792
1788
|
] }),
|
|
1793
|
-
/* @__PURE__ */
|
|
1794
|
-
/* @__PURE__ */
|
|
1789
|
+
/* @__PURE__ */ jsxs8("label", { className: "flex flex-col gap-0.5", children: [
|
|
1790
|
+
/* @__PURE__ */ jsxs8("span", { className: "text-muted-foreground", children: [
|
|
1795
1791
|
"Fill ",
|
|
1796
1792
|
Math.round(((active.type === "pixel" ? active.fillOpacity : void 0) ?? 1) * 100),
|
|
1797
1793
|
"%"
|
|
1798
1794
|
] }),
|
|
1799
|
-
/* @__PURE__ */
|
|
1795
|
+
/* @__PURE__ */ jsx8(
|
|
1800
1796
|
"input",
|
|
1801
1797
|
{
|
|
1802
1798
|
type: "range",
|
|
@@ -1811,7 +1807,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1811
1807
|
}
|
|
1812
1808
|
)
|
|
1813
1809
|
] }),
|
|
1814
|
-
/* @__PURE__ */
|
|
1810
|
+
/* @__PURE__ */ jsxs8(
|
|
1815
1811
|
"select",
|
|
1816
1812
|
{
|
|
1817
1813
|
"aria-label": "Layer blend mode",
|
|
@@ -1819,13 +1815,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1819
1815
|
value: active.blend,
|
|
1820
1816
|
onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { blend: e.target.value })),
|
|
1821
1817
|
children: [
|
|
1822
|
-
active.type === "group" && /* @__PURE__ */
|
|
1823
|
-
BLEND_MODES2.map((m) => /* @__PURE__ */
|
|
1818
|
+
active.type === "group" && /* @__PURE__ */ jsx8("option", { value: "pass-through", children: "Pass Through" }),
|
|
1819
|
+
BLEND_MODES2.map((m) => /* @__PURE__ */ jsx8("option", { value: m.id, children: m.label }, m.id))
|
|
1824
1820
|
]
|
|
1825
1821
|
}
|
|
1826
1822
|
),
|
|
1827
|
-
/* @__PURE__ */
|
|
1828
|
-
/* @__PURE__ */
|
|
1823
|
+
/* @__PURE__ */ jsxs8("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
1824
|
+
/* @__PURE__ */ jsx8(
|
|
1829
1825
|
"input",
|
|
1830
1826
|
{
|
|
1831
1827
|
type: "checkbox",
|
|
@@ -1837,8 +1833,8 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1837
1833
|
),
|
|
1838
1834
|
"Clip to below"
|
|
1839
1835
|
] }),
|
|
1840
|
-
/* @__PURE__ */
|
|
1841
|
-
/* @__PURE__ */
|
|
1836
|
+
/* @__PURE__ */ jsx8("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__ */ jsxs8("label", { className: "flex items-center gap-1", children: [
|
|
1837
|
+
/* @__PURE__ */ jsx8(
|
|
1842
1838
|
"input",
|
|
1843
1839
|
{
|
|
1844
1840
|
type: "checkbox",
|
|
@@ -1851,10 +1847,10 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1851
1847
|
k
|
|
1852
1848
|
] }, k)) })
|
|
1853
1849
|
] }),
|
|
1854
|
-
effects && active && active.type !== "adjustment" && /* @__PURE__ */
|
|
1855
|
-
/* @__PURE__ */
|
|
1850
|
+
effects && active && active.type !== "adjustment" && /* @__PURE__ */ jsx8(LayerEffectsPanel, { controller, className: "border-t border-border pt-1.5" }),
|
|
1851
|
+
/* @__PURE__ */ jsx8("ul", { className: "flex flex-col gap-0.5", role: "tree", "aria-label": "Layers", children: rows.map((row) => {
|
|
1856
1852
|
const { layer } = row;
|
|
1857
|
-
return /* @__PURE__ */
|
|
1853
|
+
return /* @__PURE__ */ jsxs8(
|
|
1858
1854
|
"li",
|
|
1859
1855
|
{
|
|
1860
1856
|
role: "treeitem",
|
|
@@ -1884,7 +1880,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1884
1880
|
className: rowClass(row.active),
|
|
1885
1881
|
style: { paddingLeft: 6 + row.depth * 14 },
|
|
1886
1882
|
children: [
|
|
1887
|
-
/* @__PURE__ */
|
|
1883
|
+
/* @__PURE__ */ jsx8(
|
|
1888
1884
|
"button",
|
|
1889
1885
|
{
|
|
1890
1886
|
type: "button",
|
|
@@ -1898,7 +1894,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1898
1894
|
children: layer.visible ? "\u25CF" : "\u25CB"
|
|
1899
1895
|
}
|
|
1900
1896
|
),
|
|
1901
|
-
layer.type === "group" && /* @__PURE__ */
|
|
1897
|
+
layer.type === "group" && /* @__PURE__ */ jsx8(
|
|
1902
1898
|
"button",
|
|
1903
1899
|
{
|
|
1904
1900
|
type: "button",
|
|
@@ -1911,9 +1907,9 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1911
1907
|
children: layer.collapsed ? "\u25B8" : "\u25BE"
|
|
1912
1908
|
}
|
|
1913
1909
|
),
|
|
1914
|
-
row.clipped && /* @__PURE__ */
|
|
1915
|
-
layerHasThumbnail(layer) ? /* @__PURE__ */
|
|
1916
|
-
/* @__PURE__ */
|
|
1910
|
+
row.clipped && /* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", "aria-label": "Clipped", children: "\u21B3" }),
|
|
1911
|
+
layerHasThumbnail(layer) ? /* @__PURE__ */ jsxs8("span", { className: "relative shrink-0", children: [
|
|
1912
|
+
/* @__PURE__ */ jsx8(
|
|
1917
1913
|
Thumbnail,
|
|
1918
1914
|
{
|
|
1919
1915
|
pixels: thumb(layer),
|
|
@@ -1922,7 +1918,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1922
1918
|
selected: row.active && state.activeTarget === "pixels" && Boolean(layer.mask)
|
|
1923
1919
|
}
|
|
1924
1920
|
),
|
|
1925
|
-
layer.type !== "pixel" && /* @__PURE__ */
|
|
1921
|
+
layer.type !== "pixel" && /* @__PURE__ */ jsx8(
|
|
1926
1922
|
"span",
|
|
1927
1923
|
{
|
|
1928
1924
|
"data-testid": "layer-kind-badge",
|
|
@@ -1930,7 +1926,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1930
1926
|
children: layerBadge(layer)
|
|
1931
1927
|
}
|
|
1932
1928
|
)
|
|
1933
|
-
] }) : /* @__PURE__ */
|
|
1929
|
+
] }) : /* @__PURE__ */ jsx8(
|
|
1934
1930
|
"span",
|
|
1935
1931
|
{
|
|
1936
1932
|
className: "shrink-0 grid place-items-center rounded bg-muted text-[9px] text-muted-foreground ring-1 ring-border",
|
|
@@ -1938,7 +1934,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1938
1934
|
children: layerBadge(layer)
|
|
1939
1935
|
}
|
|
1940
1936
|
),
|
|
1941
|
-
layer.mask && !layer.mask.source && layer.type === "pixel" && /* @__PURE__ */
|
|
1937
|
+
layer.mask && !layer.mask.source && layer.type === "pixel" && /* @__PURE__ */ jsx8(
|
|
1942
1938
|
"button",
|
|
1943
1939
|
{
|
|
1944
1940
|
type: "button",
|
|
@@ -1954,7 +1950,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1954
1950
|
children: layer.mask.linked === false ? "\u26D3\uFE0E\u0338" : "\u26D3\uFE0E"
|
|
1955
1951
|
}
|
|
1956
1952
|
),
|
|
1957
|
-
layer.mask && /* @__PURE__ */
|
|
1953
|
+
layer.mask && /* @__PURE__ */ jsx8(
|
|
1958
1954
|
Thumbnail,
|
|
1959
1955
|
{
|
|
1960
1956
|
pixels: maskThumb(layer),
|
|
@@ -1969,7 +1965,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1969
1965
|
}
|
|
1970
1966
|
}
|
|
1971
1967
|
),
|
|
1972
|
-
renaming === layer.id ? /* @__PURE__ */
|
|
1968
|
+
renaming === layer.id ? /* @__PURE__ */ jsx8(
|
|
1973
1969
|
"input",
|
|
1974
1970
|
{
|
|
1975
1971
|
autoFocus: true,
|
|
@@ -1986,7 +1982,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1986
1982
|
if (e.key === "Escape") setRenaming(null);
|
|
1987
1983
|
}
|
|
1988
1984
|
}
|
|
1989
|
-
) : /* @__PURE__ */
|
|
1985
|
+
) : /* @__PURE__ */ jsx8(
|
|
1990
1986
|
"span",
|
|
1991
1987
|
{
|
|
1992
1988
|
className: `flex-1 min-w-0 truncate ${layer.visible ? "" : "text-muted-foreground"}`,
|
|
@@ -1997,8 +1993,8 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1997
1993
|
children: row.label
|
|
1998
1994
|
}
|
|
1999
1995
|
),
|
|
2000
|
-
layerWarning(layer) && /* @__PURE__ */
|
|
2001
|
-
layerEffectsBadge(layer) && /* @__PURE__ */
|
|
1996
|
+
layerWarning(layer) && /* @__PURE__ */ jsx8("span", { role: "img", "data-testid": "layer-warning", "aria-label": layerWarning(layer), title: layerWarning(layer), className: "text-[10px] text-amber-600", children: "\u26A0" }),
|
|
1997
|
+
layerEffectsBadge(layer) && /* @__PURE__ */ jsx8(
|
|
2002
1998
|
"button",
|
|
2003
1999
|
{
|
|
2004
2000
|
type: "button",
|
|
@@ -2013,15 +2009,15 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2013
2009
|
children: "fx"
|
|
2014
2010
|
}
|
|
2015
2011
|
),
|
|
2016
|
-
locked(layer) && /* @__PURE__ */
|
|
2017
|
-
layer.blend !== "normal" && layer.blend !== "pass-through" && /* @__PURE__ */
|
|
2012
|
+
locked(layer) && /* @__PURE__ */ jsx8("span", { "aria-label": "Locked", className: "text-muted-foreground", children: "\u{1F512}" }),
|
|
2013
|
+
layer.blend !== "normal" && layer.blend !== "pass-through" && /* @__PURE__ */ jsx8("span", { className: "text-[9px] text-muted-foreground", children: layer.blend })
|
|
2018
2014
|
]
|
|
2019
2015
|
},
|
|
2020
2016
|
layer.id
|
|
2021
2017
|
);
|
|
2022
2018
|
}) }),
|
|
2023
|
-
error && /* @__PURE__ */
|
|
2024
|
-
menu && /* @__PURE__ */
|
|
2019
|
+
error && /* @__PURE__ */ jsx8("p", { role: "alert", className: "text-destructive", children: error }),
|
|
2020
|
+
menu && /* @__PURE__ */ jsx8(
|
|
2025
2021
|
"div",
|
|
2026
2022
|
{
|
|
2027
2023
|
role: "menu",
|
|
@@ -2030,7 +2026,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2030
2026
|
style: { left: menu.x, top: menu.y },
|
|
2031
2027
|
onClick: (e) => e.stopPropagation(),
|
|
2032
2028
|
onKeyDown: (e) => e.key === "Escape" && setMenu(null),
|
|
2033
|
-
children: layerMenu(controller).map((item) => /* @__PURE__ */
|
|
2029
|
+
children: layerMenu(controller).map((item) => /* @__PURE__ */ jsx8(
|
|
2034
2030
|
"button",
|
|
2035
2031
|
{
|
|
2036
2032
|
type: "button",
|
|
@@ -2052,23 +2048,23 @@ import React7, { useEffect as useEffect7, useState as useState8 } from "react";
|
|
|
2052
2048
|
import { findLayer } from "@pixerate/editor/image-editor";
|
|
2053
2049
|
|
|
2054
2050
|
// src/image-editor/ImageEffectControls.tsx
|
|
2055
|
-
import { jsx as
|
|
2051
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2056
2052
|
function ImageEffectControls({ provider, effect, name, values, onChange, onPreset, className }) {
|
|
2057
2053
|
const { description, error } = useEffectDescription(provider, effect);
|
|
2058
2054
|
let body;
|
|
2059
|
-
if (!provider) body = /* @__PURE__ */
|
|
2055
|
+
if (!provider) body = /* @__PURE__ */ jsxs9("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
2060
2056
|
'No effects provider: "',
|
|
2061
2057
|
name ?? effect,
|
|
2062
2058
|
'" is kept but not drawn.'
|
|
2063
2059
|
] });
|
|
2064
|
-
else if (error) body = /* @__PURE__ */
|
|
2065
|
-
else if (!description) body = /* @__PURE__ */
|
|
2066
|
-
else body = /* @__PURE__ */
|
|
2067
|
-
return /* @__PURE__ */
|
|
2060
|
+
else if (error) body = /* @__PURE__ */ jsx9("p", { className: "text-[11px] text-amber-600", children: error });
|
|
2061
|
+
else if (!description) body = /* @__PURE__ */ jsx9("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
|
|
2062
|
+
else body = /* @__PURE__ */ jsx9(EffectParameters, { description, values, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
|
|
2063
|
+
return /* @__PURE__ */ jsx9("div", { className, "data-testid": "image-effect-controls", children: body });
|
|
2068
2064
|
}
|
|
2069
2065
|
|
|
2070
2066
|
// src/image-editor/ImageProviderEffectsPanel.tsx
|
|
2071
|
-
import { jsx as
|
|
2067
|
+
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2072
2068
|
function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
2073
2069
|
const [, setTick] = useState8(0);
|
|
2074
2070
|
useEffect7(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -2096,21 +2092,21 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
2096
2092
|
const filters = layer?.type === "smart" ? (layer.smartFilters?.filters ?? []).filter((f) => f.kind === "effect") : [];
|
|
2097
2093
|
const generator = layer?.type === "pixel" ? layer.generator : void 0;
|
|
2098
2094
|
const canFilter = !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
|
|
2099
|
-
return /* @__PURE__ */
|
|
2100
|
-
/* @__PURE__ */
|
|
2101
|
-
/* @__PURE__ */
|
|
2102
|
-
/* @__PURE__ */
|
|
2103
|
-
/* @__PURE__ */
|
|
2095
|
+
return /* @__PURE__ */ jsxs10("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Provider effects", "data-image-provider-effects": "", children: [
|
|
2096
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
|
|
2097
|
+
/* @__PURE__ */ jsx10("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Effects" }),
|
|
2098
|
+
/* @__PURE__ */ jsx10("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider || !canFilter, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Apply effect\u2026" }),
|
|
2099
|
+
/* @__PURE__ */ jsx10("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => setBrowse(browse === "layer" ? null : "layer"), children: "Effect layer\u2026" })
|
|
2104
2100
|
] }),
|
|
2105
|
-
!provider && /* @__PURE__ */
|
|
2106
|
-
browse === "filter" && layer && /* @__PURE__ */
|
|
2107
|
-
browse === "layer" && /* @__PURE__ */
|
|
2108
|
-
generator && layer && /* @__PURE__ */
|
|
2109
|
-
/* @__PURE__ */
|
|
2110
|
-
/* @__PURE__ */
|
|
2111
|
-
/* @__PURE__ */
|
|
2101
|
+
!provider && /* @__PURE__ */ jsx10("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the document are kept." }),
|
|
2102
|
+
browse === "filter" && layer && /* @__PURE__ */ jsx10(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id))) }),
|
|
2103
|
+
browse === "layer" && /* @__PURE__ */ jsx10(EffectsBrowser, { provider, uses: ["generator", "overlay", "title"], title: "Generators and overlays", onPick: (e) => (setBrowse(null), run(() => controller.addEffectLayer(e.id))) }),
|
|
2104
|
+
generator && layer && /* @__PURE__ */ jsxs10("div", { className: "space-y-1", "data-effect-part": "generator", children: [
|
|
2105
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
|
|
2106
|
+
/* @__PURE__ */ jsx10("span", { className: "flex-1 font-medium text-foreground", children: generator.name ?? generator.effect }),
|
|
2107
|
+
/* @__PURE__ */ jsx10("button", { type: "button", className: imageOutlineButtonClass, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
|
|
2112
2108
|
] }),
|
|
2113
|
-
/* @__PURE__ */
|
|
2109
|
+
/* @__PURE__ */ jsx10(
|
|
2114
2110
|
ImageEffectControls,
|
|
2115
2111
|
{
|
|
2116
2112
|
provider,
|
|
@@ -2122,26 +2118,26 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
2122
2118
|
}
|
|
2123
2119
|
)
|
|
2124
2120
|
] }),
|
|
2125
|
-
filters.length > 0 && layer && /* @__PURE__ */
|
|
2121
|
+
filters.length > 0 && layer && /* @__PURE__ */ jsx10("ol", { className: "space-y-1", "data-effect-part": "filters", children: filters.map((f) => {
|
|
2126
2122
|
const label = f.kind === "effect" ? f.name ?? f.effect : f.kind;
|
|
2127
2123
|
const all = layer.smartFilters.filters;
|
|
2128
2124
|
const index = all.indexOf(f);
|
|
2129
2125
|
if (f.kind !== "effect") return null;
|
|
2130
|
-
return /* @__PURE__ */
|
|
2131
|
-
/* @__PURE__ */
|
|
2132
|
-
/* @__PURE__ */
|
|
2126
|
+
return /* @__PURE__ */ jsxs10("li", { className: "rounded border border-border p-1", "data-smart-effect": f.id, children: [
|
|
2127
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
|
|
2128
|
+
/* @__PURE__ */ jsx10("input", { type: "checkbox", checked: f.enabled, "aria-label": `${label} on`, onChange: (e) => {
|
|
2133
2129
|
const enabled = e.currentTarget.checked;
|
|
2134
2130
|
run(() => controller.updateEffectFilter(layer.id, f.id, { enabled }));
|
|
2135
2131
|
} }),
|
|
2136
|
-
/* @__PURE__ */
|
|
2137
|
-
/* @__PURE__ */
|
|
2138
|
-
/* @__PURE__ */
|
|
2139
|
-
/* @__PURE__ */
|
|
2132
|
+
/* @__PURE__ */ jsx10("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 }),
|
|
2133
|
+
/* @__PURE__ */ jsx10("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" }),
|
|
2134
|
+
/* @__PURE__ */ jsx10("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" }),
|
|
2135
|
+
/* @__PURE__ */ jsx10("button", { type: "button", className: imageOutlineButtonClass, "aria-label": `Remove ${label}`, onClick: () => run(() => controller.removeSmartFilter(layer.id, f.id)), children: "\u2715" })
|
|
2140
2136
|
] }),
|
|
2141
|
-
open === f.id && /* @__PURE__ */
|
|
2142
|
-
/* @__PURE__ */
|
|
2143
|
-
/* @__PURE__ */
|
|
2144
|
-
/* @__PURE__ */
|
|
2137
|
+
open === f.id && /* @__PURE__ */ jsxs10("div", { className: "mt-1 space-y-2", children: [
|
|
2138
|
+
/* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-1", children: [
|
|
2139
|
+
/* @__PURE__ */ jsx10("span", { className: "w-14 text-[11px] text-foreground", children: "Opacity" }),
|
|
2140
|
+
/* @__PURE__ */ jsx10(
|
|
2145
2141
|
"input",
|
|
2146
2142
|
{
|
|
2147
2143
|
type: "range",
|
|
@@ -2158,7 +2154,7 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
2158
2154
|
}
|
|
2159
2155
|
)
|
|
2160
2156
|
] }),
|
|
2161
|
-
/* @__PURE__ */
|
|
2157
|
+
/* @__PURE__ */ jsx10(
|
|
2162
2158
|
ImageEffectControls,
|
|
2163
2159
|
{
|
|
2164
2160
|
provider,
|
|
@@ -2172,8 +2168,8 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
2172
2168
|
] })
|
|
2173
2169
|
] }, f.id);
|
|
2174
2170
|
}) }),
|
|
2175
|
-
!layer && /* @__PURE__ */
|
|
2176
|
-
message && /* @__PURE__ */
|
|
2171
|
+
!layer && /* @__PURE__ */ jsx10("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
|
|
2172
|
+
message && /* @__PURE__ */ jsx10("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
2177
2173
|
] });
|
|
2178
2174
|
}
|
|
2179
2175
|
|
|
@@ -2199,11 +2195,11 @@ import { DEFAULT_PAINT_GRADIENT, userErrorMessage } from "@pixerate/editor/image
|
|
|
2199
2195
|
|
|
2200
2196
|
// src/image-editor/PaintGradientEditor.tsx
|
|
2201
2197
|
import { PAINT_GRADIENT_KIT } from "@pixerate/editor/image-editor";
|
|
2202
|
-
import { jsx as
|
|
2203
|
-
var PaintGradientEditor = (props) => /* @__PURE__ */
|
|
2198
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
2199
|
+
var PaintGradientEditor = (props) => /* @__PURE__ */ jsx11(PaintGradientEditorView, { ...props, kit: PAINT_GRADIENT_KIT });
|
|
2204
2200
|
|
|
2205
2201
|
// src/image-editor/BrushOptionsBar.tsx
|
|
2206
|
-
import { jsx as
|
|
2202
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2207
2203
|
var BrushOptionsBar = ({ controller, className }) => {
|
|
2208
2204
|
const [, setTick] = useState9(0);
|
|
2209
2205
|
useEffect8(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -2219,8 +2215,8 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2219
2215
|
setError(userErrorMessage(err));
|
|
2220
2216
|
}
|
|
2221
2217
|
};
|
|
2222
|
-
return /* @__PURE__ */
|
|
2223
|
-
/* @__PURE__ */
|
|
2218
|
+
return /* @__PURE__ */ jsxs11("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "brush-options", children: [
|
|
2219
|
+
/* @__PURE__ */ jsx12("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: PAINT_TOOLS.map((t) => /* @__PURE__ */ jsx12(
|
|
2224
2220
|
"button",
|
|
2225
2221
|
{
|
|
2226
2222
|
type: "button",
|
|
@@ -2232,9 +2228,9 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2232
2228
|
},
|
|
2233
2229
|
t.id
|
|
2234
2230
|
)) }),
|
|
2235
|
-
/* @__PURE__ */
|
|
2236
|
-
/* @__PURE__ */
|
|
2237
|
-
/* @__PURE__ */
|
|
2231
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", role: "group", "aria-label": "Colours", children: [
|
|
2232
|
+
/* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1", children: [
|
|
2233
|
+
/* @__PURE__ */ jsx12(
|
|
2238
2234
|
"input",
|
|
2239
2235
|
{
|
|
2240
2236
|
type: "color",
|
|
@@ -2244,10 +2240,10 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2244
2240
|
className: imageColorInputClass
|
|
2245
2241
|
}
|
|
2246
2242
|
),
|
|
2247
|
-
/* @__PURE__ */
|
|
2243
|
+
/* @__PURE__ */ jsx12("span", { className: "text-muted-foreground", children: "FG" })
|
|
2248
2244
|
] }),
|
|
2249
|
-
/* @__PURE__ */
|
|
2250
|
-
/* @__PURE__ */
|
|
2245
|
+
/* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1", children: [
|
|
2246
|
+
/* @__PURE__ */ jsx12(
|
|
2251
2247
|
"input",
|
|
2252
2248
|
{
|
|
2253
2249
|
type: "color",
|
|
@@ -2257,11 +2253,11 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2257
2253
|
className: imageColorInputClass
|
|
2258
2254
|
}
|
|
2259
2255
|
),
|
|
2260
|
-
/* @__PURE__ */
|
|
2256
|
+
/* @__PURE__ */ jsx12("span", { className: "text-muted-foreground", children: "BG" })
|
|
2261
2257
|
] }),
|
|
2262
|
-
/* @__PURE__ */
|
|
2263
|
-
/* @__PURE__ */
|
|
2264
|
-
state.activeTool === "brush" && /* @__PURE__ */
|
|
2258
|
+
/* @__PURE__ */ jsx12("button", { type: "button", title: "Swap colours (X)", className: imageChipClass(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
|
|
2259
|
+
/* @__PURE__ */ jsx12("button", { type: "button", title: "Default colours (D)", className: imageChipClass(false), onClick: () => controller.resetPaintColors(), children: "Default" }),
|
|
2260
|
+
state.activeTool === "brush" && /* @__PURE__ */ jsx12(
|
|
2265
2261
|
"button",
|
|
2266
2262
|
{
|
|
2267
2263
|
type: "button",
|
|
@@ -2273,8 +2269,8 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2273
2269
|
}
|
|
2274
2270
|
)
|
|
2275
2271
|
] }),
|
|
2276
|
-
state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */
|
|
2277
|
-
BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */
|
|
2272
|
+
state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */ jsx12(PaintGradientEditor, { value: paint, colors: { paint: foreground, secondary: background }, onChange: (g) => attempt(() => controller.setPaintOptions({ paint: g })) }),
|
|
2273
|
+
BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ jsx12(
|
|
2278
2274
|
ControlSlider,
|
|
2279
2275
|
{
|
|
2280
2276
|
spec,
|
|
@@ -2283,9 +2279,9 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2283
2279
|
},
|
|
2284
2280
|
spec.id
|
|
2285
2281
|
)),
|
|
2286
|
-
state.activeTool === "mixer" && /* @__PURE__ */
|
|
2287
|
-
/* @__PURE__ */
|
|
2288
|
-
/* @__PURE__ */
|
|
2282
|
+
state.activeTool === "mixer" && /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Mixer Brush", "data-testid": "mixer-options", children: [
|
|
2283
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
2284
|
+
/* @__PURE__ */ jsx12(
|
|
2289
2285
|
"span",
|
|
2290
2286
|
{
|
|
2291
2287
|
"aria-label": "Brush load",
|
|
@@ -2294,10 +2290,10 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2294
2290
|
style: { background: mixerLoad.reservoir ? rgbUnitToHex(mixerLoad.reservoir) : "transparent" }
|
|
2295
2291
|
}
|
|
2296
2292
|
),
|
|
2297
|
-
/* @__PURE__ */
|
|
2298
|
-
/* @__PURE__ */
|
|
2293
|
+
/* @__PURE__ */ jsx12("button", { type: "button", title: "Fill the reservoir with the foreground colour", className: imageChipClass(false), onClick: () => controller.loadMixerBrush(), children: "Load brush" }),
|
|
2294
|
+
/* @__PURE__ */ jsx12("button", { type: "button", title: "Empty the picked-up colour", className: imageChipClass(false), onClick: () => controller.cleanMixerBrush(), children: "Clean brush" })
|
|
2299
2295
|
] }),
|
|
2300
|
-
/* @__PURE__ */
|
|
2296
|
+
/* @__PURE__ */ jsx12("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children: MIXER_MIXING_OPTIONS.map((m) => /* @__PURE__ */ jsx12(
|
|
2301
2297
|
"button",
|
|
2302
2298
|
{
|
|
2303
2299
|
type: "button",
|
|
@@ -2309,52 +2305,34 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2309
2305
|
},
|
|
2310
2306
|
m.id
|
|
2311
2307
|
)) }),
|
|
2312
|
-
MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */
|
|
2313
|
-
/* @__PURE__ */
|
|
2314
|
-
/* @__PURE__ */
|
|
2315
|
-
/* @__PURE__ */
|
|
2316
|
-
"input",
|
|
2317
|
-
{
|
|
2318
|
-
type: "checkbox",
|
|
2319
|
-
"aria-label": "Load the brush after each stroke",
|
|
2320
|
-
checked: mixer.loadEachStroke,
|
|
2321
|
-
onChange: (e) => controller.setPaintOptions({ mixer: { loadEachStroke: e.target.checked } }),
|
|
2322
|
-
className: "accent-primary"
|
|
2323
|
-
}
|
|
2324
|
-
),
|
|
2308
|
+
MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ jsx12(ControlSlider, { spec, value: mixer[spec.id], onChange: (v) => controller.setPaintOptions({ mixer: { [spec.id]: v } }) }, spec.id)),
|
|
2309
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap gap-3 text-foreground", children: [
|
|
2310
|
+
/* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1.5", children: [
|
|
2311
|
+
/* @__PURE__ */ jsx12(ImageCheckbox, { label: "Load the brush after each stroke", checked: mixer.loadEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { loadEachStroke: on } }) }),
|
|
2325
2312
|
"Load each stroke"
|
|
2326
2313
|
] }),
|
|
2327
|
-
/* @__PURE__ */
|
|
2328
|
-
/* @__PURE__ */
|
|
2329
|
-
"input",
|
|
2330
|
-
{
|
|
2331
|
-
type: "checkbox",
|
|
2332
|
-
"aria-label": "Clean the brush after each stroke",
|
|
2333
|
-
checked: mixer.cleanEachStroke,
|
|
2334
|
-
onChange: (e) => controller.setPaintOptions({ mixer: { cleanEachStroke: e.target.checked } }),
|
|
2335
|
-
className: "accent-primary"
|
|
2336
|
-
}
|
|
2337
|
-
),
|
|
2314
|
+
/* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1.5", children: [
|
|
2315
|
+
/* @__PURE__ */ jsx12(ImageCheckbox, { label: "Clean the brush after each stroke", checked: mixer.cleanEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { cleanEachStroke: on } }) }),
|
|
2338
2316
|
"Clean each stroke"
|
|
2339
2317
|
] })
|
|
2340
2318
|
] })
|
|
2341
2319
|
] }),
|
|
2342
|
-
isRetouchPaintTool(tool) && /* @__PURE__ */
|
|
2343
|
-
(tool === "clone" || tool === "heal") && /* @__PURE__ */
|
|
2344
|
-
/* @__PURE__ */
|
|
2345
|
-
cloneSource && /* @__PURE__ */
|
|
2320
|
+
isRetouchPaintTool(tool) && /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Retouch options", "data-testid": "retouch-options", children: [
|
|
2321
|
+
(tool === "clone" || tool === "heal") && /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
2322
|
+
/* @__PURE__ */ jsx12("span", { className: "text-muted-foreground", "data-testid": "clone-source", children: cloneSourceLabel(controller) }),
|
|
2323
|
+
cloneSource && /* @__PURE__ */ jsx12("button", { type: "button", title: "Forget the source point", className: imageChipClass(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
|
|
2346
2324
|
] }),
|
|
2347
|
-
(tool === "clone" || tool === "heal") && /* @__PURE__ */
|
|
2348
|
-
CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */
|
|
2349
|
-
/* @__PURE__ */
|
|
2350
|
-
/* @__PURE__ */
|
|
2351
|
-
/* @__PURE__ */
|
|
2352
|
-
!cloneTransformView(controller).identity && /* @__PURE__ */
|
|
2325
|
+
(tool === "clone" || tool === "heal") && /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-1", role: "group", "aria-label": "Clone source transform", "data-testid": "clone-transform", children: [
|
|
2326
|
+
CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ jsx12(ControlSlider, { spec, value: cloneTransformView(controller)[spec.id], onChange: (v) => setCloneTransformValue(controller, spec.id, v) }, spec.id)),
|
|
2327
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", children: [
|
|
2328
|
+
/* @__PURE__ */ jsx12("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" }),
|
|
2329
|
+
/* @__PURE__ */ jsx12("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" }),
|
|
2330
|
+
!cloneTransformView(controller).identity && /* @__PURE__ */ jsx12("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className: imageChipClass(false), onClick: () => controller.setCloneTransform(null), children: "Reset transform" })
|
|
2353
2331
|
] })
|
|
2354
2332
|
] }),
|
|
2355
|
-
RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */
|
|
2356
|
-
/* @__PURE__ */
|
|
2357
|
-
choice.options.map((o) => /* @__PURE__ */
|
|
2333
|
+
RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": choice.label, children: [
|
|
2334
|
+
/* @__PURE__ */ jsx12("span", { className: "text-muted-foreground", children: choice.label }),
|
|
2335
|
+
choice.options.map((o) => /* @__PURE__ */ jsx12(
|
|
2358
2336
|
"button",
|
|
2359
2337
|
{
|
|
2360
2338
|
type: "button",
|
|
@@ -2367,61 +2345,34 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2367
2345
|
o.id
|
|
2368
2346
|
))
|
|
2369
2347
|
] }, choice.id)),
|
|
2370
|
-
RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */
|
|
2371
|
-
/* @__PURE__ */
|
|
2372
|
-
/* @__PURE__ */
|
|
2373
|
-
"input",
|
|
2374
|
-
{
|
|
2375
|
-
type: "checkbox",
|
|
2376
|
-
"aria-label": t.label,
|
|
2377
|
-
checked: retouch[t.id],
|
|
2378
|
-
onChange: (e) => controller.setPaintOptions({ retouch: { [t.id]: e.target.checked } }),
|
|
2379
|
-
className: "accent-primary"
|
|
2380
|
-
}
|
|
2381
|
-
),
|
|
2348
|
+
RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ jsx12(ControlSlider, { spec, value: retouch[spec.id], onChange: (v) => controller.setPaintOptions({ retouch: { [spec.id]: v } }) }, spec.id)),
|
|
2349
|
+
/* @__PURE__ */ jsx12("div", { className: "flex flex-wrap gap-3 text-foreground", children: RETOUCH_TOGGLES.filter((t) => t.tools.includes(tool)).map((t) => /* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1.5", children: [
|
|
2350
|
+
/* @__PURE__ */ jsx12(ImageCheckbox, { label: t.label, checked: retouch[t.id], onChange: (on) => controller.setPaintOptions({ retouch: { [t.id]: on } }) }),
|
|
2382
2351
|
t.label
|
|
2383
2352
|
] }, t.id)) })
|
|
2384
2353
|
] }),
|
|
2385
|
-
/* @__PURE__ */
|
|
2386
|
-
/* @__PURE__ */
|
|
2387
|
-
/* @__PURE__ */
|
|
2388
|
-
"input",
|
|
2389
|
-
{
|
|
2390
|
-
type: "checkbox",
|
|
2391
|
-
"aria-label": "Pressure controls size",
|
|
2392
|
-
checked: brush.pressureSize,
|
|
2393
|
-
onChange: (e) => controller.setPaintOptions({ brush: { pressureSize: e.target.checked } }),
|
|
2394
|
-
className: "accent-primary"
|
|
2395
|
-
}
|
|
2396
|
-
),
|
|
2354
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap gap-3 text-foreground", role: "group", "aria-label": "Pressure", children: [
|
|
2355
|
+
/* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1.5", children: [
|
|
2356
|
+
/* @__PURE__ */ jsx12(ImageCheckbox, { label: "Pressure controls size", checked: brush.pressureSize, onChange: (on) => controller.setPaintOptions({ brush: { pressureSize: on } }) }),
|
|
2397
2357
|
"Pressure size"
|
|
2398
2358
|
] }),
|
|
2399
|
-
/* @__PURE__ */
|
|
2400
|
-
/* @__PURE__ */
|
|
2401
|
-
"input",
|
|
2402
|
-
{
|
|
2403
|
-
type: "checkbox",
|
|
2404
|
-
"aria-label": "Pressure controls opacity",
|
|
2405
|
-
checked: brush.pressureOpacity,
|
|
2406
|
-
onChange: (e) => controller.setPaintOptions({ brush: { pressureOpacity: e.target.checked } }),
|
|
2407
|
-
className: "accent-primary"
|
|
2408
|
-
}
|
|
2409
|
-
),
|
|
2359
|
+
/* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1.5", children: [
|
|
2360
|
+
/* @__PURE__ */ jsx12(ImageCheckbox, { label: "Pressure controls opacity", checked: brush.pressureOpacity, onChange: (on) => controller.setPaintOptions({ brush: { pressureOpacity: on } }) }),
|
|
2410
2361
|
"Pressure opacity"
|
|
2411
2362
|
] })
|
|
2412
2363
|
] }),
|
|
2413
|
-
/* @__PURE__ */
|
|
2414
|
-
/* @__PURE__ */
|
|
2415
|
-
/* @__PURE__ */
|
|
2364
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex gap-1", children: [
|
|
2365
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.fillPixels()), children: "Fill" }),
|
|
2366
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.clearPixels()), children: "Clear" })
|
|
2416
2367
|
] }),
|
|
2417
|
-
error && /* @__PURE__ */
|
|
2368
|
+
error && /* @__PURE__ */ jsx12("p", { role: "alert", className: "text-destructive", children: error })
|
|
2418
2369
|
] });
|
|
2419
2370
|
};
|
|
2420
2371
|
|
|
2421
2372
|
// src/image-editor/ColorProfilePanel.tsx
|
|
2422
2373
|
import { useEffect as useEffect9, useState as useState10 } from "react";
|
|
2423
2374
|
import { COLOR_MODE_OPTIONS, INTENT_OPTIONS, PROOF_PROFILE_OPTIONS, WORKING_SPACE_OPTIONS, colorPanelView } from "@pixerate/editor/image-editor";
|
|
2424
|
-
import { Fragment as Fragment2, jsx as
|
|
2375
|
+
import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2425
2376
|
var chip = imageChipClass(false);
|
|
2426
2377
|
var select = "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground";
|
|
2427
2378
|
var ColorProfilePanel = ({ controller, className }) => {
|
|
@@ -2452,29 +2403,29 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
2452
2403
|
})
|
|
2453
2404
|
);
|
|
2454
2405
|
};
|
|
2455
|
-
return /* @__PURE__ */
|
|
2456
|
-
/* @__PURE__ */
|
|
2457
|
-
/* @__PURE__ */
|
|
2458
|
-
/* @__PURE__ */
|
|
2406
|
+
return /* @__PURE__ */ jsxs12("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "color-profile-panel", children: [
|
|
2407
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
2408
|
+
/* @__PURE__ */ jsx13("span", { className: "text-muted-foreground", children: "Profile" }),
|
|
2409
|
+
/* @__PURE__ */ jsx13("span", { "data-testid": "color-profile-name", children: view.profileName })
|
|
2459
2410
|
] }),
|
|
2460
|
-
/* @__PURE__ */
|
|
2461
|
-
/* @__PURE__ */
|
|
2462
|
-
/* @__PURE__ */
|
|
2463
|
-
view.cmykProfileName && /* @__PURE__ */
|
|
2411
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Colour mode", children: [
|
|
2412
|
+
/* @__PURE__ */ jsx13("span", { className: "text-muted-foreground", children: "Mode" }),
|
|
2413
|
+
/* @__PURE__ */ jsx13("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__ */ jsx13("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
|
|
2414
|
+
view.cmykProfileName && /* @__PURE__ */ jsx13("span", { className: "text-muted-foreground", children: view.cmykProfileName })
|
|
2464
2415
|
] }),
|
|
2465
|
-
/* @__PURE__ */
|
|
2466
|
-
/* @__PURE__ */
|
|
2467
|
-
/* @__PURE__ */
|
|
2468
|
-
/* @__PURE__ */
|
|
2469
|
-
/* @__PURE__ */
|
|
2416
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
|
|
2417
|
+
/* @__PURE__ */ jsx13("select", { "aria-label": "Target profile", className: select, value: target, onChange: (e) => setTarget(e.target.value), children: WORKING_SPACE_OPTIONS.map((o) => /* @__PURE__ */ jsx13("option", { value: o.id, children: o.label }, o.id)) }),
|
|
2418
|
+
/* @__PURE__ */ jsx13("select", { "aria-label": "Rendering intent", className: select, value: intent, onChange: (e) => setIntent(e.target.value), children: INTENT_OPTIONS.map((o) => /* @__PURE__ */ jsx13("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
|
|
2419
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", children: [
|
|
2420
|
+
/* @__PURE__ */ jsx13("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-primary" }),
|
|
2470
2421
|
"BPC"
|
|
2471
2422
|
] }),
|
|
2472
|
-
/* @__PURE__ */
|
|
2473
|
-
/* @__PURE__ */
|
|
2423
|
+
/* @__PURE__ */ jsx13("button", { type: "button", className: chip, title: "Edit \u203A Assign Profile: keep the numbers", onClick: () => attempt(() => controller.assignProfile(target)), children: "Assign" }),
|
|
2424
|
+
/* @__PURE__ */ jsx13("button", { type: "button", className: chip, title: "Edit \u203A Convert to Profile: keep the look", onClick: () => attempt(() => controller.convertToProfile(target, { intent, bpc })), children: "Convert" })
|
|
2474
2425
|
] }),
|
|
2475
|
-
/* @__PURE__ */
|
|
2476
|
-
/* @__PURE__ */
|
|
2477
|
-
/* @__PURE__ */
|
|
2426
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Proof setup", children: [
|
|
2427
|
+
/* @__PURE__ */ jsx13("span", { className: "text-muted-foreground", children: "Proof" }),
|
|
2428
|
+
/* @__PURE__ */ jsxs12(
|
|
2478
2429
|
"select",
|
|
2479
2430
|
{
|
|
2480
2431
|
"aria-label": "Proof profile",
|
|
@@ -2482,24 +2433,24 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
2482
2433
|
value: view.proof?.id ?? "",
|
|
2483
2434
|
onChange: (e) => e.target.value ? proofWith({ id: e.target.value }) : attempt(() => controller.setProofSetup(null)),
|
|
2484
2435
|
children: [
|
|
2485
|
-
/* @__PURE__ */
|
|
2486
|
-
PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */
|
|
2436
|
+
/* @__PURE__ */ jsx13("option", { value: "", children: "Off" }),
|
|
2437
|
+
PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */ jsx13("option", { value: o.id, children: o.label }, o.id))
|
|
2487
2438
|
]
|
|
2488
2439
|
}
|
|
2489
2440
|
),
|
|
2490
|
-
view.proof && /* @__PURE__ */
|
|
2491
|
-
/* @__PURE__ */
|
|
2492
|
-
/* @__PURE__ */
|
|
2493
|
-
/* @__PURE__ */
|
|
2441
|
+
view.proof && /* @__PURE__ */ jsxs12(Fragment2, { children: [
|
|
2442
|
+
/* @__PURE__ */ jsx13("select", { "aria-label": "Proof intent", className: select, value: view.proof.intent, onChange: (e) => proofWith({ intent: e.target.value }), children: INTENT_OPTIONS.map((o) => /* @__PURE__ */ jsx13("option", { value: o.id, children: o.label }, o.id)) }),
|
|
2443
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", children: [
|
|
2444
|
+
/* @__PURE__ */ jsx13("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-primary" }),
|
|
2494
2445
|
"Paper"
|
|
2495
2446
|
] }),
|
|
2496
|
-
/* @__PURE__ */
|
|
2497
|
-
/* @__PURE__ */
|
|
2447
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", children: [
|
|
2448
|
+
/* @__PURE__ */ jsx13("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-primary" }),
|
|
2498
2449
|
"Gamut warning"
|
|
2499
2450
|
] })
|
|
2500
2451
|
] })
|
|
2501
2452
|
] }),
|
|
2502
|
-
error && /* @__PURE__ */
|
|
2453
|
+
error && /* @__PURE__ */ jsx13("p", { role: "alert", className: "text-destructive", children: error })
|
|
2503
2454
|
] });
|
|
2504
2455
|
};
|
|
2505
2456
|
|
|
@@ -2511,7 +2462,7 @@ import {
|
|
|
2511
2462
|
SELECTION_TOOLS,
|
|
2512
2463
|
describeSelection
|
|
2513
2464
|
} from "@pixerate/editor/image-editor";
|
|
2514
|
-
import { jsx as
|
|
2465
|
+
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2515
2466
|
var MODIFY_OPS = [
|
|
2516
2467
|
{ op: "grow", label: "Grow" },
|
|
2517
2468
|
{ op: "shrink", label: "Shrink" },
|
|
@@ -2532,68 +2483,55 @@ var SelectionOptionsBar = ({
|
|
|
2532
2483
|
const set = (patch) => onOptionsChange({ ...options, ...patch });
|
|
2533
2484
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
2534
2485
|
const qm = quickMask ?? Boolean(controller.getState().quickMask);
|
|
2535
|
-
return /* @__PURE__ */
|
|
2536
|
-
/* @__PURE__ */
|
|
2537
|
-
/* @__PURE__ */
|
|
2538
|
-
options.tool === "wand" && /* @__PURE__ */
|
|
2539
|
-
/* @__PURE__ */
|
|
2540
|
-
/* @__PURE__ */
|
|
2541
|
-
/* @__PURE__ */
|
|
2542
|
-
/* @__PURE__ */
|
|
2486
|
+
return /* @__PURE__ */ jsxs13("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
2487
|
+
/* @__PURE__ */ jsx14("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: SELECTION_TOOLS.map((t) => /* @__PURE__ */ jsx14("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)) }),
|
|
2488
|
+
/* @__PURE__ */ jsx14("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: SELECTION_MODES.map((m) => /* @__PURE__ */ jsx14("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: SELECTION_MODE_LABELS[m] }, m)) }),
|
|
2489
|
+
options.tool === "wand" && /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-2", children: [
|
|
2490
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
|
|
2491
|
+
/* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
2492
|
+
/* @__PURE__ */ jsx14("span", { children: "Tolerance" }),
|
|
2493
|
+
/* @__PURE__ */ jsx14("span", { className: "font-mono", children: options.tolerance })
|
|
2543
2494
|
] }),
|
|
2544
|
-
/* @__PURE__ */
|
|
2545
|
-
"input",
|
|
2546
|
-
{
|
|
2547
|
-
type: "range",
|
|
2548
|
-
min: 0,
|
|
2549
|
-
max: 255,
|
|
2550
|
-
step: 1,
|
|
2551
|
-
"aria-label": "Tolerance",
|
|
2552
|
-
value: options.tolerance,
|
|
2553
|
-
onChange: (e) => set({ tolerance: Number(e.target.value) }),
|
|
2554
|
-
className: imageRangeClass
|
|
2555
|
-
}
|
|
2556
|
-
)
|
|
2495
|
+
/* @__PURE__ */ jsx14(ImageRange, { label: "Tolerance", min: 0, max: 255, step: 1, value: options.tolerance, onChange: (v) => set({ tolerance: v }) })
|
|
2557
2496
|
] }),
|
|
2558
|
-
/* @__PURE__ */
|
|
2559
|
-
/* @__PURE__ */
|
|
2497
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
2498
|
+
/* @__PURE__ */ jsx14(ImageCheckbox, { label: "Contiguous", checked: options.contiguous, onChange: (on) => set({ contiguous: on }) }),
|
|
2560
2499
|
"Contiguous"
|
|
2561
2500
|
] }),
|
|
2562
|
-
/* @__PURE__ */
|
|
2563
|
-
/* @__PURE__ */
|
|
2501
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
2502
|
+
/* @__PURE__ */ jsx14(ImageCheckbox, { label: "Sample adjusted image", checked: options.sampleMerged, onChange: (on) => set({ sampleMerged: on }) }),
|
|
2564
2503
|
"Sample adjusted image"
|
|
2565
2504
|
] }),
|
|
2566
|
-
/* @__PURE__ */
|
|
2505
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
2567
2506
|
"Sample",
|
|
2568
|
-
/* @__PURE__ */
|
|
2569
|
-
|
|
2507
|
+
/* @__PURE__ */ jsx14(
|
|
2508
|
+
ImageSelect,
|
|
2570
2509
|
{
|
|
2571
|
-
|
|
2510
|
+
label: "Sample from",
|
|
2572
2511
|
value: options.sample ?? "composite",
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
]
|
|
2512
|
+
options: [
|
|
2513
|
+
{ value: "composite", label: "All layers" },
|
|
2514
|
+
{ value: "active-layer", label: "Active layer" }
|
|
2515
|
+
],
|
|
2516
|
+
onChange: (v) => set({ sample: v })
|
|
2579
2517
|
}
|
|
2580
2518
|
)
|
|
2581
2519
|
] })
|
|
2582
2520
|
] }),
|
|
2583
|
-
/* @__PURE__ */
|
|
2584
|
-
/* @__PURE__ */
|
|
2521
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
2522
|
+
/* @__PURE__ */ jsx14(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
|
|
2585
2523
|
"Anti-alias"
|
|
2586
2524
|
] }),
|
|
2587
|
-
/* @__PURE__ */
|
|
2588
|
-
/* @__PURE__ */
|
|
2589
|
-
/* @__PURE__ */
|
|
2590
|
-
/* @__PURE__ */
|
|
2591
|
-
/* @__PURE__ */
|
|
2525
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap gap-1", children: [
|
|
2526
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
|
|
2527
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
|
|
2528
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
|
|
2529
|
+
/* @__PURE__ */ jsx14("button", { type: "button", "aria-pressed": qm, className: btn(qm), onClick: () => controller.setQuickMask(!qm), children: "Quick Mask" })
|
|
2592
2530
|
] }),
|
|
2593
|
-
/* @__PURE__ */
|
|
2594
|
-
/* @__PURE__ */
|
|
2531
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2532
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
2595
2533
|
"Radius",
|
|
2596
|
-
/* @__PURE__ */
|
|
2534
|
+
/* @__PURE__ */ jsx14(
|
|
2597
2535
|
"input",
|
|
2598
2536
|
{
|
|
2599
2537
|
type: "number",
|
|
@@ -2607,9 +2545,9 @@ var SelectionOptionsBar = ({
|
|
|
2607
2545
|
}
|
|
2608
2546
|
)
|
|
2609
2547
|
] }),
|
|
2610
|
-
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */
|
|
2548
|
+
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ jsx14("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
|
|
2611
2549
|
] }),
|
|
2612
|
-
/* @__PURE__ */
|
|
2550
|
+
/* @__PURE__ */ jsx14("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: describeSelection(sel) })
|
|
2613
2551
|
] });
|
|
2614
2552
|
};
|
|
2615
2553
|
|
|
@@ -2621,7 +2559,7 @@ import {
|
|
|
2621
2559
|
adjustmentKindLabel as adjustmentKindLabel2,
|
|
2622
2560
|
layerMaskFromSelection
|
|
2623
2561
|
} from "@pixerate/editor/image-editor";
|
|
2624
|
-
import { Fragment as Fragment3, jsx as
|
|
2562
|
+
import { Fragment as Fragment3, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2625
2563
|
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
2626
2564
|
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";
|
|
2627
2565
|
var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
@@ -2644,17 +2582,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2644
2582
|
setBusy(false);
|
|
2645
2583
|
}
|
|
2646
2584
|
};
|
|
2647
|
-
return /* @__PURE__ */
|
|
2648
|
-
/* @__PURE__ */
|
|
2649
|
-
REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */
|
|
2650
|
-
/* @__PURE__ */
|
|
2651
|
-
/* @__PURE__ */
|
|
2652
|
-
/* @__PURE__ */
|
|
2585
|
+
return /* @__PURE__ */ jsxs14("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
2586
|
+
/* @__PURE__ */ jsx15("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
|
|
2587
|
+
REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
|
|
2588
|
+
/* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
2589
|
+
/* @__PURE__ */ jsx15("span", { children: c.label }),
|
|
2590
|
+
/* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
|
|
2653
2591
|
params[c.id],
|
|
2654
2592
|
c.unit
|
|
2655
2593
|
] })
|
|
2656
2594
|
] }),
|
|
2657
|
-
/* @__PURE__ */
|
|
2595
|
+
/* @__PURE__ */ jsx15(
|
|
2658
2596
|
"input",
|
|
2659
2597
|
{
|
|
2660
2598
|
type: "range",
|
|
@@ -2668,28 +2606,28 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2668
2606
|
}
|
|
2669
2607
|
)
|
|
2670
2608
|
] }, c.id)),
|
|
2671
|
-
/* @__PURE__ */
|
|
2672
|
-
/* @__PURE__ */
|
|
2609
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
2610
|
+
/* @__PURE__ */ jsx15("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
2673
2611
|
"Smart Radius"
|
|
2674
2612
|
] }),
|
|
2675
|
-
/* @__PURE__ */
|
|
2676
|
-
/* @__PURE__ */
|
|
2677
|
-
/* @__PURE__ */
|
|
2613
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex gap-1", children: [
|
|
2614
|
+
/* @__PURE__ */ jsx15("button", { type: "button", className: button, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
2615
|
+
/* @__PURE__ */ jsx15("button", { type: "button", className: button, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
|
2678
2616
|
] }),
|
|
2679
|
-
error && /* @__PURE__ */
|
|
2680
|
-
/* @__PURE__ */
|
|
2681
|
-
/* @__PURE__ */
|
|
2682
|
-
/* @__PURE__ */
|
|
2617
|
+
error && /* @__PURE__ */ jsx15("p", { role: "alert", className: "text-destructive", children: error }),
|
|
2618
|
+
/* @__PURE__ */ jsx15("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
|
|
2619
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex gap-1 items-center", children: [
|
|
2620
|
+
/* @__PURE__ */ jsx15(
|
|
2683
2621
|
"select",
|
|
2684
2622
|
{
|
|
2685
2623
|
"aria-label": "New masked layer kind",
|
|
2686
2624
|
value: newKind,
|
|
2687
2625
|
onChange: (e) => setNewKind(e.target.value),
|
|
2688
2626
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
2689
|
-
children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */
|
|
2627
|
+
children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */ jsx15("option", { value: k.kind, children: k.label }, k.kind))
|
|
2690
2628
|
}
|
|
2691
2629
|
),
|
|
2692
|
-
/* @__PURE__ */
|
|
2630
|
+
/* @__PURE__ */ jsx15(
|
|
2693
2631
|
"button",
|
|
2694
2632
|
{
|
|
2695
2633
|
type: "button",
|
|
@@ -2700,35 +2638,35 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2700
2638
|
}
|
|
2701
2639
|
)
|
|
2702
2640
|
] }),
|
|
2703
|
-
list.length > 0 && target && /* @__PURE__ */
|
|
2704
|
-
/* @__PURE__ */
|
|
2641
|
+
list.length > 0 && target && /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-2", children: [
|
|
2642
|
+
/* @__PURE__ */ jsx15(
|
|
2705
2643
|
"select",
|
|
2706
2644
|
{
|
|
2707
2645
|
"aria-label": "Mask layer",
|
|
2708
2646
|
value: target.id,
|
|
2709
2647
|
onChange: (e) => setLayerId(e.target.value),
|
|
2710
2648
|
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
2711
|
-
children: list.map((l) => /* @__PURE__ */
|
|
2649
|
+
children: list.map((l) => /* @__PURE__ */ jsxs14("option", { value: l.id, children: [
|
|
2712
2650
|
l.name || adjustmentKindLabel2(l.kind),
|
|
2713
2651
|
l.mask ? " (masked)" : ""
|
|
2714
2652
|
] }, l.id))
|
|
2715
2653
|
}
|
|
2716
2654
|
),
|
|
2717
|
-
/* @__PURE__ */
|
|
2718
|
-
/* @__PURE__ */
|
|
2719
|
-
/* @__PURE__ */
|
|
2720
|
-
/* @__PURE__ */
|
|
2655
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap gap-1", children: [
|
|
2656
|
+
/* @__PURE__ */ jsx15("button", { type: "button", className: button, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
|
|
2657
|
+
/* @__PURE__ */ jsx15("button", { type: "button", className: button, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
|
|
2658
|
+
/* @__PURE__ */ jsx15("button", { type: "button", className: button, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
|
|
2721
2659
|
] }),
|
|
2722
|
-
target.mask && /* @__PURE__ */
|
|
2723
|
-
/* @__PURE__ */
|
|
2724
|
-
/* @__PURE__ */
|
|
2725
|
-
/* @__PURE__ */
|
|
2726
|
-
/* @__PURE__ */
|
|
2660
|
+
target.mask && /* @__PURE__ */ jsxs14(Fragment3, { children: [
|
|
2661
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
|
|
2662
|
+
/* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
2663
|
+
/* @__PURE__ */ jsx15("span", { children: "Density" }),
|
|
2664
|
+
/* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
|
|
2727
2665
|
Math.round((target.mask.density ?? 1) * 100),
|
|
2728
2666
|
"%"
|
|
2729
2667
|
] })
|
|
2730
2668
|
] }),
|
|
2731
|
-
/* @__PURE__ */
|
|
2669
|
+
/* @__PURE__ */ jsx15(
|
|
2732
2670
|
"input",
|
|
2733
2671
|
{
|
|
2734
2672
|
type: "range",
|
|
@@ -2742,15 +2680,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2742
2680
|
}
|
|
2743
2681
|
)
|
|
2744
2682
|
] }),
|
|
2745
|
-
/* @__PURE__ */
|
|
2746
|
-
/* @__PURE__ */
|
|
2747
|
-
/* @__PURE__ */
|
|
2748
|
-
/* @__PURE__ */
|
|
2683
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
|
|
2684
|
+
/* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
2685
|
+
/* @__PURE__ */ jsx15("span", { children: "Mask Feather" }),
|
|
2686
|
+
/* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
|
|
2749
2687
|
target.mask.feather ?? 0,
|
|
2750
2688
|
"px"
|
|
2751
2689
|
] })
|
|
2752
2690
|
] }),
|
|
2753
|
-
/* @__PURE__ */
|
|
2691
|
+
/* @__PURE__ */ jsx15(
|
|
2754
2692
|
"input",
|
|
2755
2693
|
{
|
|
2756
2694
|
type: "range",
|
|
@@ -2772,7 +2710,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2772
2710
|
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
2773
2711
|
import { useEffect as useEffect10, useState as useState13 } from "react";
|
|
2774
2712
|
import { FREE_TRANSFORM_FIELDS, FREE_TRANSFORM_MODE_OPTIONS, INTERPOLATIONS, TRANSFORM_ANCHORS, WARP_GRID_OPTIONS, WARP_STYLE_OPTIONS } from "@pixerate/editor/image-editor";
|
|
2775
|
-
import { jsx as
|
|
2713
|
+
import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2776
2714
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
2777
2715
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
2778
2716
|
const [, setTick] = useState13(0);
|
|
@@ -2788,17 +2726,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2788
2726
|
const v = Number(raw);
|
|
2789
2727
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
2790
2728
|
};
|
|
2791
|
-
return /* @__PURE__ */
|
|
2792
|
-
/* @__PURE__ */
|
|
2793
|
-
/* @__PURE__ */
|
|
2794
|
-
tool.mode === "warp" && /* @__PURE__ */
|
|
2795
|
-
/* @__PURE__ */
|
|
2796
|
-
/* @__PURE__ */
|
|
2797
|
-
/* @__PURE__ */
|
|
2729
|
+
return /* @__PURE__ */ jsxs15("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: [
|
|
2730
|
+
/* @__PURE__ */ jsx16("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ jsx16("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)) }),
|
|
2731
|
+
/* @__PURE__ */ jsx16("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ jsx16("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)) }),
|
|
2732
|
+
tool.mode === "warp" && /* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
2733
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", children: [
|
|
2734
|
+
/* @__PURE__ */ jsx16("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
2735
|
+
/* @__PURE__ */ jsx16("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__ */ jsx16("option", { value: o.id, children: o.label }, o.id)) })
|
|
2798
2736
|
] }),
|
|
2799
|
-
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */
|
|
2800
|
-
/* @__PURE__ */
|
|
2801
|
-
/* @__PURE__ */
|
|
2737
|
+
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", children: [
|
|
2738
|
+
/* @__PURE__ */ jsx16("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
2739
|
+
/* @__PURE__ */ jsx16(
|
|
2802
2740
|
"input",
|
|
2803
2741
|
{
|
|
2804
2742
|
type: "number",
|
|
@@ -2819,9 +2757,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2819
2757
|
},
|
|
2820
2758
|
`${k}:${warp[k]}`
|
|
2821
2759
|
),
|
|
2822
|
-
/* @__PURE__ */
|
|
2760
|
+
/* @__PURE__ */ jsx16("span", { className: "text-muted-foreground", children: "%" })
|
|
2823
2761
|
] }, k)),
|
|
2824
|
-
/* @__PURE__ */
|
|
2762
|
+
/* @__PURE__ */ jsx16(
|
|
2825
2763
|
"button",
|
|
2826
2764
|
{
|
|
2827
2765
|
type: "button",
|
|
@@ -2833,9 +2771,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2833
2771
|
children: "Vertical"
|
|
2834
2772
|
}
|
|
2835
2773
|
),
|
|
2836
|
-
/* @__PURE__ */
|
|
2837
|
-
/* @__PURE__ */
|
|
2838
|
-
/* @__PURE__ */
|
|
2774
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", children: [
|
|
2775
|
+
/* @__PURE__ */ jsx16("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
2776
|
+
/* @__PURE__ */ jsx16(
|
|
2839
2777
|
"select",
|
|
2840
2778
|
{
|
|
2841
2779
|
"aria-label": "Warp grid",
|
|
@@ -2845,14 +2783,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2845
2783
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
2846
2784
|
},
|
|
2847
2785
|
className: imageFieldClass,
|
|
2848
|
-
children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */
|
|
2786
|
+
children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ jsx16("option", { value: g.id, children: g.label }, g.id))
|
|
2849
2787
|
}
|
|
2850
2788
|
)
|
|
2851
2789
|
] })
|
|
2852
2790
|
] }),
|
|
2853
|
-
tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */
|
|
2854
|
-
/* @__PURE__ */
|
|
2855
|
-
/* @__PURE__ */
|
|
2791
|
+
tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
2792
|
+
/* @__PURE__ */ jsx16("span", { className: "text-muted-foreground", children: f.label }),
|
|
2793
|
+
/* @__PURE__ */ jsx16(
|
|
2856
2794
|
"input",
|
|
2857
2795
|
{
|
|
2858
2796
|
type: "number",
|
|
@@ -2872,8 +2810,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2872
2810
|
},
|
|
2873
2811
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
2874
2812
|
),
|
|
2875
|
-
/* @__PURE__ */
|
|
2876
|
-
f.id === "scaleX" && /* @__PURE__ */
|
|
2813
|
+
/* @__PURE__ */ jsx16("span", { className: "text-muted-foreground", children: f.unit }),
|
|
2814
|
+
f.id === "scaleX" && /* @__PURE__ */ jsx16(
|
|
2877
2815
|
"button",
|
|
2878
2816
|
{
|
|
2879
2817
|
type: "button",
|
|
@@ -2888,29 +2826,29 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2888
2826
|
}
|
|
2889
2827
|
)
|
|
2890
2828
|
] }, f.id)),
|
|
2891
|
-
/* @__PURE__ */
|
|
2892
|
-
/* @__PURE__ */
|
|
2893
|
-
/* @__PURE__ */
|
|
2829
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", children: [
|
|
2830
|
+
/* @__PURE__ */ jsx16("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
2831
|
+
/* @__PURE__ */ jsx16(
|
|
2894
2832
|
"select",
|
|
2895
2833
|
{
|
|
2896
2834
|
"aria-label": "Interpolation",
|
|
2897
2835
|
value: tool.interpolation,
|
|
2898
2836
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
2899
2837
|
className: imageFieldClass,
|
|
2900
|
-
children: INTERPOLATIONS.map((i) => /* @__PURE__ */
|
|
2838
|
+
children: INTERPOLATIONS.map((i) => /* @__PURE__ */ jsx16("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
2901
2839
|
}
|
|
2902
2840
|
)
|
|
2903
2841
|
] }),
|
|
2904
|
-
/* @__PURE__ */
|
|
2905
|
-
/* @__PURE__ */
|
|
2906
|
-
tool.error && /* @__PURE__ */
|
|
2842
|
+
/* @__PURE__ */ jsx16("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" }),
|
|
2843
|
+
/* @__PURE__ */ jsx16("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
2844
|
+
tool.error && /* @__PURE__ */ jsx16("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
2907
2845
|
] });
|
|
2908
2846
|
};
|
|
2909
2847
|
|
|
2910
2848
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
2911
2849
|
import { useEffect as useEffect11, useState as useState14 } from "react";
|
|
2912
2850
|
import { LIVE_SHAPE_KINDS, SHAPE_KIND_LABELS, applyShapeOptions } from "@pixerate/editor/image-editor";
|
|
2913
|
-
import { Fragment as Fragment4, jsx as
|
|
2851
|
+
import { Fragment as Fragment4, jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2914
2852
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
2915
2853
|
const [, setTick] = useState14(0);
|
|
2916
2854
|
useEffect11(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -2928,13 +2866,13 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2928
2866
|
}
|
|
2929
2867
|
};
|
|
2930
2868
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
2931
|
-
return /* @__PURE__ */
|
|
2932
|
-
/* @__PURE__ */
|
|
2933
|
-
/* @__PURE__ */
|
|
2934
|
-
/* @__PURE__ */
|
|
2935
|
-
/* @__PURE__ */
|
|
2869
|
+
return /* @__PURE__ */ jsxs16("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
2870
|
+
/* @__PURE__ */ jsx17("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ jsx17("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: SHAPE_KIND_LABELS[k] }, k)) }),
|
|
2871
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
2872
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
|
|
2873
|
+
/* @__PURE__ */ jsx17(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
|
|
2936
2874
|
"Fill",
|
|
2937
|
-
/* @__PURE__ */
|
|
2875
|
+
/* @__PURE__ */ jsx17(
|
|
2938
2876
|
"input",
|
|
2939
2877
|
{
|
|
2940
2878
|
type: "color",
|
|
@@ -2946,10 +2884,10 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2946
2884
|
}
|
|
2947
2885
|
)
|
|
2948
2886
|
] }),
|
|
2949
|
-
/* @__PURE__ */
|
|
2950
|
-
/* @__PURE__ */
|
|
2887
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
|
|
2888
|
+
/* @__PURE__ */ jsx17(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
|
|
2951
2889
|
"Stroke",
|
|
2952
|
-
/* @__PURE__ */
|
|
2890
|
+
/* @__PURE__ */ jsx17(
|
|
2953
2891
|
"input",
|
|
2954
2892
|
{
|
|
2955
2893
|
type: "color",
|
|
@@ -2961,9 +2899,9 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2961
2899
|
}
|
|
2962
2900
|
)
|
|
2963
2901
|
] }),
|
|
2964
|
-
/* @__PURE__ */
|
|
2902
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
|
|
2965
2903
|
"Width",
|
|
2966
|
-
/* @__PURE__ */
|
|
2904
|
+
/* @__PURE__ */ jsx17(
|
|
2967
2905
|
"input",
|
|
2968
2906
|
{
|
|
2969
2907
|
type: "number",
|
|
@@ -2977,57 +2915,45 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2977
2915
|
)
|
|
2978
2916
|
] })
|
|
2979
2917
|
] }),
|
|
2980
|
-
/* @__PURE__ */
|
|
2981
|
-
options.kind === "rect" && /* @__PURE__ */
|
|
2918
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
2919
|
+
options.kind === "rect" && /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
|
|
2982
2920
|
"Radius",
|
|
2983
|
-
/* @__PURE__ */
|
|
2921
|
+
/* @__PURE__ */ jsx17("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}` })
|
|
2984
2922
|
] }),
|
|
2985
|
-
options.kind === "polygon" && /* @__PURE__ */
|
|
2923
|
+
options.kind === "polygon" && /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
|
|
2986
2924
|
"Sides",
|
|
2987
|
-
/* @__PURE__ */
|
|
2925
|
+
/* @__PURE__ */ jsx17("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}` })
|
|
2988
2926
|
] }),
|
|
2989
|
-
options.kind === "star" && /* @__PURE__ */
|
|
2990
|
-
/* @__PURE__ */
|
|
2927
|
+
options.kind === "star" && /* @__PURE__ */ jsxs16(Fragment4, { children: [
|
|
2928
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
|
|
2991
2929
|
"Points",
|
|
2992
|
-
/* @__PURE__ */
|
|
2930
|
+
/* @__PURE__ */ jsx17("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}` })
|
|
2993
2931
|
] }),
|
|
2994
|
-
/* @__PURE__ */
|
|
2932
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
|
|
2995
2933
|
"Inner",
|
|
2996
|
-
/* @__PURE__ */
|
|
2997
|
-
"input",
|
|
2998
|
-
{
|
|
2999
|
-
type: "range",
|
|
3000
|
-
"aria-label": "Inner radius",
|
|
3001
|
-
min: 0.05,
|
|
3002
|
-
max: 1,
|
|
3003
|
-
step: 0.05,
|
|
3004
|
-
value: options.innerRatio,
|
|
3005
|
-
onChange: (e) => set({ innerRatio: Number(e.target.value) }),
|
|
3006
|
-
className: "accent-primary"
|
|
3007
|
-
}
|
|
3008
|
-
)
|
|
2934
|
+
/* @__PURE__ */ jsx17(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
|
|
3009
2935
|
] })
|
|
3010
2936
|
] }),
|
|
3011
|
-
options.kind === "line" && /* @__PURE__ */
|
|
3012
|
-
/* @__PURE__ */
|
|
2937
|
+
options.kind === "line" && /* @__PURE__ */ jsxs16(Fragment4, { children: [
|
|
2938
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
|
|
3013
2939
|
"Weight",
|
|
3014
|
-
/* @__PURE__ */
|
|
2940
|
+
/* @__PURE__ */ jsx17("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}` })
|
|
3015
2941
|
] }),
|
|
3016
|
-
/* @__PURE__ */
|
|
3017
|
-
/* @__PURE__ */
|
|
2942
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
|
|
2943
|
+
/* @__PURE__ */ jsx17(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
|
|
3018
2944
|
"Arrowhead"
|
|
3019
2945
|
] })
|
|
3020
2946
|
] })
|
|
3021
2947
|
] }),
|
|
3022
|
-
/* @__PURE__ */
|
|
3023
|
-
error && /* @__PURE__ */
|
|
2948
|
+
/* @__PURE__ */ jsx17("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." }),
|
|
2949
|
+
error && /* @__PURE__ */ jsx17("p", { role: "alert", className: "text-destructive", children: error })
|
|
3024
2950
|
] });
|
|
3025
2951
|
};
|
|
3026
2952
|
|
|
3027
2953
|
// src/image-editor/TypeOptionsBar.tsx
|
|
3028
2954
|
import { useEffect as useEffect12, useState as useState15 } from "react";
|
|
3029
2955
|
import { TEXT_ALIGNS } from "@pixerate/editor/image-editor";
|
|
3030
|
-
import { jsx as
|
|
2956
|
+
import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3031
2957
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
3032
2958
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
3033
2959
|
const [, setTick] = useState15(0);
|
|
@@ -3065,11 +2991,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
3065
2991
|
setError(e instanceof Error ? e.message : String(e));
|
|
3066
2992
|
}
|
|
3067
2993
|
};
|
|
3068
|
-
return /* @__PURE__ */
|
|
3069
|
-
/* @__PURE__ */
|
|
3070
|
-
/* @__PURE__ */
|
|
2994
|
+
return /* @__PURE__ */ jsxs17("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
|
|
2995
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
2996
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1", children: [
|
|
3071
2997
|
"Font",
|
|
3072
|
-
/* @__PURE__ */
|
|
2998
|
+
/* @__PURE__ */ jsx18(
|
|
3073
2999
|
"input",
|
|
3074
3000
|
{
|
|
3075
3001
|
list: "pixerate-type-fonts",
|
|
@@ -3079,11 +3005,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
3079
3005
|
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
3080
3006
|
}
|
|
3081
3007
|
),
|
|
3082
|
-
/* @__PURE__ */
|
|
3008
|
+
/* @__PURE__ */ jsx18("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ jsx18("option", { value: f }, f)) })
|
|
3083
3009
|
] }),
|
|
3084
|
-
/* @__PURE__ */
|
|
3010
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1", children: [
|
|
3085
3011
|
"Size",
|
|
3086
|
-
/* @__PURE__ */
|
|
3012
|
+
/* @__PURE__ */ jsx18(
|
|
3087
3013
|
"input",
|
|
3088
3014
|
{
|
|
3089
3015
|
type: "number",
|
|
@@ -3096,24 +3022,24 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
3096
3022
|
}
|
|
3097
3023
|
)
|
|
3098
3024
|
] }),
|
|
3099
|
-
/* @__PURE__ */
|
|
3100
|
-
/* @__PURE__ */
|
|
3101
|
-
/* @__PURE__ */
|
|
3025
|
+
/* @__PURE__ */ jsx18("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" }),
|
|
3026
|
+
/* @__PURE__ */ jsx18("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
3027
|
+
/* @__PURE__ */ jsx18("input", { type: "color", "aria-label": "Text colour", value: shown.color, onChange: (e) => style({ color: e.target.value }), className: imageColorInputClass })
|
|
3102
3028
|
] }),
|
|
3103
|
-
/* @__PURE__ */
|
|
3104
|
-
/* @__PURE__ */
|
|
3105
|
-
missing.length > 0 && /* @__PURE__ */
|
|
3029
|
+
/* @__PURE__ */ jsx18("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: TEXT_ALIGNS.map((a) => /* @__PURE__ */ jsx18("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
3030
|
+
/* @__PURE__ */ jsx18("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." }),
|
|
3031
|
+
missing.length > 0 && /* @__PURE__ */ jsxs17("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
3106
3032
|
"Missing ",
|
|
3107
3033
|
missing.length === 1 ? "font" : "fonts",
|
|
3108
3034
|
": ",
|
|
3109
3035
|
missing.join(", ")
|
|
3110
3036
|
] }),
|
|
3111
|
-
error && /* @__PURE__ */
|
|
3037
|
+
error && /* @__PURE__ */ jsx18("p", { role: "alert", className: "text-destructive", children: error })
|
|
3112
3038
|
] });
|
|
3113
3039
|
};
|
|
3114
3040
|
|
|
3115
3041
|
// src/image-editor/ImageEditor.tsx
|
|
3116
|
-
import { Fragment as Fragment5, jsx as
|
|
3042
|
+
import { Fragment as Fragment5, jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3117
3043
|
var ImageEditor = ({
|
|
3118
3044
|
editor: externalEditor,
|
|
3119
3045
|
src,
|
|
@@ -3276,16 +3202,16 @@ var ImageEditor = ({
|
|
|
3276
3202
|
link.click();
|
|
3277
3203
|
}
|
|
3278
3204
|
};
|
|
3279
|
-
return /* @__PURE__ */
|
|
3205
|
+
return /* @__PURE__ */ jsxs18(
|
|
3280
3206
|
"div",
|
|
3281
3207
|
{
|
|
3282
3208
|
ref: rootRef,
|
|
3283
3209
|
className: `${imageEditorFrameClass} ${className}`,
|
|
3284
3210
|
style,
|
|
3285
3211
|
children: [
|
|
3286
|
-
/* @__PURE__ */
|
|
3287
|
-
/* @__PURE__ */
|
|
3288
|
-
/* @__PURE__ */
|
|
3212
|
+
/* @__PURE__ */ jsxs18("div", { className: imageEditorHeaderClass, children: [
|
|
3213
|
+
/* @__PURE__ */ jsxs18("div", { role: "tablist", className: imageTabListClass, children: [
|
|
3214
|
+
/* @__PURE__ */ jsx19(
|
|
3289
3215
|
"button",
|
|
3290
3216
|
{
|
|
3291
3217
|
type: "button",
|
|
@@ -3300,7 +3226,7 @@ var ImageEditor = ({
|
|
|
3300
3226
|
children: "Transform & Crop"
|
|
3301
3227
|
}
|
|
3302
3228
|
),
|
|
3303
|
-
/* @__PURE__ */
|
|
3229
|
+
/* @__PURE__ */ jsx19(
|
|
3304
3230
|
"button",
|
|
3305
3231
|
{
|
|
3306
3232
|
type: "button",
|
|
@@ -3315,7 +3241,7 @@ var ImageEditor = ({
|
|
|
3315
3241
|
children: "Adjustments"
|
|
3316
3242
|
}
|
|
3317
3243
|
),
|
|
3318
|
-
/* @__PURE__ */
|
|
3244
|
+
/* @__PURE__ */ jsx19(
|
|
3319
3245
|
"button",
|
|
3320
3246
|
{
|
|
3321
3247
|
type: "button",
|
|
@@ -3330,7 +3256,7 @@ var ImageEditor = ({
|
|
|
3330
3256
|
children: "Layers"
|
|
3331
3257
|
}
|
|
3332
3258
|
),
|
|
3333
|
-
/* @__PURE__ */
|
|
3259
|
+
/* @__PURE__ */ jsx19(
|
|
3334
3260
|
"button",
|
|
3335
3261
|
{
|
|
3336
3262
|
type: "button",
|
|
@@ -3345,7 +3271,7 @@ var ImageEditor = ({
|
|
|
3345
3271
|
children: "Paint"
|
|
3346
3272
|
}
|
|
3347
3273
|
),
|
|
3348
|
-
/* @__PURE__ */
|
|
3274
|
+
/* @__PURE__ */ jsx19(
|
|
3349
3275
|
"button",
|
|
3350
3276
|
{
|
|
3351
3277
|
type: "button",
|
|
@@ -3360,7 +3286,7 @@ var ImageEditor = ({
|
|
|
3360
3286
|
children: "Select & Mask"
|
|
3361
3287
|
}
|
|
3362
3288
|
),
|
|
3363
|
-
/* @__PURE__ */
|
|
3289
|
+
/* @__PURE__ */ jsx19(
|
|
3364
3290
|
"button",
|
|
3365
3291
|
{
|
|
3366
3292
|
type: "button",
|
|
@@ -3375,7 +3301,7 @@ var ImageEditor = ({
|
|
|
3375
3301
|
children: "Annotations"
|
|
3376
3302
|
}
|
|
3377
3303
|
),
|
|
3378
|
-
/* @__PURE__ */
|
|
3304
|
+
/* @__PURE__ */ jsx19(
|
|
3379
3305
|
"button",
|
|
3380
3306
|
{
|
|
3381
3307
|
type: "button",
|
|
@@ -3390,7 +3316,7 @@ var ImageEditor = ({
|
|
|
3390
3316
|
children: "Depth Mask"
|
|
3391
3317
|
}
|
|
3392
3318
|
),
|
|
3393
|
-
/* @__PURE__ */
|
|
3319
|
+
/* @__PURE__ */ jsxs18(
|
|
3394
3320
|
"button",
|
|
3395
3321
|
{
|
|
3396
3322
|
type: "button",
|
|
@@ -3403,14 +3329,14 @@ var ImageEditor = ({
|
|
|
3403
3329
|
"aria-selected": activeTab === "ai",
|
|
3404
3330
|
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
3405
3331
|
children: [
|
|
3406
|
-
/* @__PURE__ */
|
|
3332
|
+
/* @__PURE__ */ jsx19("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx19("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" }) }),
|
|
3407
3333
|
"AI Tools"
|
|
3408
3334
|
]
|
|
3409
3335
|
}
|
|
3410
3336
|
)
|
|
3411
3337
|
] }),
|
|
3412
|
-
/* @__PURE__ */
|
|
3413
|
-
/* @__PURE__ */
|
|
3338
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
3339
|
+
/* @__PURE__ */ jsx19(
|
|
3414
3340
|
"button",
|
|
3415
3341
|
{
|
|
3416
3342
|
type: "button",
|
|
@@ -3421,7 +3347,7 @@ var ImageEditor = ({
|
|
|
3421
3347
|
children: "\u21A9"
|
|
3422
3348
|
}
|
|
3423
3349
|
),
|
|
3424
|
-
/* @__PURE__ */
|
|
3350
|
+
/* @__PURE__ */ jsx19(
|
|
3425
3351
|
"button",
|
|
3426
3352
|
{
|
|
3427
3353
|
type: "button",
|
|
@@ -3432,7 +3358,7 @@ var ImageEditor = ({
|
|
|
3432
3358
|
children: "\u21AA"
|
|
3433
3359
|
}
|
|
3434
3360
|
),
|
|
3435
|
-
/* @__PURE__ */
|
|
3361
|
+
/* @__PURE__ */ jsx19(
|
|
3436
3362
|
"button",
|
|
3437
3363
|
{
|
|
3438
3364
|
type: "button",
|
|
@@ -3441,8 +3367,8 @@ var ImageEditor = ({
|
|
|
3441
3367
|
children: "Reset"
|
|
3442
3368
|
}
|
|
3443
3369
|
),
|
|
3444
|
-
/* @__PURE__ */
|
|
3445
|
-
/* @__PURE__ */
|
|
3370
|
+
/* @__PURE__ */ jsx19("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
3371
|
+
/* @__PURE__ */ jsx19(
|
|
3446
3372
|
"button",
|
|
3447
3373
|
{
|
|
3448
3374
|
type: "button",
|
|
@@ -3452,11 +3378,11 @@ var ImageEditor = ({
|
|
|
3452
3378
|
children: "-"
|
|
3453
3379
|
}
|
|
3454
3380
|
),
|
|
3455
|
-
/* @__PURE__ */
|
|
3381
|
+
/* @__PURE__ */ jsxs18("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
3456
3382
|
Math.round(state.zoom * 100),
|
|
3457
3383
|
"%"
|
|
3458
3384
|
] }),
|
|
3459
|
-
/* @__PURE__ */
|
|
3385
|
+
/* @__PURE__ */ jsx19(
|
|
3460
3386
|
"button",
|
|
3461
3387
|
{
|
|
3462
3388
|
type: "button",
|
|
@@ -3466,8 +3392,8 @@ var ImageEditor = ({
|
|
|
3466
3392
|
children: "+"
|
|
3467
3393
|
}
|
|
3468
3394
|
),
|
|
3469
|
-
/* @__PURE__ */
|
|
3470
|
-
/* @__PURE__ */
|
|
3395
|
+
/* @__PURE__ */ jsx19("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
3396
|
+
/* @__PURE__ */ jsx19(
|
|
3471
3397
|
"button",
|
|
3472
3398
|
{
|
|
3473
3399
|
type: "button",
|
|
@@ -3478,7 +3404,7 @@ var ImageEditor = ({
|
|
|
3478
3404
|
children: "Hold Compare"
|
|
3479
3405
|
}
|
|
3480
3406
|
),
|
|
3481
|
-
/* @__PURE__ */
|
|
3407
|
+
/* @__PURE__ */ jsx19(
|
|
3482
3408
|
"button",
|
|
3483
3409
|
{
|
|
3484
3410
|
type: "button",
|
|
@@ -3489,10 +3415,10 @@ var ImageEditor = ({
|
|
|
3489
3415
|
)
|
|
3490
3416
|
] })
|
|
3491
3417
|
] }),
|
|
3492
|
-
transformTool.active && /* @__PURE__ */
|
|
3493
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */
|
|
3494
|
-
/* @__PURE__ */
|
|
3495
|
-
/* @__PURE__ */
|
|
3418
|
+
transformTool.active && /* @__PURE__ */ jsx19(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
3419
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ jsx19("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
3420
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
3421
|
+
/* @__PURE__ */ jsx19(
|
|
3496
3422
|
ImageEditorCanvas,
|
|
3497
3423
|
{
|
|
3498
3424
|
editor,
|
|
@@ -3516,11 +3442,11 @@ var ImageEditor = ({
|
|
|
3516
3442
|
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
3517
3443
|
}
|
|
3518
3444
|
),
|
|
3519
|
-
/* @__PURE__ */
|
|
3520
|
-
activeTab === "crop" && /* @__PURE__ */
|
|
3521
|
-
/* @__PURE__ */
|
|
3522
|
-
/* @__PURE__ */
|
|
3523
|
-
/* @__PURE__ */
|
|
3445
|
+
/* @__PURE__ */ jsxs18("div", { className: imageSidebarClass, children: [
|
|
3446
|
+
activeTab === "crop" && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
3447
|
+
/* @__PURE__ */ jsx19("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
3448
|
+
/* @__PURE__ */ jsxs18("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
3449
|
+
/* @__PURE__ */ jsx19(
|
|
3524
3450
|
"button",
|
|
3525
3451
|
{
|
|
3526
3452
|
type: "button",
|
|
@@ -3532,7 +3458,7 @@ var ImageEditor = ({
|
|
|
3532
3458
|
children: "Freeform"
|
|
3533
3459
|
}
|
|
3534
3460
|
),
|
|
3535
|
-
/* @__PURE__ */
|
|
3461
|
+
/* @__PURE__ */ jsx19(
|
|
3536
3462
|
"button",
|
|
3537
3463
|
{
|
|
3538
3464
|
type: "button",
|
|
@@ -3544,7 +3470,7 @@ var ImageEditor = ({
|
|
|
3544
3470
|
children: "1:1 Square"
|
|
3545
3471
|
}
|
|
3546
3472
|
),
|
|
3547
|
-
/* @__PURE__ */
|
|
3473
|
+
/* @__PURE__ */ jsx19(
|
|
3548
3474
|
"button",
|
|
3549
3475
|
{
|
|
3550
3476
|
type: "button",
|
|
@@ -3556,7 +3482,7 @@ var ImageEditor = ({
|
|
|
3556
3482
|
children: "4:3 Standard"
|
|
3557
3483
|
}
|
|
3558
3484
|
),
|
|
3559
|
-
/* @__PURE__ */
|
|
3485
|
+
/* @__PURE__ */ jsx19(
|
|
3560
3486
|
"button",
|
|
3561
3487
|
{
|
|
3562
3488
|
type: "button",
|
|
@@ -3568,7 +3494,7 @@ var ImageEditor = ({
|
|
|
3568
3494
|
children: "16:9 Wide"
|
|
3569
3495
|
}
|
|
3570
3496
|
),
|
|
3571
|
-
/* @__PURE__ */
|
|
3497
|
+
/* @__PURE__ */ jsx19(
|
|
3572
3498
|
"button",
|
|
3573
3499
|
{
|
|
3574
3500
|
type: "button",
|
|
@@ -3580,7 +3506,7 @@ var ImageEditor = ({
|
|
|
3580
3506
|
children: "3:2 Photo"
|
|
3581
3507
|
}
|
|
3582
3508
|
),
|
|
3583
|
-
/* @__PURE__ */
|
|
3509
|
+
/* @__PURE__ */ jsx19(
|
|
3584
3510
|
"button",
|
|
3585
3511
|
{
|
|
3586
3512
|
type: "button",
|
|
@@ -3593,10 +3519,10 @@ var ImageEditor = ({
|
|
|
3593
3519
|
}
|
|
3594
3520
|
)
|
|
3595
3521
|
] }),
|
|
3596
|
-
/* @__PURE__ */
|
|
3597
|
-
/* @__PURE__ */
|
|
3598
|
-
/* @__PURE__ */
|
|
3599
|
-
/* @__PURE__ */
|
|
3522
|
+
/* @__PURE__ */ jsx19("div", { className: imageDividerClass }),
|
|
3523
|
+
/* @__PURE__ */ jsx19("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
3524
|
+
/* @__PURE__ */ jsxs18("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
3525
|
+
/* @__PURE__ */ jsx19(
|
|
3600
3526
|
"button",
|
|
3601
3527
|
{
|
|
3602
3528
|
type: "button",
|
|
@@ -3605,7 +3531,7 @@ var ImageEditor = ({
|
|
|
3605
3531
|
children: "Rotate -90\xB0"
|
|
3606
3532
|
}
|
|
3607
3533
|
),
|
|
3608
|
-
/* @__PURE__ */
|
|
3534
|
+
/* @__PURE__ */ jsx19(
|
|
3609
3535
|
"button",
|
|
3610
3536
|
{
|
|
3611
3537
|
type: "button",
|
|
@@ -3614,7 +3540,7 @@ var ImageEditor = ({
|
|
|
3614
3540
|
children: "Rotate +90\xB0"
|
|
3615
3541
|
}
|
|
3616
3542
|
),
|
|
3617
|
-
/* @__PURE__ */
|
|
3543
|
+
/* @__PURE__ */ jsx19(
|
|
3618
3544
|
"button",
|
|
3619
3545
|
{
|
|
3620
3546
|
type: "button",
|
|
@@ -3623,7 +3549,7 @@ var ImageEditor = ({
|
|
|
3623
3549
|
children: "Flip Horizontal"
|
|
3624
3550
|
}
|
|
3625
3551
|
),
|
|
3626
|
-
/* @__PURE__ */
|
|
3552
|
+
/* @__PURE__ */ jsx19(
|
|
3627
3553
|
"button",
|
|
3628
3554
|
{
|
|
3629
3555
|
type: "button",
|
|
@@ -3634,10 +3560,10 @@ var ImageEditor = ({
|
|
|
3634
3560
|
)
|
|
3635
3561
|
] })
|
|
3636
3562
|
] }),
|
|
3637
|
-
activeTab === "adjust" && /* @__PURE__ */
|
|
3638
|
-
/* @__PURE__ */
|
|
3639
|
-
/* @__PURE__ */
|
|
3640
|
-
/* @__PURE__ */
|
|
3563
|
+
activeTab === "adjust" && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
3564
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between", children: [
|
|
3565
|
+
/* @__PURE__ */ jsx19("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
3566
|
+
/* @__PURE__ */ jsx19(
|
|
3641
3567
|
"button",
|
|
3642
3568
|
{
|
|
3643
3569
|
type: "button",
|
|
@@ -3647,9 +3573,9 @@ var ImageEditor = ({
|
|
|
3647
3573
|
}
|
|
3648
3574
|
)
|
|
3649
3575
|
] }),
|
|
3650
|
-
/* @__PURE__ */
|
|
3651
|
-
IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */
|
|
3652
|
-
/* @__PURE__ */
|
|
3576
|
+
/* @__PURE__ */ jsx19(Histogram, { histogram: editor.histogram }),
|
|
3577
|
+
IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs18(React15.Fragment, { children: [
|
|
3578
|
+
/* @__PURE__ */ jsx19(
|
|
3653
3579
|
ControlSlider,
|
|
3654
3580
|
{
|
|
3655
3581
|
spec,
|
|
@@ -3658,14 +3584,14 @@ var ImageEditor = ({
|
|
|
3658
3584
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
3659
3585
|
}
|
|
3660
3586
|
),
|
|
3661
|
-
spec.id === "tint" && legacyProcess && /* @__PURE__ */
|
|
3587
|
+
spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs18(
|
|
3662
3588
|
"div",
|
|
3663
3589
|
{
|
|
3664
3590
|
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",
|
|
3665
3591
|
"data-testid": "image-editor-process-notice",
|
|
3666
3592
|
children: [
|
|
3667
|
-
/* @__PURE__ */
|
|
3668
|
-
/* @__PURE__ */
|
|
3593
|
+
/* @__PURE__ */ jsx19("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
3594
|
+
/* @__PURE__ */ jsx19(
|
|
3669
3595
|
"button",
|
|
3670
3596
|
{
|
|
3671
3597
|
type: "button",
|
|
@@ -3678,7 +3604,7 @@ var ImageEditor = ({
|
|
|
3678
3604
|
}
|
|
3679
3605
|
)
|
|
3680
3606
|
] }, spec.id)),
|
|
3681
|
-
/* @__PURE__ */
|
|
3607
|
+
/* @__PURE__ */ jsx19("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx19(
|
|
3682
3608
|
AdjustmentLayersPanel,
|
|
3683
3609
|
{
|
|
3684
3610
|
controller,
|
|
@@ -3687,9 +3613,9 @@ var ImageEditor = ({
|
|
|
3687
3613
|
}
|
|
3688
3614
|
) })
|
|
3689
3615
|
] }),
|
|
3690
|
-
activeTab === "layers" && /* @__PURE__ */
|
|
3691
|
-
/* @__PURE__ */
|
|
3692
|
-
/* @__PURE__ */
|
|
3616
|
+
activeTab === "layers" && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
3617
|
+
/* @__PURE__ */ jsx19("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
3618
|
+
/* @__PURE__ */ jsx19(
|
|
3693
3619
|
"button",
|
|
3694
3620
|
{
|
|
3695
3621
|
type: "button",
|
|
@@ -3700,15 +3626,15 @@ var ImageEditor = ({
|
|
|
3700
3626
|
children: "Free Transform"
|
|
3701
3627
|
}
|
|
3702
3628
|
),
|
|
3703
|
-
/* @__PURE__ */
|
|
3704
|
-
effectsShown && /* @__PURE__ */
|
|
3705
|
-
/* @__PURE__ */
|
|
3706
|
-
/* @__PURE__ */
|
|
3629
|
+
/* @__PURE__ */ jsx19(LayersPanel, { controller }),
|
|
3630
|
+
effectsShown && /* @__PURE__ */ jsx19(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
3631
|
+
/* @__PURE__ */ jsx19("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
3632
|
+
/* @__PURE__ */ jsx19(ColorProfilePanel, { controller })
|
|
3707
3633
|
] }),
|
|
3708
|
-
activeTab === "paint" && /* @__PURE__ */
|
|
3709
|
-
/* @__PURE__ */
|
|
3710
|
-
/* @__PURE__ */
|
|
3711
|
-
/* @__PURE__ */
|
|
3634
|
+
activeTab === "paint" && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
3635
|
+
/* @__PURE__ */ jsx19("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
3636
|
+
/* @__PURE__ */ jsx19(BrushOptionsBar, { controller }),
|
|
3637
|
+
/* @__PURE__ */ jsx19(
|
|
3712
3638
|
"button",
|
|
3713
3639
|
{
|
|
3714
3640
|
type: "button",
|
|
@@ -3719,12 +3645,12 @@ var ImageEditor = ({
|
|
|
3719
3645
|
children: "Free Transform"
|
|
3720
3646
|
}
|
|
3721
3647
|
),
|
|
3722
|
-
paintError && /* @__PURE__ */
|
|
3723
|
-
/* @__PURE__ */
|
|
3648
|
+
paintError && /* @__PURE__ */ jsx19("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
3649
|
+
/* @__PURE__ */ jsx19("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx19(LayersPanel, { controller }) })
|
|
3724
3650
|
] }),
|
|
3725
|
-
activeTab === "annotate" && /* @__PURE__ */
|
|
3726
|
-
/* @__PURE__ */
|
|
3727
|
-
/* @__PURE__ */
|
|
3651
|
+
activeTab === "annotate" && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
3652
|
+
/* @__PURE__ */ jsx19("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
|
|
3653
|
+
/* @__PURE__ */ jsx19("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ jsx19(
|
|
3728
3654
|
"button",
|
|
3729
3655
|
{
|
|
3730
3656
|
type: "button",
|
|
@@ -3735,13 +3661,13 @@ var ImageEditor = ({
|
|
|
3735
3661
|
},
|
|
3736
3662
|
t
|
|
3737
3663
|
)) }),
|
|
3738
|
-
state.activeTool === "shape" && /* @__PURE__ */
|
|
3739
|
-
state.activeTool === "type" && /* @__PURE__ */
|
|
3740
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */
|
|
3741
|
-
shapeTypeError && /* @__PURE__ */
|
|
3742
|
-
/* @__PURE__ */
|
|
3743
|
-
/* @__PURE__ */
|
|
3744
|
-
/* @__PURE__ */
|
|
3664
|
+
state.activeTool === "shape" && /* @__PURE__ */ jsx19(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
3665
|
+
state.activeTool === "type" && /* @__PURE__ */ jsx19(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
|
|
3666
|
+
state.activeTool === "type" && typeSession && /* @__PURE__ */ jsx19("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" }),
|
|
3667
|
+
shapeTypeError && /* @__PURE__ */ jsx19("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
3668
|
+
/* @__PURE__ */ jsx19("div", { className: imageDividerClass }),
|
|
3669
|
+
/* @__PURE__ */ jsx19("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
3670
|
+
/* @__PURE__ */ jsx19("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ jsx19(
|
|
3745
3671
|
"button",
|
|
3746
3672
|
{
|
|
3747
3673
|
type: "button",
|
|
@@ -3751,9 +3677,9 @@ var ImageEditor = ({
|
|
|
3751
3677
|
},
|
|
3752
3678
|
t
|
|
3753
3679
|
)) }),
|
|
3754
|
-
/* @__PURE__ */
|
|
3755
|
-
/* @__PURE__ */
|
|
3756
|
-
/* @__PURE__ */
|
|
3680
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
3681
|
+
/* @__PURE__ */ jsx19("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
3682
|
+
/* @__PURE__ */ jsx19(
|
|
3757
3683
|
"input",
|
|
3758
3684
|
{
|
|
3759
3685
|
type: "color",
|
|
@@ -3762,15 +3688,15 @@ var ImageEditor = ({
|
|
|
3762
3688
|
className: "w-8 h-8 rounded border border-border cursor-pointer bg-transparent"
|
|
3763
3689
|
}
|
|
3764
3690
|
),
|
|
3765
|
-
/* @__PURE__ */
|
|
3766
|
-
/* @__PURE__ */
|
|
3767
|
-
/* @__PURE__ */
|
|
3768
|
-
/* @__PURE__ */
|
|
3691
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex-1 ml-2", children: [
|
|
3692
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
3693
|
+
/* @__PURE__ */ jsx19("span", { children: "Width:" }),
|
|
3694
|
+
/* @__PURE__ */ jsxs18("span", { className: "font-mono", children: [
|
|
3769
3695
|
strokeWidth,
|
|
3770
3696
|
"px"
|
|
3771
3697
|
] })
|
|
3772
3698
|
] }),
|
|
3773
|
-
/* @__PURE__ */
|
|
3699
|
+
/* @__PURE__ */ jsx19(
|
|
3774
3700
|
"input",
|
|
3775
3701
|
{
|
|
3776
3702
|
type: "range",
|
|
@@ -3783,10 +3709,10 @@ var ImageEditor = ({
|
|
|
3783
3709
|
)
|
|
3784
3710
|
] })
|
|
3785
3711
|
] }),
|
|
3786
|
-
/* @__PURE__ */
|
|
3787
|
-
/* @__PURE__ */
|
|
3788
|
-
/* @__PURE__ */
|
|
3789
|
-
/* @__PURE__ */
|
|
3712
|
+
/* @__PURE__ */ jsx19("div", { className: imageDividerClass }),
|
|
3713
|
+
/* @__PURE__ */ jsx19("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
3714
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex gap-2", children: [
|
|
3715
|
+
/* @__PURE__ */ jsx19(
|
|
3790
3716
|
"input",
|
|
3791
3717
|
{
|
|
3792
3718
|
type: "text",
|
|
@@ -3797,7 +3723,7 @@ var ImageEditor = ({
|
|
|
3797
3723
|
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"
|
|
3798
3724
|
}
|
|
3799
3725
|
),
|
|
3800
|
-
/* @__PURE__ */
|
|
3726
|
+
/* @__PURE__ */ jsx19(
|
|
3801
3727
|
"button",
|
|
3802
3728
|
{
|
|
3803
3729
|
type: "button",
|
|
@@ -3807,14 +3733,14 @@ var ImageEditor = ({
|
|
|
3807
3733
|
}
|
|
3808
3734
|
)
|
|
3809
3735
|
] }),
|
|
3810
|
-
/* @__PURE__ */
|
|
3811
|
-
/* @__PURE__ */
|
|
3812
|
-
/* @__PURE__ */
|
|
3736
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
3737
|
+
/* @__PURE__ */ jsx19("span", { children: "Font Size:" }),
|
|
3738
|
+
/* @__PURE__ */ jsxs18("span", { className: "font-mono", children: [
|
|
3813
3739
|
fontSize,
|
|
3814
3740
|
"px"
|
|
3815
3741
|
] })
|
|
3816
3742
|
] }),
|
|
3817
|
-
/* @__PURE__ */
|
|
3743
|
+
/* @__PURE__ */ jsx19(
|
|
3818
3744
|
"input",
|
|
3819
3745
|
{
|
|
3820
3746
|
type: "range",
|
|
@@ -3825,14 +3751,14 @@ var ImageEditor = ({
|
|
|
3825
3751
|
className: imageRangeClass
|
|
3826
3752
|
}
|
|
3827
3753
|
),
|
|
3828
|
-
/* @__PURE__ */
|
|
3829
|
-
/* @__PURE__ */
|
|
3830
|
-
/* @__PURE__ */
|
|
3754
|
+
/* @__PURE__ */ jsx19("div", { className: imageDividerClass }),
|
|
3755
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between", children: [
|
|
3756
|
+
/* @__PURE__ */ jsxs18("span", { className: "text-muted-foreground", children: [
|
|
3831
3757
|
"Layers (",
|
|
3832
3758
|
state.annotations.length,
|
|
3833
3759
|
")"
|
|
3834
3760
|
] }),
|
|
3835
|
-
state.selectedAnnotationId && /* @__PURE__ */
|
|
3761
|
+
state.selectedAnnotationId && /* @__PURE__ */ jsx19(
|
|
3836
3762
|
"button",
|
|
3837
3763
|
{
|
|
3838
3764
|
type: "button",
|
|
@@ -3841,7 +3767,7 @@ var ImageEditor = ({
|
|
|
3841
3767
|
children: "Delete Selected"
|
|
3842
3768
|
}
|
|
3843
3769
|
),
|
|
3844
|
-
state.annotations.length > 0 && /* @__PURE__ */
|
|
3770
|
+
state.annotations.length > 0 && /* @__PURE__ */ jsx19(
|
|
3845
3771
|
"button",
|
|
3846
3772
|
{
|
|
3847
3773
|
type: "button",
|
|
@@ -3852,10 +3778,10 @@ var ImageEditor = ({
|
|
|
3852
3778
|
)
|
|
3853
3779
|
] })
|
|
3854
3780
|
] }),
|
|
3855
|
-
activeTab === "depth" && /* @__PURE__ */
|
|
3856
|
-
/* @__PURE__ */
|
|
3857
|
-
/* @__PURE__ */
|
|
3858
|
-
/* @__PURE__ */
|
|
3781
|
+
activeTab === "depth" && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
3782
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between", children: [
|
|
3783
|
+
/* @__PURE__ */ jsx19("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
3784
|
+
/* @__PURE__ */ jsx19(
|
|
3859
3785
|
"button",
|
|
3860
3786
|
{
|
|
3861
3787
|
type: "button",
|
|
@@ -3865,8 +3791,8 @@ var ImageEditor = ({
|
|
|
3865
3791
|
}
|
|
3866
3792
|
)
|
|
3867
3793
|
] }),
|
|
3868
|
-
/* @__PURE__ */
|
|
3869
|
-
/* @__PURE__ */
|
|
3794
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
3795
|
+
/* @__PURE__ */ jsx19(
|
|
3870
3796
|
"input",
|
|
3871
3797
|
{
|
|
3872
3798
|
type: "checkbox",
|
|
@@ -3875,12 +3801,12 @@ var ImageEditor = ({
|
|
|
3875
3801
|
className: "rounded accent-primary"
|
|
3876
3802
|
}
|
|
3877
3803
|
),
|
|
3878
|
-
/* @__PURE__ */
|
|
3804
|
+
/* @__PURE__ */ jsx19("span", { children: "Enable Depth / Alpha Mask" })
|
|
3879
3805
|
] }),
|
|
3880
|
-
state.depthMask.enabled && /* @__PURE__ */
|
|
3881
|
-
/* @__PURE__ */
|
|
3882
|
-
/* @__PURE__ */
|
|
3883
|
-
/* @__PURE__ */
|
|
3806
|
+
state.depthMask.enabled && /* @__PURE__ */ jsxs18(Fragment5, { children: [
|
|
3807
|
+
/* @__PURE__ */ jsxs18("div", { children: [
|
|
3808
|
+
/* @__PURE__ */ jsx19("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
3809
|
+
/* @__PURE__ */ jsx19(
|
|
3884
3810
|
"input",
|
|
3885
3811
|
{
|
|
3886
3812
|
type: "text",
|
|
@@ -3891,8 +3817,8 @@ var ImageEditor = ({
|
|
|
3891
3817
|
}
|
|
3892
3818
|
)
|
|
3893
3819
|
] }),
|
|
3894
|
-
/* @__PURE__ */
|
|
3895
|
-
/* @__PURE__ */
|
|
3820
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex gap-2", children: [
|
|
3821
|
+
/* @__PURE__ */ jsx19(
|
|
3896
3822
|
"button",
|
|
3897
3823
|
{
|
|
3898
3824
|
type: "button",
|
|
@@ -3901,7 +3827,7 @@ var ImageEditor = ({
|
|
|
3901
3827
|
children: "Threshold Mode"
|
|
3902
3828
|
}
|
|
3903
3829
|
),
|
|
3904
|
-
/* @__PURE__ */
|
|
3830
|
+
/* @__PURE__ */ jsx19(
|
|
3905
3831
|
"button",
|
|
3906
3832
|
{
|
|
3907
3833
|
type: "button",
|
|
@@ -3911,12 +3837,12 @@ var ImageEditor = ({
|
|
|
3911
3837
|
}
|
|
3912
3838
|
)
|
|
3913
3839
|
] }),
|
|
3914
|
-
/* @__PURE__ */
|
|
3915
|
-
/* @__PURE__ */
|
|
3916
|
-
/* @__PURE__ */
|
|
3917
|
-
/* @__PURE__ */
|
|
3840
|
+
/* @__PURE__ */ jsxs18("div", { children: [
|
|
3841
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
3842
|
+
/* @__PURE__ */ jsx19("span", { children: "Depth Start (Lower):" }),
|
|
3843
|
+
/* @__PURE__ */ jsx19("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
3918
3844
|
] }),
|
|
3919
|
-
/* @__PURE__ */
|
|
3845
|
+
/* @__PURE__ */ jsx19(
|
|
3920
3846
|
"input",
|
|
3921
3847
|
{
|
|
3922
3848
|
type: "range",
|
|
@@ -3930,12 +3856,12 @@ var ImageEditor = ({
|
|
|
3930
3856
|
}
|
|
3931
3857
|
)
|
|
3932
3858
|
] }),
|
|
3933
|
-
/* @__PURE__ */
|
|
3934
|
-
/* @__PURE__ */
|
|
3935
|
-
/* @__PURE__ */
|
|
3936
|
-
/* @__PURE__ */
|
|
3859
|
+
/* @__PURE__ */ jsxs18("div", { children: [
|
|
3860
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
3861
|
+
/* @__PURE__ */ jsx19("span", { children: "Depth Stop (Upper):" }),
|
|
3862
|
+
/* @__PURE__ */ jsx19("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
3937
3863
|
] }),
|
|
3938
|
-
/* @__PURE__ */
|
|
3864
|
+
/* @__PURE__ */ jsx19(
|
|
3939
3865
|
"input",
|
|
3940
3866
|
{
|
|
3941
3867
|
type: "range",
|
|
@@ -3949,12 +3875,12 @@ var ImageEditor = ({
|
|
|
3949
3875
|
}
|
|
3950
3876
|
)
|
|
3951
3877
|
] }),
|
|
3952
|
-
/* @__PURE__ */
|
|
3953
|
-
/* @__PURE__ */
|
|
3954
|
-
/* @__PURE__ */
|
|
3955
|
-
/* @__PURE__ */
|
|
3878
|
+
/* @__PURE__ */ jsxs18("div", { children: [
|
|
3879
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
3880
|
+
/* @__PURE__ */ jsx19("span", { children: "Softness:" }),
|
|
3881
|
+
/* @__PURE__ */ jsx19("span", { className: "font-mono", children: state.depthMask.softness })
|
|
3956
3882
|
] }),
|
|
3957
|
-
/* @__PURE__ */
|
|
3883
|
+
/* @__PURE__ */ jsx19(
|
|
3958
3884
|
"input",
|
|
3959
3885
|
{
|
|
3960
3886
|
type: "range",
|
|
@@ -3966,8 +3892,8 @@ var ImageEditor = ({
|
|
|
3966
3892
|
}
|
|
3967
3893
|
)
|
|
3968
3894
|
] }),
|
|
3969
|
-
/* @__PURE__ */
|
|
3970
|
-
/* @__PURE__ */
|
|
3895
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
3896
|
+
/* @__PURE__ */ jsx19(
|
|
3971
3897
|
"input",
|
|
3972
3898
|
{
|
|
3973
3899
|
type: "checkbox",
|
|
@@ -3976,12 +3902,12 @@ var ImageEditor = ({
|
|
|
3976
3902
|
className: "rounded accent-primary"
|
|
3977
3903
|
}
|
|
3978
3904
|
),
|
|
3979
|
-
/* @__PURE__ */
|
|
3905
|
+
/* @__PURE__ */ jsx19("span", { children: "Invert Mask" })
|
|
3980
3906
|
] })
|
|
3981
3907
|
] })
|
|
3982
3908
|
] }),
|
|
3983
|
-
activeTab === "select" && /* @__PURE__ */
|
|
3984
|
-
/* @__PURE__ */
|
|
3909
|
+
activeTab === "select" && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
3910
|
+
/* @__PURE__ */ jsx19(
|
|
3985
3911
|
SelectionOptionsBar,
|
|
3986
3912
|
{
|
|
3987
3913
|
controller,
|
|
@@ -3991,9 +3917,9 @@ var ImageEditor = ({
|
|
|
3991
3917
|
quickMask: Boolean(state.quickMask)
|
|
3992
3918
|
}
|
|
3993
3919
|
),
|
|
3994
|
-
selectionError && /* @__PURE__ */
|
|
3995
|
-
/* @__PURE__ */
|
|
3996
|
-
/* @__PURE__ */
|
|
3920
|
+
selectionError && /* @__PURE__ */ jsx19("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
3921
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex gap-1", children: [
|
|
3922
|
+
/* @__PURE__ */ jsx19(
|
|
3997
3923
|
"button",
|
|
3998
3924
|
{
|
|
3999
3925
|
type: "button",
|
|
@@ -4004,7 +3930,7 @@ var ImageEditor = ({
|
|
|
4004
3930
|
children: "Transform Selection"
|
|
4005
3931
|
}
|
|
4006
3932
|
),
|
|
4007
|
-
/* @__PURE__ */
|
|
3933
|
+
/* @__PURE__ */ jsx19(
|
|
4008
3934
|
"button",
|
|
4009
3935
|
{
|
|
4010
3936
|
type: "button",
|
|
@@ -4016,12 +3942,12 @@ var ImageEditor = ({
|
|
|
4016
3942
|
}
|
|
4017
3943
|
)
|
|
4018
3944
|
] }),
|
|
4019
|
-
/* @__PURE__ */
|
|
3945
|
+
/* @__PURE__ */ jsx19(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers })
|
|
4020
3946
|
] }),
|
|
4021
|
-
activeTab === "ai" && /* @__PURE__ */
|
|
4022
|
-
/* @__PURE__ */
|
|
4023
|
-
/* @__PURE__ */
|
|
4024
|
-
/* @__PURE__ */
|
|
3947
|
+
activeTab === "ai" && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
3948
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
3949
|
+
/* @__PURE__ */ jsx19("span", { children: "Results go to" }),
|
|
3950
|
+
/* @__PURE__ */ jsxs18(
|
|
4025
3951
|
"select",
|
|
4026
3952
|
{
|
|
4027
3953
|
"aria-label": "AI result target",
|
|
@@ -4029,54 +3955,54 @@ var ImageEditor = ({
|
|
|
4029
3955
|
onChange: (e) => setAiTarget(e.target.value),
|
|
4030
3956
|
className: imageSelectClass,
|
|
4031
3957
|
children: [
|
|
4032
|
-
/* @__PURE__ */
|
|
4033
|
-
/* @__PURE__ */
|
|
4034
|
-
/* @__PURE__ */
|
|
3958
|
+
/* @__PURE__ */ jsx19("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
3959
|
+
/* @__PURE__ */ jsx19("option", { value: "new-layer", children: "New layer / mask" }),
|
|
3960
|
+
/* @__PURE__ */ jsx19("option", { value: "replace", children: "Replace image" })
|
|
4035
3961
|
]
|
|
4036
3962
|
}
|
|
4037
3963
|
)
|
|
4038
3964
|
] }),
|
|
4039
|
-
/* @__PURE__ */
|
|
4040
|
-
/* @__PURE__ */
|
|
4041
|
-
/* @__PURE__ */
|
|
4042
|
-
/* @__PURE__ */
|
|
3965
|
+
/* @__PURE__ */ jsxs18("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
3966
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between", children: [
|
|
3967
|
+
/* @__PURE__ */ jsxs18("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
3968
|
+
/* @__PURE__ */ jsx19("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx19("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" }) }),
|
|
4043
3969
|
"Background Removal"
|
|
4044
3970
|
] }),
|
|
4045
|
-
isRemovingBg && /* @__PURE__ */
|
|
3971
|
+
isRemovingBg && /* @__PURE__ */ jsx19("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..." })
|
|
4046
3972
|
] }),
|
|
4047
|
-
/* @__PURE__ */
|
|
4048
|
-
/* @__PURE__ */
|
|
3973
|
+
/* @__PURE__ */ jsx19("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
3974
|
+
/* @__PURE__ */ jsx19(
|
|
4049
3975
|
"button",
|
|
4050
3976
|
{
|
|
4051
3977
|
type: "button",
|
|
4052
3978
|
onClick: handleRemoveBackground,
|
|
4053
3979
|
disabled: isRemovingBg || isInpainting,
|
|
4054
3980
|
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",
|
|
4055
|
-
children: isRemovingBg ? /* @__PURE__ */
|
|
4056
|
-
/* @__PURE__ */
|
|
3981
|
+
children: isRemovingBg ? /* @__PURE__ */ jsxs18(Fragment5, { children: [
|
|
3982
|
+
/* @__PURE__ */ jsx19("div", { className: imageSpinnerClass }),
|
|
4057
3983
|
"Removing Background..."
|
|
4058
|
-
] }) : /* @__PURE__ */
|
|
4059
|
-
/* @__PURE__ */
|
|
3984
|
+
] }) : /* @__PURE__ */ jsxs18(Fragment5, { children: [
|
|
3985
|
+
/* @__PURE__ */ jsx19("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx19("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" }) }),
|
|
4060
3986
|
"Remove Background"
|
|
4061
3987
|
] })
|
|
4062
3988
|
}
|
|
4063
3989
|
)
|
|
4064
3990
|
] }),
|
|
4065
|
-
/* @__PURE__ */
|
|
4066
|
-
/* @__PURE__ */
|
|
4067
|
-
/* @__PURE__ */
|
|
4068
|
-
/* @__PURE__ */
|
|
4069
|
-
/* @__PURE__ */
|
|
4070
|
-
/* @__PURE__ */
|
|
3991
|
+
/* @__PURE__ */ jsxs18("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
3992
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between", children: [
|
|
3993
|
+
/* @__PURE__ */ jsxs18("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
3994
|
+
/* @__PURE__ */ jsxs18("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
3995
|
+
/* @__PURE__ */ jsx19("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" }),
|
|
3996
|
+
/* @__PURE__ */ jsx19("path", { d: "m14 7 3 3" })
|
|
4071
3997
|
] }),
|
|
4072
3998
|
"Generative Inpainting"
|
|
4073
3999
|
] }),
|
|
4074
|
-
isInpainting && /* @__PURE__ */
|
|
4000
|
+
isInpainting && /* @__PURE__ */ jsx19("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..." })
|
|
4075
4001
|
] }),
|
|
4076
|
-
/* @__PURE__ */
|
|
4077
|
-
/* @__PURE__ */
|
|
4078
|
-
/* @__PURE__ */
|
|
4079
|
-
/* @__PURE__ */
|
|
4002
|
+
/* @__PURE__ */ jsx19("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
|
|
4003
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-1", children: [
|
|
4004
|
+
/* @__PURE__ */ jsx19("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
4005
|
+
/* @__PURE__ */ jsx19(
|
|
4080
4006
|
"textarea",
|
|
4081
4007
|
{
|
|
4082
4008
|
id: "ai-inpaint-prompt-react",
|
|
@@ -4088,10 +4014,10 @@ var ImageEditor = ({
|
|
|
4088
4014
|
}
|
|
4089
4015
|
)
|
|
4090
4016
|
] }),
|
|
4091
|
-
/* @__PURE__ */
|
|
4092
|
-
/* @__PURE__ */
|
|
4093
|
-
/* @__PURE__ */
|
|
4094
|
-
/* @__PURE__ */
|
|
4017
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-1", children: [
|
|
4018
|
+
/* @__PURE__ */ jsx19("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
4019
|
+
/* @__PURE__ */ jsxs18("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
4020
|
+
/* @__PURE__ */ jsxs18(
|
|
4095
4021
|
"button",
|
|
4096
4022
|
{
|
|
4097
4023
|
type: "button",
|
|
@@ -4104,7 +4030,7 @@ var ImageEditor = ({
|
|
|
4104
4030
|
]
|
|
4105
4031
|
}
|
|
4106
4032
|
),
|
|
4107
|
-
/* @__PURE__ */
|
|
4033
|
+
/* @__PURE__ */ jsxs18(
|
|
4108
4034
|
"button",
|
|
4109
4035
|
{
|
|
4110
4036
|
type: "button",
|
|
@@ -4119,25 +4045,25 @@ var ImageEditor = ({
|
|
|
4119
4045
|
)
|
|
4120
4046
|
] })
|
|
4121
4047
|
] }),
|
|
4122
|
-
/* @__PURE__ */
|
|
4048
|
+
/* @__PURE__ */ jsx19(
|
|
4123
4049
|
"button",
|
|
4124
4050
|
{
|
|
4125
4051
|
type: "button",
|
|
4126
4052
|
onClick: handleInpaint,
|
|
4127
4053
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
4128
4054
|
className: "mt-1 px-3 py-2 rounded-lg bg-primary hover:bg-primary/90 disabled:opacity-50 text-primary-foreground font-medium shadow transition-colors flex items-center justify-center gap-2",
|
|
4129
|
-
children: isInpainting ? /* @__PURE__ */
|
|
4130
|
-
/* @__PURE__ */
|
|
4055
|
+
children: isInpainting ? /* @__PURE__ */ jsxs18(Fragment5, { children: [
|
|
4056
|
+
/* @__PURE__ */ jsx19("div", { className: imageSpinnerClass }),
|
|
4131
4057
|
"Generating Inpaint..."
|
|
4132
|
-
] }) : /* @__PURE__ */
|
|
4133
|
-
/* @__PURE__ */
|
|
4058
|
+
] }) : /* @__PURE__ */ jsxs18(Fragment5, { children: [
|
|
4059
|
+
/* @__PURE__ */ jsx19("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx19("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" }) }),
|
|
4134
4060
|
"Apply Inpainting"
|
|
4135
4061
|
] })
|
|
4136
4062
|
}
|
|
4137
4063
|
)
|
|
4138
4064
|
] }),
|
|
4139
|
-
aiError && /* @__PURE__ */
|
|
4140
|
-
aiSuccess && /* @__PURE__ */
|
|
4065
|
+
aiError && /* @__PURE__ */ jsx19("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
|
|
4066
|
+
aiSuccess && /* @__PURE__ */ jsx19("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
|
|
4141
4067
|
] })
|
|
4142
4068
|
] })
|
|
4143
4069
|
] })
|
|
@@ -4150,6 +4076,11 @@ export {
|
|
|
4150
4076
|
useImageEditor,
|
|
4151
4077
|
useImageEffectsTools,
|
|
4152
4078
|
ImageEditorCanvas,
|
|
4079
|
+
ImageEditorControlsProvider,
|
|
4080
|
+
useImageEditorControls,
|
|
4081
|
+
ImageCheckbox,
|
|
4082
|
+
ImageRange,
|
|
4083
|
+
ImageSelect,
|
|
4153
4084
|
ControlSlider,
|
|
4154
4085
|
Histogram,
|
|
4155
4086
|
useImageHistogram,
|