@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
|
@@ -38,10 +38,14 @@ __export(image_editor_exports, {
|
|
|
38
38
|
CurvesEditor: () => CurvesEditor,
|
|
39
39
|
FreeTransformOptionsBar: () => FreeTransformOptionsBar,
|
|
40
40
|
Histogram: () => Histogram,
|
|
41
|
+
ImageCheckbox: () => ImageCheckbox,
|
|
41
42
|
ImageEditor: () => ImageEditor,
|
|
42
43
|
ImageEditorCanvas: () => ImageEditorCanvas,
|
|
44
|
+
ImageEditorControlsProvider: () => ImageEditorControlsProvider,
|
|
43
45
|
ImageEffectControls: () => ImageEffectControls,
|
|
44
46
|
ImageProviderEffectsPanel: () => ImageProviderEffectsPanel,
|
|
47
|
+
ImageRange: () => ImageRange,
|
|
48
|
+
ImageSelect: () => ImageSelect,
|
|
45
49
|
LayerEffectsPanel: () => LayerEffectsPanel,
|
|
46
50
|
LayersPanel: () => LayersPanel,
|
|
47
51
|
PaintGradientEditor: () => PaintGradientEditor,
|
|
@@ -50,6 +54,7 @@ __export(image_editor_exports, {
|
|
|
50
54
|
ShapeOptionsBar: () => ShapeOptionsBar,
|
|
51
55
|
TypeOptionsBar: () => TypeOptionsBar,
|
|
52
56
|
useImageEditor: () => useImageEditor,
|
|
57
|
+
useImageEditorControls: () => useImageEditorControls,
|
|
53
58
|
useImageEffectsTools: () => useImageEffectsTools,
|
|
54
59
|
useImageHistogram: () => useImageHistogram
|
|
55
60
|
});
|
|
@@ -224,7 +229,7 @@ function useImageEffectsTools(registry, controller, options = {}) {
|
|
|
224
229
|
}
|
|
225
230
|
|
|
226
231
|
// src/image-editor/ImageEditor.tsx
|
|
227
|
-
var
|
|
232
|
+
var import_react29 = __toESM(require("react"), 1);
|
|
228
233
|
var import_image_editor19 = require("@pixerate/editor/image-editor");
|
|
229
234
|
|
|
230
235
|
// src/image-editor/ImageEditorCanvas.tsx
|
|
@@ -1051,37 +1056,109 @@ var ImageEditorCanvas = ({
|
|
|
1051
1056
|
|
|
1052
1057
|
// src/image-editor/ControlSlider.tsx
|
|
1053
1058
|
var import_image_editor3 = require("@pixerate/editor/image-editor");
|
|
1059
|
+
|
|
1060
|
+
// src/image-editor/controls/controls.tsx
|
|
1061
|
+
var import_react6 = require("react");
|
|
1062
|
+
|
|
1063
|
+
// src/image-editor/styles.ts
|
|
1064
|
+
var imageEditorFrameClass = "relative flex flex-col bg-background border border-border rounded-xl overflow-hidden shadow-sm text-foreground";
|
|
1065
|
+
var imageEditorHeaderClass = "flex flex-wrap items-center justify-between px-4 py-3 bg-muted/40 border-b border-border gap-3";
|
|
1066
|
+
var imageTabListClass = "flex items-center gap-1 bg-background p-1 rounded-lg border border-border text-xs";
|
|
1067
|
+
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"}`;
|
|
1068
|
+
var imageHeaderButtonClass = "p-1.5 rounded-lg border border-border bg-background text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed";
|
|
1069
|
+
var imagePrimaryButtonClass = "rounded-lg bg-primary hover:bg-primary/90 text-primary-foreground font-medium shadow transition-colors disabled:opacity-50";
|
|
1070
|
+
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]";
|
|
1071
|
+
var imageSectionTitleClass = "font-semibold text-foreground uppercase tracking-wider text-[11px]";
|
|
1072
|
+
var imageSectionClass = "border-t border-border pt-3";
|
|
1073
|
+
var imageDividerClass = "h-px bg-border my-1";
|
|
1074
|
+
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";
|
|
1075
|
+
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";
|
|
1076
|
+
var imageOutlineButtonClass = "rounded border border-border px-1.5 py-0.5 text-[11px] text-foreground hover:bg-muted disabled:opacity-40";
|
|
1077
|
+
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"}`;
|
|
1078
|
+
var imageFieldClass = "rounded border border-input bg-background px-1 py-0.5 text-foreground";
|
|
1079
|
+
var imageSelectClass = "rounded border border-input bg-background px-1.5 py-1 text-foreground";
|
|
1080
|
+
var imageColorInputClass = "h-6 w-8 rounded border border-border bg-transparent";
|
|
1081
|
+
var imageRangeClass = "w-full accent-primary";
|
|
1082
|
+
var imageErrorBannerClass = "border-b border-destructive/40 bg-destructive/10 px-4 py-1.5 text-xs text-destructive";
|
|
1083
|
+
var imageSpinnerClass = "w-3.5 h-3.5 border-2 border-primary-foreground/30 border-t-primary-foreground rounded-full animate-spin";
|
|
1084
|
+
|
|
1085
|
+
// src/image-editor/controls/controls.tsx
|
|
1054
1086
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1087
|
+
var ControlsContext = (0, import_react6.createContext)({});
|
|
1088
|
+
function ImageEditorControlsProvider({ controls, children }) {
|
|
1089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ControlsContext.Provider, { value: controls, children });
|
|
1090
|
+
}
|
|
1091
|
+
function useImageEditorControls() {
|
|
1092
|
+
return (0, import_react6.useContext)(ControlsContext);
|
|
1093
|
+
}
|
|
1094
|
+
function ImageCheckbox(props) {
|
|
1095
|
+
const Host = useImageEditorControls().Checkbox;
|
|
1096
|
+
if (Host) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Host, { ...props });
|
|
1097
|
+
const { checked, label, disabled, onChange, className = "" } = props;
|
|
1098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1099
|
+
"input",
|
|
1100
|
+
{
|
|
1101
|
+
type: "checkbox",
|
|
1102
|
+
"aria-label": label,
|
|
1103
|
+
checked,
|
|
1104
|
+
disabled,
|
|
1105
|
+
onChange: (e) => onChange(e.target.checked),
|
|
1106
|
+
className: `accent-primary ${className}`
|
|
1107
|
+
}
|
|
1108
|
+
);
|
|
1109
|
+
}
|
|
1110
|
+
function ImageRange(props) {
|
|
1111
|
+
const Host = useImageEditorControls().Range;
|
|
1112
|
+
if (Host) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Host, { ...props });
|
|
1113
|
+
const { value, min, max, step, label, disabled, onChange, onStart, onEnd, className = "" } = props;
|
|
1114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1115
|
+
"input",
|
|
1116
|
+
{
|
|
1117
|
+
type: "range",
|
|
1118
|
+
"aria-label": label,
|
|
1119
|
+
min,
|
|
1120
|
+
max,
|
|
1121
|
+
step,
|
|
1122
|
+
value,
|
|
1123
|
+
disabled,
|
|
1124
|
+
onPointerDown: () => onStart?.(),
|
|
1125
|
+
onPointerUp: () => onEnd?.(),
|
|
1126
|
+
onKeyDown: () => onStart?.(),
|
|
1127
|
+
onKeyUp: () => onEnd?.(),
|
|
1128
|
+
onChange: (e) => onChange(Number(e.target.value)),
|
|
1129
|
+
className: `w-full accent-primary disabled:opacity-40 ${className}`
|
|
1130
|
+
}
|
|
1131
|
+
);
|
|
1132
|
+
}
|
|
1133
|
+
function ImageSelect(props) {
|
|
1134
|
+
const Host = useImageEditorControls().Select;
|
|
1135
|
+
if (Host) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Host, { ...props });
|
|
1136
|
+
const { value, options, label, placeholder, disabled, onChange, className = "" } = props;
|
|
1137
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("select", { "aria-label": label, value, disabled, onChange: (e) => onChange(e.target.value), className: `${imageSelectClass} ${className}`, children: [
|
|
1138
|
+
placeholder !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "", children: placeholder }),
|
|
1139
|
+
options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: o.value, children: o.label }, o.value))
|
|
1140
|
+
] });
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
// src/image-editor/ControlSlider.tsx
|
|
1144
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1055
1145
|
var ControlSlider = ({ spec, value, onChange, disabled, label, className }) => {
|
|
1056
1146
|
const name = label ?? spec.label;
|
|
1057
1147
|
const track = (0, import_image_editor3.controlTrackBackground)(spec);
|
|
1058
|
-
return /* @__PURE__ */ (0,
|
|
1059
|
-
/* @__PURE__ */ (0,
|
|
1060
|
-
/* @__PURE__ */ (0,
|
|
1061
|
-
/* @__PURE__ */ (0,
|
|
1148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { "data-control-id": spec.id, className, children: [
|
|
1149
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
1150
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: name }),
|
|
1151
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "font-mono", children: (0, import_image_editor3.formatControlValue)(spec, value) })
|
|
1062
1152
|
] }),
|
|
1063
|
-
/* @__PURE__ */ (0,
|
|
1064
|
-
|
|
1065
|
-
{
|
|
1066
|
-
type: "range",
|
|
1067
|
-
min: spec.min,
|
|
1068
|
-
max: spec.max,
|
|
1069
|
-
step: spec.step,
|
|
1070
|
-
"aria-label": name,
|
|
1071
|
-
disabled,
|
|
1072
|
-
value,
|
|
1073
|
-
onChange: (e) => onChange(Number(e.target.value)),
|
|
1074
|
-
className: "w-full accent-primary disabled:opacity-40"
|
|
1075
|
-
}
|
|
1076
|
-
),
|
|
1077
|
-
track && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "h-0.5 rounded-full opacity-70", style: { background: track } })
|
|
1153
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ImageRange, { min: spec.min, max: spec.max, step: spec.step, label: name, disabled, value, onChange }),
|
|
1154
|
+
track && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "h-0.5 rounded-full opacity-70", style: { background: track } })
|
|
1078
1155
|
] });
|
|
1079
1156
|
};
|
|
1080
1157
|
|
|
1081
1158
|
// src/image-editor/Histogram.tsx
|
|
1082
|
-
var
|
|
1159
|
+
var import_react7 = require("react");
|
|
1083
1160
|
var import_image_editor4 = require("@pixerate/editor/image-editor");
|
|
1084
|
-
var
|
|
1161
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1085
1162
|
var FILL = {
|
|
1086
1163
|
luminance: "rgba(148, 163, 184, 0.45)",
|
|
1087
1164
|
red: "rgba(239, 68, 68, 0.45)",
|
|
@@ -1091,14 +1168,14 @@ var FILL = {
|
|
|
1091
1168
|
var W = 256;
|
|
1092
1169
|
var Histogram = ({ histogram, channel = "rgb", height = 64, className = "", style }) => {
|
|
1093
1170
|
const channels = channel === "rgb" ? ["luminance", "red", "green", "blue"] : [channel];
|
|
1094
|
-
const paths = (0,
|
|
1171
|
+
const paths = (0, import_react7.useMemo)(
|
|
1095
1172
|
() => histogram && histogram.samples > 0 ? channels.map((c) => ({ c, d: (0, import_image_editor4.histogramPath)(histogram, c, W, height) })) : [],
|
|
1096
1173
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1097
1174
|
[histogram, channel, height]
|
|
1098
1175
|
);
|
|
1099
1176
|
const clipLow = histogram && histogram.samples ? Math.max(...histogram.shadows) / histogram.samples : 0;
|
|
1100
1177
|
const clipHigh = histogram && histogram.samples ? Math.max(...histogram.highlights) / histogram.samples : 0;
|
|
1101
|
-
return /* @__PURE__ */ (0,
|
|
1178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1102
1179
|
"svg",
|
|
1103
1180
|
{
|
|
1104
1181
|
viewBox: `0 0 ${W} ${height}`,
|
|
@@ -1109,32 +1186,32 @@ var Histogram = ({ histogram, channel = "rgb", height = 64, className = "", styl
|
|
|
1109
1186
|
className: `w-full rounded bg-muted/40 ${className}`,
|
|
1110
1187
|
style: { height, ...style },
|
|
1111
1188
|
children: [
|
|
1112
|
-
paths.map(({ c, d }) => /* @__PURE__ */ (0,
|
|
1113
|
-
clipLow > 5e-3 && /* @__PURE__ */ (0,
|
|
1114
|
-
clipHigh > 5e-3 && /* @__PURE__ */ (0,
|
|
1189
|
+
paths.map(({ c, d }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d, fill: FILL[c], stroke: "none" }, c)),
|
|
1190
|
+
clipLow > 5e-3 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("rect", { x: 0, y: 0, width: 3, height, fill: "#3b82f6", "data-testid": "histogram-clip-shadows" }),
|
|
1191
|
+
clipHigh > 5e-3 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("rect", { x: W - 3, y: 0, width: 3, height, fill: "#ef4444", "data-testid": "histogram-clip-highlights" })
|
|
1115
1192
|
]
|
|
1116
1193
|
}
|
|
1117
1194
|
);
|
|
1118
1195
|
};
|
|
1119
1196
|
function useImageHistogram(controller) {
|
|
1120
|
-
const [histogram, setHistogram] = (0,
|
|
1121
|
-
(0,
|
|
1197
|
+
const [histogram, setHistogram] = (0, import_react7.useState)(() => controller.getHistogram());
|
|
1198
|
+
(0, import_react7.useEffect)(() => controller.subscribeHistogram(setHistogram), [controller]);
|
|
1122
1199
|
return histogram;
|
|
1123
1200
|
}
|
|
1124
1201
|
|
|
1125
1202
|
// src/image-editor/AdjustmentLayersPanel.tsx
|
|
1126
|
-
var
|
|
1203
|
+
var import_react9 = require("react");
|
|
1127
1204
|
var import_image_editor6 = require("@pixerate/editor/image-editor");
|
|
1128
1205
|
|
|
1129
1206
|
// src/image-editor/CurvesEditor.tsx
|
|
1130
|
-
var
|
|
1207
|
+
var import_react8 = require("react");
|
|
1131
1208
|
var import_image_editor5 = require("@pixerate/editor/image-editor");
|
|
1132
|
-
var
|
|
1209
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1133
1210
|
var BOX = 256;
|
|
1134
1211
|
var STROKE = { master: "var(--foreground, #e2e8f0)", red: "#ef4444", green: "#22c55e", blue: "#3b82f6" };
|
|
1135
1212
|
var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 200, className = "" }) => {
|
|
1136
|
-
const svgRef = (0,
|
|
1137
|
-
const [drag, setDrag] = (0,
|
|
1213
|
+
const svgRef = (0, import_react8.useRef)(null);
|
|
1214
|
+
const [drag, setDrag] = (0, import_react8.useState)(null);
|
|
1138
1215
|
const toBox = (e) => {
|
|
1139
1216
|
const rect = svgRef.current?.getBoundingClientRect();
|
|
1140
1217
|
if (!rect || !rect.width || !rect.height) return { x: 0, y: 0 };
|
|
@@ -1163,7 +1240,7 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
1163
1240
|
if (index !== -1 && points.length > 2) onChange((0, import_image_editor5.removeCurvePoint)(points, index), true);
|
|
1164
1241
|
};
|
|
1165
1242
|
const histChannel = channel === "master" ? "luminance" : channel;
|
|
1166
|
-
return /* @__PURE__ */ (0,
|
|
1243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1167
1244
|
"svg",
|
|
1168
1245
|
{
|
|
1169
1246
|
ref: svgRef,
|
|
@@ -1180,16 +1257,16 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
1180
1257
|
onPointerCancel: () => setDrag(null),
|
|
1181
1258
|
onDoubleClick,
|
|
1182
1259
|
children: [
|
|
1183
|
-
histogram && histogram.samples > 0 && /* @__PURE__ */ (0,
|
|
1184
|
-
[64, 128, 192].map((v) => /* @__PURE__ */ (0,
|
|
1185
|
-
/* @__PURE__ */ (0,
|
|
1186
|
-
/* @__PURE__ */ (0,
|
|
1260
|
+
histogram && histogram.samples > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: (0, import_image_editor5.histogramPath)(histogram, histChannel, BOX, BOX), fill: "rgba(148, 163, 184, 0.25)" }),
|
|
1261
|
+
[64, 128, 192].map((v) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("g", { stroke: "rgba(148, 163, 184, 0.2)", strokeWidth: 1, children: [
|
|
1262
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("line", { x1: v, y1: 0, x2: v, y2: BOX }),
|
|
1263
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("line", { x1: 0, y1: v, x2: BOX, y2: v })
|
|
1187
1264
|
] }, v)),
|
|
1188
|
-
/* @__PURE__ */ (0,
|
|
1189
|
-
/* @__PURE__ */ (0,
|
|
1265
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("line", { x1: 0, y1: BOX, x2: BOX, y2: 0, stroke: "rgba(148, 163, 184, 0.35)", strokeDasharray: "4 4" }),
|
|
1266
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: (0, import_image_editor5.curveSvgPath)(points, BOX, BOX), fill: "none", stroke: STROKE[channel], strokeWidth: 2 }),
|
|
1190
1267
|
points.map((p, i) => {
|
|
1191
1268
|
const b = (0, import_image_editor5.curvePointToBox)(p, BOX, BOX);
|
|
1192
|
-
return /* @__PURE__ */ (0,
|
|
1269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1193
1270
|
"circle",
|
|
1194
1271
|
{
|
|
1195
1272
|
cx: b.x,
|
|
@@ -1208,30 +1285,8 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
1208
1285
|
);
|
|
1209
1286
|
};
|
|
1210
1287
|
|
|
1211
|
-
// src/image-editor/styles.ts
|
|
1212
|
-
var imageEditorFrameClass = "relative flex flex-col bg-background border border-border rounded-xl overflow-hidden shadow-sm text-foreground";
|
|
1213
|
-
var imageEditorHeaderClass = "flex flex-wrap items-center justify-between px-4 py-3 bg-muted/40 border-b border-border gap-3";
|
|
1214
|
-
var imageTabListClass = "flex items-center gap-1 bg-background p-1 rounded-lg border border-border text-xs";
|
|
1215
|
-
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"}`;
|
|
1216
|
-
var imageHeaderButtonClass = "p-1.5 rounded-lg border border-border bg-background text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed";
|
|
1217
|
-
var imagePrimaryButtonClass = "rounded-lg bg-primary hover:bg-primary/90 text-primary-foreground font-medium shadow transition-colors disabled:opacity-50";
|
|
1218
|
-
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]";
|
|
1219
|
-
var imageSectionTitleClass = "font-semibold text-foreground uppercase tracking-wider text-[11px]";
|
|
1220
|
-
var imageSectionClass = "border-t border-border pt-3";
|
|
1221
|
-
var imageDividerClass = "h-px bg-border my-1";
|
|
1222
|
-
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";
|
|
1223
|
-
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";
|
|
1224
|
-
var imageOutlineButtonClass = "rounded border border-border px-1.5 py-0.5 text-[11px] text-foreground hover:bg-muted disabled:opacity-40";
|
|
1225
|
-
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"}`;
|
|
1226
|
-
var imageFieldClass = "rounded border border-input bg-background px-1 py-0.5 text-foreground";
|
|
1227
|
-
var imageSelectClass = "rounded border border-input bg-background px-1.5 py-1 text-foreground";
|
|
1228
|
-
var imageColorInputClass = "h-6 w-8 rounded border border-border bg-transparent";
|
|
1229
|
-
var imageRangeClass = "w-full accent-primary";
|
|
1230
|
-
var imageErrorBannerClass = "border-b border-destructive/40 bg-destructive/10 px-4 py-1.5 text-xs text-destructive";
|
|
1231
|
-
var imageSpinnerClass = "w-3.5 h-3.5 border-2 border-primary-foreground/30 border-t-primary-foreground rounded-full animate-spin";
|
|
1232
|
-
|
|
1233
1288
|
// src/image-editor/AdjustmentLayersPanel.tsx
|
|
1234
|
-
var
|
|
1289
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1235
1290
|
var CHANNELS = [
|
|
1236
1291
|
{ id: "master", label: "RGB" },
|
|
1237
1292
|
{ id: "red", label: "Red" },
|
|
@@ -1246,26 +1301,26 @@ var TONES = [
|
|
|
1246
1301
|
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"}`;
|
|
1247
1302
|
var HueRangeStrip = ({ bounds }) => {
|
|
1248
1303
|
const pts = Array.from({ length: 73 }, (_, i) => `${i / 72 * 360},${20 - (0, import_image_editor6.hueRangeWeight)({ bounds }, i * 5) * 18}`).join(" ");
|
|
1249
|
-
return /* @__PURE__ */ (0,
|
|
1250
|
-
/* @__PURE__ */ (0,
|
|
1251
|
-
/* @__PURE__ */ (0,
|
|
1252
|
-
/* @__PURE__ */ (0,
|
|
1304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 360 20", preserveAspectRatio: "none", className: "w-full h-4 rounded", "data-testid": "hue-range-strip", children: [
|
|
1305
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("linearGradient", { id: "pixerate-hue-strip", children: [0, 60, 120, 180, 240, 300, 360].map((h) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("stop", { offset: `${h / 360 * 100}%`, stopColor: `hsl(${h}, 90%, 50%)` }, h)) }) }),
|
|
1306
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("rect", { width: 360, height: 20, fill: "url(#pixerate-hue-strip)", opacity: 0.6 }),
|
|
1307
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("polyline", { points: pts, fill: "none", stroke: "#fff", strokeWidth: 1.5 })
|
|
1253
1308
|
] });
|
|
1254
1309
|
};
|
|
1255
1310
|
var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, className = "" }) => {
|
|
1256
1311
|
const follow = layersProp === void 0;
|
|
1257
|
-
const [, setTick] = (0,
|
|
1258
|
-
(0,
|
|
1312
|
+
const [, setTick] = (0, import_react9.useState)(0);
|
|
1313
|
+
(0, import_react9.useEffect)(() => follow ? controller.subscribe(() => setTick((n) => n + 1)) : void 0, [controller, follow]);
|
|
1259
1314
|
const layers = layersProp ?? controller.getAdjustmentLayers();
|
|
1260
|
-
const [newKind, setNewKind] = (0,
|
|
1261
|
-
const [selectedId, setSelectedId] = (0,
|
|
1262
|
-
const [channel, setChannel] = (0,
|
|
1263
|
-
const [range, setRange] = (0,
|
|
1264
|
-
const [tone, setTone] = (0,
|
|
1315
|
+
const [newKind, setNewKind] = (0, import_react9.useState)("curves");
|
|
1316
|
+
const [selectedId, setSelectedId] = (0, import_react9.useState)(null);
|
|
1317
|
+
const [channel, setChannel] = (0, import_react9.useState)("master");
|
|
1318
|
+
const [range, setRange] = (0, import_react9.useState)(-1);
|
|
1319
|
+
const [tone, setTone] = (0, import_react9.useState)("midtones");
|
|
1265
1320
|
const selected = layers.find((l) => l.id === selectedId) ?? null;
|
|
1266
1321
|
const topFirst = [...layers].reverse();
|
|
1267
1322
|
const setParam = (layer, path, value, commit = true) => controller.updateAdjustmentLayer(layer.id, { params: (0, import_image_editor6.setControlPath)(layer.params, path, value) }, commit);
|
|
1268
|
-
const slider = (layer, spec, label) => /* @__PURE__ */ (0,
|
|
1323
|
+
const slider = (layer, spec, label) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1269
1324
|
ControlSlider,
|
|
1270
1325
|
{
|
|
1271
1326
|
spec,
|
|
@@ -1276,24 +1331,16 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
|
|
|
1276
1331
|
spec.id
|
|
1277
1332
|
);
|
|
1278
1333
|
const controlsOf = (layer, filter = () => true) => import_image_editor6.ADJUSTMENT_LAYER_CONTROLS[layer.kind].filter(filter);
|
|
1279
|
-
const checkbox = (layer, path, label) => /* @__PURE__ */ (0,
|
|
1280
|
-
/* @__PURE__ */ (0,
|
|
1281
|
-
"input",
|
|
1282
|
-
{
|
|
1283
|
-
type: "checkbox",
|
|
1284
|
-
checked: Boolean((0, import_image_editor6.getControlPath)(layer.params, path)),
|
|
1285
|
-
onChange: (e) => setParam(layer, path, e.target.checked),
|
|
1286
|
-
className: "accent-primary"
|
|
1287
|
-
}
|
|
1288
|
-
),
|
|
1334
|
+
const checkbox = (layer, path, label) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
1335
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ImageCheckbox, { label, checked: Boolean((0, import_image_editor6.getControlPath)(layer.params, path)), onChange: (on) => setParam(layer, path, on) }),
|
|
1289
1336
|
label
|
|
1290
1337
|
] });
|
|
1291
1338
|
const editor = (layer) => {
|
|
1292
1339
|
switch (layer.kind) {
|
|
1293
1340
|
case "curves":
|
|
1294
|
-
return /* @__PURE__ */ (0,
|
|
1295
|
-
/* @__PURE__ */ (0,
|
|
1296
|
-
/* @__PURE__ */ (0,
|
|
1341
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
1342
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Curve channel", children: CHANNELS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: chipClass(channel === c.id), onClick: () => setChannel(c.id), children: c.label }, c.id)) }),
|
|
1343
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1297
1344
|
CurvesEditor,
|
|
1298
1345
|
{
|
|
1299
1346
|
points: layer.params[channel],
|
|
@@ -1304,43 +1351,35 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
|
|
|
1304
1351
|
)
|
|
1305
1352
|
] });
|
|
1306
1353
|
case "levels":
|
|
1307
|
-
return /* @__PURE__ */ (0,
|
|
1308
|
-
/* @__PURE__ */ (0,
|
|
1354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
1355
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Levels channel", children: CHANNELS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: chipClass(channel === c.id), onClick: () => setChannel(c.id), children: c.label }, c.id)) }),
|
|
1309
1356
|
controlsOf(layer, (s) => s.id.startsWith(`${channel}.`)).map((s) => slider(layer, s))
|
|
1310
1357
|
] });
|
|
1311
1358
|
case "hueSaturation":
|
|
1312
|
-
return /* @__PURE__ */ (0,
|
|
1313
|
-
/* @__PURE__ */ (0,
|
|
1314
|
-
/* @__PURE__ */ (0,
|
|
1315
|
-
import_image_editor6.HUE_RANGE_LABELS.map((name, i) => /* @__PURE__ */ (0,
|
|
1359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
1360
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-wrap gap-1", role: "group", "aria-label": "Hue range", children: [
|
|
1361
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: chipClass(range === -1), onClick: () => setRange(-1), children: "Master" }),
|
|
1362
|
+
import_image_editor6.HUE_RANGE_LABELS.map((name, i) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: chipClass(range === i), onClick: () => setRange(i), disabled: layer.params.colorize, children: name }, name))
|
|
1316
1363
|
] }),
|
|
1317
|
-
range >= 0 && !layer.params.colorize && /* @__PURE__ */ (0,
|
|
1364
|
+
range >= 0 && !layer.params.colorize && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(HueRangeStrip, { bounds: layer.params.ranges[range].bounds }),
|
|
1318
1365
|
controlsOf(layer, (s) => range === -1 || layer.params.colorize ? !s.id.startsWith("ranges.") : s.id.startsWith(`ranges.${range}.`)).map(
|
|
1319
1366
|
(s) => slider(layer, s)
|
|
1320
1367
|
),
|
|
1321
1368
|
range === -1 && checkbox(layer, "colorize", "Colorize")
|
|
1322
1369
|
] });
|
|
1323
1370
|
case "colorBalance":
|
|
1324
|
-
return /* @__PURE__ */ (0,
|
|
1325
|
-
/* @__PURE__ */ (0,
|
|
1371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
1372
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Tone", children: TONES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: chipClass(tone === t.id), onClick: () => setTone(t.id), children: t.label }, t.id)) }),
|
|
1326
1373
|
controlsOf(layer, (s) => s.id.startsWith(`${tone}.`)).map((s) => slider(layer, s)),
|
|
1327
1374
|
checkbox(layer, "preserveLuminosity", "Preserve luminosity")
|
|
1328
1375
|
] });
|
|
1329
1376
|
case "blackWhite":
|
|
1330
|
-
return /* @__PURE__ */ (0,
|
|
1377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
1331
1378
|
controlsOf(layer).map((s) => slider(layer, s)),
|
|
1332
|
-
/* @__PURE__ */ (0,
|
|
1333
|
-
/* @__PURE__ */ (0,
|
|
1334
|
-
"input",
|
|
1335
|
-
{
|
|
1336
|
-
type: "checkbox",
|
|
1337
|
-
checked: layer.params.tint !== null,
|
|
1338
|
-
onChange: (e) => setParam(layer, "tint", e.target.checked ? "#e1d3b3" : null),
|
|
1339
|
-
className: "accent-primary"
|
|
1340
|
-
}
|
|
1341
|
-
),
|
|
1379
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
1380
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ImageCheckbox, { label: "Tint", checked: layer.params.tint !== null, onChange: (on) => setParam(layer, "tint", on ? "#e1d3b3" : null) }),
|
|
1342
1381
|
"Tint",
|
|
1343
|
-
layer.params.tint && /* @__PURE__ */ (0,
|
|
1382
|
+
layer.params.tint && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1344
1383
|
"input",
|
|
1345
1384
|
{
|
|
1346
1385
|
type: "color",
|
|
@@ -1353,10 +1392,10 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
|
|
|
1353
1392
|
] })
|
|
1354
1393
|
] });
|
|
1355
1394
|
case "photoFilter":
|
|
1356
|
-
return /* @__PURE__ */ (0,
|
|
1357
|
-
/* @__PURE__ */ (0,
|
|
1395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
1396
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
1358
1397
|
"Filter colour",
|
|
1359
|
-
/* @__PURE__ */ (0,
|
|
1398
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1360
1399
|
"input",
|
|
1361
1400
|
{
|
|
1362
1401
|
type: "color",
|
|
@@ -1371,25 +1410,25 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
|
|
|
1371
1410
|
checkbox(layer, "preserveLuminosity", "Preserve luminosity")
|
|
1372
1411
|
] });
|
|
1373
1412
|
case "invert":
|
|
1374
|
-
return /* @__PURE__ */ (0,
|
|
1413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-muted-foreground text-[11px]", children: "Invert has no settings." });
|
|
1375
1414
|
default:
|
|
1376
|
-
return /* @__PURE__ */ (0,
|
|
1415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex flex-col gap-2", children: controlsOf(layer).map((s) => slider(layer, s)) });
|
|
1377
1416
|
}
|
|
1378
1417
|
};
|
|
1379
|
-
return /* @__PURE__ */ (0,
|
|
1380
|
-
/* @__PURE__ */ (0,
|
|
1381
|
-
/* @__PURE__ */ (0,
|
|
1382
|
-
/* @__PURE__ */ (0,
|
|
1383
|
-
|
|
1418
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `flex flex-col gap-2 text-xs ${className}`.trim(), "data-testid": "adjustment-layers-panel", children: [
|
|
1419
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: imageSectionTitleClass, children: "Adjustment Layers" }) }),
|
|
1420
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex gap-1.5", children: [
|
|
1421
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1422
|
+
ImageSelect,
|
|
1384
1423
|
{
|
|
1385
|
-
|
|
1386
|
-
className:
|
|
1424
|
+
label: "New adjustment layer kind",
|
|
1425
|
+
className: "flex-1",
|
|
1387
1426
|
value: newKind,
|
|
1388
|
-
|
|
1389
|
-
|
|
1427
|
+
options: import_image_editor6.ADJUSTMENT_KINDS.map((k) => ({ value: k.kind, label: k.label })),
|
|
1428
|
+
onChange: (v) => setNewKind(v)
|
|
1390
1429
|
}
|
|
1391
1430
|
),
|
|
1392
|
-
/* @__PURE__ */ (0,
|
|
1431
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1393
1432
|
"button",
|
|
1394
1433
|
{
|
|
1395
1434
|
type: "button",
|
|
@@ -1403,25 +1442,16 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
|
|
|
1403
1442
|
}
|
|
1404
1443
|
)
|
|
1405
1444
|
] }),
|
|
1406
|
-
topFirst.length > 0 && /* @__PURE__ */ (0,
|
|
1445
|
+
topFirst.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Adjustment layers", children: topFirst.map((layer) => {
|
|
1407
1446
|
const index = layers.indexOf(layer);
|
|
1408
1447
|
const label = layer.name || (0, import_image_editor6.adjustmentKindLabel)(layer.kind);
|
|
1409
|
-
return /* @__PURE__ */ (0,
|
|
1448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1410
1449
|
"li",
|
|
1411
1450
|
{
|
|
1412
1451
|
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"}`,
|
|
1413
1452
|
children: [
|
|
1414
|
-
/* @__PURE__ */ (0,
|
|
1415
|
-
|
|
1416
|
-
{
|
|
1417
|
-
type: "checkbox",
|
|
1418
|
-
"aria-label": `Show ${label}`,
|
|
1419
|
-
checked: layer.enabled,
|
|
1420
|
-
onChange: () => controller.toggleAdjustmentLayer(layer.id),
|
|
1421
|
-
className: "accent-primary"
|
|
1422
|
-
}
|
|
1423
|
-
),
|
|
1424
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1453
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ImageCheckbox, { label: `Show ${label}`, checked: layer.enabled, onChange: () => controller.toggleAdjustmentLayer(layer.id) }),
|
|
1454
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1425
1455
|
"button",
|
|
1426
1456
|
{
|
|
1427
1457
|
type: "button",
|
|
@@ -1431,7 +1461,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
|
|
|
1431
1461
|
children: label
|
|
1432
1462
|
}
|
|
1433
1463
|
),
|
|
1434
|
-
/* @__PURE__ */ (0,
|
|
1464
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1435
1465
|
"button",
|
|
1436
1466
|
{
|
|
1437
1467
|
type: "button",
|
|
@@ -1442,7 +1472,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
|
|
|
1442
1472
|
children: "\u2191"
|
|
1443
1473
|
}
|
|
1444
1474
|
),
|
|
1445
|
-
/* @__PURE__ */ (0,
|
|
1475
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1446
1476
|
"button",
|
|
1447
1477
|
{
|
|
1448
1478
|
type: "button",
|
|
@@ -1453,7 +1483,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
|
|
|
1453
1483
|
children: "\u2193"
|
|
1454
1484
|
}
|
|
1455
1485
|
),
|
|
1456
|
-
/* @__PURE__ */ (0,
|
|
1486
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1457
1487
|
"button",
|
|
1458
1488
|
{
|
|
1459
1489
|
type: "button",
|
|
@@ -1471,21 +1501,21 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
|
|
|
1471
1501
|
layer.id
|
|
1472
1502
|
);
|
|
1473
1503
|
}) }),
|
|
1474
|
-
selected && /* @__PURE__ */ (0,
|
|
1475
|
-
/* @__PURE__ */ (0,
|
|
1476
|
-
/* @__PURE__ */ (0,
|
|
1477
|
-
/* @__PURE__ */ (0,
|
|
1478
|
-
|
|
1504
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col gap-2 rounded border border-border p-2", "data-testid": "adjustment-layer-editor", children: [
|
|
1505
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1506
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-muted-foreground", children: "Blend" }),
|
|
1507
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1508
|
+
ImageSelect,
|
|
1479
1509
|
{
|
|
1480
|
-
|
|
1481
|
-
className:
|
|
1510
|
+
label: "Blend mode",
|
|
1511
|
+
className: "flex-1",
|
|
1482
1512
|
value: selected.blend,
|
|
1483
|
-
|
|
1484
|
-
|
|
1513
|
+
options: import_image_editor6.BLEND_MODES.map((m) => ({ value: m.id, label: m.label })),
|
|
1514
|
+
onChange: (v) => controller.updateAdjustmentLayer(selected.id, { blend: v })
|
|
1485
1515
|
}
|
|
1486
1516
|
)
|
|
1487
1517
|
] }),
|
|
1488
|
-
/* @__PURE__ */ (0,
|
|
1518
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1489
1519
|
ControlSlider,
|
|
1490
1520
|
{
|
|
1491
1521
|
spec: import_image_editor6.ADJUSTMENT_LAYER_OPACITY_CONTROL,
|
|
@@ -1500,18 +1530,18 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
|
|
|
1500
1530
|
};
|
|
1501
1531
|
|
|
1502
1532
|
// src/image-editor/LayersPanel.tsx
|
|
1503
|
-
var
|
|
1533
|
+
var import_react11 = require("react");
|
|
1504
1534
|
|
|
1505
1535
|
// src/image-editor/LayerEffectsPanel.tsx
|
|
1506
|
-
var
|
|
1536
|
+
var import_react10 = require("react");
|
|
1507
1537
|
var import_image_editor7 = require("@pixerate/editor/image-editor");
|
|
1508
|
-
var
|
|
1538
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1509
1539
|
var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
1510
|
-
const [, setTick] = (0,
|
|
1511
|
-
(0,
|
|
1512
|
-
const [open, setOpen] = (0,
|
|
1513
|
-
const [error, setError] = (0,
|
|
1514
|
-
const commitNext = (0,
|
|
1540
|
+
const [, setTick] = (0, import_react10.useState)(0);
|
|
1541
|
+
(0, import_react10.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
1542
|
+
const [open, setOpen] = (0, import_react10.useState)(null);
|
|
1543
|
+
const [error, setError] = (0, import_react10.useState)(null);
|
|
1544
|
+
const commitNext = (0, import_react10.useRef)(true);
|
|
1515
1545
|
const layer = layerId ? controller.getLayer(layerId) : controller.getActiveLayer();
|
|
1516
1546
|
const model = (0, import_image_editor7.layerEffectsPanel)(layer);
|
|
1517
1547
|
const id = layer?.id;
|
|
@@ -1523,13 +1553,8 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1523
1553
|
setError(err instanceof Error ? err.message : String(err));
|
|
1524
1554
|
}
|
|
1525
1555
|
};
|
|
1526
|
-
const sliderEvents = {
|
|
1527
|
-
onPointerDown: () => commitNext.current = true,
|
|
1528
|
-
onPointerUp: () => commitNext.current = true,
|
|
1529
|
-
onKeyDown: () => commitNext.current = true
|
|
1530
|
-
};
|
|
1531
1556
|
if (!model.available || !id) {
|
|
1532
|
-
return /* @__PURE__ */ (0,
|
|
1557
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `text-xs text-muted-foreground ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
|
|
1533
1558
|
}
|
|
1534
1559
|
const effects = controller.getLayerEffects(id);
|
|
1535
1560
|
const patterns = controller.getDocumentPatterns();
|
|
@@ -1544,77 +1569,65 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1544
1569
|
case "range": {
|
|
1545
1570
|
const k = c.percent ? 100 : 1;
|
|
1546
1571
|
const shown = Math.round(c.value * k * 100) / 100;
|
|
1547
|
-
return /* @__PURE__ */ (0,
|
|
1548
|
-
/* @__PURE__ */ (0,
|
|
1572
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
|
|
1573
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
1549
1574
|
label,
|
|
1550
1575
|
" ",
|
|
1551
1576
|
shown,
|
|
1552
1577
|
c.unit
|
|
1553
1578
|
] }),
|
|
1554
|
-
/* @__PURE__ */ (0,
|
|
1555
|
-
|
|
1579
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1580
|
+
ImageRange,
|
|
1556
1581
|
{
|
|
1557
|
-
|
|
1558
|
-
"aria-label": label,
|
|
1582
|
+
label,
|
|
1559
1583
|
min: c.min * k,
|
|
1560
1584
|
max: c.max * k,
|
|
1561
1585
|
step: c.step * k,
|
|
1562
1586
|
value: shown,
|
|
1563
1587
|
disabled: model.readOnly,
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1588
|
+
onStart: () => commitNext.current = true,
|
|
1589
|
+
onEnd: () => commitNext.current = true,
|
|
1590
|
+
onChange: (v) => change(effectId, c, v / k, true)
|
|
1567
1591
|
}
|
|
1568
1592
|
)
|
|
1569
1593
|
] }, c.key);
|
|
1570
1594
|
}
|
|
1571
1595
|
case "color":
|
|
1572
|
-
return /* @__PURE__ */ (0,
|
|
1573
|
-
/* @__PURE__ */ (0,
|
|
1596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
1597
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", { type: "color", "aria-label": label, value: c.value, disabled: model.readOnly, onChange: (e) => change(effectId, c, e.target.value) }),
|
|
1574
1598
|
label
|
|
1575
1599
|
] }, c.key);
|
|
1576
1600
|
case "checkbox":
|
|
1577
|
-
return /* @__PURE__ */ (0,
|
|
1578
|
-
/* @__PURE__ */ (0,
|
|
1601
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
1602
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ImageCheckbox, { label, checked: c.value, disabled: model.readOnly, onChange: (on) => change(effectId, c, on) }),
|
|
1579
1603
|
label
|
|
1580
1604
|
] }, c.key);
|
|
1581
1605
|
case "select":
|
|
1582
|
-
return /* @__PURE__ */ (0,
|
|
1583
|
-
/* @__PURE__ */ (0,
|
|
1584
|
-
/* @__PURE__ */ (0,
|
|
1585
|
-
|
|
1606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
|
|
1607
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-muted-foreground", children: label }),
|
|
1608
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1609
|
+
ImageSelect,
|
|
1586
1610
|
{
|
|
1587
|
-
|
|
1588
|
-
value: c.value,
|
|
1611
|
+
label,
|
|
1612
|
+
value: String(c.value),
|
|
1589
1613
|
disabled: model.readOnly,
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
children: c.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: o.value, children: o.label }, o.value))
|
|
1614
|
+
options: c.options.map((o) => ({ value: String(o.value), label: o.label })),
|
|
1615
|
+
onChange: (v) => change(effectId, c, v)
|
|
1593
1616
|
}
|
|
1594
1617
|
)
|
|
1595
1618
|
] }, c.key);
|
|
1596
1619
|
}
|
|
1597
1620
|
};
|
|
1598
|
-
return /* @__PURE__ */ (0,
|
|
1599
|
-
/* @__PURE__ */ (0,
|
|
1600
|
-
/* @__PURE__ */ (0,
|
|
1601
|
-
/* @__PURE__ */ (0,
|
|
1602
|
-
/* @__PURE__ */ (0,
|
|
1603
|
-
"input",
|
|
1604
|
-
{
|
|
1605
|
-
type: "checkbox",
|
|
1606
|
-
"aria-label": "Effects on",
|
|
1607
|
-
checked: model.enabled,
|
|
1608
|
-
disabled: model.readOnly,
|
|
1609
|
-
onChange: (e) => attempt(() => controller.setLayerEffectsEnabled(id, e.target.checked)),
|
|
1610
|
-
className: "accent-primary"
|
|
1611
|
-
}
|
|
1612
|
-
),
|
|
1621
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-foreground ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer effects", role: "group", children: [
|
|
1622
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
1623
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "font-semibold text-foreground", children: "fx Effects" }),
|
|
1624
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
|
|
1625
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ImageCheckbox, { label: "Effects on", checked: model.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.setLayerEffectsEnabled(id, on)) }),
|
|
1613
1626
|
"On"
|
|
1614
1627
|
] }),
|
|
1615
|
-
/* @__PURE__ */ (0,
|
|
1628
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
1616
1629
|
"Scale",
|
|
1617
|
-
/* @__PURE__ */ (0,
|
|
1630
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1618
1631
|
"input",
|
|
1619
1632
|
{
|
|
1620
1633
|
type: "number",
|
|
@@ -1633,43 +1646,30 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1633
1646
|
),
|
|
1634
1647
|
"%"
|
|
1635
1648
|
] }),
|
|
1636
|
-
/* @__PURE__ */ (0,
|
|
1637
|
-
|
|
1649
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1650
|
+
ImageSelect,
|
|
1638
1651
|
{
|
|
1639
|
-
|
|
1652
|
+
label: "Add effect",
|
|
1640
1653
|
value: "",
|
|
1654
|
+
placeholder: "Add effect\u2026",
|
|
1641
1655
|
disabled: model.readOnly,
|
|
1642
|
-
|
|
1643
|
-
|
|
1656
|
+
options: import_image_editor7.LAYER_EFFECT_MENU.map((m) => ({ value: m.kind, label: m.label })),
|
|
1657
|
+
onChange: (v) => {
|
|
1658
|
+
const kind = v;
|
|
1644
1659
|
if (!kind) return;
|
|
1645
1660
|
attempt(() => setOpen(controller.addLayerEffect(id, kind).effect.id));
|
|
1646
|
-
}
|
|
1647
|
-
className: imageSelectClass,
|
|
1648
|
-
children: [
|
|
1649
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "", children: "Add effect\u2026" }),
|
|
1650
|
-
import_image_editor7.LAYER_EFFECT_MENU.map((m) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: m.kind, children: m.label }, m.kind))
|
|
1651
|
-
]
|
|
1661
|
+
}
|
|
1652
1662
|
}
|
|
1653
1663
|
)
|
|
1654
1664
|
] }),
|
|
1655
|
-
model.readOnly && model.reason && /* @__PURE__ */ (0,
|
|
1656
|
-
/* @__PURE__ */ (0,
|
|
1665
|
+
model.readOnly && model.reason && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-muted-foreground", children: model.reason }),
|
|
1666
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Effects", children: model.rows.map((row) => {
|
|
1657
1667
|
const effect = effects.items.find((e) => e.id === row.id);
|
|
1658
1668
|
const expanded = open === row.id;
|
|
1659
|
-
return /* @__PURE__ */ (0,
|
|
1660
|
-
/* @__PURE__ */ (0,
|
|
1661
|
-
/* @__PURE__ */ (0,
|
|
1662
|
-
|
|
1663
|
-
{
|
|
1664
|
-
type: "checkbox",
|
|
1665
|
-
"aria-label": `${row.label} on`,
|
|
1666
|
-
checked: row.enabled,
|
|
1667
|
-
disabled: model.readOnly,
|
|
1668
|
-
onChange: (e) => attempt(() => controller.updateLayerEffect(id, row.id, { enabled: e.target.checked })),
|
|
1669
|
-
className: "accent-primary"
|
|
1670
|
-
}
|
|
1671
|
-
),
|
|
1672
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1669
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("li", { "data-effect-id": row.id, className: "rounded bg-background/60 ring-1 ring-border", children: [
|
|
1670
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
|
|
1671
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ImageCheckbox, { label: `${row.label} on`, checked: row.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.updateLayerEffect(id, row.id, { enabled: on })) }),
|
|
1672
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1673
1673
|
"button",
|
|
1674
1674
|
{
|
|
1675
1675
|
type: "button",
|
|
@@ -1679,18 +1679,18 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1679
1679
|
children: row.label
|
|
1680
1680
|
}
|
|
1681
1681
|
),
|
|
1682
|
-
/* @__PURE__ */ (0,
|
|
1682
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: imageIconButtonClass, "aria-label": `Remove ${row.label}`, disabled: model.readOnly, onClick: () => attempt(() => controller.removeLayerEffect(id, row.id)), children: "\u2715" })
|
|
1683
1683
|
] }),
|
|
1684
|
-
expanded && /* @__PURE__ */ (0,
|
|
1684
|
+
expanded && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 px-1.5 pb-1.5", "data-testid": "effect-settings", children: (0, import_image_editor7.layerEffectControls)(effect, patterns).map((c) => renderControl(row.id, c)) })
|
|
1685
1685
|
] }, row.id);
|
|
1686
1686
|
}) }),
|
|
1687
|
-
error && /* @__PURE__ */ (0,
|
|
1687
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
1688
1688
|
] });
|
|
1689
1689
|
};
|
|
1690
1690
|
|
|
1691
1691
|
// src/image-editor/LayersPanel.tsx
|
|
1692
1692
|
var import_image_editor8 = require("@pixerate/editor/image-editor");
|
|
1693
|
-
var
|
|
1693
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1694
1694
|
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"}`;
|
|
1695
1695
|
var Thumbnail = ({
|
|
1696
1696
|
pixels,
|
|
@@ -1700,8 +1700,8 @@ var Thumbnail = ({
|
|
|
1700
1700
|
selected,
|
|
1701
1701
|
testId
|
|
1702
1702
|
}) => {
|
|
1703
|
-
const ref = (0,
|
|
1704
|
-
(0,
|
|
1703
|
+
const ref = (0, import_react11.useRef)(null);
|
|
1704
|
+
(0, import_react11.useEffect)(() => {
|
|
1705
1705
|
const canvas = ref.current;
|
|
1706
1706
|
const ctx = canvas?.getContext("2d");
|
|
1707
1707
|
if (!canvas || !ctx || !pixels || typeof ctx.createImageData !== "function") return;
|
|
@@ -1711,7 +1711,7 @@ var Thumbnail = ({
|
|
|
1711
1711
|
img.data.set(pixels.data);
|
|
1712
1712
|
ctx.putImageData(img, 0, 0);
|
|
1713
1713
|
}, [pixels]);
|
|
1714
|
-
return /* @__PURE__ */ (0,
|
|
1714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1715
1715
|
"canvas",
|
|
1716
1716
|
{
|
|
1717
1717
|
ref,
|
|
@@ -1725,14 +1725,14 @@ var Thumbnail = ({
|
|
|
1725
1725
|
);
|
|
1726
1726
|
};
|
|
1727
1727
|
var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "image", effects = true, className }) => {
|
|
1728
|
-
const [, setTick] = (0,
|
|
1729
|
-
(0,
|
|
1730
|
-
const [error, setError] = (0,
|
|
1731
|
-
const [renaming, setRenaming] = (0,
|
|
1732
|
-
const [menu, setMenu] = (0,
|
|
1733
|
-
const [drag, setDrag] = (0,
|
|
1734
|
-
const [psdNotes, setPsdNotes] = (0,
|
|
1735
|
-
const fileInput = (0,
|
|
1728
|
+
const [, setTick] = (0, import_react11.useState)(0);
|
|
1729
|
+
(0, import_react11.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
1730
|
+
const [error, setError] = (0, import_react11.useState)(null);
|
|
1731
|
+
const [renaming, setRenaming] = (0, import_react11.useState)(null);
|
|
1732
|
+
const [menu, setMenu] = (0, import_react11.useState)(null);
|
|
1733
|
+
const [drag, setDrag] = (0, import_react11.useState)(null);
|
|
1734
|
+
const [psdNotes, setPsdNotes] = (0, import_react11.useState)([]);
|
|
1735
|
+
const fileInput = (0, import_react11.useRef)(null);
|
|
1736
1736
|
const psdTask = async (fn) => {
|
|
1737
1737
|
try {
|
|
1738
1738
|
setError(null);
|
|
@@ -1741,7 +1741,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1741
1741
|
setError(err instanceof Error ? err.message : String(err));
|
|
1742
1742
|
}
|
|
1743
1743
|
};
|
|
1744
|
-
const commitNext = (0,
|
|
1744
|
+
const commitNext = (0, import_react11.useRef)(true);
|
|
1745
1745
|
const state = controller.getState();
|
|
1746
1746
|
const rows = (0, import_image_editor8.layerPanelRows)(state.layers, state.activeLayerId);
|
|
1747
1747
|
const active = controller.getActiveLayer();
|
|
@@ -1779,14 +1779,14 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1779
1779
|
const thumb = (layer) => (0, import_image_editor8.layerHasThumbnail)(layer) ? controller.getLayerThumbnail(layer.id, { maxSide: 64 }) : null;
|
|
1780
1780
|
const maskThumb = (layer) => layer.mask && !layer.mask.source ? controller.getLayerThumbnail(layer.id, { maxSide: 64, mask: true }) : null;
|
|
1781
1781
|
const locked = (layer) => Boolean(layer.locks?.all || layer.locks?.pixels || layer.locks?.position || layer.locks?.transparency);
|
|
1782
|
-
return /* @__PURE__ */ (0,
|
|
1783
|
-
/* @__PURE__ */ (0,
|
|
1784
|
-
/* @__PURE__ */ (0,
|
|
1785
|
-
/* @__PURE__ */ (0,
|
|
1786
|
-
/* @__PURE__ */ (0,
|
|
1787
|
-
/* @__PURE__ */ (0,
|
|
1788
|
-
/* @__PURE__ */ (0,
|
|
1789
|
-
/* @__PURE__ */ (0,
|
|
1782
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "layers-panel", onClick: () => menu && setMenu(null), children: [
|
|
1783
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "toolbar", "aria-label": "Layer actions", children: [
|
|
1784
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-layer"), children: "New Layer" }),
|
|
1785
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-group"), children: "New Group" }),
|
|
1786
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("duplicate"), children: "Duplicate" }),
|
|
1787
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("add-mask"), children: "Add Mask" }),
|
|
1788
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("delete"), children: "Delete" }),
|
|
1789
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1790
1790
|
"button",
|
|
1791
1791
|
{
|
|
1792
1792
|
type: "button",
|
|
@@ -1801,7 +1801,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1801
1801
|
children: "\u22EF"
|
|
1802
1802
|
}
|
|
1803
1803
|
),
|
|
1804
|
-
/* @__PURE__ */ (0,
|
|
1804
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1805
1805
|
"select",
|
|
1806
1806
|
{
|
|
1807
1807
|
"aria-label": "Bits per channel",
|
|
@@ -1809,13 +1809,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1809
1809
|
className: "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground",
|
|
1810
1810
|
value: controller.bitDepth,
|
|
1811
1811
|
onChange: (e) => attempt(() => controller.setBitDepth(Number(e.target.value))),
|
|
1812
|
-
children: import_image_editor8.BIT_DEPTH_OPTIONS.map((o) => /* @__PURE__ */ (0,
|
|
1812
|
+
children: import_image_editor8.BIT_DEPTH_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: o.depth, title: o.title, children: o.label }, o.depth))
|
|
1813
1813
|
}
|
|
1814
1814
|
),
|
|
1815
|
-
psd && /* @__PURE__ */ (0,
|
|
1816
|
-
/* @__PURE__ */ (0,
|
|
1817
|
-
/* @__PURE__ */ (0,
|
|
1818
|
-
/* @__PURE__ */ (0,
|
|
1815
|
+
psd && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
1816
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => fileInput.current?.click(), children: "Open PSD\u2026" }),
|
|
1817
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => psdTask(async () => (await (0, import_image_editor8.downloadPsd)(controller, psdFileName)).warnings), children: "Export PSD" }),
|
|
1818
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1819
1819
|
"input",
|
|
1820
1820
|
{
|
|
1821
1821
|
ref: fileInput,
|
|
@@ -1833,18 +1833,18 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1833
1833
|
)
|
|
1834
1834
|
] })
|
|
1835
1835
|
] }),
|
|
1836
|
-
psdNotes.length > 0 && /* @__PURE__ */ (0,
|
|
1837
|
-
psdNotes.map((n) => /* @__PURE__ */ (0,
|
|
1838
|
-
/* @__PURE__ */ (0,
|
|
1836
|
+
psdNotes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("ul", { className: "rounded bg-amber-500/10 text-amber-600 px-2 py-1 space-y-0.5", "data-testid": "psd-warnings", "aria-label": "PSD warnings", children: [
|
|
1837
|
+
psdNotes.map((n) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { children: n }, n)),
|
|
1838
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "underline", onClick: () => setPsdNotes([]), children: "Dismiss" }) })
|
|
1839
1839
|
] }),
|
|
1840
|
-
active && /* @__PURE__ */ (0,
|
|
1841
|
-
/* @__PURE__ */ (0,
|
|
1842
|
-
/* @__PURE__ */ (0,
|
|
1840
|
+
active && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 items-center", "data-testid": "layer-properties", children: [
|
|
1841
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
|
|
1842
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
1843
1843
|
"Opacity ",
|
|
1844
1844
|
Math.round(active.opacity * 100),
|
|
1845
1845
|
"%"
|
|
1846
1846
|
] }),
|
|
1847
|
-
/* @__PURE__ */ (0,
|
|
1847
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1848
1848
|
"input",
|
|
1849
1849
|
{
|
|
1850
1850
|
type: "range",
|
|
@@ -1858,13 +1858,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1858
1858
|
}
|
|
1859
1859
|
)
|
|
1860
1860
|
] }),
|
|
1861
|
-
/* @__PURE__ */ (0,
|
|
1862
|
-
/* @__PURE__ */ (0,
|
|
1861
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
|
|
1862
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
1863
1863
|
"Fill ",
|
|
1864
1864
|
Math.round(((active.type === "pixel" ? active.fillOpacity : void 0) ?? 1) * 100),
|
|
1865
1865
|
"%"
|
|
1866
1866
|
] }),
|
|
1867
|
-
/* @__PURE__ */ (0,
|
|
1867
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1868
1868
|
"input",
|
|
1869
1869
|
{
|
|
1870
1870
|
type: "range",
|
|
@@ -1879,7 +1879,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1879
1879
|
}
|
|
1880
1880
|
)
|
|
1881
1881
|
] }),
|
|
1882
|
-
/* @__PURE__ */ (0,
|
|
1882
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1883
1883
|
"select",
|
|
1884
1884
|
{
|
|
1885
1885
|
"aria-label": "Layer blend mode",
|
|
@@ -1887,13 +1887,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1887
1887
|
value: active.blend,
|
|
1888
1888
|
onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { blend: e.target.value })),
|
|
1889
1889
|
children: [
|
|
1890
|
-
active.type === "group" && /* @__PURE__ */ (0,
|
|
1891
|
-
import_image_editor8.BLEND_MODES.map((m) => /* @__PURE__ */ (0,
|
|
1890
|
+
active.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "pass-through", children: "Pass Through" }),
|
|
1891
|
+
import_image_editor8.BLEND_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: m.id, children: m.label }, m.id))
|
|
1892
1892
|
]
|
|
1893
1893
|
}
|
|
1894
1894
|
),
|
|
1895
|
-
/* @__PURE__ */ (0,
|
|
1896
|
-
/* @__PURE__ */ (0,
|
|
1895
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
1896
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1897
1897
|
"input",
|
|
1898
1898
|
{
|
|
1899
1899
|
type: "checkbox",
|
|
@@ -1905,8 +1905,8 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1905
1905
|
),
|
|
1906
1906
|
"Clip to below"
|
|
1907
1907
|
] }),
|
|
1908
|
-
/* @__PURE__ */ (0,
|
|
1909
|
-
/* @__PURE__ */ (0,
|
|
1908
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "col-span-2 flex flex-wrap gap-2 text-muted-foreground", role: "group", "aria-label": "Layer locks", children: ["pixels", "transparency", "position", "all"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
1909
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1910
1910
|
"input",
|
|
1911
1911
|
{
|
|
1912
1912
|
type: "checkbox",
|
|
@@ -1919,10 +1919,10 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1919
1919
|
k
|
|
1920
1920
|
] }, k)) })
|
|
1921
1921
|
] }),
|
|
1922
|
-
effects && active && active.type !== "adjustment" && /* @__PURE__ */ (0,
|
|
1923
|
-
/* @__PURE__ */ (0,
|
|
1922
|
+
effects && active && active.type !== "adjustment" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(LayerEffectsPanel, { controller, className: "border-t border-border pt-1.5" }),
|
|
1923
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: "flex flex-col gap-0.5", role: "tree", "aria-label": "Layers", children: rows.map((row) => {
|
|
1924
1924
|
const { layer } = row;
|
|
1925
|
-
return /* @__PURE__ */ (0,
|
|
1925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1926
1926
|
"li",
|
|
1927
1927
|
{
|
|
1928
1928
|
role: "treeitem",
|
|
@@ -1952,7 +1952,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1952
1952
|
className: rowClass(row.active),
|
|
1953
1953
|
style: { paddingLeft: 6 + row.depth * 14 },
|
|
1954
1954
|
children: [
|
|
1955
|
-
/* @__PURE__ */ (0,
|
|
1955
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1956
1956
|
"button",
|
|
1957
1957
|
{
|
|
1958
1958
|
type: "button",
|
|
@@ -1966,7 +1966,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1966
1966
|
children: layer.visible ? "\u25CF" : "\u25CB"
|
|
1967
1967
|
}
|
|
1968
1968
|
),
|
|
1969
|
-
layer.type === "group" && /* @__PURE__ */ (0,
|
|
1969
|
+
layer.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1970
1970
|
"button",
|
|
1971
1971
|
{
|
|
1972
1972
|
type: "button",
|
|
@@ -1979,9 +1979,9 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1979
1979
|
children: layer.collapsed ? "\u25B8" : "\u25BE"
|
|
1980
1980
|
}
|
|
1981
1981
|
),
|
|
1982
|
-
row.clipped && /* @__PURE__ */ (0,
|
|
1983
|
-
(0, import_image_editor8.layerHasThumbnail)(layer) ? /* @__PURE__ */ (0,
|
|
1984
|
-
/* @__PURE__ */ (0,
|
|
1982
|
+
row.clipped && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-muted-foreground", "aria-label": "Clipped", children: "\u21B3" }),
|
|
1983
|
+
(0, import_image_editor8.layerHasThumbnail)(layer) ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "relative shrink-0", children: [
|
|
1984
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1985
1985
|
Thumbnail,
|
|
1986
1986
|
{
|
|
1987
1987
|
pixels: thumb(layer),
|
|
@@ -1990,7 +1990,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1990
1990
|
selected: row.active && state.activeTarget === "pixels" && Boolean(layer.mask)
|
|
1991
1991
|
}
|
|
1992
1992
|
),
|
|
1993
|
-
layer.type !== "pixel" && /* @__PURE__ */ (0,
|
|
1993
|
+
layer.type !== "pixel" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1994
1994
|
"span",
|
|
1995
1995
|
{
|
|
1996
1996
|
"data-testid": "layer-kind-badge",
|
|
@@ -1998,7 +1998,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1998
1998
|
children: (0, import_image_editor8.layerBadge)(layer)
|
|
1999
1999
|
}
|
|
2000
2000
|
)
|
|
2001
|
-
] }) : /* @__PURE__ */ (0,
|
|
2001
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2002
2002
|
"span",
|
|
2003
2003
|
{
|
|
2004
2004
|
className: "shrink-0 grid place-items-center rounded bg-muted text-[9px] text-muted-foreground ring-1 ring-border",
|
|
@@ -2006,7 +2006,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2006
2006
|
children: (0, import_image_editor8.layerBadge)(layer)
|
|
2007
2007
|
}
|
|
2008
2008
|
),
|
|
2009
|
-
layer.mask && !layer.mask.source && layer.type === "pixel" && /* @__PURE__ */ (0,
|
|
2009
|
+
layer.mask && !layer.mask.source && layer.type === "pixel" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2010
2010
|
"button",
|
|
2011
2011
|
{
|
|
2012
2012
|
type: "button",
|
|
@@ -2022,7 +2022,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2022
2022
|
children: layer.mask.linked === false ? "\u26D3\uFE0E\u0338" : "\u26D3\uFE0E"
|
|
2023
2023
|
}
|
|
2024
2024
|
),
|
|
2025
|
-
layer.mask && /* @__PURE__ */ (0,
|
|
2025
|
+
layer.mask && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2026
2026
|
Thumbnail,
|
|
2027
2027
|
{
|
|
2028
2028
|
pixels: maskThumb(layer),
|
|
@@ -2037,7 +2037,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2037
2037
|
}
|
|
2038
2038
|
}
|
|
2039
2039
|
),
|
|
2040
|
-
renaming === layer.id ? /* @__PURE__ */ (0,
|
|
2040
|
+
renaming === layer.id ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2041
2041
|
"input",
|
|
2042
2042
|
{
|
|
2043
2043
|
autoFocus: true,
|
|
@@ -2054,7 +2054,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2054
2054
|
if (e.key === "Escape") setRenaming(null);
|
|
2055
2055
|
}
|
|
2056
2056
|
}
|
|
2057
|
-
) : /* @__PURE__ */ (0,
|
|
2057
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2058
2058
|
"span",
|
|
2059
2059
|
{
|
|
2060
2060
|
className: `flex-1 min-w-0 truncate ${layer.visible ? "" : "text-muted-foreground"}`,
|
|
@@ -2065,8 +2065,8 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2065
2065
|
children: row.label
|
|
2066
2066
|
}
|
|
2067
2067
|
),
|
|
2068
|
-
(0, import_image_editor8.layerWarning)(layer) && /* @__PURE__ */ (0,
|
|
2069
|
-
(0, import_image_editor8.layerEffectsBadge)(layer) && /* @__PURE__ */ (0,
|
|
2068
|
+
(0, import_image_editor8.layerWarning)(layer) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { role: "img", "data-testid": "layer-warning", "aria-label": (0, import_image_editor8.layerWarning)(layer), title: (0, import_image_editor8.layerWarning)(layer), className: "text-[10px] text-amber-600", children: "\u26A0" }),
|
|
2069
|
+
(0, import_image_editor8.layerEffectsBadge)(layer) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2070
2070
|
"button",
|
|
2071
2071
|
{
|
|
2072
2072
|
type: "button",
|
|
@@ -2081,15 +2081,15 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2081
2081
|
children: "fx"
|
|
2082
2082
|
}
|
|
2083
2083
|
),
|
|
2084
|
-
locked(layer) && /* @__PURE__ */ (0,
|
|
2085
|
-
layer.blend !== "normal" && layer.blend !== "pass-through" && /* @__PURE__ */ (0,
|
|
2084
|
+
locked(layer) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-label": "Locked", className: "text-muted-foreground", children: "\u{1F512}" }),
|
|
2085
|
+
layer.blend !== "normal" && layer.blend !== "pass-through" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-[9px] text-muted-foreground", children: layer.blend })
|
|
2086
2086
|
]
|
|
2087
2087
|
},
|
|
2088
2088
|
layer.id
|
|
2089
2089
|
);
|
|
2090
2090
|
}) }),
|
|
2091
|
-
error && /* @__PURE__ */ (0,
|
|
2092
|
-
menu && /* @__PURE__ */ (0,
|
|
2091
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
|
|
2092
|
+
menu && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2093
2093
|
"div",
|
|
2094
2094
|
{
|
|
2095
2095
|
role: "menu",
|
|
@@ -2098,7 +2098,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2098
2098
|
style: { left: menu.x, top: menu.y },
|
|
2099
2099
|
onClick: (e) => e.stopPropagation(),
|
|
2100
2100
|
onKeyDown: (e) => e.key === "Escape" && setMenu(null),
|
|
2101
|
-
children: (0, import_image_editor8.layerMenu)(controller).map((item) => /* @__PURE__ */ (0,
|
|
2101
|
+
children: (0, import_image_editor8.layerMenu)(controller).map((item) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2102
2102
|
"button",
|
|
2103
2103
|
{
|
|
2104
2104
|
type: "button",
|
|
@@ -2116,21 +2116,21 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2116
2116
|
};
|
|
2117
2117
|
|
|
2118
2118
|
// src/image-editor/ImageProviderEffectsPanel.tsx
|
|
2119
|
-
var
|
|
2119
|
+
var import_react20 = __toESM(require("react"), 1);
|
|
2120
2120
|
var import_image_editor9 = require("@pixerate/editor/image-editor");
|
|
2121
2121
|
|
|
2122
2122
|
// src/effects/useEffects.ts
|
|
2123
|
-
var
|
|
2123
|
+
var import_react12 = require("react");
|
|
2124
2124
|
function useEffects(host, provider) {
|
|
2125
|
-
(0,
|
|
2125
|
+
(0, import_react12.useEffect)(() => {
|
|
2126
2126
|
if (!host || !provider) return;
|
|
2127
2127
|
return host.useEffects(provider);
|
|
2128
2128
|
}, [host, provider]);
|
|
2129
2129
|
}
|
|
2130
2130
|
function useEffectDescription(provider, effect) {
|
|
2131
|
-
const [state, setState] = (0,
|
|
2131
|
+
const [state, setState] = (0, import_react12.useState)({ key: "", description: null, error: null });
|
|
2132
2132
|
const key = provider && effect ? `${provider.id}:${effect}` : "";
|
|
2133
|
-
(0,
|
|
2133
|
+
(0, import_react12.useEffect)(() => {
|
|
2134
2134
|
if (!provider || !effect) return;
|
|
2135
2135
|
let live = true;
|
|
2136
2136
|
Promise.resolve().then(() => provider.describe(effect)).then(
|
|
@@ -2145,13 +2145,13 @@ function useEffectDescription(provider, effect) {
|
|
|
2145
2145
|
}
|
|
2146
2146
|
|
|
2147
2147
|
// src/effects/EffectThumbnail.tsx
|
|
2148
|
-
var
|
|
2148
|
+
var import_react13 = require("react");
|
|
2149
2149
|
var import_effects = require("@pixerate/editor/effects");
|
|
2150
|
-
var
|
|
2150
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2151
2151
|
function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
|
|
2152
|
-
const ref = (0,
|
|
2153
|
-
const [failed, setFailed] = (0,
|
|
2154
|
-
(0,
|
|
2152
|
+
const ref = (0, import_react13.useRef)(null);
|
|
2153
|
+
const [failed, setFailed] = (0, import_react13.useState)(effect.kind === "motion");
|
|
2154
|
+
(0, import_react13.useEffect)(() => {
|
|
2155
2155
|
if (effect.kind === "motion") return;
|
|
2156
2156
|
let live = true;
|
|
2157
2157
|
(0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
|
|
@@ -2166,28 +2166,28 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
|
|
|
2166
2166
|
live = false;
|
|
2167
2167
|
};
|
|
2168
2168
|
}, [provider, effect, width, height]);
|
|
2169
|
-
return /* @__PURE__ */ (0,
|
|
2169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2170
2170
|
"div",
|
|
2171
2171
|
{
|
|
2172
2172
|
className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
|
|
2173
2173
|
style: { aspectRatio: `${width} / ${height}` },
|
|
2174
2174
|
"data-effect-thumbnail": effect.id,
|
|
2175
|
-
children: failed ? /* @__PURE__ */ (0,
|
|
2175
|
+
children: failed ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: effect.kind === "motion" ? "Motion" : "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
|
|
2176
2176
|
}
|
|
2177
2177
|
);
|
|
2178
2178
|
}
|
|
2179
2179
|
|
|
2180
2180
|
// src/effects/EffectsBrowser.tsx
|
|
2181
|
-
var
|
|
2181
|
+
var import_react14 = require("react");
|
|
2182
2182
|
var import_effects2 = require("@pixerate/editor/effects");
|
|
2183
|
-
var
|
|
2183
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2184
2184
|
function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
|
|
2185
|
-
const [all, setAll] = (0,
|
|
2186
|
-
const [query, setQuery] = (0,
|
|
2187
|
-
const [category, setCategory] = (0,
|
|
2188
|
-
const [use, setUse] = (0,
|
|
2189
|
-
const [error, setError] = (0,
|
|
2190
|
-
(0,
|
|
2185
|
+
const [all, setAll] = (0, import_react14.useState)([]);
|
|
2186
|
+
const [query, setQuery] = (0, import_react14.useState)("");
|
|
2187
|
+
const [category, setCategory] = (0, import_react14.useState)("");
|
|
2188
|
+
const [use, setUse] = (0, import_react14.useState)("");
|
|
2189
|
+
const [error, setError] = (0, import_react14.useState)(null);
|
|
2190
|
+
(0, import_react14.useEffect)(() => {
|
|
2191
2191
|
if (!provider) return setAll([]);
|
|
2192
2192
|
let live = true;
|
|
2193
2193
|
Promise.resolve().then(() => provider.list()).then(
|
|
@@ -2198,8 +2198,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
2198
2198
|
live = false;
|
|
2199
2199
|
};
|
|
2200
2200
|
}, [provider]);
|
|
2201
|
-
const [found, setFound] = (0,
|
|
2202
|
-
(0,
|
|
2201
|
+
const [found, setFound] = (0, import_react14.useState)([]);
|
|
2202
|
+
(0, import_react14.useEffect)(() => {
|
|
2203
2203
|
if (!provider) return setFound([]);
|
|
2204
2204
|
let live = true;
|
|
2205
2205
|
Promise.resolve().then(() => provider.search(query, { ...category ? { category } : {}, ...use ? { use } : {} })).then((list) => live && setFound(list), () => live && setFound([]));
|
|
@@ -2208,14 +2208,14 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
2208
2208
|
};
|
|
2209
2209
|
}, [provider, query, category, use]);
|
|
2210
2210
|
const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (uses ? e.kind !== "motion" || uses.includes("motion") : e.kind !== "motion") && (!uses || e.uses.some((u) => uses.includes(u)));
|
|
2211
|
-
const categories = (0,
|
|
2211
|
+
const categories = (0, import_react14.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
|
|
2212
2212
|
const shown = found.filter(allowed);
|
|
2213
2213
|
if (!provider)
|
|
2214
|
-
return /* @__PURE__ */ (0,
|
|
2215
|
-
return /* @__PURE__ */ (0,
|
|
2216
|
-
title && /* @__PURE__ */ (0,
|
|
2217
|
-
/* @__PURE__ */ (0,
|
|
2218
|
-
/* @__PURE__ */ (0,
|
|
2214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground ${className}`, "data-effects-browser": "", "data-effects-unavailable": "", children: "No effects provider is registered, so effects cannot be added. Effects already in the document are kept." });
|
|
2215
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
|
|
2216
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "text-xs font-semibold", children: title }),
|
|
2217
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
2218
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2219
2219
|
"input",
|
|
2220
2220
|
{
|
|
2221
2221
|
type: "search",
|
|
@@ -2226,17 +2226,17 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
2226
2226
|
onChange: (e) => setQuery(e.currentTarget.value)
|
|
2227
2227
|
}
|
|
2228
2228
|
),
|
|
2229
|
-
/* @__PURE__ */ (0,
|
|
2230
|
-
/* @__PURE__ */ (0,
|
|
2231
|
-
categories.map((c) => /* @__PURE__ */ (0,
|
|
2229
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Category", value: category, onChange: (e) => setCategory(e.currentTarget.value), children: [
|
|
2230
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "", children: "All categories" }),
|
|
2231
|
+
categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: c, children: c }, c))
|
|
2232
2232
|
] }),
|
|
2233
|
-
uses && uses.length > 1 && /* @__PURE__ */ (0,
|
|
2234
|
-
/* @__PURE__ */ (0,
|
|
2235
|
-
uses.map((u) => /* @__PURE__ */ (0,
|
|
2233
|
+
uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Use", value: use, onChange: (e) => setUse(e.currentTarget.value), children: [
|
|
2234
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "", children: "Any use" }),
|
|
2235
|
+
uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
|
|
2236
2236
|
] })
|
|
2237
2237
|
] }),
|
|
2238
|
-
error && /* @__PURE__ */ (0,
|
|
2239
|
-
/* @__PURE__ */ (0,
|
|
2238
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
|
|
2239
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { className: "grid max-h-96 grid-cols-[repeat(auto-fill,minmax(6.5rem,1fr))] gap-1.5 overflow-y-auto", role: "list", children: shown.map((e) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
2240
2240
|
"button",
|
|
2241
2241
|
{
|
|
2242
2242
|
type: "button",
|
|
@@ -2245,23 +2245,23 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
2245
2245
|
"data-effect-id": e.id,
|
|
2246
2246
|
onClick: () => onPick(e),
|
|
2247
2247
|
children: [
|
|
2248
|
-
thumbnails && /* @__PURE__ */ (0,
|
|
2249
|
-
/* @__PURE__ */ (0,
|
|
2250
|
-
/* @__PURE__ */ (0,
|
|
2248
|
+
thumbnails && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(EffectThumbnail, { provider, effect: e }),
|
|
2249
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
|
|
2250
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
|
|
2251
2251
|
]
|
|
2252
2252
|
}
|
|
2253
2253
|
) }, e.id)) }),
|
|
2254
|
-
!shown.length && !error && /* @__PURE__ */ (0,
|
|
2254
|
+
!shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
|
|
2255
2255
|
] });
|
|
2256
2256
|
}
|
|
2257
2257
|
|
|
2258
2258
|
// src/effects/EffectParameters.tsx
|
|
2259
|
-
var
|
|
2259
|
+
var import_react19 = __toESM(require("react"), 1);
|
|
2260
2260
|
var import_effects3 = require("@pixerate/editor/effects");
|
|
2261
2261
|
var import_parameters2 = require("@pixerate/editor/parameters");
|
|
2262
2262
|
|
|
2263
2263
|
// src/parameters/fields.tsx
|
|
2264
|
-
var
|
|
2264
|
+
var import_react18 = require("react");
|
|
2265
2265
|
var import_parameters = require("@pixerate/editor/parameters");
|
|
2266
2266
|
|
|
2267
2267
|
// src/color/index.ts
|
|
@@ -2274,9 +2274,9 @@ __export(color_exports, {
|
|
|
2274
2274
|
});
|
|
2275
2275
|
|
|
2276
2276
|
// src/color/ColorPicker.tsx
|
|
2277
|
-
var
|
|
2277
|
+
var import_react15 = require("react");
|
|
2278
2278
|
var import_color = require("@pixerate/editor/color");
|
|
2279
|
-
var
|
|
2279
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2280
2280
|
var LOCAL_STORAGE_KEY = "pixerate:color:recent";
|
|
2281
2281
|
function readLocalRecents() {
|
|
2282
2282
|
try {
|
|
@@ -2314,24 +2314,24 @@ var ColorPicker = ({
|
|
|
2314
2314
|
id,
|
|
2315
2315
|
"aria-label": ariaLabel = "Color picker"
|
|
2316
2316
|
}) => {
|
|
2317
|
-
const generatedId = (0,
|
|
2317
|
+
const generatedId = (0, import_react15.useId)();
|
|
2318
2318
|
const pickerId = id || generatedId;
|
|
2319
|
-
const [pickerState, setPickerState] = (0,
|
|
2319
|
+
const [pickerState, setPickerState] = (0, import_react15.useState)(
|
|
2320
2320
|
() => (0, import_color.pickerStateFromColor)(value) ?? DEFAULT_PICKER_STATE
|
|
2321
2321
|
);
|
|
2322
|
-
const stateRef = (0,
|
|
2322
|
+
const stateRef = (0, import_react15.useRef)(pickerState);
|
|
2323
2323
|
stateRef.current = pickerState;
|
|
2324
|
-
(0,
|
|
2324
|
+
(0, import_react15.useEffect)(() => {
|
|
2325
2325
|
const next = (0, import_color.pickerStateFromColor)(value, stateRef.current);
|
|
2326
2326
|
if (next) {
|
|
2327
2327
|
setPickerState(next);
|
|
2328
2328
|
}
|
|
2329
2329
|
}, [value]);
|
|
2330
|
-
const [internalRecent, setInternalRecent] = (0,
|
|
2330
|
+
const [internalRecent, setInternalRecent] = (0, import_react15.useState)(
|
|
2331
2331
|
() => controlledRecent ? [] : readLocalRecents()
|
|
2332
2332
|
);
|
|
2333
2333
|
const activeRecent = controlledRecent ?? internalRecent;
|
|
2334
|
-
const recordRecent = (0,
|
|
2334
|
+
const recordRecent = (0, import_react15.useCallback)(
|
|
2335
2335
|
(color) => {
|
|
2336
2336
|
const updated = (0, import_color.pushRecentColor)(activeRecent, color, 12);
|
|
2337
2337
|
if (!controlledRecent) {
|
|
@@ -2342,11 +2342,11 @@ var ColorPicker = ({
|
|
|
2342
2342
|
},
|
|
2343
2343
|
[activeRecent, controlledRecent, onRecentChange]
|
|
2344
2344
|
);
|
|
2345
|
-
const [textDraft, setTextDraft] = (0,
|
|
2346
|
-
const [isInvalid, setIsInvalid] = (0,
|
|
2347
|
-
const [isClipped, setIsClipped] = (0,
|
|
2348
|
-
const isTypingRef = (0,
|
|
2349
|
-
(0,
|
|
2345
|
+
const [textDraft, setTextDraft] = (0, import_react15.useState)(value);
|
|
2346
|
+
const [isInvalid, setIsInvalid] = (0, import_react15.useState)(false);
|
|
2347
|
+
const [isClipped, setIsClipped] = (0, import_react15.useState)(false);
|
|
2348
|
+
const isTypingRef = (0, import_react15.useRef)(false);
|
|
2349
|
+
(0, import_react15.useEffect)(() => {
|
|
2350
2350
|
if (!isTypingRef.current) {
|
|
2351
2351
|
setTextDraft(value);
|
|
2352
2352
|
setIsInvalid(false);
|
|
@@ -2354,11 +2354,11 @@ var ColorPicker = ({
|
|
|
2354
2354
|
setIsClipped(Boolean(parsed && !(0, import_color.inSrgbGamut)(parsed)));
|
|
2355
2355
|
}
|
|
2356
2356
|
}, [value]);
|
|
2357
|
-
const [hasEyeDropper, setHasEyeDropper] = (0,
|
|
2358
|
-
(0,
|
|
2357
|
+
const [hasEyeDropper, setHasEyeDropper] = (0, import_react15.useState)(false);
|
|
2358
|
+
(0, import_react15.useEffect)(() => {
|
|
2359
2359
|
setHasEyeDropper(typeof window !== "undefined" && "EyeDropper" in window);
|
|
2360
2360
|
}, []);
|
|
2361
|
-
const emitColorChange = (0,
|
|
2361
|
+
const emitColorChange = (0, import_react15.useCallback)(
|
|
2362
2362
|
(nextState) => {
|
|
2363
2363
|
setPickerState(nextState);
|
|
2364
2364
|
const hex = (0, import_color.pickerStateToHex)(nextState, alpha);
|
|
@@ -2366,10 +2366,10 @@ var ColorPicker = ({
|
|
|
2366
2366
|
},
|
|
2367
2367
|
[alpha, onChange]
|
|
2368
2368
|
);
|
|
2369
|
-
const latest = (0,
|
|
2369
|
+
const latest = (0, import_react15.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
|
|
2370
2370
|
latest.current = { emitColorChange, recordRecent, onGestureEnd, alpha };
|
|
2371
|
-
const endDragRef = (0,
|
|
2372
|
-
(0,
|
|
2371
|
+
const endDragRef = (0, import_react15.useRef)(null);
|
|
2372
|
+
(0, import_react15.useEffect)(() => () => endDragRef.current?.(), []);
|
|
2373
2373
|
const startDrag = (e, next) => {
|
|
2374
2374
|
if (disabled) return;
|
|
2375
2375
|
e.preventDefault();
|
|
@@ -2471,7 +2471,7 @@ var ColorPicker = ({
|
|
|
2471
2471
|
} catch {
|
|
2472
2472
|
}
|
|
2473
2473
|
};
|
|
2474
|
-
const contrastResult = (0,
|
|
2474
|
+
const contrastResult = (0, import_react15.useMemo)(() => {
|
|
2475
2475
|
if (!contrastAgainst) return null;
|
|
2476
2476
|
const fg = (0, import_color.parseColor)(value);
|
|
2477
2477
|
const bg = (0, import_color.parseColor)(contrastAgainst);
|
|
@@ -2483,7 +2483,7 @@ var ColorPicker = ({
|
|
|
2483
2483
|
}, [value, contrastAgainst]);
|
|
2484
2484
|
const currentHex = (0, import_color.pickerStateToHex)(pickerState, alpha);
|
|
2485
2485
|
const liveDescription = `Selected color: ${value}${contrastResult ? `, contrast ${contrastResult.ratio.toFixed(1)}:1 against ${contrastAgainst}, ${contrastResult.aa ? "passes AA" : "fails AA"}` : ""}`;
|
|
2486
|
-
return /* @__PURE__ */ (0,
|
|
2486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2487
2487
|
"div",
|
|
2488
2488
|
{
|
|
2489
2489
|
id: pickerId,
|
|
@@ -2507,7 +2507,7 @@ var ColorPicker = ({
|
|
|
2507
2507
|
pointerEvents: disabled ? "none" : "auto"
|
|
2508
2508
|
},
|
|
2509
2509
|
children: [
|
|
2510
|
-
/* @__PURE__ */ (0,
|
|
2510
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2511
2511
|
"span",
|
|
2512
2512
|
{
|
|
2513
2513
|
role: "status",
|
|
@@ -2526,7 +2526,7 @@ var ColorPicker = ({
|
|
|
2526
2526
|
children: liveDescription
|
|
2527
2527
|
}
|
|
2528
2528
|
),
|
|
2529
|
-
/* @__PURE__ */ (0,
|
|
2529
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2530
2530
|
"div",
|
|
2531
2531
|
{
|
|
2532
2532
|
role: "slider",
|
|
@@ -2548,7 +2548,7 @@ var ColorPicker = ({
|
|
|
2548
2548
|
touchAction: "none",
|
|
2549
2549
|
outline: "none"
|
|
2550
2550
|
},
|
|
2551
|
-
children: /* @__PURE__ */ (0,
|
|
2551
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2552
2552
|
"div",
|
|
2553
2553
|
{
|
|
2554
2554
|
style: {
|
|
@@ -2568,7 +2568,7 @@ var ColorPicker = ({
|
|
|
2568
2568
|
)
|
|
2569
2569
|
}
|
|
2570
2570
|
),
|
|
2571
|
-
/* @__PURE__ */ (0,
|
|
2571
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2572
2572
|
"div",
|
|
2573
2573
|
{
|
|
2574
2574
|
role: "slider",
|
|
@@ -2591,7 +2591,7 @@ var ColorPicker = ({
|
|
|
2591
2591
|
touchAction: "none",
|
|
2592
2592
|
outline: "none"
|
|
2593
2593
|
},
|
|
2594
|
-
children: /* @__PURE__ */ (0,
|
|
2594
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2595
2595
|
"div",
|
|
2596
2596
|
{
|
|
2597
2597
|
style: {
|
|
@@ -2611,7 +2611,7 @@ var ColorPicker = ({
|
|
|
2611
2611
|
)
|
|
2612
2612
|
}
|
|
2613
2613
|
),
|
|
2614
|
-
alpha && /* @__PURE__ */ (0,
|
|
2614
|
+
alpha && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2615
2615
|
"div",
|
|
2616
2616
|
{
|
|
2617
2617
|
role: "slider",
|
|
@@ -2637,7 +2637,7 @@ var ColorPicker = ({
|
|
|
2637
2637
|
overflow: "hidden"
|
|
2638
2638
|
},
|
|
2639
2639
|
children: [
|
|
2640
|
-
/* @__PURE__ */ (0,
|
|
2640
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2641
2641
|
"div",
|
|
2642
2642
|
{
|
|
2643
2643
|
style: {
|
|
@@ -2647,7 +2647,7 @@ var ColorPicker = ({
|
|
|
2647
2647
|
}
|
|
2648
2648
|
}
|
|
2649
2649
|
),
|
|
2650
|
-
/* @__PURE__ */ (0,
|
|
2650
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2651
2651
|
"div",
|
|
2652
2652
|
{
|
|
2653
2653
|
style: {
|
|
@@ -2668,8 +2668,8 @@ var ColorPicker = ({
|
|
|
2668
2668
|
]
|
|
2669
2669
|
}
|
|
2670
2670
|
),
|
|
2671
|
-
/* @__PURE__ */ (0,
|
|
2672
|
-
/* @__PURE__ */ (0,
|
|
2671
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
|
|
2672
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2673
2673
|
"div",
|
|
2674
2674
|
{
|
|
2675
2675
|
style: {
|
|
@@ -2683,7 +2683,7 @@ var ColorPicker = ({
|
|
|
2683
2683
|
flexShrink: 0,
|
|
2684
2684
|
border: "1px solid rgba(255,255,255,0.15)"
|
|
2685
2685
|
},
|
|
2686
|
-
children: /* @__PURE__ */ (0,
|
|
2686
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2687
2687
|
"div",
|
|
2688
2688
|
{
|
|
2689
2689
|
style: {
|
|
@@ -2695,7 +2695,7 @@ var ColorPicker = ({
|
|
|
2695
2695
|
)
|
|
2696
2696
|
}
|
|
2697
2697
|
),
|
|
2698
|
-
/* @__PURE__ */ (0,
|
|
2698
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2699
2699
|
"input",
|
|
2700
2700
|
{
|
|
2701
2701
|
type: "text",
|
|
@@ -2725,7 +2725,7 @@ var ColorPicker = ({
|
|
|
2725
2725
|
}
|
|
2726
2726
|
}
|
|
2727
2727
|
),
|
|
2728
|
-
hasEyeDropper && /* @__PURE__ */ (0,
|
|
2728
|
+
hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2729
2729
|
"button",
|
|
2730
2730
|
{
|
|
2731
2731
|
type: "button",
|
|
@@ -2745,7 +2745,7 @@ var ColorPicker = ({
|
|
|
2745
2745
|
color: "inherit",
|
|
2746
2746
|
cursor: disabled ? "default" : "pointer"
|
|
2747
2747
|
},
|
|
2748
|
-
children: /* @__PURE__ */ (0,
|
|
2748
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2749
2749
|
"svg",
|
|
2750
2750
|
{
|
|
2751
2751
|
width: "14",
|
|
@@ -2757,16 +2757,16 @@ var ColorPicker = ({
|
|
|
2757
2757
|
strokeLinecap: "round",
|
|
2758
2758
|
strokeLinejoin: "round",
|
|
2759
2759
|
children: [
|
|
2760
|
-
/* @__PURE__ */ (0,
|
|
2761
|
-
/* @__PURE__ */ (0,
|
|
2762
|
-
/* @__PURE__ */ (0,
|
|
2760
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "m19 11-8-8-8.5 8.5a2.12 2.12 0 0 0 0 3l2.5 2.5 1.5-1.5" }),
|
|
2761
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
|
|
2762
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "m14 6 4 4" })
|
|
2763
2763
|
]
|
|
2764
2764
|
}
|
|
2765
2765
|
)
|
|
2766
2766
|
}
|
|
2767
2767
|
)
|
|
2768
2768
|
] }),
|
|
2769
|
-
isClipped && /* @__PURE__ */ (0,
|
|
2769
|
+
isClipped && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2770
2770
|
"div",
|
|
2771
2771
|
{
|
|
2772
2772
|
role: "note",
|
|
@@ -2782,10 +2782,10 @@ var ColorPicker = ({
|
|
|
2782
2782
|
borderRadius: "4px",
|
|
2783
2783
|
alignSelf: "flex-start"
|
|
2784
2784
|
},
|
|
2785
|
-
children: /* @__PURE__ */ (0,
|
|
2785
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
|
|
2786
2786
|
}
|
|
2787
2787
|
),
|
|
2788
|
-
contrastResult && /* @__PURE__ */ (0,
|
|
2788
|
+
contrastResult && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2789
2789
|
"div",
|
|
2790
2790
|
{
|
|
2791
2791
|
style: {
|
|
@@ -2799,15 +2799,15 @@ var ColorPicker = ({
|
|
|
2799
2799
|
border: "1px solid rgba(255,255,255,0.1)"
|
|
2800
2800
|
},
|
|
2801
2801
|
children: [
|
|
2802
|
-
/* @__PURE__ */ (0,
|
|
2802
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
2803
2803
|
"Contrast: ",
|
|
2804
|
-
/* @__PURE__ */ (0,
|
|
2804
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("strong", { children: [
|
|
2805
2805
|
contrastResult.ratio.toFixed(2),
|
|
2806
2806
|
":1"
|
|
2807
2807
|
] })
|
|
2808
2808
|
] }),
|
|
2809
|
-
/* @__PURE__ */ (0,
|
|
2810
|
-
/* @__PURE__ */ (0,
|
|
2809
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
|
|
2810
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2811
2811
|
"span",
|
|
2812
2812
|
{
|
|
2813
2813
|
style: {
|
|
@@ -2820,7 +2820,7 @@ var ColorPicker = ({
|
|
|
2820
2820
|
]
|
|
2821
2821
|
}
|
|
2822
2822
|
),
|
|
2823
|
-
/* @__PURE__ */ (0,
|
|
2823
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2824
2824
|
"span",
|
|
2825
2825
|
{
|
|
2826
2826
|
style: {
|
|
@@ -2837,9 +2837,9 @@ var ColorPicker = ({
|
|
|
2837
2837
|
]
|
|
2838
2838
|
}
|
|
2839
2839
|
),
|
|
2840
|
-
swatches && swatches.length > 0 && /* @__PURE__ */ (0,
|
|
2841
|
-
/* @__PURE__ */ (0,
|
|
2842
|
-
/* @__PURE__ */ (0,
|
|
2840
|
+
swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
|
|
2841
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
|
|
2842
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2843
2843
|
"button",
|
|
2844
2844
|
{
|
|
2845
2845
|
type: "button",
|
|
@@ -2865,9 +2865,9 @@ var ColorPicker = ({
|
|
|
2865
2865
|
`${color}-${idx}`
|
|
2866
2866
|
)) })
|
|
2867
2867
|
] }),
|
|
2868
|
-
activeRecent.length > 0 && /* @__PURE__ */ (0,
|
|
2869
|
-
/* @__PURE__ */ (0,
|
|
2870
|
-
/* @__PURE__ */ (0,
|
|
2868
|
+
activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
|
|
2869
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
|
|
2870
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2871
2871
|
"button",
|
|
2872
2872
|
{
|
|
2873
2873
|
type: "button",
|
|
@@ -2898,9 +2898,9 @@ var ColorPicker = ({
|
|
|
2898
2898
|
};
|
|
2899
2899
|
|
|
2900
2900
|
// src/color/DualColorPicker.tsx
|
|
2901
|
-
var
|
|
2901
|
+
var import_react16 = require("react");
|
|
2902
2902
|
var import_color2 = require("@pixerate/editor/color");
|
|
2903
|
-
var
|
|
2903
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2904
2904
|
function DualColorPicker({
|
|
2905
2905
|
value,
|
|
2906
2906
|
onChange,
|
|
@@ -2915,8 +2915,8 @@ function DualColorPicker({
|
|
|
2915
2915
|
disabled = false,
|
|
2916
2916
|
className = ""
|
|
2917
2917
|
}) {
|
|
2918
|
-
const sameId = (0,
|
|
2919
|
-
const [internalScheme, setInternalScheme] = (0,
|
|
2918
|
+
const sameId = (0, import_react16.useId)();
|
|
2919
|
+
const [internalScheme, setInternalScheme] = (0, import_react16.useState)("light");
|
|
2920
2920
|
const activeScheme = controlledScheme ?? internalScheme;
|
|
2921
2921
|
const handleSchemeSelect = (nextScheme) => {
|
|
2922
2922
|
if (onSchemeChange) {
|
|
@@ -2927,7 +2927,7 @@ function DualColorPicker({
|
|
|
2927
2927
|
};
|
|
2928
2928
|
const dual = (0, import_color2.normalizeDualColor)(value) ?? { light: "#000000", dark: "#000000" };
|
|
2929
2929
|
const isSame = dual.light.toLowerCase() === dual.dark.toLowerCase();
|
|
2930
|
-
const [sameInBoth, setSameInBoth] = (0,
|
|
2930
|
+
const [sameInBoth, setSameInBoth] = (0, import_react16.useState)(isSame);
|
|
2931
2931
|
const handleSameToggle = (e) => {
|
|
2932
2932
|
const nextSame = e.target.checked;
|
|
2933
2933
|
setSameInBoth(nextSame);
|
|
@@ -2959,7 +2959,7 @@ function DualColorPicker({
|
|
|
2959
2959
|
const activeColor = activeScheme === "dark" ? dual.dark : dual.light;
|
|
2960
2960
|
const activeContrastTarget = contrastAgainst ? (0, import_color2.resolveColor)(contrastAgainst, activeScheme) ?? void 0 : void 0;
|
|
2961
2961
|
const dualContrast = contrastAgainst && (0, import_color2.normalizeDualColor)(contrastAgainst) ? (0, import_color2.checkDualColorContrast)(dual, contrastAgainst) : null;
|
|
2962
|
-
return /* @__PURE__ */ (0,
|
|
2962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2963
2963
|
"div",
|
|
2964
2964
|
{
|
|
2965
2965
|
className: `pixerate-dual-color-picker ${className}`,
|
|
@@ -2978,7 +2978,7 @@ function DualColorPicker({
|
|
|
2978
2978
|
boxSizing: "border-box"
|
|
2979
2979
|
},
|
|
2980
2980
|
children: [
|
|
2981
|
-
/* @__PURE__ */ (0,
|
|
2981
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2982
2982
|
"div",
|
|
2983
2983
|
{
|
|
2984
2984
|
role: "tablist",
|
|
@@ -2991,7 +2991,7 @@ function DualColorPicker({
|
|
|
2991
2991
|
gap: "2px"
|
|
2992
2992
|
},
|
|
2993
2993
|
children: [
|
|
2994
|
-
/* @__PURE__ */ (0,
|
|
2994
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2995
2995
|
"button",
|
|
2996
2996
|
{
|
|
2997
2997
|
type: "button",
|
|
@@ -3014,7 +3014,7 @@ function DualColorPicker({
|
|
|
3014
3014
|
children: "Light"
|
|
3015
3015
|
}
|
|
3016
3016
|
),
|
|
3017
|
-
/* @__PURE__ */ (0,
|
|
3017
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3018
3018
|
"button",
|
|
3019
3019
|
{
|
|
3020
3020
|
type: "button",
|
|
@@ -3040,8 +3040,8 @@ function DualColorPicker({
|
|
|
3040
3040
|
]
|
|
3041
3041
|
}
|
|
3042
3042
|
),
|
|
3043
|
-
/* @__PURE__ */ (0,
|
|
3044
|
-
/* @__PURE__ */ (0,
|
|
3043
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
|
|
3044
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
3045
3045
|
"button",
|
|
3046
3046
|
{
|
|
3047
3047
|
type: "button",
|
|
@@ -3063,7 +3063,7 @@ function DualColorPicker({
|
|
|
3063
3063
|
outline: "none"
|
|
3064
3064
|
},
|
|
3065
3065
|
children: [
|
|
3066
|
-
/* @__PURE__ */ (0,
|
|
3066
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3067
3067
|
"span",
|
|
3068
3068
|
{
|
|
3069
3069
|
style: {
|
|
@@ -3075,11 +3075,11 @@ function DualColorPicker({
|
|
|
3075
3075
|
}
|
|
3076
3076
|
}
|
|
3077
3077
|
),
|
|
3078
|
-
/* @__PURE__ */ (0,
|
|
3078
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
|
|
3079
3079
|
]
|
|
3080
3080
|
}
|
|
3081
3081
|
),
|
|
3082
|
-
/* @__PURE__ */ (0,
|
|
3082
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
3083
3083
|
"button",
|
|
3084
3084
|
{
|
|
3085
3085
|
type: "button",
|
|
@@ -3101,7 +3101,7 @@ function DualColorPicker({
|
|
|
3101
3101
|
outline: "none"
|
|
3102
3102
|
},
|
|
3103
3103
|
children: [
|
|
3104
|
-
/* @__PURE__ */ (0,
|
|
3104
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3105
3105
|
"span",
|
|
3106
3106
|
{
|
|
3107
3107
|
style: {
|
|
@@ -3113,12 +3113,12 @@ function DualColorPicker({
|
|
|
3113
3113
|
}
|
|
3114
3114
|
}
|
|
3115
3115
|
),
|
|
3116
|
-
/* @__PURE__ */ (0,
|
|
3116
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
|
|
3117
3117
|
]
|
|
3118
3118
|
}
|
|
3119
3119
|
)
|
|
3120
3120
|
] }),
|
|
3121
|
-
/* @__PURE__ */ (0,
|
|
3121
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
3122
3122
|
"div",
|
|
3123
3123
|
{
|
|
3124
3124
|
style: {
|
|
@@ -3129,7 +3129,7 @@ function DualColorPicker({
|
|
|
3129
3129
|
padding: "2px 0"
|
|
3130
3130
|
},
|
|
3131
3131
|
children: [
|
|
3132
|
-
/* @__PURE__ */ (0,
|
|
3132
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
3133
3133
|
"label",
|
|
3134
3134
|
{
|
|
3135
3135
|
htmlFor: sameId,
|
|
@@ -3143,7 +3143,7 @@ function DualColorPicker({
|
|
|
3143
3143
|
color: "#c4cad4"
|
|
3144
3144
|
},
|
|
3145
3145
|
children: [
|
|
3146
|
-
/* @__PURE__ */ (0,
|
|
3146
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3147
3147
|
"input",
|
|
3148
3148
|
{
|
|
3149
3149
|
id: sameId,
|
|
@@ -3154,11 +3154,11 @@ function DualColorPicker({
|
|
|
3154
3154
|
style: { cursor: disabled ? "not-allowed" : "pointer" }
|
|
3155
3155
|
}
|
|
3156
3156
|
),
|
|
3157
|
-
/* @__PURE__ */ (0,
|
|
3157
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: "Same in both" })
|
|
3158
3158
|
]
|
|
3159
3159
|
}
|
|
3160
3160
|
),
|
|
3161
|
-
/* @__PURE__ */ (0,
|
|
3161
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3162
3162
|
"button",
|
|
3163
3163
|
{
|
|
3164
3164
|
type: "button",
|
|
@@ -3180,7 +3180,7 @@ function DualColorPicker({
|
|
|
3180
3180
|
]
|
|
3181
3181
|
}
|
|
3182
3182
|
),
|
|
3183
|
-
dualContrast && /* @__PURE__ */ (0,
|
|
3183
|
+
dualContrast && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
3184
3184
|
"div",
|
|
3185
3185
|
{
|
|
3186
3186
|
"data-testid": "dual-contrast-summary",
|
|
@@ -3194,20 +3194,20 @@ function DualColorPicker({
|
|
|
3194
3194
|
color: "#8c95a6"
|
|
3195
3195
|
},
|
|
3196
3196
|
children: [
|
|
3197
|
-
/* @__PURE__ */ (0,
|
|
3197
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { children: [
|
|
3198
3198
|
"Light:",
|
|
3199
3199
|
" ",
|
|
3200
|
-
/* @__PURE__ */ (0,
|
|
3200
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
|
|
3201
3201
|
dualContrast.light.ratio.toFixed(2),
|
|
3202
3202
|
" (",
|
|
3203
3203
|
dualContrast.light.level,
|
|
3204
3204
|
")"
|
|
3205
3205
|
] })
|
|
3206
3206
|
] }),
|
|
3207
|
-
/* @__PURE__ */ (0,
|
|
3207
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { children: [
|
|
3208
3208
|
"Dark:",
|
|
3209
3209
|
" ",
|
|
3210
|
-
/* @__PURE__ */ (0,
|
|
3210
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
|
|
3211
3211
|
dualContrast.dark.ratio.toFixed(2),
|
|
3212
3212
|
" (",
|
|
3213
3213
|
dualContrast.dark.level,
|
|
@@ -3217,7 +3217,7 @@ function DualColorPicker({
|
|
|
3217
3217
|
]
|
|
3218
3218
|
}
|
|
3219
3219
|
),
|
|
3220
|
-
/* @__PURE__ */ (0,
|
|
3220
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3221
3221
|
ColorPicker,
|
|
3222
3222
|
{
|
|
3223
3223
|
value: activeColor,
|
|
@@ -3236,7 +3236,7 @@ function DualColorPicker({
|
|
|
3236
3236
|
}
|
|
3237
3237
|
|
|
3238
3238
|
// src/color/useColorScheme.ts
|
|
3239
|
-
var
|
|
3239
|
+
var import_react17 = require("react");
|
|
3240
3240
|
var import_color3 = require("@pixerate/editor/color");
|
|
3241
3241
|
function getSnapshot(attribute) {
|
|
3242
3242
|
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
@@ -3261,7 +3261,7 @@ function getServerSnapshot() {
|
|
|
3261
3261
|
function useColorScheme(options) {
|
|
3262
3262
|
const override = options?.override;
|
|
3263
3263
|
const attribute = options?.attribute;
|
|
3264
|
-
const subscribe = (0,
|
|
3264
|
+
const subscribe = (0, import_react17.useMemo)(() => {
|
|
3265
3265
|
return (callback) => {
|
|
3266
3266
|
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
3267
3267
|
return () => {
|
|
@@ -3287,7 +3287,7 @@ function useColorScheme(options) {
|
|
|
3287
3287
|
};
|
|
3288
3288
|
};
|
|
3289
3289
|
}, [attribute]);
|
|
3290
|
-
const detected = (0,
|
|
3290
|
+
const detected = (0, import_react17.useSyncExternalStore)(
|
|
3291
3291
|
subscribe,
|
|
3292
3292
|
() => getSnapshot(attribute),
|
|
3293
3293
|
getServerSnapshot
|
|
@@ -3304,7 +3304,7 @@ function useResolvedColor(value, scheme) {
|
|
|
3304
3304
|
__reExport(color_exports, require("@pixerate/editor/color"));
|
|
3305
3305
|
|
|
3306
3306
|
// src/parameters/fields.tsx
|
|
3307
|
-
var
|
|
3307
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
3308
3308
|
var parameterInputClass = "h-7 w-full min-w-0 rounded-md border border-input bg-background px-2 text-xs text-foreground tabular-nums focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50";
|
|
3309
3309
|
var parameterButtonClass = "inline-flex h-7 items-center justify-center gap-1 rounded-md border border-input bg-background px-2 text-xs text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:pointer-events-none disabled:opacity-50";
|
|
3310
3310
|
var rangeClass = "h-4 w-full min-w-0 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50";
|
|
@@ -3328,7 +3328,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
|
|
|
3328
3328
|
onKeyDown: keyDown,
|
|
3329
3329
|
...rest
|
|
3330
3330
|
};
|
|
3331
|
-
return multiline ? /* @__PURE__ */ (0,
|
|
3331
|
+
return multiline ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("textarea", { ...props, className: `${props.className} h-auto min-h-[3.5rem] py-1` }, value) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "text", ...props }, value);
|
|
3332
3332
|
}
|
|
3333
3333
|
var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
|
|
3334
3334
|
function ParameterNumberInput({
|
|
@@ -3339,8 +3339,8 @@ function ParameterNumberInput({
|
|
|
3339
3339
|
id,
|
|
3340
3340
|
"aria-label": ariaLabel
|
|
3341
3341
|
}) {
|
|
3342
|
-
return /* @__PURE__ */ (0,
|
|
3343
|
-
/* @__PURE__ */ (0,
|
|
3342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
|
|
3343
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3344
3344
|
ParameterCommitInput,
|
|
3345
3345
|
{
|
|
3346
3346
|
id,
|
|
@@ -3362,21 +3362,21 @@ function ParameterNumberInput({
|
|
|
3362
3362
|
}
|
|
3363
3363
|
}
|
|
3364
3364
|
),
|
|
3365
|
-
field.unit && /* @__PURE__ */ (0,
|
|
3365
|
+
field.unit && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
|
|
3366
3366
|
] });
|
|
3367
3367
|
}
|
|
3368
3368
|
function ParameterSlider(props) {
|
|
3369
3369
|
const { field, value, onChange, onGestureStart, onGestureEnd, disabled } = props;
|
|
3370
|
-
const dragging = (0,
|
|
3370
|
+
const dragging = (0, import_react18.useRef)(false);
|
|
3371
3371
|
const end = () => {
|
|
3372
3372
|
if (!dragging.current) return;
|
|
3373
3373
|
dragging.current = false;
|
|
3374
3374
|
onGestureEnd?.();
|
|
3375
3375
|
};
|
|
3376
|
-
if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0,
|
|
3376
|
+
if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterNumberInput, { ...props });
|
|
3377
3377
|
const step = (0, import_parameters.parameterStep)(field);
|
|
3378
|
-
return /* @__PURE__ */ (0,
|
|
3379
|
-
/* @__PURE__ */ (0,
|
|
3378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3379
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3380
3380
|
"input",
|
|
3381
3381
|
{
|
|
3382
3382
|
type: "range",
|
|
@@ -3399,11 +3399,11 @@ function ParameterSlider(props) {
|
|
|
3399
3399
|
onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
|
|
3400
3400
|
}
|
|
3401
3401
|
),
|
|
3402
|
-
/* @__PURE__ */ (0,
|
|
3402
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
|
|
3403
3403
|
] });
|
|
3404
3404
|
}
|
|
3405
3405
|
function ParameterToggle({ field, value, onChange, disabled, id }) {
|
|
3406
|
-
return /* @__PURE__ */ (0,
|
|
3406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3407
3407
|
"button",
|
|
3408
3408
|
{
|
|
3409
3409
|
type: "button",
|
|
@@ -3414,7 +3414,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
|
|
|
3414
3414
|
disabled: disabled || field.readOnly,
|
|
3415
3415
|
onClick: () => onChange(!value),
|
|
3416
3416
|
className: `relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:opacity-50 ${value ? "bg-primary" : "bg-muted"}`,
|
|
3417
|
-
children: /* @__PURE__ */ (0,
|
|
3417
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3418
3418
|
"span",
|
|
3419
3419
|
{
|
|
3420
3420
|
className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
|
|
@@ -3427,7 +3427,7 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
|
|
|
3427
3427
|
const options = (0, import_parameters.getChoiceOptions)(field);
|
|
3428
3428
|
const off = disabled || field.readOnly;
|
|
3429
3429
|
if (field.control === "segmented") {
|
|
3430
|
-
return /* @__PURE__ */ (0,
|
|
3430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { role: "radiogroup", "aria-label": (0, import_parameters.parameterLabel)(field), className: "inline-flex flex-wrap rounded-md border border-input bg-muted p-0.5", children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3431
3431
|
"button",
|
|
3432
3432
|
{
|
|
3433
3433
|
type: "button",
|
|
@@ -3443,7 +3443,7 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
|
|
|
3443
3443
|
)) });
|
|
3444
3444
|
}
|
|
3445
3445
|
const index = options.findIndex((o) => o.value === value);
|
|
3446
|
-
return /* @__PURE__ */ (0,
|
|
3446
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3447
3447
|
"select",
|
|
3448
3448
|
{
|
|
3449
3449
|
id,
|
|
@@ -3455,22 +3455,22 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
|
|
|
3455
3455
|
if (option) onChange(option.value);
|
|
3456
3456
|
},
|
|
3457
3457
|
className: parameterInputClass,
|
|
3458
|
-
children: options.map((o, i) => /* @__PURE__ */ (0,
|
|
3458
|
+
children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: String(i), title: o.description, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
|
|
3459
3459
|
}
|
|
3460
3460
|
);
|
|
3461
3461
|
}
|
|
3462
3462
|
function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id }) {
|
|
3463
|
-
const [open, setOpen] = (0,
|
|
3464
|
-
const containerRef = (0,
|
|
3465
|
-
const buttonRef = (0,
|
|
3466
|
-
const popoverRef = (0,
|
|
3463
|
+
const [open, setOpen] = (0, import_react18.useState)(false);
|
|
3464
|
+
const containerRef = (0, import_react18.useRef)(null);
|
|
3465
|
+
const buttonRef = (0, import_react18.useRef)(null);
|
|
3466
|
+
const popoverRef = (0, import_react18.useRef)(null);
|
|
3467
3467
|
const alpha = !!field.alpha;
|
|
3468
3468
|
const hex = (0, import_parameters.normalizeHexColor)(value, true) ?? "#000000ff";
|
|
3469
3469
|
const rgb = hex.slice(0, 7);
|
|
3470
3470
|
const shown = alpha ? hex : rgb;
|
|
3471
3471
|
const off = disabled || field.readOnly;
|
|
3472
3472
|
const name = (0, import_parameters.parameterLabel)(field);
|
|
3473
|
-
(0,
|
|
3473
|
+
(0, import_react18.useEffect)(() => {
|
|
3474
3474
|
if (!open) return;
|
|
3475
3475
|
const onPointerDown = (e) => {
|
|
3476
3476
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -3491,9 +3491,9 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3491
3491
|
window.removeEventListener("keydown", onKeyDown, true);
|
|
3492
3492
|
};
|
|
3493
3493
|
}, [open]);
|
|
3494
|
-
return /* @__PURE__ */ (0,
|
|
3495
|
-
/* @__PURE__ */ (0,
|
|
3496
|
-
/* @__PURE__ */ (0,
|
|
3494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
|
|
3495
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3496
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3497
3497
|
"button",
|
|
3498
3498
|
{
|
|
3499
3499
|
ref: buttonRef,
|
|
@@ -3504,10 +3504,10 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3504
3504
|
disabled: off,
|
|
3505
3505
|
onClick: () => setOpen((prev) => !prev),
|
|
3506
3506
|
className: "relative h-7 w-9 shrink-0 overflow-hidden rounded-md border border-input bg-[repeating-conic-gradient(#d4d4d8_0_25%,#fff_0_50%)] bg-[length:8px_8px] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50",
|
|
3507
|
-
children: /* @__PURE__ */ (0,
|
|
3507
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
|
|
3508
3508
|
}
|
|
3509
3509
|
),
|
|
3510
|
-
/* @__PURE__ */ (0,
|
|
3510
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3511
3511
|
ParameterCommitInput,
|
|
3512
3512
|
{
|
|
3513
3513
|
id,
|
|
@@ -3523,7 +3523,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3523
3523
|
}
|
|
3524
3524
|
)
|
|
3525
3525
|
] }),
|
|
3526
|
-
open && /* @__PURE__ */ (0,
|
|
3526
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3527
3527
|
"div",
|
|
3528
3528
|
{
|
|
3529
3529
|
ref: popoverRef,
|
|
@@ -3537,7 +3537,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3537
3537
|
},
|
|
3538
3538
|
className: "absolute left-0 top-full z-50 mt-1 w-64 rounded-lg border border-border bg-popover p-2 text-popover-foreground shadow-xl",
|
|
3539
3539
|
style: { background: "var(--popover, var(--background, #fff))" },
|
|
3540
|
-
children: /* @__PURE__ */ (0,
|
|
3540
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3541
3541
|
ColorPicker,
|
|
3542
3542
|
{
|
|
3543
3543
|
value: shown,
|
|
@@ -3555,11 +3555,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3555
3555
|
}
|
|
3556
3556
|
function ParameterVector({ field, value, onChange, disabled, id }) {
|
|
3557
3557
|
const size = (0, import_parameters.vectorSize)(field);
|
|
3558
|
-
return /* @__PURE__ */ (0,
|
|
3558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
|
|
3559
3559
|
const component = (0, import_parameters.vectorComponentField)(field, i);
|
|
3560
|
-
return /* @__PURE__ */ (0,
|
|
3561
|
-
/* @__PURE__ */ (0,
|
|
3562
|
-
/* @__PURE__ */ (0,
|
|
3560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
|
|
3561
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
|
|
3562
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3563
3563
|
ParameterNumberInput,
|
|
3564
3564
|
{
|
|
3565
3565
|
field: component,
|
|
@@ -3576,11 +3576,11 @@ function ParameterVector({ field, value, onChange, disabled, id }) {
|
|
|
3576
3576
|
function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
3577
3577
|
const off = disabled || field.readOnly;
|
|
3578
3578
|
const name = (0, import_parameters.parameterLabel)(field);
|
|
3579
|
-
return /* @__PURE__ */ (0,
|
|
3580
|
-
/* @__PURE__ */ (0,
|
|
3581
|
-
/* @__PURE__ */ (0,
|
|
3582
|
-
/* @__PURE__ */ (0,
|
|
3583
|
-
/* @__PURE__ */ (0,
|
|
3579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "space-y-1.5", children: [
|
|
3580
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3581
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex h-12 w-16 shrink-0 items-center justify-center overflow-hidden rounded-md border border-input bg-muted", children: value ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
|
|
3582
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
3583
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3584
3584
|
ParameterCommitInput,
|
|
3585
3585
|
{
|
|
3586
3586
|
id,
|
|
@@ -3591,10 +3591,10 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
3591
3591
|
onCommit: (text) => onChange(text.trim())
|
|
3592
3592
|
}
|
|
3593
3593
|
),
|
|
3594
|
-
/* @__PURE__ */ (0,
|
|
3595
|
-
resolveFile && /* @__PURE__ */ (0,
|
|
3594
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex gap-1", children: [
|
|
3595
|
+
resolveFile && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`, children: [
|
|
3596
3596
|
"Choose file\u2026",
|
|
3597
|
-
/* @__PURE__ */ (0,
|
|
3597
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3598
3598
|
"input",
|
|
3599
3599
|
{
|
|
3600
3600
|
type: "file",
|
|
@@ -3610,11 +3610,11 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
3610
3610
|
}
|
|
3611
3611
|
)
|
|
3612
3612
|
] }),
|
|
3613
|
-
value && /* @__PURE__ */ (0,
|
|
3613
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: parameterButtonClass, disabled: off, onClick: () => onChange(""), "aria-label": `Clear ${name}`, children: "Clear" })
|
|
3614
3614
|
] })
|
|
3615
3615
|
] })
|
|
3616
3616
|
] }),
|
|
3617
|
-
field.options && field.options.length > 0 && /* @__PURE__ */ (0,
|
|
3617
|
+
field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3618
3618
|
"button",
|
|
3619
3619
|
{
|
|
3620
3620
|
type: "button",
|
|
@@ -3624,14 +3624,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
3624
3624
|
disabled: off,
|
|
3625
3625
|
onClick: () => onChange(o.url),
|
|
3626
3626
|
className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
|
|
3627
|
-
children: /* @__PURE__ */ (0,
|
|
3627
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
|
|
3628
3628
|
},
|
|
3629
3629
|
o.url
|
|
3630
3630
|
)) })
|
|
3631
3631
|
] });
|
|
3632
3632
|
}
|
|
3633
3633
|
function ParameterText({ field, value, onChange, disabled, id }) {
|
|
3634
|
-
return /* @__PURE__ */ (0,
|
|
3634
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3635
3635
|
ParameterCommitInput,
|
|
3636
3636
|
{
|
|
3637
3637
|
id,
|
|
@@ -3650,24 +3650,24 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
|
|
|
3650
3650
|
switch (field.type) {
|
|
3651
3651
|
case "number":
|
|
3652
3652
|
case "int":
|
|
3653
|
-
return /* @__PURE__ */ (0,
|
|
3653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
|
|
3654
3654
|
case "boolean":
|
|
3655
|
-
return /* @__PURE__ */ (0,
|
|
3655
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
|
|
3656
3656
|
case "choice":
|
|
3657
|
-
return /* @__PURE__ */ (0,
|
|
3657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
|
|
3658
3658
|
case "color":
|
|
3659
|
-
return /* @__PURE__ */ (0,
|
|
3659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
|
|
3660
3660
|
case "vector":
|
|
3661
|
-
return /* @__PURE__ */ (0,
|
|
3661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
|
|
3662
3662
|
case "image":
|
|
3663
|
-
return /* @__PURE__ */ (0,
|
|
3663
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
|
|
3664
3664
|
case "text":
|
|
3665
|
-
return /* @__PURE__ */ (0,
|
|
3665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterText, { field, value, onChange: set, ...rest });
|
|
3666
3666
|
}
|
|
3667
3667
|
}
|
|
3668
3668
|
|
|
3669
3669
|
// src/effects/EffectParameters.tsx
|
|
3670
|
-
var
|
|
3670
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3671
3671
|
function EffectParameters({
|
|
3672
3672
|
description,
|
|
3673
3673
|
values,
|
|
@@ -3681,12 +3681,12 @@ function EffectParameters({
|
|
|
3681
3681
|
disabled = false,
|
|
3682
3682
|
className = ""
|
|
3683
3683
|
}) {
|
|
3684
|
-
const fields = (0,
|
|
3685
|
-
const idBase = (0,
|
|
3686
|
-
const gesture =
|
|
3687
|
-
const count =
|
|
3688
|
-
return /* @__PURE__ */ (0,
|
|
3689
|
-
(onPreset || onPresetName) && description.presets.length > 0 && /* @__PURE__ */ (0,
|
|
3684
|
+
const fields = (0, import_react19.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
|
|
3685
|
+
const idBase = (0, import_react19.useId)();
|
|
3686
|
+
const gesture = import_react19.default.useRef(null);
|
|
3687
|
+
const count = import_react19.default.useRef(0);
|
|
3688
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
|
|
3689
|
+
(onPreset || onPresetName) && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3690
3690
|
"select",
|
|
3691
3691
|
{
|
|
3692
3692
|
className: "w-full rounded border border-border bg-transparent px-1 py-0.5 text-xs",
|
|
@@ -3704,8 +3704,8 @@ function EffectParameters({
|
|
|
3704
3704
|
}
|
|
3705
3705
|
},
|
|
3706
3706
|
children: [
|
|
3707
|
-
/* @__PURE__ */ (0,
|
|
3708
|
-
description.presets.map((p) => /* @__PURE__ */ (0,
|
|
3707
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", children: "Presets\u2026" }),
|
|
3708
|
+
description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: p.name, children: p.name }, p.name))
|
|
3709
3709
|
]
|
|
3710
3710
|
}
|
|
3711
3711
|
),
|
|
@@ -3715,14 +3715,14 @@ function EffectParameters({
|
|
|
3715
3715
|
const keyed = keyframed?.has(field.id) ?? false;
|
|
3716
3716
|
const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
|
|
3717
3717
|
const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
|
|
3718
|
-
return /* @__PURE__ */ (0,
|
|
3719
|
-
/* @__PURE__ */ (0,
|
|
3720
|
-
/* @__PURE__ */ (0,
|
|
3721
|
-
keyed && /* @__PURE__ */ (0,
|
|
3718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
|
|
3719
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
3720
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
|
|
3721
|
+
keyed && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
|
|
3722
3722
|
renderControlAddon?.(field.id),
|
|
3723
|
-
onReset && changed && !disabled && /* @__PURE__ */ (0,
|
|
3723
|
+
onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: "rounded px-1 text-[11px] text-muted-foreground hover:text-foreground", "aria-label": `Reset ${label}`, onClick: () => onReset(field.id), children: "\u21BA" })
|
|
3724
3724
|
] }),
|
|
3725
|
-
/* @__PURE__ */ (0,
|
|
3725
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3726
3726
|
ParameterFieldControl,
|
|
3727
3727
|
{
|
|
3728
3728
|
field,
|
|
@@ -3736,34 +3736,34 @@ function EffectParameters({
|
|
|
3736
3736
|
)
|
|
3737
3737
|
] }, field.id);
|
|
3738
3738
|
}),
|
|
3739
|
-
!fields.length && /* @__PURE__ */ (0,
|
|
3739
|
+
!fields.length && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
|
|
3740
3740
|
] });
|
|
3741
3741
|
}
|
|
3742
3742
|
|
|
3743
3743
|
// src/image-editor/ImageEffectControls.tsx
|
|
3744
|
-
var
|
|
3744
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3745
3745
|
function ImageEffectControls({ provider, effect, name, values, onChange, onPreset, className }) {
|
|
3746
3746
|
const { description, error } = useEffectDescription(provider, effect);
|
|
3747
3747
|
let body;
|
|
3748
|
-
if (!provider) body = /* @__PURE__ */ (0,
|
|
3748
|
+
if (!provider) body = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
3749
3749
|
'No effects provider: "',
|
|
3750
3750
|
name ?? effect,
|
|
3751
3751
|
'" is kept but not drawn.'
|
|
3752
3752
|
] });
|
|
3753
|
-
else if (error) body = /* @__PURE__ */ (0,
|
|
3754
|
-
else if (!description) body = /* @__PURE__ */ (0,
|
|
3755
|
-
else body = /* @__PURE__ */ (0,
|
|
3756
|
-
return /* @__PURE__ */ (0,
|
|
3753
|
+
else if (error) body = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-amber-600", children: error });
|
|
3754
|
+
else if (!description) body = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
|
|
3755
|
+
else body = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(EffectParameters, { description, values, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
|
|
3756
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className, "data-testid": "image-effect-controls", children: body });
|
|
3757
3757
|
}
|
|
3758
3758
|
|
|
3759
3759
|
// src/image-editor/ImageProviderEffectsPanel.tsx
|
|
3760
|
-
var
|
|
3760
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3761
3761
|
function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
3762
|
-
const [, setTick] = (0,
|
|
3763
|
-
(0,
|
|
3764
|
-
const [browse, setBrowse] = (0,
|
|
3765
|
-
const [message, setMessage] = (0,
|
|
3766
|
-
const [open, setOpen] = (0,
|
|
3762
|
+
const [, setTick] = (0, import_react20.useState)(0);
|
|
3763
|
+
(0, import_react20.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
3764
|
+
const [browse, setBrowse] = (0, import_react20.useState)(null);
|
|
3765
|
+
const [message, setMessage] = (0, import_react20.useState)(null);
|
|
3766
|
+
const [open, setOpen] = (0, import_react20.useState)(null);
|
|
3767
3767
|
const provider = controller.effectsProvider;
|
|
3768
3768
|
const state = controller.getState();
|
|
3769
3769
|
const layer = state.activeLayerId ? (0, import_image_editor9.findLayer)(state.layers, state.activeLayerId)?.layer ?? null : null;
|
|
@@ -3771,7 +3771,7 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
3771
3771
|
setMessage(null);
|
|
3772
3772
|
Promise.resolve().then(work).catch((e) => setMessage(e instanceof Error ? e.message : String(e)));
|
|
3773
3773
|
};
|
|
3774
|
-
const drags =
|
|
3774
|
+
const drags = import_react20.default.useRef(/* @__PURE__ */ new Set());
|
|
3775
3775
|
const commit = (gesture) => {
|
|
3776
3776
|
if (gesture) {
|
|
3777
3777
|
if (!drags.current.has(gesture)) {
|
|
@@ -3785,21 +3785,21 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
3785
3785
|
const filters = layer?.type === "smart" ? (layer.smartFilters?.filters ?? []).filter((f) => f.kind === "effect") : [];
|
|
3786
3786
|
const generator = layer?.type === "pixel" ? layer.generator : void 0;
|
|
3787
3787
|
const canFilter = !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
|
|
3788
|
-
return /* @__PURE__ */ (0,
|
|
3789
|
-
/* @__PURE__ */ (0,
|
|
3790
|
-
/* @__PURE__ */ (0,
|
|
3791
|
-
/* @__PURE__ */ (0,
|
|
3792
|
-
/* @__PURE__ */ (0,
|
|
3788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Provider effects", "data-image-provider-effects": "", children: [
|
|
3789
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
3790
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Effects" }),
|
|
3791
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider || !canFilter, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Apply effect\u2026" }),
|
|
3792
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => setBrowse(browse === "layer" ? null : "layer"), children: "Effect layer\u2026" })
|
|
3793
3793
|
] }),
|
|
3794
|
-
!provider && /* @__PURE__ */ (0,
|
|
3795
|
-
browse === "filter" && layer && /* @__PURE__ */ (0,
|
|
3796
|
-
browse === "layer" && /* @__PURE__ */ (0,
|
|
3797
|
-
generator && layer && /* @__PURE__ */ (0,
|
|
3798
|
-
/* @__PURE__ */ (0,
|
|
3799
|
-
/* @__PURE__ */ (0,
|
|
3800
|
-
/* @__PURE__ */ (0,
|
|
3794
|
+
!provider && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the document are kept." }),
|
|
3795
|
+
browse === "filter" && layer && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id))) }),
|
|
3796
|
+
browse === "layer" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(EffectsBrowser, { provider, uses: ["generator", "overlay", "title"], title: "Generators and overlays", onPick: (e) => (setBrowse(null), run(() => controller.addEffectLayer(e.id))) }),
|
|
3797
|
+
generator && layer && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "space-y-1", "data-effect-part": "generator", children: [
|
|
3798
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
3799
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "flex-1 font-medium text-foreground", children: generator.name ?? generator.effect }),
|
|
3800
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: imageOutlineButtonClass, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
|
|
3801
3801
|
] }),
|
|
3802
|
-
/* @__PURE__ */ (0,
|
|
3802
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3803
3803
|
ImageEffectControls,
|
|
3804
3804
|
{
|
|
3805
3805
|
provider,
|
|
@@ -3811,26 +3811,26 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
3811
3811
|
}
|
|
3812
3812
|
)
|
|
3813
3813
|
] }),
|
|
3814
|
-
filters.length > 0 && layer && /* @__PURE__ */ (0,
|
|
3814
|
+
filters.length > 0 && layer && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("ol", { className: "space-y-1", "data-effect-part": "filters", children: filters.map((f) => {
|
|
3815
3815
|
const label = f.kind === "effect" ? f.name ?? f.effect : f.kind;
|
|
3816
3816
|
const all = layer.smartFilters.filters;
|
|
3817
3817
|
const index = all.indexOf(f);
|
|
3818
3818
|
if (f.kind !== "effect") return null;
|
|
3819
|
-
return /* @__PURE__ */ (0,
|
|
3820
|
-
/* @__PURE__ */ (0,
|
|
3821
|
-
/* @__PURE__ */ (0,
|
|
3819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("li", { className: "rounded border border-border p-1", "data-smart-effect": f.id, children: [
|
|
3820
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
3821
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "checkbox", checked: f.enabled, "aria-label": `${label} on`, onChange: (e) => {
|
|
3822
3822
|
const enabled = e.currentTarget.checked;
|
|
3823
3823
|
run(() => controller.updateEffectFilter(layer.id, f.id, { enabled }));
|
|
3824
3824
|
} }),
|
|
3825
|
-
/* @__PURE__ */ (0,
|
|
3826
|
-
/* @__PURE__ */ (0,
|
|
3827
|
-
/* @__PURE__ */ (0,
|
|
3828
|
-
/* @__PURE__ */ (0,
|
|
3825
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: "min-w-0 flex-1 truncate text-left text-foreground", "aria-expanded": open === f.id, onClick: () => setOpen(open === f.id ? null : f.id), children: label }),
|
|
3826
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: index === all.length - 1, "aria-label": "Move up", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index + 1 })), children: "\u2191" }),
|
|
3827
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: index === 0, "aria-label": "Move down", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index - 1 })), children: "\u2193" }),
|
|
3828
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: imageOutlineButtonClass, "aria-label": `Remove ${label}`, onClick: () => run(() => controller.removeSmartFilter(layer.id, f.id)), children: "\u2715" })
|
|
3829
3829
|
] }),
|
|
3830
|
-
open === f.id && /* @__PURE__ */ (0,
|
|
3831
|
-
/* @__PURE__ */ (0,
|
|
3832
|
-
/* @__PURE__ */ (0,
|
|
3833
|
-
/* @__PURE__ */ (0,
|
|
3830
|
+
open === f.id && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "mt-1 space-y-2", children: [
|
|
3831
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
3832
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "w-14 text-[11px] text-foreground", children: "Opacity" }),
|
|
3833
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3834
3834
|
"input",
|
|
3835
3835
|
{
|
|
3836
3836
|
type: "range",
|
|
@@ -3847,7 +3847,7 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
3847
3847
|
}
|
|
3848
3848
|
)
|
|
3849
3849
|
] }),
|
|
3850
|
-
/* @__PURE__ */ (0,
|
|
3850
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3851
3851
|
ImageEffectControls,
|
|
3852
3852
|
{
|
|
3853
3853
|
provider,
|
|
@@ -3861,13 +3861,13 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
3861
3861
|
] })
|
|
3862
3862
|
] }, f.id);
|
|
3863
3863
|
}) }),
|
|
3864
|
-
!layer && /* @__PURE__ */ (0,
|
|
3865
|
-
message && /* @__PURE__ */ (0,
|
|
3864
|
+
!layer && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
|
|
3865
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
3866
3866
|
] });
|
|
3867
3867
|
}
|
|
3868
3868
|
|
|
3869
3869
|
// src/image-editor/BrushOptionsBar.tsx
|
|
3870
|
-
var
|
|
3870
|
+
var import_react22 = require("react");
|
|
3871
3871
|
var import_image_editor11 = require("@pixerate/editor/image-editor");
|
|
3872
3872
|
var import_image_editor12 = require("@pixerate/editor/image-editor");
|
|
3873
3873
|
|
|
@@ -3875,8 +3875,8 @@ var import_image_editor12 = require("@pixerate/editor/image-editor");
|
|
|
3875
3875
|
var import_image_editor10 = require("@pixerate/editor/image-editor");
|
|
3876
3876
|
|
|
3877
3877
|
// src/paint-editor/PaintGradientEditorView.tsx
|
|
3878
|
-
var
|
|
3879
|
-
var
|
|
3878
|
+
var import_react21 = require("react");
|
|
3879
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3880
3880
|
var button = "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700 disabled:opacity-40";
|
|
3881
3881
|
var select = "rounded bg-slate-800 px-1 py-0.5 text-[11px]";
|
|
3882
3882
|
var number = "w-16 rounded bg-slate-800 px-1 py-0.5 text-[11px]";
|
|
@@ -3897,7 +3897,7 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
|
|
|
3897
3897
|
reversePaintGradient,
|
|
3898
3898
|
updatePaintGradientStop
|
|
3899
3899
|
} = kit;
|
|
3900
|
-
const [selected, setSelected] = (0,
|
|
3900
|
+
const [selected, setSelected] = (0, import_react21.useState)(0);
|
|
3901
3901
|
const sel = Math.min(selected, value.stops.length - 1);
|
|
3902
3902
|
const stop = value.stops[sel];
|
|
3903
3903
|
const map = value.map;
|
|
@@ -3907,15 +3907,15 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
|
|
|
3907
3907
|
setSelected(r.index);
|
|
3908
3908
|
onChange(r.paint);
|
|
3909
3909
|
};
|
|
3910
|
-
return /* @__PURE__ */ (0,
|
|
3911
|
-
/* @__PURE__ */ (0,
|
|
3912
|
-
/* @__PURE__ */ (0,
|
|
3913
|
-
/* @__PURE__ */ (0,
|
|
3914
|
-
PAINT_GRADIENT_PRESETS.map((p, i) => /* @__PURE__ */ (0,
|
|
3910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "paint-gradient-editor", "aria-label": "Gradient paint", children: [
|
|
3911
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
3912
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("select", { "aria-label": "Gradient preset", className: select, value: "", onChange: (e) => e.target.value && (setSelected(0), onChange(PAINT_GRADIENT_PRESETS[Number(e.target.value)].paint)), children: [
|
|
3913
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "", children: "Presets\u2026" }),
|
|
3914
|
+
PAINT_GRADIENT_PRESETS.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: i, children: p.name }, p.name))
|
|
3915
3915
|
] }),
|
|
3916
|
-
/* @__PURE__ */ (0,
|
|
3916
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, onClick: () => onChange(reversePaintGradient(value)), children: "Reverse" })
|
|
3917
3917
|
] }),
|
|
3918
|
-
/* @__PURE__ */ (0,
|
|
3918
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3919
3919
|
"div",
|
|
3920
3920
|
{
|
|
3921
3921
|
role: "slider",
|
|
@@ -3937,7 +3937,7 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
|
|
|
3937
3937
|
}
|
|
3938
3938
|
}
|
|
3939
3939
|
),
|
|
3940
|
-
/* @__PURE__ */ (0,
|
|
3940
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "relative h-4", "aria-label": "Stops", children: value.stops.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3941
3941
|
"button",
|
|
3942
3942
|
{
|
|
3943
3943
|
type: "button",
|
|
@@ -3949,63 +3949,63 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
|
|
|
3949
3949
|
},
|
|
3950
3950
|
i
|
|
3951
3951
|
)) }),
|
|
3952
|
-
/* @__PURE__ */ (0,
|
|
3953
|
-
/* @__PURE__ */ (0,
|
|
3954
|
-
/* @__PURE__ */ (0,
|
|
3955
|
-
/* @__PURE__ */ (0,
|
|
3956
|
-
/* @__PURE__ */ (0,
|
|
3952
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-stop", children: [
|
|
3953
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("select", { "aria-label": "Stop colour source", className: select, value: stop.color === "paint" || stop.color === "secondary" ? stop.color : "color", onChange: (e) => patchStop({ color: e.target.value === "color" ? stopHex(stop.color) : e.target.value }), children: [
|
|
3954
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "color", children: "Colour" }),
|
|
3955
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "paint", children: "Paint colour" }),
|
|
3956
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "secondary", children: "Second colour" })
|
|
3957
3957
|
] }),
|
|
3958
|
-
stop.color !== "paint" && stop.color !== "secondary" && /* @__PURE__ */ (0,
|
|
3959
|
-
/* @__PURE__ */ (0,
|
|
3958
|
+
stop.color !== "paint" && stop.color !== "secondary" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "color", "aria-label": "Stop colour", value: stop.color, onChange: (e) => patchStop({ color: e.target.value }), className: "h-6 w-8 rounded bg-transparent" }),
|
|
3959
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
3960
3960
|
"At",
|
|
3961
|
-
/* @__PURE__ */ (0,
|
|
3961
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "number", "aria-label": "Stop position", min: 0, max: 100, step: 1, value: pct(stop.offset), onChange: (e) => patchStop({ offset: Number(e.target.value) / 100 }), className: number }),
|
|
3962
3962
|
"%"
|
|
3963
3963
|
] }),
|
|
3964
|
-
/* @__PURE__ */ (0,
|
|
3964
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
3965
3965
|
"Opacity",
|
|
3966
|
-
/* @__PURE__ */ (0,
|
|
3966
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "number", "aria-label": "Stop opacity", min: 0, max: 100, step: 5, value: pct(stop.opacity ?? 1), onChange: (e) => patchStop({ opacity: Number(e.target.value) / 100 }), className: number }),
|
|
3967
3967
|
"%"
|
|
3968
3968
|
] }),
|
|
3969
|
-
sel < value.stops.length - 1 && /* @__PURE__ */ (0,
|
|
3969
|
+
sel < value.stops.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
3970
3970
|
"Midpoint",
|
|
3971
|
-
/* @__PURE__ */ (0,
|
|
3971
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "number", "aria-label": "Stop midpoint", min: 5, max: 95, step: 1, value: pct(stop.midpoint ?? 0.5), onChange: (e) => patchStop({ midpoint: Number(e.target.value) / 100 }), className: number }),
|
|
3972
3972
|
"%"
|
|
3973
3973
|
] }),
|
|
3974
|
-
/* @__PURE__ */ (0,
|
|
3974
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, disabled: value.stops.length <= 2, onClick: () => (setSelected(Math.max(0, sel - 1)), onChange(removePaintGradientStop(value, sel))), children: "Remove stop" })
|
|
3975
3975
|
] }),
|
|
3976
|
-
/* @__PURE__ */ (0,
|
|
3977
|
-
/* @__PURE__ */ (0,
|
|
3978
|
-
map.by === "distance" && /* @__PURE__ */ (0,
|
|
3979
|
-
/* @__PURE__ */ (0,
|
|
3980
|
-
/* @__PURE__ */ (0,
|
|
3981
|
-
/* @__PURE__ */ (0,
|
|
3982
|
-
/* @__PURE__ */ (0,
|
|
3976
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-mapping", children: [
|
|
3977
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("select", { "aria-label": "Gradient follows", className: select, value: map.by, onChange: (e) => onChange({ ...value, map: paintGradientMappingFor(e.target.value, map) }), children: PAINT_GRADIENT_MAPPINGS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: m, children: PAINT_GRADIENT_MAPPING_LABELS[m] }, m)) }),
|
|
3978
|
+
map.by === "distance" && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
3979
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "number", "aria-label": "Gradient length", min: 1, max: 1e5, value: map.length, onChange: (e) => onChange({ ...value, map: { ...map, length: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
|
|
3980
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("select", { "aria-label": "Gradient length unit", className: select, value: map.unit ?? "px", onChange: (e) => onChange({ ...value, map: { ...map, unit: e.target.value } }), children: [
|
|
3981
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "px", children: "px" }),
|
|
3982
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "dabs", children: "dabs" })
|
|
3983
3983
|
] })
|
|
3984
3984
|
] }),
|
|
3985
|
-
map.by === "time" && /* @__PURE__ */ (0,
|
|
3986
|
-
map.by === "random" && /* @__PURE__ */ (0,
|
|
3987
|
-
(map.by === "distance" || map.by === "time") && /* @__PURE__ */ (0,
|
|
3985
|
+
map.by === "time" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "number", "aria-label": "Gradient duration", min: 1, max: 6e5, value: map.duration, onChange: (e) => onChange({ ...value, map: { ...map, duration: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
|
|
3986
|
+
map.by === "random" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "number", "aria-label": "Dabs per pick", min: 1, max: 500, value: map.every ?? 1, onChange: (e) => onChange({ ...value, map: { ...map, every: Math.max(1, Math.round(Number(e.target.value) || 1)) } }), className: number }),
|
|
3987
|
+
(map.by === "distance" || map.by === "time") && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("select", { "aria-label": "Gradient repeat", className: select, value: map.repeat ?? "clamp", onChange: (e) => onChange({ ...value, map: { ...map, repeat: e.target.value } }), children: PAINT_GRADIENT_REPEATS.map((r) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: r, children: PAINT_GRADIENT_REPEAT_LABELS[r] }, r)) })
|
|
3988
3988
|
] }),
|
|
3989
|
-
/* @__PURE__ */ (0,
|
|
3990
|
-
/* @__PURE__ */ (0,
|
|
3991
|
-
/* @__PURE__ */ (0,
|
|
3989
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
3990
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("select", { "aria-label": "Gradient mixing", className: select, value: value.space, onChange: (e) => onChange({ ...value, space: e.target.value }), children: PAINT_GRADIENT_SPACES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: s, children: PAINT_GRADIENT_SPACE_LABELS[s] }, s)) }),
|
|
3991
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex flex-1 items-center gap-1", children: [
|
|
3992
3992
|
"Softness",
|
|
3993
|
-
/* @__PURE__ */ (0,
|
|
3993
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "range", "aria-label": "Gradient softness", min: 0, max: 1, step: 0.05, value: value.softness ?? 1, onChange: (e) => onChange({ ...value, softness: Number(e.target.value) }), className: "flex-1 accent-indigo-500" })
|
|
3994
3994
|
] })
|
|
3995
3995
|
] })
|
|
3996
3996
|
] });
|
|
3997
3997
|
};
|
|
3998
3998
|
|
|
3999
3999
|
// src/image-editor/PaintGradientEditor.tsx
|
|
4000
|
-
var
|
|
4001
|
-
var PaintGradientEditor = (props) => /* @__PURE__ */ (0,
|
|
4000
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
4001
|
+
var PaintGradientEditor = (props) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PaintGradientEditorView, { ...props, kit: import_image_editor10.PAINT_GRADIENT_KIT });
|
|
4002
4002
|
|
|
4003
4003
|
// src/image-editor/BrushOptionsBar.tsx
|
|
4004
|
-
var
|
|
4004
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
4005
4005
|
var BrushOptionsBar = ({ controller, className }) => {
|
|
4006
|
-
const [, setTick] = (0,
|
|
4007
|
-
(0,
|
|
4008
|
-
const [error, setError] = (0,
|
|
4006
|
+
const [, setTick] = (0, import_react22.useState)(0);
|
|
4007
|
+
(0, import_react22.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4008
|
+
const [error, setError] = (0, import_react22.useState)(null);
|
|
4009
4009
|
const state = controller.getState();
|
|
4010
4010
|
const { brush, foreground, background, mixer, mixerLoad, retouch, cloneSource, paint } = state.paint;
|
|
4011
4011
|
const tool = state.activeTool;
|
|
@@ -4017,8 +4017,8 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4017
4017
|
setError((0, import_image_editor12.userErrorMessage)(err));
|
|
4018
4018
|
}
|
|
4019
4019
|
};
|
|
4020
|
-
return /* @__PURE__ */ (0,
|
|
4021
|
-
/* @__PURE__ */ (0,
|
|
4020
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "brush-options", children: [
|
|
4021
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: import_image_editor11.PAINT_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4022
4022
|
"button",
|
|
4023
4023
|
{
|
|
4024
4024
|
type: "button",
|
|
@@ -4030,9 +4030,9 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4030
4030
|
},
|
|
4031
4031
|
t.id
|
|
4032
4032
|
)) }),
|
|
4033
|
-
/* @__PURE__ */ (0,
|
|
4034
|
-
/* @__PURE__ */ (0,
|
|
4035
|
-
/* @__PURE__ */ (0,
|
|
4033
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", role: "group", "aria-label": "Colours", children: [
|
|
4034
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4035
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4036
4036
|
"input",
|
|
4037
4037
|
{
|
|
4038
4038
|
type: "color",
|
|
@@ -4042,10 +4042,10 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4042
4042
|
className: imageColorInputClass
|
|
4043
4043
|
}
|
|
4044
4044
|
),
|
|
4045
|
-
/* @__PURE__ */ (0,
|
|
4045
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: "FG" })
|
|
4046
4046
|
] }),
|
|
4047
|
-
/* @__PURE__ */ (0,
|
|
4048
|
-
/* @__PURE__ */ (0,
|
|
4047
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4048
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4049
4049
|
"input",
|
|
4050
4050
|
{
|
|
4051
4051
|
type: "color",
|
|
@@ -4055,11 +4055,11 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4055
4055
|
className: imageColorInputClass
|
|
4056
4056
|
}
|
|
4057
4057
|
),
|
|
4058
|
-
/* @__PURE__ */ (0,
|
|
4058
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: "BG" })
|
|
4059
4059
|
] }),
|
|
4060
|
-
/* @__PURE__ */ (0,
|
|
4061
|
-
/* @__PURE__ */ (0,
|
|
4062
|
-
state.activeTool === "brush" && /* @__PURE__ */ (0,
|
|
4060
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", title: "Swap colours (X)", className: imageChipClass(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
|
|
4061
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", title: "Default colours (D)", className: imageChipClass(false), onClick: () => controller.resetPaintColors(), children: "Default" }),
|
|
4062
|
+
state.activeTool === "brush" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4063
4063
|
"button",
|
|
4064
4064
|
{
|
|
4065
4065
|
type: "button",
|
|
@@ -4071,8 +4071,8 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4071
4071
|
}
|
|
4072
4072
|
)
|
|
4073
4073
|
] }),
|
|
4074
|
-
state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */ (0,
|
|
4075
|
-
import_image_editor11.BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0,
|
|
4074
|
+
state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PaintGradientEditor, { value: paint, colors: { paint: foreground, secondary: background }, onChange: (g) => attempt(() => controller.setPaintOptions({ paint: g })) }),
|
|
4075
|
+
import_image_editor11.BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4076
4076
|
ControlSlider,
|
|
4077
4077
|
{
|
|
4078
4078
|
spec,
|
|
@@ -4081,9 +4081,9 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4081
4081
|
},
|
|
4082
4082
|
spec.id
|
|
4083
4083
|
)),
|
|
4084
|
-
state.activeTool === "mixer" && /* @__PURE__ */ (0,
|
|
4085
|
-
/* @__PURE__ */ (0,
|
|
4086
|
-
/* @__PURE__ */ (0,
|
|
4084
|
+
state.activeTool === "mixer" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Mixer Brush", "data-testid": "mixer-options", children: [
|
|
4085
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4086
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4087
4087
|
"span",
|
|
4088
4088
|
{
|
|
4089
4089
|
"aria-label": "Brush load",
|
|
@@ -4092,10 +4092,10 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4092
4092
|
style: { background: mixerLoad.reservoir ? (0, import_image_editor11.rgbUnitToHex)(mixerLoad.reservoir) : "transparent" }
|
|
4093
4093
|
}
|
|
4094
4094
|
),
|
|
4095
|
-
/* @__PURE__ */ (0,
|
|
4096
|
-
/* @__PURE__ */ (0,
|
|
4095
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", title: "Fill the reservoir with the foreground colour", className: imageChipClass(false), onClick: () => controller.loadMixerBrush(), children: "Load brush" }),
|
|
4096
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", title: "Empty the picked-up colour", className: imageChipClass(false), onClick: () => controller.cleanMixerBrush(), children: "Clean brush" })
|
|
4097
4097
|
] }),
|
|
4098
|
-
/* @__PURE__ */ (0,
|
|
4098
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children: import_image_editor11.MIXER_MIXING_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4099
4099
|
"button",
|
|
4100
4100
|
{
|
|
4101
4101
|
type: "button",
|
|
@@ -4107,52 +4107,34 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4107
4107
|
},
|
|
4108
4108
|
m.id
|
|
4109
4109
|
)) }),
|
|
4110
|
-
import_image_editor11.MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0,
|
|
4111
|
-
/* @__PURE__ */ (0,
|
|
4112
|
-
/* @__PURE__ */ (0,
|
|
4113
|
-
/* @__PURE__ */ (0,
|
|
4114
|
-
"input",
|
|
4115
|
-
{
|
|
4116
|
-
type: "checkbox",
|
|
4117
|
-
"aria-label": "Load the brush after each stroke",
|
|
4118
|
-
checked: mixer.loadEachStroke,
|
|
4119
|
-
onChange: (e) => controller.setPaintOptions({ mixer: { loadEachStroke: e.target.checked } }),
|
|
4120
|
-
className: "accent-primary"
|
|
4121
|
-
}
|
|
4122
|
-
),
|
|
4110
|
+
import_image_editor11.MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ControlSlider, { spec, value: mixer[spec.id], onChange: (v) => controller.setPaintOptions({ mixer: { [spec.id]: v } }) }, spec.id)),
|
|
4111
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap gap-3 text-foreground", children: [
|
|
4112
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
4113
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ImageCheckbox, { label: "Load the brush after each stroke", checked: mixer.loadEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { loadEachStroke: on } }) }),
|
|
4123
4114
|
"Load each stroke"
|
|
4124
4115
|
] }),
|
|
4125
|
-
/* @__PURE__ */ (0,
|
|
4126
|
-
/* @__PURE__ */ (0,
|
|
4127
|
-
"input",
|
|
4128
|
-
{
|
|
4129
|
-
type: "checkbox",
|
|
4130
|
-
"aria-label": "Clean the brush after each stroke",
|
|
4131
|
-
checked: mixer.cleanEachStroke,
|
|
4132
|
-
onChange: (e) => controller.setPaintOptions({ mixer: { cleanEachStroke: e.target.checked } }),
|
|
4133
|
-
className: "accent-primary"
|
|
4134
|
-
}
|
|
4135
|
-
),
|
|
4116
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
4117
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ImageCheckbox, { label: "Clean the brush after each stroke", checked: mixer.cleanEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { cleanEachStroke: on } }) }),
|
|
4136
4118
|
"Clean each stroke"
|
|
4137
4119
|
] })
|
|
4138
4120
|
] })
|
|
4139
4121
|
] }),
|
|
4140
|
-
(0, import_image_editor11.isRetouchPaintTool)(tool) && /* @__PURE__ */ (0,
|
|
4141
|
-
(tool === "clone" || tool === "heal") && /* @__PURE__ */ (0,
|
|
4142
|
-
/* @__PURE__ */ (0,
|
|
4143
|
-
cloneSource && /* @__PURE__ */ (0,
|
|
4122
|
+
(0, import_image_editor11.isRetouchPaintTool)(tool) && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Retouch options", "data-testid": "retouch-options", children: [
|
|
4123
|
+
(tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4124
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", "data-testid": "clone-source", children: (0, import_image_editor11.cloneSourceLabel)(controller) }),
|
|
4125
|
+
cloneSource && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", title: "Forget the source point", className: imageChipClass(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
|
|
4144
4126
|
] }),
|
|
4145
|
-
(tool === "clone" || tool === "heal") && /* @__PURE__ */ (0,
|
|
4146
|
-
import_image_editor11.CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ (0,
|
|
4147
|
-
/* @__PURE__ */ (0,
|
|
4148
|
-
/* @__PURE__ */ (0,
|
|
4149
|
-
/* @__PURE__ */ (0,
|
|
4150
|
-
!(0, import_image_editor11.cloneTransformView)(controller).identity && /* @__PURE__ */ (0,
|
|
4127
|
+
(tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-1", role: "group", "aria-label": "Clone source transform", "data-testid": "clone-transform", children: [
|
|
4128
|
+
import_image_editor11.CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ControlSlider, { spec, value: (0, import_image_editor11.cloneTransformView)(controller)[spec.id], onChange: (v) => (0, import_image_editor11.setCloneTransformValue)(controller, spec.id, v) }, spec.id)),
|
|
4129
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
4130
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor11.cloneTransformView)(controller).flipH, title: "Mirror the source left to right", className: imageChipClass((0, import_image_editor11.cloneTransformView)(controller).flipH), onClick: () => (0, import_image_editor11.setCloneTransformValue)(controller, "flipH"), children: "Flip H" }),
|
|
4131
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor11.cloneTransformView)(controller).flipV, title: "Mirror the source top to bottom", className: imageChipClass((0, import_image_editor11.cloneTransformView)(controller).flipV), onClick: () => (0, import_image_editor11.setCloneTransformValue)(controller, "flipV"), children: "Flip V" }),
|
|
4132
|
+
!(0, import_image_editor11.cloneTransformView)(controller).identity && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className: imageChipClass(false), onClick: () => controller.setCloneTransform(null), children: "Reset transform" })
|
|
4151
4133
|
] })
|
|
4152
4134
|
] }),
|
|
4153
|
-
import_image_editor11.RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ (0,
|
|
4154
|
-
/* @__PURE__ */ (0,
|
|
4155
|
-
choice.options.map((o) => /* @__PURE__ */ (0,
|
|
4135
|
+
import_image_editor11.RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": choice.label, children: [
|
|
4136
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: choice.label }),
|
|
4137
|
+
choice.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4156
4138
|
"button",
|
|
4157
4139
|
{
|
|
4158
4140
|
type: "button",
|
|
@@ -4165,70 +4147,43 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4165
4147
|
o.id
|
|
4166
4148
|
))
|
|
4167
4149
|
] }, choice.id)),
|
|
4168
|
-
import_image_editor11.RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ (0,
|
|
4169
|
-
/* @__PURE__ */ (0,
|
|
4170
|
-
/* @__PURE__ */ (0,
|
|
4171
|
-
"input",
|
|
4172
|
-
{
|
|
4173
|
-
type: "checkbox",
|
|
4174
|
-
"aria-label": t.label,
|
|
4175
|
-
checked: retouch[t.id],
|
|
4176
|
-
onChange: (e) => controller.setPaintOptions({ retouch: { [t.id]: e.target.checked } }),
|
|
4177
|
-
className: "accent-primary"
|
|
4178
|
-
}
|
|
4179
|
-
),
|
|
4150
|
+
import_image_editor11.RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ControlSlider, { spec, value: retouch[spec.id], onChange: (v) => controller.setPaintOptions({ retouch: { [spec.id]: v } }) }, spec.id)),
|
|
4151
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex flex-wrap gap-3 text-foreground", children: import_image_editor11.RETOUCH_TOGGLES.filter((t) => t.tools.includes(tool)).map((t) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
4152
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ImageCheckbox, { label: t.label, checked: retouch[t.id], onChange: (on) => controller.setPaintOptions({ retouch: { [t.id]: on } }) }),
|
|
4180
4153
|
t.label
|
|
4181
4154
|
] }, t.id)) })
|
|
4182
4155
|
] }),
|
|
4183
|
-
/* @__PURE__ */ (0,
|
|
4184
|
-
/* @__PURE__ */ (0,
|
|
4185
|
-
/* @__PURE__ */ (0,
|
|
4186
|
-
"input",
|
|
4187
|
-
{
|
|
4188
|
-
type: "checkbox",
|
|
4189
|
-
"aria-label": "Pressure controls size",
|
|
4190
|
-
checked: brush.pressureSize,
|
|
4191
|
-
onChange: (e) => controller.setPaintOptions({ brush: { pressureSize: e.target.checked } }),
|
|
4192
|
-
className: "accent-primary"
|
|
4193
|
-
}
|
|
4194
|
-
),
|
|
4156
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap gap-3 text-foreground", role: "group", "aria-label": "Pressure", children: [
|
|
4157
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
4158
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ImageCheckbox, { label: "Pressure controls size", checked: brush.pressureSize, onChange: (on) => controller.setPaintOptions({ brush: { pressureSize: on } }) }),
|
|
4195
4159
|
"Pressure size"
|
|
4196
4160
|
] }),
|
|
4197
|
-
/* @__PURE__ */ (0,
|
|
4198
|
-
/* @__PURE__ */ (0,
|
|
4199
|
-
"input",
|
|
4200
|
-
{
|
|
4201
|
-
type: "checkbox",
|
|
4202
|
-
"aria-label": "Pressure controls opacity",
|
|
4203
|
-
checked: brush.pressureOpacity,
|
|
4204
|
-
onChange: (e) => controller.setPaintOptions({ brush: { pressureOpacity: e.target.checked } }),
|
|
4205
|
-
className: "accent-primary"
|
|
4206
|
-
}
|
|
4207
|
-
),
|
|
4161
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
4162
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ImageCheckbox, { label: "Pressure controls opacity", checked: brush.pressureOpacity, onChange: (on) => controller.setPaintOptions({ brush: { pressureOpacity: on } }) }),
|
|
4208
4163
|
"Pressure opacity"
|
|
4209
4164
|
] })
|
|
4210
4165
|
] }),
|
|
4211
|
-
/* @__PURE__ */ (0,
|
|
4212
|
-
/* @__PURE__ */ (0,
|
|
4213
|
-
/* @__PURE__ */ (0,
|
|
4166
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex gap-1", children: [
|
|
4167
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.fillPixels()), children: "Fill" }),
|
|
4168
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.clearPixels()), children: "Clear" })
|
|
4214
4169
|
] }),
|
|
4215
|
-
error && /* @__PURE__ */ (0,
|
|
4170
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
4216
4171
|
] });
|
|
4217
4172
|
};
|
|
4218
4173
|
|
|
4219
4174
|
// src/image-editor/ColorProfilePanel.tsx
|
|
4220
|
-
var
|
|
4175
|
+
var import_react23 = require("react");
|
|
4221
4176
|
var import_image_editor13 = require("@pixerate/editor/image-editor");
|
|
4222
|
-
var
|
|
4177
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
4223
4178
|
var chip = imageChipClass(false);
|
|
4224
4179
|
var select2 = "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground";
|
|
4225
4180
|
var ColorProfilePanel = ({ controller, className }) => {
|
|
4226
|
-
const [, setTick] = (0,
|
|
4227
|
-
(0,
|
|
4228
|
-
const [target, setTarget] = (0,
|
|
4229
|
-
const [intent, setIntent] = (0,
|
|
4230
|
-
const [bpc, setBpc] = (0,
|
|
4231
|
-
const [error, setError] = (0,
|
|
4181
|
+
const [, setTick] = (0, import_react23.useState)(0);
|
|
4182
|
+
(0, import_react23.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4183
|
+
const [target, setTarget] = (0, import_react23.useState)("display-p3");
|
|
4184
|
+
const [intent, setIntent] = (0, import_react23.useState)("relative");
|
|
4185
|
+
const [bpc, setBpc] = (0, import_react23.useState)(true);
|
|
4186
|
+
const [error, setError] = (0, import_react23.useState)(null);
|
|
4232
4187
|
const view = (0, import_image_editor13.colorPanelView)(controller);
|
|
4233
4188
|
const attempt = (fn) => {
|
|
4234
4189
|
try {
|
|
@@ -4250,29 +4205,29 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
4250
4205
|
})
|
|
4251
4206
|
);
|
|
4252
4207
|
};
|
|
4253
|
-
return /* @__PURE__ */ (0,
|
|
4254
|
-
/* @__PURE__ */ (0,
|
|
4255
|
-
/* @__PURE__ */ (0,
|
|
4256
|
-
/* @__PURE__ */ (0,
|
|
4208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "color-profile-panel", children: [
|
|
4209
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4210
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-muted-foreground", children: "Profile" }),
|
|
4211
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "data-testid": "color-profile-name", children: view.profileName })
|
|
4257
4212
|
] }),
|
|
4258
|
-
/* @__PURE__ */ (0,
|
|
4259
|
-
/* @__PURE__ */ (0,
|
|
4260
|
-
/* @__PURE__ */ (0,
|
|
4261
|
-
view.cmykProfileName && /* @__PURE__ */ (0,
|
|
4213
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Colour mode", children: [
|
|
4214
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-muted-foreground", children: "Mode" }),
|
|
4215
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("select", { "aria-label": "Colour mode", className: select2, value: view.mode, onChange: (e) => attempt(() => controller.setColorMode(e.target.value)), children: import_image_editor13.COLOR_MODE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
|
|
4216
|
+
view.cmykProfileName && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-muted-foreground", children: view.cmykProfileName })
|
|
4262
4217
|
] }),
|
|
4263
|
-
/* @__PURE__ */ (0,
|
|
4264
|
-
/* @__PURE__ */ (0,
|
|
4265
|
-
/* @__PURE__ */ (0,
|
|
4266
|
-
/* @__PURE__ */ (0,
|
|
4267
|
-
/* @__PURE__ */ (0,
|
|
4218
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
|
|
4219
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("select", { "aria-label": "Target profile", className: select2, value: target, onChange: (e) => setTarget(e.target.value), children: import_image_editor13.WORKING_SPACE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
|
|
4220
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("select", { "aria-label": "Rendering intent", className: select2, value: intent, onChange: (e) => setIntent(e.target.value), children: import_image_editor13.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
|
|
4221
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4222
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-primary" }),
|
|
4268
4223
|
"BPC"
|
|
4269
4224
|
] }),
|
|
4270
|
-
/* @__PURE__ */ (0,
|
|
4271
|
-
/* @__PURE__ */ (0,
|
|
4225
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: chip, title: "Edit \u203A Assign Profile: keep the numbers", onClick: () => attempt(() => controller.assignProfile(target)), children: "Assign" }),
|
|
4226
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: chip, title: "Edit \u203A Convert to Profile: keep the look", onClick: () => attempt(() => controller.convertToProfile(target, { intent, bpc })), children: "Convert" })
|
|
4272
4227
|
] }),
|
|
4273
|
-
/* @__PURE__ */ (0,
|
|
4274
|
-
/* @__PURE__ */ (0,
|
|
4275
|
-
/* @__PURE__ */ (0,
|
|
4228
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Proof setup", children: [
|
|
4229
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-muted-foreground", children: "Proof" }),
|
|
4230
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
4276
4231
|
"select",
|
|
4277
4232
|
{
|
|
4278
4233
|
"aria-label": "Proof profile",
|
|
@@ -4280,31 +4235,31 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
4280
4235
|
value: view.proof?.id ?? "",
|
|
4281
4236
|
onChange: (e) => e.target.value ? proofWith({ id: e.target.value }) : attempt(() => controller.setProofSetup(null)),
|
|
4282
4237
|
children: [
|
|
4283
|
-
/* @__PURE__ */ (0,
|
|
4284
|
-
import_image_editor13.PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */ (0,
|
|
4238
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "", children: "Off" }),
|
|
4239
|
+
import_image_editor13.PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: o.id, children: o.label }, o.id))
|
|
4285
4240
|
]
|
|
4286
4241
|
}
|
|
4287
4242
|
),
|
|
4288
|
-
view.proof && /* @__PURE__ */ (0,
|
|
4289
|
-
/* @__PURE__ */ (0,
|
|
4290
|
-
/* @__PURE__ */ (0,
|
|
4291
|
-
/* @__PURE__ */ (0,
|
|
4243
|
+
view.proof && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
4244
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("select", { "aria-label": "Proof intent", className: select2, value: view.proof.intent, onChange: (e) => proofWith({ intent: e.target.value }), children: import_image_editor13.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
|
|
4245
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4246
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-primary" }),
|
|
4292
4247
|
"Paper"
|
|
4293
4248
|
] }),
|
|
4294
|
-
/* @__PURE__ */ (0,
|
|
4295
|
-
/* @__PURE__ */ (0,
|
|
4249
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4250
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-primary" }),
|
|
4296
4251
|
"Gamut warning"
|
|
4297
4252
|
] })
|
|
4298
4253
|
] })
|
|
4299
4254
|
] }),
|
|
4300
|
-
error && /* @__PURE__ */ (0,
|
|
4255
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
4301
4256
|
] });
|
|
4302
4257
|
};
|
|
4303
4258
|
|
|
4304
4259
|
// src/image-editor/SelectionOptionsBar.tsx
|
|
4305
|
-
var
|
|
4260
|
+
var import_react24 = require("react");
|
|
4306
4261
|
var import_image_editor14 = require("@pixerate/editor/image-editor");
|
|
4307
|
-
var
|
|
4262
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4308
4263
|
var MODIFY_OPS = [
|
|
4309
4264
|
{ op: "grow", label: "Grow" },
|
|
4310
4265
|
{ op: "shrink", label: "Shrink" },
|
|
@@ -4321,72 +4276,59 @@ var SelectionOptionsBar = ({
|
|
|
4321
4276
|
quickMask,
|
|
4322
4277
|
className = ""
|
|
4323
4278
|
}) => {
|
|
4324
|
-
const [radius, setRadius] = (0,
|
|
4279
|
+
const [radius, setRadius] = (0, import_react24.useState)(2);
|
|
4325
4280
|
const set = (patch) => onOptionsChange({ ...options, ...patch });
|
|
4326
4281
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
4327
4282
|
const qm = quickMask ?? Boolean(controller.getState().quickMask);
|
|
4328
|
-
return /* @__PURE__ */ (0,
|
|
4329
|
-
/* @__PURE__ */ (0,
|
|
4330
|
-
/* @__PURE__ */ (0,
|
|
4331
|
-
options.tool === "wand" && /* @__PURE__ */ (0,
|
|
4332
|
-
/* @__PURE__ */ (0,
|
|
4333
|
-
/* @__PURE__ */ (0,
|
|
4334
|
-
/* @__PURE__ */ (0,
|
|
4335
|
-
/* @__PURE__ */ (0,
|
|
4283
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
4284
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor14.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
|
|
4285
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: import_image_editor14.SELECTION_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: import_image_editor14.SELECTION_MODE_LABELS[m] }, m)) }),
|
|
4286
|
+
options.tool === "wand" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
4287
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
4288
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4289
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Tolerance" }),
|
|
4290
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-mono", children: options.tolerance })
|
|
4336
4291
|
] }),
|
|
4337
|
-
/* @__PURE__ */ (0,
|
|
4338
|
-
"input",
|
|
4339
|
-
{
|
|
4340
|
-
type: "range",
|
|
4341
|
-
min: 0,
|
|
4342
|
-
max: 255,
|
|
4343
|
-
step: 1,
|
|
4344
|
-
"aria-label": "Tolerance",
|
|
4345
|
-
value: options.tolerance,
|
|
4346
|
-
onChange: (e) => set({ tolerance: Number(e.target.value) }),
|
|
4347
|
-
className: imageRangeClass
|
|
4348
|
-
}
|
|
4349
|
-
)
|
|
4292
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageRange, { label: "Tolerance", min: 0, max: 255, step: 1, value: options.tolerance, onChange: (v) => set({ tolerance: v }) })
|
|
4350
4293
|
] }),
|
|
4351
|
-
/* @__PURE__ */ (0,
|
|
4352
|
-
/* @__PURE__ */ (0,
|
|
4294
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4295
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageCheckbox, { label: "Contiguous", checked: options.contiguous, onChange: (on) => set({ contiguous: on }) }),
|
|
4353
4296
|
"Contiguous"
|
|
4354
4297
|
] }),
|
|
4355
|
-
/* @__PURE__ */ (0,
|
|
4356
|
-
/* @__PURE__ */ (0,
|
|
4298
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4299
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageCheckbox, { label: "Sample adjusted image", checked: options.sampleMerged, onChange: (on) => set({ sampleMerged: on }) }),
|
|
4357
4300
|
"Sample adjusted image"
|
|
4358
4301
|
] }),
|
|
4359
|
-
/* @__PURE__ */ (0,
|
|
4302
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4360
4303
|
"Sample",
|
|
4361
|
-
/* @__PURE__ */ (0,
|
|
4362
|
-
|
|
4304
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4305
|
+
ImageSelect,
|
|
4363
4306
|
{
|
|
4364
|
-
|
|
4307
|
+
label: "Sample from",
|
|
4365
4308
|
value: options.sample ?? "composite",
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
]
|
|
4309
|
+
options: [
|
|
4310
|
+
{ value: "composite", label: "All layers" },
|
|
4311
|
+
{ value: "active-layer", label: "Active layer" }
|
|
4312
|
+
],
|
|
4313
|
+
onChange: (v) => set({ sample: v })
|
|
4372
4314
|
}
|
|
4373
4315
|
)
|
|
4374
4316
|
] })
|
|
4375
4317
|
] }),
|
|
4376
|
-
/* @__PURE__ */ (0,
|
|
4377
|
-
/* @__PURE__ */ (0,
|
|
4318
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4319
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
|
|
4378
4320
|
"Anti-alias"
|
|
4379
4321
|
] }),
|
|
4380
|
-
/* @__PURE__ */ (0,
|
|
4381
|
-
/* @__PURE__ */ (0,
|
|
4382
|
-
/* @__PURE__ */ (0,
|
|
4383
|
-
/* @__PURE__ */ (0,
|
|
4384
|
-
/* @__PURE__ */ (0,
|
|
4322
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
4323
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
|
|
4324
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
|
|
4325
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
|
|
4326
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", "aria-pressed": qm, className: btn(qm), onClick: () => controller.setQuickMask(!qm), children: "Quick Mask" })
|
|
4385
4327
|
] }),
|
|
4386
|
-
/* @__PURE__ */ (0,
|
|
4387
|
-
/* @__PURE__ */ (0,
|
|
4328
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
4329
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4388
4330
|
"Radius",
|
|
4389
|
-
/* @__PURE__ */ (0,
|
|
4331
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4390
4332
|
"input",
|
|
4391
4333
|
{
|
|
4392
4334
|
type: "number",
|
|
@@ -4400,24 +4342,24 @@ var SelectionOptionsBar = ({
|
|
|
4400
4342
|
}
|
|
4401
4343
|
)
|
|
4402
4344
|
] }),
|
|
4403
|
-
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0,
|
|
4345
|
+
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
|
|
4404
4346
|
] }),
|
|
4405
|
-
/* @__PURE__ */ (0,
|
|
4347
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: (0, import_image_editor14.describeSelection)(sel) })
|
|
4406
4348
|
] });
|
|
4407
4349
|
};
|
|
4408
4350
|
|
|
4409
4351
|
// src/image-editor/RefineEdgePanel.tsx
|
|
4410
|
-
var
|
|
4352
|
+
var import_react25 = require("react");
|
|
4411
4353
|
var import_image_editor15 = require("@pixerate/editor/image-editor");
|
|
4412
|
-
var
|
|
4354
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4413
4355
|
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
4414
4356
|
var button2 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
|
|
4415
4357
|
var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
4416
|
-
const [params, setParams] = (0,
|
|
4417
|
-
const [busy, setBusy] = (0,
|
|
4418
|
-
const [error, setError] = (0,
|
|
4419
|
-
const [layerId, setLayerId] = (0,
|
|
4420
|
-
const [newKind, setNewKind] = (0,
|
|
4358
|
+
const [params, setParams] = (0, import_react25.useState)(DEFAULT_PARAMS);
|
|
4359
|
+
const [busy, setBusy] = (0, import_react25.useState)(false);
|
|
4360
|
+
const [error, setError] = (0, import_react25.useState)(null);
|
|
4361
|
+
const [layerId, setLayerId] = (0, import_react25.useState)("");
|
|
4362
|
+
const [newKind, setNewKind] = (0, import_react25.useState)("hueSaturation");
|
|
4421
4363
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
4422
4364
|
const list = layers ?? controller.getAdjustmentLayers();
|
|
4423
4365
|
const target = list.find((l) => l.id === layerId) ?? list[list.length - 1];
|
|
@@ -4432,17 +4374,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4432
4374
|
setBusy(false);
|
|
4433
4375
|
}
|
|
4434
4376
|
};
|
|
4435
|
-
return /* @__PURE__ */ (0,
|
|
4436
|
-
/* @__PURE__ */ (0,
|
|
4437
|
-
import_image_editor15.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0,
|
|
4438
|
-
/* @__PURE__ */ (0,
|
|
4439
|
-
/* @__PURE__ */ (0,
|
|
4440
|
-
/* @__PURE__ */ (0,
|
|
4377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
4378
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
|
|
4379
|
+
import_image_editor15.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
4380
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4381
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: c.label }),
|
|
4382
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "font-mono", children: [
|
|
4441
4383
|
params[c.id],
|
|
4442
4384
|
c.unit
|
|
4443
4385
|
] })
|
|
4444
4386
|
] }),
|
|
4445
|
-
/* @__PURE__ */ (0,
|
|
4387
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4446
4388
|
"input",
|
|
4447
4389
|
{
|
|
4448
4390
|
type: "range",
|
|
@@ -4456,28 +4398,28 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4456
4398
|
}
|
|
4457
4399
|
)
|
|
4458
4400
|
] }, c.id)),
|
|
4459
|
-
/* @__PURE__ */ (0,
|
|
4460
|
-
/* @__PURE__ */ (0,
|
|
4401
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4402
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
4461
4403
|
"Smart Radius"
|
|
4462
4404
|
] }),
|
|
4463
|
-
/* @__PURE__ */ (0,
|
|
4464
|
-
/* @__PURE__ */ (0,
|
|
4465
|
-
/* @__PURE__ */ (0,
|
|
4405
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex gap-1", children: [
|
|
4406
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: button2, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
4407
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: button2, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
|
4466
4408
|
] }),
|
|
4467
|
-
error && /* @__PURE__ */ (0,
|
|
4468
|
-
/* @__PURE__ */ (0,
|
|
4469
|
-
/* @__PURE__ */ (0,
|
|
4470
|
-
/* @__PURE__ */ (0,
|
|
4409
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
|
|
4410
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
|
|
4411
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex gap-1 items-center", children: [
|
|
4412
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4471
4413
|
"select",
|
|
4472
4414
|
{
|
|
4473
4415
|
"aria-label": "New masked layer kind",
|
|
4474
4416
|
value: newKind,
|
|
4475
4417
|
onChange: (e) => setNewKind(e.target.value),
|
|
4476
4418
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
4477
|
-
children: import_image_editor15.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0,
|
|
4419
|
+
children: import_image_editor15.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: k.kind, children: k.label }, k.kind))
|
|
4478
4420
|
}
|
|
4479
4421
|
),
|
|
4480
|
-
/* @__PURE__ */ (0,
|
|
4422
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4481
4423
|
"button",
|
|
4482
4424
|
{
|
|
4483
4425
|
type: "button",
|
|
@@ -4488,35 +4430,35 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4488
4430
|
}
|
|
4489
4431
|
)
|
|
4490
4432
|
] }),
|
|
4491
|
-
list.length > 0 && target && /* @__PURE__ */ (0,
|
|
4492
|
-
/* @__PURE__ */ (0,
|
|
4433
|
+
list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
4434
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4493
4435
|
"select",
|
|
4494
4436
|
{
|
|
4495
4437
|
"aria-label": "Mask layer",
|
|
4496
4438
|
value: target.id,
|
|
4497
4439
|
onChange: (e) => setLayerId(e.target.value),
|
|
4498
4440
|
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
4499
|
-
children: list.map((l) => /* @__PURE__ */ (0,
|
|
4441
|
+
children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("option", { value: l.id, children: [
|
|
4500
4442
|
l.name || (0, import_image_editor15.adjustmentKindLabel)(l.kind),
|
|
4501
4443
|
l.mask ? " (masked)" : ""
|
|
4502
4444
|
] }, l.id))
|
|
4503
4445
|
}
|
|
4504
4446
|
),
|
|
4505
|
-
/* @__PURE__ */ (0,
|
|
4506
|
-
/* @__PURE__ */ (0,
|
|
4507
|
-
/* @__PURE__ */ (0,
|
|
4508
|
-
/* @__PURE__ */ (0,
|
|
4447
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
4448
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: button2, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
|
|
4449
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: button2, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
|
|
4450
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: button2, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
|
|
4509
4451
|
] }),
|
|
4510
|
-
target.mask && /* @__PURE__ */ (0,
|
|
4511
|
-
/* @__PURE__ */ (0,
|
|
4512
|
-
/* @__PURE__ */ (0,
|
|
4513
|
-
/* @__PURE__ */ (0,
|
|
4514
|
-
/* @__PURE__ */ (0,
|
|
4452
|
+
target.mask && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
4453
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
4454
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4455
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "Density" }),
|
|
4456
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "font-mono", children: [
|
|
4515
4457
|
Math.round((target.mask.density ?? 1) * 100),
|
|
4516
4458
|
"%"
|
|
4517
4459
|
] })
|
|
4518
4460
|
] }),
|
|
4519
|
-
/* @__PURE__ */ (0,
|
|
4461
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4520
4462
|
"input",
|
|
4521
4463
|
{
|
|
4522
4464
|
type: "range",
|
|
@@ -4530,15 +4472,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4530
4472
|
}
|
|
4531
4473
|
)
|
|
4532
4474
|
] }),
|
|
4533
|
-
/* @__PURE__ */ (0,
|
|
4534
|
-
/* @__PURE__ */ (0,
|
|
4535
|
-
/* @__PURE__ */ (0,
|
|
4536
|
-
/* @__PURE__ */ (0,
|
|
4475
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
4476
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4477
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "Mask Feather" }),
|
|
4478
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "font-mono", children: [
|
|
4537
4479
|
target.mask.feather ?? 0,
|
|
4538
4480
|
"px"
|
|
4539
4481
|
] })
|
|
4540
4482
|
] }),
|
|
4541
|
-
/* @__PURE__ */ (0,
|
|
4483
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4542
4484
|
"input",
|
|
4543
4485
|
{
|
|
4544
4486
|
type: "range",
|
|
@@ -4558,13 +4500,13 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4558
4500
|
};
|
|
4559
4501
|
|
|
4560
4502
|
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
4561
|
-
var
|
|
4503
|
+
var import_react26 = require("react");
|
|
4562
4504
|
var import_image_editor16 = require("@pixerate/editor/image-editor");
|
|
4563
|
-
var
|
|
4505
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4564
4506
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
4565
4507
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
4566
|
-
const [, setTick] = (0,
|
|
4567
|
-
(0,
|
|
4508
|
+
const [, setTick] = (0, import_react26.useState)(0);
|
|
4509
|
+
(0, import_react26.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
|
|
4568
4510
|
const bar = tool.bar();
|
|
4569
4511
|
if (!tool.active || !bar) return null;
|
|
4570
4512
|
const warp = tool.warpBar();
|
|
@@ -4576,17 +4518,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4576
4518
|
const v = Number(raw);
|
|
4577
4519
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
4578
4520
|
};
|
|
4579
|
-
return /* @__PURE__ */ (0,
|
|
4580
|
-
/* @__PURE__ */ (0,
|
|
4581
|
-
/* @__PURE__ */ (0,
|
|
4582
|
-
tool.mode === "warp" && /* @__PURE__ */ (0,
|
|
4583
|
-
/* @__PURE__ */ (0,
|
|
4584
|
-
/* @__PURE__ */ (0,
|
|
4585
|
-
/* @__PURE__ */ (0,
|
|
4521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: `flex flex-wrap items-center gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
|
|
4522
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor16.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: imageChipClass(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
|
|
4523
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor16.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-accent hover:bg-primary/90", onClick: () => tool.setReference(a) }, a)) }),
|
|
4524
|
+
tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
4525
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4526
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
4527
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor16.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: o.id, children: o.label }, o.id)) })
|
|
4586
4528
|
] }),
|
|
4587
|
-
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0,
|
|
4588
|
-
/* @__PURE__ */ (0,
|
|
4589
|
-
/* @__PURE__ */ (0,
|
|
4529
|
+
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4530
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
4531
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4590
4532
|
"input",
|
|
4591
4533
|
{
|
|
4592
4534
|
type: "number",
|
|
@@ -4607,9 +4549,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4607
4549
|
},
|
|
4608
4550
|
`${k}:${warp[k]}`
|
|
4609
4551
|
),
|
|
4610
|
-
/* @__PURE__ */ (0,
|
|
4552
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", children: "%" })
|
|
4611
4553
|
] }, k)),
|
|
4612
|
-
/* @__PURE__ */ (0,
|
|
4554
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4613
4555
|
"button",
|
|
4614
4556
|
{
|
|
4615
4557
|
type: "button",
|
|
@@ -4621,9 +4563,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4621
4563
|
children: "Vertical"
|
|
4622
4564
|
}
|
|
4623
4565
|
),
|
|
4624
|
-
/* @__PURE__ */ (0,
|
|
4625
|
-
/* @__PURE__ */ (0,
|
|
4626
|
-
/* @__PURE__ */ (0,
|
|
4566
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4567
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
4568
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4627
4569
|
"select",
|
|
4628
4570
|
{
|
|
4629
4571
|
"aria-label": "Warp grid",
|
|
@@ -4633,14 +4575,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4633
4575
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
4634
4576
|
},
|
|
4635
4577
|
className: imageFieldClass,
|
|
4636
|
-
children: import_image_editor16.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0,
|
|
4578
|
+
children: import_image_editor16.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: g.id, children: g.label }, g.id))
|
|
4637
4579
|
}
|
|
4638
4580
|
)
|
|
4639
4581
|
] })
|
|
4640
4582
|
] }),
|
|
4641
|
-
tool.mode !== "warp" && import_image_editor16.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0,
|
|
4642
|
-
/* @__PURE__ */ (0,
|
|
4643
|
-
/* @__PURE__ */ (0,
|
|
4583
|
+
tool.mode !== "warp" && import_image_editor16.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
4584
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", children: f.label }),
|
|
4585
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4644
4586
|
"input",
|
|
4645
4587
|
{
|
|
4646
4588
|
type: "number",
|
|
@@ -4660,8 +4602,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4660
4602
|
},
|
|
4661
4603
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
4662
4604
|
),
|
|
4663
|
-
/* @__PURE__ */ (0,
|
|
4664
|
-
f.id === "scaleX" && /* @__PURE__ */ (0,
|
|
4605
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
|
|
4606
|
+
f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4665
4607
|
"button",
|
|
4666
4608
|
{
|
|
4667
4609
|
type: "button",
|
|
@@ -4676,33 +4618,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4676
4618
|
}
|
|
4677
4619
|
)
|
|
4678
4620
|
] }, f.id)),
|
|
4679
|
-
/* @__PURE__ */ (0,
|
|
4680
|
-
/* @__PURE__ */ (0,
|
|
4681
|
-
/* @__PURE__ */ (0,
|
|
4621
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4622
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
4623
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4682
4624
|
"select",
|
|
4683
4625
|
{
|
|
4684
4626
|
"aria-label": "Interpolation",
|
|
4685
4627
|
value: tool.interpolation,
|
|
4686
4628
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
4687
4629
|
className: imageFieldClass,
|
|
4688
|
-
children: import_image_editor16.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0,
|
|
4630
|
+
children: import_image_editor16.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
4689
4631
|
}
|
|
4690
4632
|
)
|
|
4691
4633
|
] }),
|
|
4692
|
-
/* @__PURE__ */ (0,
|
|
4693
|
-
/* @__PURE__ */ (0,
|
|
4694
|
-
tool.error && /* @__PURE__ */ (0,
|
|
4634
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90", onClick: () => tool.commit(), children: "Commit" }),
|
|
4635
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
4636
|
+
tool.error && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
4695
4637
|
] });
|
|
4696
4638
|
};
|
|
4697
4639
|
|
|
4698
4640
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
4699
|
-
var
|
|
4641
|
+
var import_react27 = require("react");
|
|
4700
4642
|
var import_image_editor17 = require("@pixerate/editor/image-editor");
|
|
4701
|
-
var
|
|
4643
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4702
4644
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
4703
|
-
const [, setTick] = (0,
|
|
4704
|
-
(0,
|
|
4705
|
-
const [error, setError] = (0,
|
|
4645
|
+
const [, setTick] = (0, import_react27.useState)(0);
|
|
4646
|
+
(0, import_react27.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4647
|
+
const [error, setError] = (0, import_react27.useState)(null);
|
|
4706
4648
|
const active = controller.getActiveLayer();
|
|
4707
4649
|
const shapeId = active?.type === "shape" ? active.id : null;
|
|
4708
4650
|
const set = (change) => {
|
|
@@ -4716,13 +4658,13 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4716
4658
|
}
|
|
4717
4659
|
};
|
|
4718
4660
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
4719
|
-
return /* @__PURE__ */ (0,
|
|
4720
|
-
/* @__PURE__ */ (0,
|
|
4721
|
-
/* @__PURE__ */ (0,
|
|
4722
|
-
/* @__PURE__ */ (0,
|
|
4723
|
-
/* @__PURE__ */ (0,
|
|
4661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
4662
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor17.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor17.SHAPE_KIND_LABELS[k] }, k)) }),
|
|
4663
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
4664
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4665
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
|
|
4724
4666
|
"Fill",
|
|
4725
|
-
/* @__PURE__ */ (0,
|
|
4667
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4726
4668
|
"input",
|
|
4727
4669
|
{
|
|
4728
4670
|
type: "color",
|
|
@@ -4734,10 +4676,10 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4734
4676
|
}
|
|
4735
4677
|
)
|
|
4736
4678
|
] }),
|
|
4737
|
-
/* @__PURE__ */ (0,
|
|
4738
|
-
/* @__PURE__ */ (0,
|
|
4679
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4680
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
|
|
4739
4681
|
"Stroke",
|
|
4740
|
-
/* @__PURE__ */ (0,
|
|
4682
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4741
4683
|
"input",
|
|
4742
4684
|
{
|
|
4743
4685
|
type: "color",
|
|
@@ -4749,9 +4691,9 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4749
4691
|
}
|
|
4750
4692
|
)
|
|
4751
4693
|
] }),
|
|
4752
|
-
/* @__PURE__ */ (0,
|
|
4694
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4753
4695
|
"Width",
|
|
4754
|
-
/* @__PURE__ */ (0,
|
|
4696
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4755
4697
|
"input",
|
|
4756
4698
|
{
|
|
4757
4699
|
type: "number",
|
|
@@ -4765,63 +4707,51 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4765
4707
|
)
|
|
4766
4708
|
] })
|
|
4767
4709
|
] }),
|
|
4768
|
-
/* @__PURE__ */ (0,
|
|
4769
|
-
options.kind === "rect" && /* @__PURE__ */ (0,
|
|
4710
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
4711
|
+
options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4770
4712
|
"Radius",
|
|
4771
|
-
/* @__PURE__ */ (0,
|
|
4713
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "number", "aria-label": "Corner radius", min: 0, max: 1e3, value: options.radius, onChange: (e) => set({ radius: num(e.target.value, 0, 1e3) }), className: `w-14 ${imageFieldClass}` })
|
|
4772
4714
|
] }),
|
|
4773
|
-
options.kind === "polygon" && /* @__PURE__ */ (0,
|
|
4715
|
+
options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4774
4716
|
"Sides",
|
|
4775
|
-
/* @__PURE__ */ (0,
|
|
4717
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "number", "aria-label": "Sides", min: 3, max: 100, value: options.sides, onChange: (e) => set({ sides: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
|
|
4776
4718
|
] }),
|
|
4777
|
-
options.kind === "star" && /* @__PURE__ */ (0,
|
|
4778
|
-
/* @__PURE__ */ (0,
|
|
4719
|
+
options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
4720
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4779
4721
|
"Points",
|
|
4780
|
-
/* @__PURE__ */ (0,
|
|
4722
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "number", "aria-label": "Points", min: 3, max: 100, value: options.points, onChange: (e) => set({ points: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
|
|
4781
4723
|
] }),
|
|
4782
|
-
/* @__PURE__ */ (0,
|
|
4724
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4783
4725
|
"Inner",
|
|
4784
|
-
/* @__PURE__ */ (0,
|
|
4785
|
-
"input",
|
|
4786
|
-
{
|
|
4787
|
-
type: "range",
|
|
4788
|
-
"aria-label": "Inner radius",
|
|
4789
|
-
min: 0.05,
|
|
4790
|
-
max: 1,
|
|
4791
|
-
step: 0.05,
|
|
4792
|
-
value: options.innerRatio,
|
|
4793
|
-
onChange: (e) => set({ innerRatio: Number(e.target.value) }),
|
|
4794
|
-
className: "accent-primary"
|
|
4795
|
-
}
|
|
4796
|
-
)
|
|
4726
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
|
|
4797
4727
|
] })
|
|
4798
4728
|
] }),
|
|
4799
|
-
options.kind === "line" && /* @__PURE__ */ (0,
|
|
4800
|
-
/* @__PURE__ */ (0,
|
|
4729
|
+
options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
4730
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4801
4731
|
"Weight",
|
|
4802
|
-
/* @__PURE__ */ (0,
|
|
4732
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "number", "aria-label": "Line weight", min: 1, max: 200, value: options.weight, onChange: (e) => set({ weight: num(e.target.value, 1, 200) }), className: `w-14 ${imageFieldClass}` })
|
|
4803
4733
|
] }),
|
|
4804
|
-
/* @__PURE__ */ (0,
|
|
4805
|
-
/* @__PURE__ */ (0,
|
|
4734
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4735
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
|
|
4806
4736
|
"Arrowhead"
|
|
4807
4737
|
] })
|
|
4808
4738
|
] })
|
|
4809
4739
|
] }),
|
|
4810
|
-
/* @__PURE__ */ (0,
|
|
4811
|
-
error && /* @__PURE__ */ (0,
|
|
4740
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Drag on the image to draw. Shift: square, circle or 45\xB0 line. Alt: from the centre." }),
|
|
4741
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
4812
4742
|
] });
|
|
4813
4743
|
};
|
|
4814
4744
|
|
|
4815
4745
|
// src/image-editor/TypeOptionsBar.tsx
|
|
4816
|
-
var
|
|
4746
|
+
var import_react28 = require("react");
|
|
4817
4747
|
var import_image_editor18 = require("@pixerate/editor/image-editor");
|
|
4818
|
-
var
|
|
4748
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4819
4749
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
4820
4750
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
4821
|
-
const [, setTick] = (0,
|
|
4822
|
-
(0,
|
|
4823
|
-
(0,
|
|
4824
|
-
const [error, setError] = (0,
|
|
4751
|
+
const [, setTick] = (0, import_react28.useState)(0);
|
|
4752
|
+
(0, import_react28.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4753
|
+
(0, import_react28.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
|
|
4754
|
+
const [error, setError] = (0, import_react28.useState)(null);
|
|
4825
4755
|
const active = controller.getActiveLayer();
|
|
4826
4756
|
const typeId = !session && active?.type === "type" ? active.id : null;
|
|
4827
4757
|
const here = session?.alive ? session.styleHere() : {};
|
|
@@ -4853,11 +4783,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4853
4783
|
setError(e instanceof Error ? e.message : String(e));
|
|
4854
4784
|
}
|
|
4855
4785
|
};
|
|
4856
|
-
return /* @__PURE__ */ (0,
|
|
4857
|
-
/* @__PURE__ */ (0,
|
|
4858
|
-
/* @__PURE__ */ (0,
|
|
4786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
|
|
4787
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
4788
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4859
4789
|
"Font",
|
|
4860
|
-
/* @__PURE__ */ (0,
|
|
4790
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4861
4791
|
"input",
|
|
4862
4792
|
{
|
|
4863
4793
|
list: "pixerate-type-fonts",
|
|
@@ -4867,11 +4797,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4867
4797
|
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
4868
4798
|
}
|
|
4869
4799
|
),
|
|
4870
|
-
/* @__PURE__ */ (0,
|
|
4800
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: f }, f)) })
|
|
4871
4801
|
] }),
|
|
4872
|
-
/* @__PURE__ */ (0,
|
|
4802
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4873
4803
|
"Size",
|
|
4874
|
-
/* @__PURE__ */ (0,
|
|
4804
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4875
4805
|
"input",
|
|
4876
4806
|
{
|
|
4877
4807
|
type: "number",
|
|
@@ -4884,24 +4814,24 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4884
4814
|
}
|
|
4885
4815
|
)
|
|
4886
4816
|
] }),
|
|
4887
|
-
/* @__PURE__ */ (0,
|
|
4888
|
-
/* @__PURE__ */ (0,
|
|
4889
|
-
/* @__PURE__ */ (0,
|
|
4817
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${imageChipClass(shown.fontWeight >= 600)} font-bold`, onClick: () => style({ fontWeight: shown.fontWeight >= 600 ? 400 : 700 }), children: "B" }),
|
|
4818
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
4819
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { type: "color", "aria-label": "Text colour", value: shown.color, onChange: (e) => style({ color: e.target.value }), className: imageColorInputClass })
|
|
4890
4820
|
] }),
|
|
4891
|
-
/* @__PURE__ */ (0,
|
|
4892
|
-
/* @__PURE__ */ (0,
|
|
4893
|
-
missing.length > 0 && /* @__PURE__ */ (0,
|
|
4821
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor18.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
4822
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text, drag for a paragraph box, click text to edit it. Esc finishes." }),
|
|
4823
|
+
missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
4894
4824
|
"Missing ",
|
|
4895
4825
|
missing.length === 1 ? "font" : "fonts",
|
|
4896
4826
|
": ",
|
|
4897
4827
|
missing.join(", ")
|
|
4898
4828
|
] }),
|
|
4899
|
-
error && /* @__PURE__ */ (0,
|
|
4829
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
4900
4830
|
] });
|
|
4901
4831
|
};
|
|
4902
4832
|
|
|
4903
4833
|
// src/image-editor/ImageEditor.tsx
|
|
4904
|
-
var
|
|
4834
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4905
4835
|
var ImageEditor = ({
|
|
4906
4836
|
editor: externalEditor,
|
|
4907
4837
|
src,
|
|
@@ -4926,32 +4856,32 @@ var ImageEditor = ({
|
|
|
4926
4856
|
return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
|
|
4927
4857
|
});
|
|
4928
4858
|
const legacyProcess = (0, import_image_editor19.normalizeProcessVersion)(state.adjustments.process) < import_image_editor19.LATEST_PROCESS_VERSION;
|
|
4929
|
-
const [activeTab, setActiveTab] = (0,
|
|
4930
|
-
const rootRef = (0,
|
|
4859
|
+
const [activeTab, setActiveTab] = (0, import_react29.useState)("crop");
|
|
4860
|
+
const rootRef = (0, import_react29.useRef)(null);
|
|
4931
4861
|
const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
|
|
4932
|
-
const activeTabRef = (0,
|
|
4862
|
+
const activeTabRef = (0, import_react29.useRef)(activeTab);
|
|
4933
4863
|
activeTabRef.current = activeTab;
|
|
4934
4864
|
const openPanel = async (ref) => {
|
|
4935
4865
|
if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
|
|
4936
4866
|
rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
|
|
4937
4867
|
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
4938
4868
|
};
|
|
4939
|
-
const [activeCropRatio, setActiveCropRatio] = (0,
|
|
4940
|
-
const [selectionOptions, setSelectionOptions] = (0,
|
|
4941
|
-
const [shapeOptions, setShapeOptions] = (0,
|
|
4942
|
-
const [typeOptions, setTypeOptions] = (0,
|
|
4943
|
-
const [typeSession, setTypeSession] = (0,
|
|
4944
|
-
const [selectionError, setSelectionError] = (0,
|
|
4945
|
-
const [paintError, setPaintError] = (0,
|
|
4946
|
-
const [shapeTypeError, setShapeTypeError] = (0,
|
|
4869
|
+
const [activeCropRatio, setActiveCropRatio] = (0, import_react29.useState)(null);
|
|
4870
|
+
const [selectionOptions, setSelectionOptions] = (0, import_react29.useState)(import_image_editor19.DEFAULT_SELECTION_TOOL_OPTIONS);
|
|
4871
|
+
const [shapeOptions, setShapeOptions] = (0, import_react29.useState)(import_image_editor19.DEFAULT_SHAPE_TOOL_OPTIONS);
|
|
4872
|
+
const [typeOptions, setTypeOptions] = (0, import_react29.useState)(import_image_editor19.DEFAULT_TYPE_TOOL_OPTIONS);
|
|
4873
|
+
const [typeSession, setTypeSession] = (0, import_react29.useState)(null);
|
|
4874
|
+
const [selectionError, setSelectionError] = (0, import_react29.useState)(null);
|
|
4875
|
+
const [paintError, setPaintError] = (0, import_react29.useState)(null);
|
|
4876
|
+
const [shapeTypeError, setShapeTypeError] = (0, import_react29.useState)(null);
|
|
4947
4877
|
const handleCanvasError = (source, message) => {
|
|
4948
4878
|
if (source === "paint") setPaintError(message);
|
|
4949
4879
|
else if (source === "select") setSelectionError(message);
|
|
4950
4880
|
else setShapeTypeError(message);
|
|
4951
4881
|
};
|
|
4952
4882
|
const finishTyping = () => setTypeSession(null);
|
|
4953
|
-
const transformToolRef = (0,
|
|
4954
|
-
const transformControllerRef = (0,
|
|
4883
|
+
const transformToolRef = (0, import_react29.useRef)(null);
|
|
4884
|
+
const transformControllerRef = (0, import_react29.useRef)(controller);
|
|
4955
4885
|
if (!transformToolRef.current || transformControllerRef.current !== controller) {
|
|
4956
4886
|
transformToolRef.current?.cancel();
|
|
4957
4887
|
transformToolRef.current = new import_image_editor19.FreeTransformTool(controller, {
|
|
@@ -4960,16 +4890,16 @@ var ImageEditor = ({
|
|
|
4960
4890
|
transformControllerRef.current = controller;
|
|
4961
4891
|
}
|
|
4962
4892
|
const transformTool = transformToolRef.current;
|
|
4963
|
-
const [, setTransformTick] = (0,
|
|
4964
|
-
(0,
|
|
4965
|
-
(0,
|
|
4966
|
-
const [inpaintPrompt, setInpaintPrompt] = (0,
|
|
4967
|
-
const [inpaintMaskMode, setInpaintMaskMode] = (0,
|
|
4968
|
-
const [isRemovingBg, setIsRemovingBg] = (0,
|
|
4969
|
-
const [isInpainting, setIsInpainting] = (0,
|
|
4970
|
-
const [aiError, setAiError] = (0,
|
|
4971
|
-
const [aiSuccess, setAiSuccess] = (0,
|
|
4972
|
-
const [aiTarget, setAiTarget] = (0,
|
|
4893
|
+
const [, setTransformTick] = (0, import_react29.useState)(0);
|
|
4894
|
+
(0, import_react29.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
|
|
4895
|
+
(0, import_react29.useEffect)(() => () => transformToolRef.current?.cancel(), []);
|
|
4896
|
+
const [inpaintPrompt, setInpaintPrompt] = (0, import_react29.useState)("");
|
|
4897
|
+
const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react29.useState)("annotations");
|
|
4898
|
+
const [isRemovingBg, setIsRemovingBg] = (0, import_react29.useState)(false);
|
|
4899
|
+
const [isInpainting, setIsInpainting] = (0, import_react29.useState)(false);
|
|
4900
|
+
const [aiError, setAiError] = (0, import_react29.useState)(null);
|
|
4901
|
+
const [aiSuccess, setAiSuccess] = (0, import_react29.useState)(null);
|
|
4902
|
+
const [aiTarget, setAiTarget] = (0, import_react29.useState)("auto");
|
|
4973
4903
|
const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
|
|
4974
4904
|
const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
|
|
4975
4905
|
const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
|
|
@@ -5032,11 +4962,11 @@ var ImageEditor = ({
|
|
|
5032
4962
|
setIsInpainting(false);
|
|
5033
4963
|
}
|
|
5034
4964
|
};
|
|
5035
|
-
const [activeColor, setActiveColor] = (0,
|
|
5036
|
-
const [strokeWidth, setStrokeWidth] = (0,
|
|
5037
|
-
const [fontSize, setFontSize] = (0,
|
|
5038
|
-
const [textInput, setTextInput] = (0,
|
|
5039
|
-
(0,
|
|
4965
|
+
const [activeColor, setActiveColor] = (0, import_react29.useState)("#ef4444");
|
|
4966
|
+
const [strokeWidth, setStrokeWidth] = (0, import_react29.useState)(3);
|
|
4967
|
+
const [fontSize, setFontSize] = (0, import_react29.useState)(24);
|
|
4968
|
+
const [textInput, setTextInput] = (0, import_react29.useState)("");
|
|
4969
|
+
(0, import_react29.useEffect)(() => {
|
|
5040
4970
|
if (activeTab === "crop" && editor.state.activeTool !== "crop") {
|
|
5041
4971
|
editor.setTool("crop");
|
|
5042
4972
|
}
|
|
@@ -5064,16 +4994,16 @@ var ImageEditor = ({
|
|
|
5064
4994
|
link.click();
|
|
5065
4995
|
}
|
|
5066
4996
|
};
|
|
5067
|
-
return /* @__PURE__ */ (0,
|
|
4997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
5068
4998
|
"div",
|
|
5069
4999
|
{
|
|
5070
5000
|
ref: rootRef,
|
|
5071
5001
|
className: `${imageEditorFrameClass} ${className}`,
|
|
5072
5002
|
style,
|
|
5073
5003
|
children: [
|
|
5074
|
-
/* @__PURE__ */ (0,
|
|
5075
|
-
/* @__PURE__ */ (0,
|
|
5076
|
-
/* @__PURE__ */ (0,
|
|
5004
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: imageEditorHeaderClass, children: [
|
|
5005
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
|
|
5006
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5077
5007
|
"button",
|
|
5078
5008
|
{
|
|
5079
5009
|
type: "button",
|
|
@@ -5088,7 +5018,7 @@ var ImageEditor = ({
|
|
|
5088
5018
|
children: "Transform & Crop"
|
|
5089
5019
|
}
|
|
5090
5020
|
),
|
|
5091
|
-
/* @__PURE__ */ (0,
|
|
5021
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5092
5022
|
"button",
|
|
5093
5023
|
{
|
|
5094
5024
|
type: "button",
|
|
@@ -5103,7 +5033,7 @@ var ImageEditor = ({
|
|
|
5103
5033
|
children: "Adjustments"
|
|
5104
5034
|
}
|
|
5105
5035
|
),
|
|
5106
|
-
/* @__PURE__ */ (0,
|
|
5036
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5107
5037
|
"button",
|
|
5108
5038
|
{
|
|
5109
5039
|
type: "button",
|
|
@@ -5118,7 +5048,7 @@ var ImageEditor = ({
|
|
|
5118
5048
|
children: "Layers"
|
|
5119
5049
|
}
|
|
5120
5050
|
),
|
|
5121
|
-
/* @__PURE__ */ (0,
|
|
5051
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5122
5052
|
"button",
|
|
5123
5053
|
{
|
|
5124
5054
|
type: "button",
|
|
@@ -5133,7 +5063,7 @@ var ImageEditor = ({
|
|
|
5133
5063
|
children: "Paint"
|
|
5134
5064
|
}
|
|
5135
5065
|
),
|
|
5136
|
-
/* @__PURE__ */ (0,
|
|
5066
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5137
5067
|
"button",
|
|
5138
5068
|
{
|
|
5139
5069
|
type: "button",
|
|
@@ -5148,7 +5078,7 @@ var ImageEditor = ({
|
|
|
5148
5078
|
children: "Select & Mask"
|
|
5149
5079
|
}
|
|
5150
5080
|
),
|
|
5151
|
-
/* @__PURE__ */ (0,
|
|
5081
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5152
5082
|
"button",
|
|
5153
5083
|
{
|
|
5154
5084
|
type: "button",
|
|
@@ -5163,7 +5093,7 @@ var ImageEditor = ({
|
|
|
5163
5093
|
children: "Annotations"
|
|
5164
5094
|
}
|
|
5165
5095
|
),
|
|
5166
|
-
/* @__PURE__ */ (0,
|
|
5096
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5167
5097
|
"button",
|
|
5168
5098
|
{
|
|
5169
5099
|
type: "button",
|
|
@@ -5178,7 +5108,7 @@ var ImageEditor = ({
|
|
|
5178
5108
|
children: "Depth Mask"
|
|
5179
5109
|
}
|
|
5180
5110
|
),
|
|
5181
|
-
/* @__PURE__ */ (0,
|
|
5111
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
5182
5112
|
"button",
|
|
5183
5113
|
{
|
|
5184
5114
|
type: "button",
|
|
@@ -5191,14 +5121,14 @@ var ImageEditor = ({
|
|
|
5191
5121
|
"aria-selected": activeTab === "ai",
|
|
5192
5122
|
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
5193
5123
|
children: [
|
|
5194
|
-
/* @__PURE__ */ (0,
|
|
5124
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
|
|
5195
5125
|
"AI Tools"
|
|
5196
5126
|
]
|
|
5197
5127
|
}
|
|
5198
5128
|
)
|
|
5199
5129
|
] }),
|
|
5200
|
-
/* @__PURE__ */ (0,
|
|
5201
|
-
/* @__PURE__ */ (0,
|
|
5130
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
5131
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5202
5132
|
"button",
|
|
5203
5133
|
{
|
|
5204
5134
|
type: "button",
|
|
@@ -5209,7 +5139,7 @@ var ImageEditor = ({
|
|
|
5209
5139
|
children: "\u21A9"
|
|
5210
5140
|
}
|
|
5211
5141
|
),
|
|
5212
|
-
/* @__PURE__ */ (0,
|
|
5142
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5213
5143
|
"button",
|
|
5214
5144
|
{
|
|
5215
5145
|
type: "button",
|
|
@@ -5220,7 +5150,7 @@ var ImageEditor = ({
|
|
|
5220
5150
|
children: "\u21AA"
|
|
5221
5151
|
}
|
|
5222
5152
|
),
|
|
5223
|
-
/* @__PURE__ */ (0,
|
|
5153
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5224
5154
|
"button",
|
|
5225
5155
|
{
|
|
5226
5156
|
type: "button",
|
|
@@ -5229,8 +5159,8 @@ var ImageEditor = ({
|
|
|
5229
5159
|
children: "Reset"
|
|
5230
5160
|
}
|
|
5231
5161
|
),
|
|
5232
|
-
/* @__PURE__ */ (0,
|
|
5233
|
-
/* @__PURE__ */ (0,
|
|
5162
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
5163
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5234
5164
|
"button",
|
|
5235
5165
|
{
|
|
5236
5166
|
type: "button",
|
|
@@ -5240,11 +5170,11 @@ var ImageEditor = ({
|
|
|
5240
5170
|
children: "-"
|
|
5241
5171
|
}
|
|
5242
5172
|
),
|
|
5243
|
-
/* @__PURE__ */ (0,
|
|
5173
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
5244
5174
|
Math.round(state.zoom * 100),
|
|
5245
5175
|
"%"
|
|
5246
5176
|
] }),
|
|
5247
|
-
/* @__PURE__ */ (0,
|
|
5177
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5248
5178
|
"button",
|
|
5249
5179
|
{
|
|
5250
5180
|
type: "button",
|
|
@@ -5254,8 +5184,8 @@ var ImageEditor = ({
|
|
|
5254
5184
|
children: "+"
|
|
5255
5185
|
}
|
|
5256
5186
|
),
|
|
5257
|
-
/* @__PURE__ */ (0,
|
|
5258
|
-
/* @__PURE__ */ (0,
|
|
5187
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
5188
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5259
5189
|
"button",
|
|
5260
5190
|
{
|
|
5261
5191
|
type: "button",
|
|
@@ -5266,7 +5196,7 @@ var ImageEditor = ({
|
|
|
5266
5196
|
children: "Hold Compare"
|
|
5267
5197
|
}
|
|
5268
5198
|
),
|
|
5269
|
-
/* @__PURE__ */ (0,
|
|
5199
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5270
5200
|
"button",
|
|
5271
5201
|
{
|
|
5272
5202
|
type: "button",
|
|
@@ -5277,10 +5207,10 @@ var ImageEditor = ({
|
|
|
5277
5207
|
)
|
|
5278
5208
|
] })
|
|
5279
5209
|
] }),
|
|
5280
|
-
transformTool.active && /* @__PURE__ */ (0,
|
|
5281
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */ (0,
|
|
5282
|
-
/* @__PURE__ */ (0,
|
|
5283
|
-
/* @__PURE__ */ (0,
|
|
5210
|
+
transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
5211
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
5212
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
5213
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5284
5214
|
ImageEditorCanvas,
|
|
5285
5215
|
{
|
|
5286
5216
|
editor,
|
|
@@ -5304,11 +5234,11 @@ var ImageEditor = ({
|
|
|
5304
5234
|
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
5305
5235
|
}
|
|
5306
5236
|
),
|
|
5307
|
-
/* @__PURE__ */ (0,
|
|
5308
|
-
activeTab === "crop" && /* @__PURE__ */ (0,
|
|
5309
|
-
/* @__PURE__ */ (0,
|
|
5310
|
-
/* @__PURE__ */ (0,
|
|
5311
|
-
/* @__PURE__ */ (0,
|
|
5237
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: imageSidebarClass, children: [
|
|
5238
|
+
activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5239
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
5240
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
5241
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5312
5242
|
"button",
|
|
5313
5243
|
{
|
|
5314
5244
|
type: "button",
|
|
@@ -5320,7 +5250,7 @@ var ImageEditor = ({
|
|
|
5320
5250
|
children: "Freeform"
|
|
5321
5251
|
}
|
|
5322
5252
|
),
|
|
5323
|
-
/* @__PURE__ */ (0,
|
|
5253
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5324
5254
|
"button",
|
|
5325
5255
|
{
|
|
5326
5256
|
type: "button",
|
|
@@ -5332,7 +5262,7 @@ var ImageEditor = ({
|
|
|
5332
5262
|
children: "1:1 Square"
|
|
5333
5263
|
}
|
|
5334
5264
|
),
|
|
5335
|
-
/* @__PURE__ */ (0,
|
|
5265
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5336
5266
|
"button",
|
|
5337
5267
|
{
|
|
5338
5268
|
type: "button",
|
|
@@ -5344,7 +5274,7 @@ var ImageEditor = ({
|
|
|
5344
5274
|
children: "4:3 Standard"
|
|
5345
5275
|
}
|
|
5346
5276
|
),
|
|
5347
|
-
/* @__PURE__ */ (0,
|
|
5277
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5348
5278
|
"button",
|
|
5349
5279
|
{
|
|
5350
5280
|
type: "button",
|
|
@@ -5356,7 +5286,7 @@ var ImageEditor = ({
|
|
|
5356
5286
|
children: "16:9 Wide"
|
|
5357
5287
|
}
|
|
5358
5288
|
),
|
|
5359
|
-
/* @__PURE__ */ (0,
|
|
5289
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5360
5290
|
"button",
|
|
5361
5291
|
{
|
|
5362
5292
|
type: "button",
|
|
@@ -5368,7 +5298,7 @@ var ImageEditor = ({
|
|
|
5368
5298
|
children: "3:2 Photo"
|
|
5369
5299
|
}
|
|
5370
5300
|
),
|
|
5371
|
-
/* @__PURE__ */ (0,
|
|
5301
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5372
5302
|
"button",
|
|
5373
5303
|
{
|
|
5374
5304
|
type: "button",
|
|
@@ -5381,10 +5311,10 @@ var ImageEditor = ({
|
|
|
5381
5311
|
}
|
|
5382
5312
|
)
|
|
5383
5313
|
] }),
|
|
5384
|
-
/* @__PURE__ */ (0,
|
|
5385
|
-
/* @__PURE__ */ (0,
|
|
5386
|
-
/* @__PURE__ */ (0,
|
|
5387
|
-
/* @__PURE__ */ (0,
|
|
5314
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: imageDividerClass }),
|
|
5315
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
5316
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
5317
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5388
5318
|
"button",
|
|
5389
5319
|
{
|
|
5390
5320
|
type: "button",
|
|
@@ -5393,7 +5323,7 @@ var ImageEditor = ({
|
|
|
5393
5323
|
children: "Rotate -90\xB0"
|
|
5394
5324
|
}
|
|
5395
5325
|
),
|
|
5396
|
-
/* @__PURE__ */ (0,
|
|
5326
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5397
5327
|
"button",
|
|
5398
5328
|
{
|
|
5399
5329
|
type: "button",
|
|
@@ -5402,7 +5332,7 @@ var ImageEditor = ({
|
|
|
5402
5332
|
children: "Rotate +90\xB0"
|
|
5403
5333
|
}
|
|
5404
5334
|
),
|
|
5405
|
-
/* @__PURE__ */ (0,
|
|
5335
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5406
5336
|
"button",
|
|
5407
5337
|
{
|
|
5408
5338
|
type: "button",
|
|
@@ -5411,7 +5341,7 @@ var ImageEditor = ({
|
|
|
5411
5341
|
children: "Flip Horizontal"
|
|
5412
5342
|
}
|
|
5413
5343
|
),
|
|
5414
|
-
/* @__PURE__ */ (0,
|
|
5344
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5415
5345
|
"button",
|
|
5416
5346
|
{
|
|
5417
5347
|
type: "button",
|
|
@@ -5422,10 +5352,10 @@ var ImageEditor = ({
|
|
|
5422
5352
|
)
|
|
5423
5353
|
] })
|
|
5424
5354
|
] }),
|
|
5425
|
-
activeTab === "adjust" && /* @__PURE__ */ (0,
|
|
5426
|
-
/* @__PURE__ */ (0,
|
|
5427
|
-
/* @__PURE__ */ (0,
|
|
5428
|
-
/* @__PURE__ */ (0,
|
|
5355
|
+
activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5356
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5357
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
5358
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5429
5359
|
"button",
|
|
5430
5360
|
{
|
|
5431
5361
|
type: "button",
|
|
@@ -5435,9 +5365,9 @@ var ImageEditor = ({
|
|
|
5435
5365
|
}
|
|
5436
5366
|
)
|
|
5437
5367
|
] }),
|
|
5438
|
-
/* @__PURE__ */ (0,
|
|
5439
|
-
import_image_editor19.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0,
|
|
5440
|
-
/* @__PURE__ */ (0,
|
|
5368
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Histogram, { histogram: editor.histogram }),
|
|
5369
|
+
import_image_editor19.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_react29.default.Fragment, { children: [
|
|
5370
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5441
5371
|
ControlSlider,
|
|
5442
5372
|
{
|
|
5443
5373
|
spec,
|
|
@@ -5446,14 +5376,14 @@ var ImageEditor = ({
|
|
|
5446
5376
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
5447
5377
|
}
|
|
5448
5378
|
),
|
|
5449
|
-
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0,
|
|
5379
|
+
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
5450
5380
|
"div",
|
|
5451
5381
|
{
|
|
5452
5382
|
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",
|
|
5453
5383
|
"data-testid": "image-editor-process-notice",
|
|
5454
5384
|
children: [
|
|
5455
|
-
/* @__PURE__ */ (0,
|
|
5456
|
-
/* @__PURE__ */ (0,
|
|
5385
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
5386
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5457
5387
|
"button",
|
|
5458
5388
|
{
|
|
5459
5389
|
type: "button",
|
|
@@ -5466,7 +5396,7 @@ var ImageEditor = ({
|
|
|
5466
5396
|
}
|
|
5467
5397
|
)
|
|
5468
5398
|
] }, spec.id)),
|
|
5469
|
-
/* @__PURE__ */ (0,
|
|
5399
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5470
5400
|
AdjustmentLayersPanel,
|
|
5471
5401
|
{
|
|
5472
5402
|
controller,
|
|
@@ -5475,9 +5405,9 @@ var ImageEditor = ({
|
|
|
5475
5405
|
}
|
|
5476
5406
|
) })
|
|
5477
5407
|
] }),
|
|
5478
|
-
activeTab === "layers" && /* @__PURE__ */ (0,
|
|
5479
|
-
/* @__PURE__ */ (0,
|
|
5480
|
-
/* @__PURE__ */ (0,
|
|
5408
|
+
activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5409
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
5410
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5481
5411
|
"button",
|
|
5482
5412
|
{
|
|
5483
5413
|
type: "button",
|
|
@@ -5488,15 +5418,15 @@ var ImageEditor = ({
|
|
|
5488
5418
|
children: "Free Transform"
|
|
5489
5419
|
}
|
|
5490
5420
|
),
|
|
5491
|
-
/* @__PURE__ */ (0,
|
|
5492
|
-
effectsShown && /* @__PURE__ */ (0,
|
|
5493
|
-
/* @__PURE__ */ (0,
|
|
5494
|
-
/* @__PURE__ */ (0,
|
|
5421
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(LayersPanel, { controller }),
|
|
5422
|
+
effectsShown && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
5423
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
5424
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ColorProfilePanel, { controller })
|
|
5495
5425
|
] }),
|
|
5496
|
-
activeTab === "paint" && /* @__PURE__ */ (0,
|
|
5497
|
-
/* @__PURE__ */ (0,
|
|
5498
|
-
/* @__PURE__ */ (0,
|
|
5499
|
-
/* @__PURE__ */ (0,
|
|
5426
|
+
activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5427
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
5428
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(BrushOptionsBar, { controller }),
|
|
5429
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5500
5430
|
"button",
|
|
5501
5431
|
{
|
|
5502
5432
|
type: "button",
|
|
@@ -5507,12 +5437,12 @@ var ImageEditor = ({
|
|
|
5507
5437
|
children: "Free Transform"
|
|
5508
5438
|
}
|
|
5509
5439
|
),
|
|
5510
|
-
paintError && /* @__PURE__ */ (0,
|
|
5511
|
-
/* @__PURE__ */ (0,
|
|
5440
|
+
paintError && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
5441
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(LayersPanel, { controller }) })
|
|
5512
5442
|
] }),
|
|
5513
|
-
activeTab === "annotate" && /* @__PURE__ */ (0,
|
|
5514
|
-
/* @__PURE__ */ (0,
|
|
5515
|
-
/* @__PURE__ */ (0,
|
|
5443
|
+
activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5444
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
|
|
5445
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5516
5446
|
"button",
|
|
5517
5447
|
{
|
|
5518
5448
|
type: "button",
|
|
@@ -5523,13 +5453,13 @@ var ImageEditor = ({
|
|
|
5523
5453
|
},
|
|
5524
5454
|
t
|
|
5525
5455
|
)) }),
|
|
5526
|
-
state.activeTool === "shape" && /* @__PURE__ */ (0,
|
|
5527
|
-
state.activeTool === "type" && /* @__PURE__ */ (0,
|
|
5528
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0,
|
|
5529
|
-
shapeTypeError && /* @__PURE__ */ (0,
|
|
5530
|
-
/* @__PURE__ */ (0,
|
|
5531
|
-
/* @__PURE__ */ (0,
|
|
5532
|
-
/* @__PURE__ */ (0,
|
|
5456
|
+
state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
5457
|
+
state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
|
|
5458
|
+
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-muted px-2 py-1 text-[11px] text-foreground hover:bg-accent", children: "Done editing text" }),
|
|
5459
|
+
shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
5460
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: imageDividerClass }),
|
|
5461
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
5462
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5533
5463
|
"button",
|
|
5534
5464
|
{
|
|
5535
5465
|
type: "button",
|
|
@@ -5539,9 +5469,9 @@ var ImageEditor = ({
|
|
|
5539
5469
|
},
|
|
5540
5470
|
t
|
|
5541
5471
|
)) }),
|
|
5542
|
-
/* @__PURE__ */ (0,
|
|
5543
|
-
/* @__PURE__ */ (0,
|
|
5544
|
-
/* @__PURE__ */ (0,
|
|
5472
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
5473
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
5474
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5545
5475
|
"input",
|
|
5546
5476
|
{
|
|
5547
5477
|
type: "color",
|
|
@@ -5550,15 +5480,15 @@ var ImageEditor = ({
|
|
|
5550
5480
|
className: "w-8 h-8 rounded border border-border cursor-pointer bg-transparent"
|
|
5551
5481
|
}
|
|
5552
5482
|
),
|
|
5553
|
-
/* @__PURE__ */ (0,
|
|
5554
|
-
/* @__PURE__ */ (0,
|
|
5555
|
-
/* @__PURE__ */ (0,
|
|
5556
|
-
/* @__PURE__ */ (0,
|
|
5483
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex-1 ml-2", children: [
|
|
5484
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
5485
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Width:" }),
|
|
5486
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-mono", children: [
|
|
5557
5487
|
strokeWidth,
|
|
5558
5488
|
"px"
|
|
5559
5489
|
] })
|
|
5560
5490
|
] }),
|
|
5561
|
-
/* @__PURE__ */ (0,
|
|
5491
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5562
5492
|
"input",
|
|
5563
5493
|
{
|
|
5564
5494
|
type: "range",
|
|
@@ -5571,10 +5501,10 @@ var ImageEditor = ({
|
|
|
5571
5501
|
)
|
|
5572
5502
|
] })
|
|
5573
5503
|
] }),
|
|
5574
|
-
/* @__PURE__ */ (0,
|
|
5575
|
-
/* @__PURE__ */ (0,
|
|
5576
|
-
/* @__PURE__ */ (0,
|
|
5577
|
-
/* @__PURE__ */ (0,
|
|
5504
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: imageDividerClass }),
|
|
5505
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
5506
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex gap-2", children: [
|
|
5507
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5578
5508
|
"input",
|
|
5579
5509
|
{
|
|
5580
5510
|
type: "text",
|
|
@@ -5585,7 +5515,7 @@ var ImageEditor = ({
|
|
|
5585
5515
|
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"
|
|
5586
5516
|
}
|
|
5587
5517
|
),
|
|
5588
|
-
/* @__PURE__ */ (0,
|
|
5518
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5589
5519
|
"button",
|
|
5590
5520
|
{
|
|
5591
5521
|
type: "button",
|
|
@@ -5595,14 +5525,14 @@ var ImageEditor = ({
|
|
|
5595
5525
|
}
|
|
5596
5526
|
)
|
|
5597
5527
|
] }),
|
|
5598
|
-
/* @__PURE__ */ (0,
|
|
5599
|
-
/* @__PURE__ */ (0,
|
|
5600
|
-
/* @__PURE__ */ (0,
|
|
5528
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
5529
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Font Size:" }),
|
|
5530
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-mono", children: [
|
|
5601
5531
|
fontSize,
|
|
5602
5532
|
"px"
|
|
5603
5533
|
] })
|
|
5604
5534
|
] }),
|
|
5605
|
-
/* @__PURE__ */ (0,
|
|
5535
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5606
5536
|
"input",
|
|
5607
5537
|
{
|
|
5608
5538
|
type: "range",
|
|
@@ -5613,14 +5543,14 @@ var ImageEditor = ({
|
|
|
5613
5543
|
className: imageRangeClass
|
|
5614
5544
|
}
|
|
5615
5545
|
),
|
|
5616
|
-
/* @__PURE__ */ (0,
|
|
5617
|
-
/* @__PURE__ */ (0,
|
|
5618
|
-
/* @__PURE__ */ (0,
|
|
5546
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: imageDividerClass }),
|
|
5547
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5548
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
5619
5549
|
"Layers (",
|
|
5620
5550
|
state.annotations.length,
|
|
5621
5551
|
")"
|
|
5622
5552
|
] }),
|
|
5623
|
-
state.selectedAnnotationId && /* @__PURE__ */ (0,
|
|
5553
|
+
state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5624
5554
|
"button",
|
|
5625
5555
|
{
|
|
5626
5556
|
type: "button",
|
|
@@ -5629,7 +5559,7 @@ var ImageEditor = ({
|
|
|
5629
5559
|
children: "Delete Selected"
|
|
5630
5560
|
}
|
|
5631
5561
|
),
|
|
5632
|
-
state.annotations.length > 0 && /* @__PURE__ */ (0,
|
|
5562
|
+
state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5633
5563
|
"button",
|
|
5634
5564
|
{
|
|
5635
5565
|
type: "button",
|
|
@@ -5640,10 +5570,10 @@ var ImageEditor = ({
|
|
|
5640
5570
|
)
|
|
5641
5571
|
] })
|
|
5642
5572
|
] }),
|
|
5643
|
-
activeTab === "depth" && /* @__PURE__ */ (0,
|
|
5644
|
-
/* @__PURE__ */ (0,
|
|
5645
|
-
/* @__PURE__ */ (0,
|
|
5646
|
-
/* @__PURE__ */ (0,
|
|
5573
|
+
activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5574
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5575
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
5576
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5647
5577
|
"button",
|
|
5648
5578
|
{
|
|
5649
5579
|
type: "button",
|
|
@@ -5653,8 +5583,8 @@ var ImageEditor = ({
|
|
|
5653
5583
|
}
|
|
5654
5584
|
)
|
|
5655
5585
|
] }),
|
|
5656
|
-
/* @__PURE__ */ (0,
|
|
5657
|
-
/* @__PURE__ */ (0,
|
|
5586
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
5587
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5658
5588
|
"input",
|
|
5659
5589
|
{
|
|
5660
5590
|
type: "checkbox",
|
|
@@ -5663,12 +5593,12 @@ var ImageEditor = ({
|
|
|
5663
5593
|
className: "rounded accent-primary"
|
|
5664
5594
|
}
|
|
5665
5595
|
),
|
|
5666
|
-
/* @__PURE__ */ (0,
|
|
5596
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Enable Depth / Alpha Mask" })
|
|
5667
5597
|
] }),
|
|
5668
|
-
state.depthMask.enabled && /* @__PURE__ */ (0,
|
|
5669
|
-
/* @__PURE__ */ (0,
|
|
5670
|
-
/* @__PURE__ */ (0,
|
|
5671
|
-
/* @__PURE__ */ (0,
|
|
5598
|
+
state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
5599
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { children: [
|
|
5600
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
5601
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5672
5602
|
"input",
|
|
5673
5603
|
{
|
|
5674
5604
|
type: "text",
|
|
@@ -5679,8 +5609,8 @@ var ImageEditor = ({
|
|
|
5679
5609
|
}
|
|
5680
5610
|
)
|
|
5681
5611
|
] }),
|
|
5682
|
-
/* @__PURE__ */ (0,
|
|
5683
|
-
/* @__PURE__ */ (0,
|
|
5612
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex gap-2", children: [
|
|
5613
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5684
5614
|
"button",
|
|
5685
5615
|
{
|
|
5686
5616
|
type: "button",
|
|
@@ -5689,7 +5619,7 @@ var ImageEditor = ({
|
|
|
5689
5619
|
children: "Threshold Mode"
|
|
5690
5620
|
}
|
|
5691
5621
|
),
|
|
5692
|
-
/* @__PURE__ */ (0,
|
|
5622
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5693
5623
|
"button",
|
|
5694
5624
|
{
|
|
5695
5625
|
type: "button",
|
|
@@ -5699,12 +5629,12 @@ var ImageEditor = ({
|
|
|
5699
5629
|
}
|
|
5700
5630
|
)
|
|
5701
5631
|
] }),
|
|
5702
|
-
/* @__PURE__ */ (0,
|
|
5703
|
-
/* @__PURE__ */ (0,
|
|
5704
|
-
/* @__PURE__ */ (0,
|
|
5705
|
-
/* @__PURE__ */ (0,
|
|
5632
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { children: [
|
|
5633
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5634
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Depth Start (Lower):" }),
|
|
5635
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
5706
5636
|
] }),
|
|
5707
|
-
/* @__PURE__ */ (0,
|
|
5637
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5708
5638
|
"input",
|
|
5709
5639
|
{
|
|
5710
5640
|
type: "range",
|
|
@@ -5718,12 +5648,12 @@ var ImageEditor = ({
|
|
|
5718
5648
|
}
|
|
5719
5649
|
)
|
|
5720
5650
|
] }),
|
|
5721
|
-
/* @__PURE__ */ (0,
|
|
5722
|
-
/* @__PURE__ */ (0,
|
|
5723
|
-
/* @__PURE__ */ (0,
|
|
5724
|
-
/* @__PURE__ */ (0,
|
|
5651
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { children: [
|
|
5652
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5653
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Depth Stop (Upper):" }),
|
|
5654
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
5725
5655
|
] }),
|
|
5726
|
-
/* @__PURE__ */ (0,
|
|
5656
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5727
5657
|
"input",
|
|
5728
5658
|
{
|
|
5729
5659
|
type: "range",
|
|
@@ -5737,12 +5667,12 @@ var ImageEditor = ({
|
|
|
5737
5667
|
}
|
|
5738
5668
|
)
|
|
5739
5669
|
] }),
|
|
5740
|
-
/* @__PURE__ */ (0,
|
|
5741
|
-
/* @__PURE__ */ (0,
|
|
5742
|
-
/* @__PURE__ */ (0,
|
|
5743
|
-
/* @__PURE__ */ (0,
|
|
5670
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { children: [
|
|
5671
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5672
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Softness:" }),
|
|
5673
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
|
|
5744
5674
|
] }),
|
|
5745
|
-
/* @__PURE__ */ (0,
|
|
5675
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5746
5676
|
"input",
|
|
5747
5677
|
{
|
|
5748
5678
|
type: "range",
|
|
@@ -5754,8 +5684,8 @@ var ImageEditor = ({
|
|
|
5754
5684
|
}
|
|
5755
5685
|
)
|
|
5756
5686
|
] }),
|
|
5757
|
-
/* @__PURE__ */ (0,
|
|
5758
|
-
/* @__PURE__ */ (0,
|
|
5687
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
5688
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5759
5689
|
"input",
|
|
5760
5690
|
{
|
|
5761
5691
|
type: "checkbox",
|
|
@@ -5764,12 +5694,12 @@ var ImageEditor = ({
|
|
|
5764
5694
|
className: "rounded accent-primary"
|
|
5765
5695
|
}
|
|
5766
5696
|
),
|
|
5767
|
-
/* @__PURE__ */ (0,
|
|
5697
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Invert Mask" })
|
|
5768
5698
|
] })
|
|
5769
5699
|
] })
|
|
5770
5700
|
] }),
|
|
5771
|
-
activeTab === "select" && /* @__PURE__ */ (0,
|
|
5772
|
-
/* @__PURE__ */ (0,
|
|
5701
|
+
activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5702
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5773
5703
|
SelectionOptionsBar,
|
|
5774
5704
|
{
|
|
5775
5705
|
controller,
|
|
@@ -5779,9 +5709,9 @@ var ImageEditor = ({
|
|
|
5779
5709
|
quickMask: Boolean(state.quickMask)
|
|
5780
5710
|
}
|
|
5781
5711
|
),
|
|
5782
|
-
selectionError && /* @__PURE__ */ (0,
|
|
5783
|
-
/* @__PURE__ */ (0,
|
|
5784
|
-
/* @__PURE__ */ (0,
|
|
5712
|
+
selectionError && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
5713
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex gap-1", children: [
|
|
5714
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5785
5715
|
"button",
|
|
5786
5716
|
{
|
|
5787
5717
|
type: "button",
|
|
@@ -5792,7 +5722,7 @@ var ImageEditor = ({
|
|
|
5792
5722
|
children: "Transform Selection"
|
|
5793
5723
|
}
|
|
5794
5724
|
),
|
|
5795
|
-
/* @__PURE__ */ (0,
|
|
5725
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5796
5726
|
"button",
|
|
5797
5727
|
{
|
|
5798
5728
|
type: "button",
|
|
@@ -5804,12 +5734,12 @@ var ImageEditor = ({
|
|
|
5804
5734
|
}
|
|
5805
5735
|
)
|
|
5806
5736
|
] }),
|
|
5807
|
-
/* @__PURE__ */ (0,
|
|
5737
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers })
|
|
5808
5738
|
] }),
|
|
5809
|
-
activeTab === "ai" && /* @__PURE__ */ (0,
|
|
5810
|
-
/* @__PURE__ */ (0,
|
|
5811
|
-
/* @__PURE__ */ (0,
|
|
5812
|
-
/* @__PURE__ */ (0,
|
|
5739
|
+
activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5740
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
5741
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Results go to" }),
|
|
5742
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
5813
5743
|
"select",
|
|
5814
5744
|
{
|
|
5815
5745
|
"aria-label": "AI result target",
|
|
@@ -5817,54 +5747,54 @@ var ImageEditor = ({
|
|
|
5817
5747
|
onChange: (e) => setAiTarget(e.target.value),
|
|
5818
5748
|
className: imageSelectClass,
|
|
5819
5749
|
children: [
|
|
5820
|
-
/* @__PURE__ */ (0,
|
|
5821
|
-
/* @__PURE__ */ (0,
|
|
5822
|
-
/* @__PURE__ */ (0,
|
|
5750
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
5751
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
|
|
5752
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "replace", children: "Replace image" })
|
|
5823
5753
|
]
|
|
5824
5754
|
}
|
|
5825
5755
|
)
|
|
5826
5756
|
] }),
|
|
5827
|
-
/* @__PURE__ */ (0,
|
|
5828
|
-
/* @__PURE__ */ (0,
|
|
5829
|
-
/* @__PURE__ */ (0,
|
|
5830
|
-
/* @__PURE__ */ (0,
|
|
5757
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
5758
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5759
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
5760
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" }) }),
|
|
5831
5761
|
"Background Removal"
|
|
5832
5762
|
] }),
|
|
5833
|
-
isRemovingBg && /* @__PURE__ */ (0,
|
|
5763
|
+
isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Removing..." })
|
|
5834
5764
|
] }),
|
|
5835
|
-
/* @__PURE__ */ (0,
|
|
5836
|
-
/* @__PURE__ */ (0,
|
|
5765
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
5766
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5837
5767
|
"button",
|
|
5838
5768
|
{
|
|
5839
5769
|
type: "button",
|
|
5840
5770
|
onClick: handleRemoveBackground,
|
|
5841
5771
|
disabled: isRemovingBg || isInpainting,
|
|
5842
5772
|
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",
|
|
5843
|
-
children: isRemovingBg ? /* @__PURE__ */ (0,
|
|
5844
|
-
/* @__PURE__ */ (0,
|
|
5773
|
+
children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
5774
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: imageSpinnerClass }),
|
|
5845
5775
|
"Removing Background..."
|
|
5846
|
-
] }) : /* @__PURE__ */ (0,
|
|
5847
|
-
/* @__PURE__ */ (0,
|
|
5776
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
5777
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
|
|
5848
5778
|
"Remove Background"
|
|
5849
5779
|
] })
|
|
5850
5780
|
}
|
|
5851
5781
|
)
|
|
5852
5782
|
] }),
|
|
5853
|
-
/* @__PURE__ */ (0,
|
|
5854
|
-
/* @__PURE__ */ (0,
|
|
5855
|
-
/* @__PURE__ */ (0,
|
|
5856
|
-
/* @__PURE__ */ (0,
|
|
5857
|
-
/* @__PURE__ */ (0,
|
|
5858
|
-
/* @__PURE__ */ (0,
|
|
5783
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
5784
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5785
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
5786
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
5787
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "m21.64 3.64-1.28-1.28a1.2 1.2 0 0 0-1.7 0l-9.72 9.72-1.94 4.86 4.86-1.94 9.72-9.72a1.2 1.2 0 0 0 .06-1.64z" }),
|
|
5788
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "m14 7 3 3" })
|
|
5859
5789
|
] }),
|
|
5860
5790
|
"Generative Inpainting"
|
|
5861
5791
|
] }),
|
|
5862
|
-
isInpainting && /* @__PURE__ */ (0,
|
|
5792
|
+
isInpainting && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Inpainting..." })
|
|
5863
5793
|
] }),
|
|
5864
|
-
/* @__PURE__ */ (0,
|
|
5865
|
-
/* @__PURE__ */ (0,
|
|
5866
|
-
/* @__PURE__ */ (0,
|
|
5867
|
-
/* @__PURE__ */ (0,
|
|
5794
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
|
|
5795
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
5796
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
5797
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5868
5798
|
"textarea",
|
|
5869
5799
|
{
|
|
5870
5800
|
id: "ai-inpaint-prompt-react",
|
|
@@ -5876,10 +5806,10 @@ var ImageEditor = ({
|
|
|
5876
5806
|
}
|
|
5877
5807
|
)
|
|
5878
5808
|
] }),
|
|
5879
|
-
/* @__PURE__ */ (0,
|
|
5880
|
-
/* @__PURE__ */ (0,
|
|
5881
|
-
/* @__PURE__ */ (0,
|
|
5882
|
-
/* @__PURE__ */ (0,
|
|
5809
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
5810
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
5811
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
5812
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
5883
5813
|
"button",
|
|
5884
5814
|
{
|
|
5885
5815
|
type: "button",
|
|
@@ -5892,7 +5822,7 @@ var ImageEditor = ({
|
|
|
5892
5822
|
]
|
|
5893
5823
|
}
|
|
5894
5824
|
),
|
|
5895
|
-
/* @__PURE__ */ (0,
|
|
5825
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
5896
5826
|
"button",
|
|
5897
5827
|
{
|
|
5898
5828
|
type: "button",
|
|
@@ -5907,25 +5837,25 @@ var ImageEditor = ({
|
|
|
5907
5837
|
)
|
|
5908
5838
|
] })
|
|
5909
5839
|
] }),
|
|
5910
|
-
/* @__PURE__ */ (0,
|
|
5840
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5911
5841
|
"button",
|
|
5912
5842
|
{
|
|
5913
5843
|
type: "button",
|
|
5914
5844
|
onClick: handleInpaint,
|
|
5915
5845
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
5916
5846
|
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",
|
|
5917
|
-
children: isInpainting ? /* @__PURE__ */ (0,
|
|
5918
|
-
/* @__PURE__ */ (0,
|
|
5847
|
+
children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
5848
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: imageSpinnerClass }),
|
|
5919
5849
|
"Generating Inpaint..."
|
|
5920
|
-
] }) : /* @__PURE__ */ (0,
|
|
5921
|
-
/* @__PURE__ */ (0,
|
|
5850
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
5851
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
|
|
5922
5852
|
"Apply Inpainting"
|
|
5923
5853
|
] })
|
|
5924
5854
|
}
|
|
5925
5855
|
)
|
|
5926
5856
|
] }),
|
|
5927
|
-
aiError && /* @__PURE__ */ (0,
|
|
5928
|
-
aiSuccess && /* @__PURE__ */ (0,
|
|
5857
|
+
aiError && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
|
|
5858
|
+
aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
|
|
5929
5859
|
] })
|
|
5930
5860
|
] })
|
|
5931
5861
|
] })
|
|
@@ -5942,10 +5872,14 @@ var ImageEditor = ({
|
|
|
5942
5872
|
CurvesEditor,
|
|
5943
5873
|
FreeTransformOptionsBar,
|
|
5944
5874
|
Histogram,
|
|
5875
|
+
ImageCheckbox,
|
|
5945
5876
|
ImageEditor,
|
|
5946
5877
|
ImageEditorCanvas,
|
|
5878
|
+
ImageEditorControlsProvider,
|
|
5947
5879
|
ImageEffectControls,
|
|
5948
5880
|
ImageProviderEffectsPanel,
|
|
5881
|
+
ImageRange,
|
|
5882
|
+
ImageSelect,
|
|
5949
5883
|
LayerEffectsPanel,
|
|
5950
5884
|
LayersPanel,
|
|
5951
5885
|
PaintGradientEditor,
|
|
@@ -5954,6 +5888,7 @@ var ImageEditor = ({
|
|
|
5954
5888
|
ShapeOptionsBar,
|
|
5955
5889
|
TypeOptionsBar,
|
|
5956
5890
|
useImageEditor,
|
|
5891
|
+
useImageEditorControls,
|
|
5957
5892
|
useImageEffectsTools,
|
|
5958
5893
|
useImageHistogram
|
|
5959
5894
|
});
|