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