@pixerate/editor-react 0.91.1 → 0.93.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animation-editor/AnimationEditor.d.cts +11 -1
- package/dist/animation-editor/AnimationEditor.d.ts +11 -1
- package/dist/animation-editor/index.cjs +494 -366
- package/dist/animation-editor/index.js +48 -4
- package/dist/canvas/AgentPresenceLayer.d.cts +3 -0
- package/dist/canvas/AgentPresenceLayer.d.ts +3 -0
- package/dist/canvas/index.cjs +1033 -893
- package/dist/canvas/index.d.cts +2 -0
- package/dist/canvas/index.d.ts +2 -0
- package/dist/canvas/index.js +125 -74
- package/dist/canvas/useCanvasPlaybackSurface.d.cts +28 -0
- package/dist/canvas/useCanvasPlaybackSurface.d.ts +28 -0
- package/dist/chart/ChartEditor.d.cts +12 -1
- package/dist/chart/ChartEditor.d.ts +12 -1
- package/dist/chart/index.cjs +187 -29
- package/dist/chart/index.js +74 -10
- package/dist/{chunk-SMMO7CZB.js → chunk-6YRSQW2V.js} +84 -2
- package/dist/chunk-7I73DW4V.js +43 -0
- package/dist/{chunk-GML6BYCN.js → chunk-GECXTPSH.js} +53 -3
- package/dist/chunk-IPVWWVSF.js +96 -0
- package/dist/hooks/useAgentToolProvider.d.cts +6 -2
- package/dist/hooks/useAgentToolProvider.d.ts +6 -2
- package/dist/image-editor/ImageEditor.d.cts +10 -0
- package/dist/image-editor/ImageEditor.d.ts +10 -0
- package/dist/image-editor/index.cjs +1028 -864
- package/dist/image-editor/index.js +2 -1
- package/dist/index.cjs +2070 -1812
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +21 -3
- package/dist/paint-editor/PaintEditor.d.cts +12 -1
- package/dist/paint-editor/PaintEditor.d.ts +12 -1
- package/dist/paint-editor/index.cjs +319 -164
- package/dist/paint-editor/index.js +84 -11
- package/dist/parameters/ParametersPanel.d.cts +11 -1
- package/dist/parameters/ParametersPanel.d.ts +11 -1
- package/dist/parameters/index.cjs +190 -41
- package/dist/parameters/index.js +23 -4
- package/dist/playback/AgentPlaybackContext.d.cts +9 -0
- package/dist/playback/AgentPlaybackContext.d.ts +9 -0
- package/dist/playback/PresenceLayer.d.cts +28 -0
- package/dist/playback/PresenceLayer.d.ts +28 -0
- package/dist/playback/index.d.cts +4 -0
- package/dist/playback/index.d.ts +4 -0
- package/dist/playback/useElementPlaybackSurface.d.cts +19 -0
- package/dist/playback/useElementPlaybackSurface.d.ts +19 -0
- package/dist/playback/usePlaybackSurface.d.cts +11 -0
- package/dist/playback/usePlaybackSurface.d.ts +11 -0
- package/dist/spreadsheet/SpreadsheetEditor.d.cts +10 -0
- package/dist/spreadsheet/SpreadsheetEditor.d.ts +10 -0
- package/dist/spreadsheet/index.cjs +443 -313
- package/dist/spreadsheet/index.js +2 -1
- package/dist/vector/VectorCanvas.d.cts +11 -1
- package/dist/vector/VectorCanvas.d.ts +11 -1
- package/dist/vector/index.cjs +946 -826
- package/dist/vector/index.js +42 -3
- package/dist/video-editor/VideoEditor.d.cts +6 -1
- package/dist/video-editor/VideoEditor.d.ts +6 -1
- package/dist/video-editor/VideoTimeline.d.cts +11 -1
- package/dist/video-editor/VideoTimeline.d.ts +11 -1
- package/dist/video-editor/index.cjs +463 -332
- package/dist/video-editor/index.js +53 -5
- package/package.json +3 -3
|
@@ -218,21 +218,110 @@ function useImageEffectsTools(registry, controller, options = {}) {
|
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
// src/image-editor/ImageEditor.tsx
|
|
221
|
-
var
|
|
221
|
+
var import_react24 = __toESM(require("react"), 1);
|
|
222
|
+
|
|
223
|
+
// src/playback/AgentPlaybackContext.tsx
|
|
224
|
+
var import_react2 = require("react");
|
|
225
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
226
|
+
var AgentPlaybackContext = (0, import_react2.createContext)(null);
|
|
227
|
+
function useAgentPlayback() {
|
|
228
|
+
return (0, import_react2.useContext)(AgentPlaybackContext);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// src/playback/usePlaybackSurface.ts
|
|
232
|
+
var import_react3 = require("react");
|
|
233
|
+
var import_tools = require("@pixerate/editor/tools");
|
|
234
|
+
function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
|
|
235
|
+
const ambient = useAgentPlayback();
|
|
236
|
+
const target = playback === void 0 ? ambient : playback;
|
|
237
|
+
const [ownPresence] = (0, import_react3.useState)(() => new import_tools.PresenceStore());
|
|
238
|
+
const presence = sharedPresence ?? ownPresence;
|
|
239
|
+
const latest = (0, import_react3.useRef)(options);
|
|
240
|
+
latest.current = options;
|
|
241
|
+
(0, import_react3.useEffect)(() => {
|
|
242
|
+
if (!target || !id) return;
|
|
243
|
+
const o = () => latest.current;
|
|
244
|
+
const surface = {
|
|
245
|
+
presence,
|
|
246
|
+
locate: (ref) => o().locate?.(ref) ?? null,
|
|
247
|
+
bounds: () => o().bounds?.() ?? null,
|
|
248
|
+
visible: () => o().visible?.() ?? true,
|
|
249
|
+
toViewport: (p) => o().toViewport?.(p) ?? p,
|
|
250
|
+
fromViewport: (p) => o().fromViewport?.(p) ?? p,
|
|
251
|
+
beginGesture: (key) => o().beginGesture?.(key),
|
|
252
|
+
endGesture: () => o().endGesture?.(),
|
|
253
|
+
reveal: () => o().reveal?.(),
|
|
254
|
+
open: (ref) => o().open?.(ref),
|
|
255
|
+
get defaultKind() {
|
|
256
|
+
return o().defaultKind;
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
const detach = target.attach(id, surface);
|
|
260
|
+
return () => {
|
|
261
|
+
detach();
|
|
262
|
+
for (const a of presence.getState().actors) presence.remove(a.id);
|
|
263
|
+
};
|
|
264
|
+
}, [target, id, presence]);
|
|
265
|
+
return presence;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// src/playback/PresenceLayer.tsx
|
|
269
|
+
var import_react4 = __toESM(require("react"), 1);
|
|
270
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
271
|
+
function PresenceLayer({ presence, viewport, className = "" }) {
|
|
272
|
+
const { actors } = (0, import_react4.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
|
|
273
|
+
if (!actors.length) return null;
|
|
274
|
+
const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
|
|
275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
276
|
+
"div",
|
|
277
|
+
{
|
|
278
|
+
className: `pixerate-presence ${className}`.trim(),
|
|
279
|
+
"aria-hidden": "true",
|
|
280
|
+
"data-testid": "presence-layer",
|
|
281
|
+
style: { position: "absolute", inset: 0, pointerEvents: "none", overflow: "hidden", zIndex: 50 },
|
|
282
|
+
children: actors.map((a) => {
|
|
283
|
+
const at = map(a);
|
|
284
|
+
const ring = a.focus && (() => {
|
|
285
|
+
const tl = map(a.focus);
|
|
286
|
+
const br = map({ x: a.focus.x + a.focus.width, y: a.focus.y + a.focus.height });
|
|
287
|
+
return { left: tl.x - 4, top: tl.y - 4, width: br.x - tl.x + 8, height: br.y - tl.y + 8 };
|
|
288
|
+
})();
|
|
289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react4.default.Fragment, { children: [
|
|
290
|
+
ring && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
291
|
+
"div",
|
|
292
|
+
{
|
|
293
|
+
"data-actor-focus": a.id,
|
|
294
|
+
style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
|
|
295
|
+
}
|
|
296
|
+
),
|
|
297
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: [
|
|
298
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: "18", height: "20", viewBox: "0 0 12 18", style: { display: "block", transform: a.pressed ? "scale(0.85)" : void 0, transformOrigin: "0 0", filter: "drop-shadow(0 1px 2px rgba(0,0,0,.35))" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M0,0 L0,14 L4,10.5 L7,17 L9.5,16 L6.5,9.5 L11.5,9.5 Z", style: { fill: a.color, stroke: "#ffffff", strokeWidth: 1 } }) }),
|
|
299
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
|
|
300
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
|
|
301
|
+
a.message && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { "data-actor-message": a.id, style: { width: "max-content", maxWidth: 240, borderRadius: 8, borderTopLeftRadius: 0, padding: "4px 8px", fontSize: 12, color: "#1e293b", background: "#ffffff", boxShadow: "0 4px 12px rgba(15,23,42,.18)" }, children: a.message })
|
|
302
|
+
] })
|
|
303
|
+
] })
|
|
304
|
+
] }, a.id);
|
|
305
|
+
})
|
|
306
|
+
}
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// src/image-editor/ImageEditor.tsx
|
|
222
311
|
var import_image_editor18 = require("@pixerate/editor/image-editor");
|
|
223
312
|
|
|
224
313
|
// src/image-editor/ControlSlider.tsx
|
|
225
314
|
var import_image_editor2 = require("@pixerate/editor/image-editor");
|
|
226
|
-
var
|
|
315
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
227
316
|
var ControlSlider = ({ spec, value, onChange, disabled, label }) => {
|
|
228
317
|
const name = label ?? spec.label;
|
|
229
318
|
const track = (0, import_image_editor2.controlTrackBackground)(spec);
|
|
230
|
-
return /* @__PURE__ */ (0,
|
|
231
|
-
/* @__PURE__ */ (0,
|
|
232
|
-
/* @__PURE__ */ (0,
|
|
233
|
-
/* @__PURE__ */ (0,
|
|
319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { "data-control-id": spec.id, children: [
|
|
320
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex justify-between text-slate-400 mb-1", children: [
|
|
321
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: name }),
|
|
322
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "font-mono", children: (0, import_image_editor2.formatControlValue)(spec, value) })
|
|
234
323
|
] }),
|
|
235
|
-
/* @__PURE__ */ (0,
|
|
324
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
236
325
|
"input",
|
|
237
326
|
{
|
|
238
327
|
type: "range",
|
|
@@ -246,14 +335,14 @@ var ControlSlider = ({ spec, value, onChange, disabled, label }) => {
|
|
|
246
335
|
className: "w-full accent-indigo-500 disabled:opacity-40"
|
|
247
336
|
}
|
|
248
337
|
),
|
|
249
|
-
track && /* @__PURE__ */ (0,
|
|
338
|
+
track && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "h-0.5 rounded-full opacity-70", style: { background: track } })
|
|
250
339
|
] });
|
|
251
340
|
};
|
|
252
341
|
|
|
253
342
|
// src/image-editor/Histogram.tsx
|
|
254
|
-
var
|
|
343
|
+
var import_react5 = require("react");
|
|
255
344
|
var import_image_editor3 = require("@pixerate/editor/image-editor");
|
|
256
|
-
var
|
|
345
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
257
346
|
var FILL = {
|
|
258
347
|
luminance: "rgba(148, 163, 184, 0.45)",
|
|
259
348
|
red: "rgba(239, 68, 68, 0.45)",
|
|
@@ -263,14 +352,14 @@ var FILL = {
|
|
|
263
352
|
var W = 256;
|
|
264
353
|
var Histogram = ({ histogram, channel = "rgb", height = 64, className = "", style }) => {
|
|
265
354
|
const channels = channel === "rgb" ? ["luminance", "red", "green", "blue"] : [channel];
|
|
266
|
-
const paths = (0,
|
|
355
|
+
const paths = (0, import_react5.useMemo)(
|
|
267
356
|
() => histogram && histogram.samples > 0 ? channels.map((c) => ({ c, d: (0, import_image_editor3.histogramPath)(histogram, c, W, height) })) : [],
|
|
268
357
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
269
358
|
[histogram, channel, height]
|
|
270
359
|
);
|
|
271
360
|
const clipLow = histogram && histogram.samples ? Math.max(...histogram.shadows) / histogram.samples : 0;
|
|
272
361
|
const clipHigh = histogram && histogram.samples ? Math.max(...histogram.highlights) / histogram.samples : 0;
|
|
273
|
-
return /* @__PURE__ */ (0,
|
|
362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
274
363
|
"svg",
|
|
275
364
|
{
|
|
276
365
|
viewBox: `0 0 ${W} ${height}`,
|
|
@@ -281,32 +370,32 @@ var Histogram = ({ histogram, channel = "rgb", height = 64, className = "", styl
|
|
|
281
370
|
className: `w-full rounded bg-slate-950/60 ${className}`,
|
|
282
371
|
style: { height, ...style },
|
|
283
372
|
children: [
|
|
284
|
-
paths.map(({ c, d }) => /* @__PURE__ */ (0,
|
|
285
|
-
clipLow > 5e-3 && /* @__PURE__ */ (0,
|
|
286
|
-
clipHigh > 5e-3 && /* @__PURE__ */ (0,
|
|
373
|
+
paths.map(({ c, d }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d, fill: FILL[c], stroke: "none" }, c)),
|
|
374
|
+
clipLow > 5e-3 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: 0, y: 0, width: 3, height, fill: "#3b82f6", "data-testid": "histogram-clip-shadows" }),
|
|
375
|
+
clipHigh > 5e-3 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: W - 3, y: 0, width: 3, height, fill: "#ef4444", "data-testid": "histogram-clip-highlights" })
|
|
287
376
|
]
|
|
288
377
|
}
|
|
289
378
|
);
|
|
290
379
|
};
|
|
291
380
|
function useImageHistogram(controller) {
|
|
292
|
-
const [histogram, setHistogram] = (0,
|
|
293
|
-
(0,
|
|
381
|
+
const [histogram, setHistogram] = (0, import_react5.useState)(() => controller.getHistogram());
|
|
382
|
+
(0, import_react5.useEffect)(() => controller.subscribeHistogram(setHistogram), [controller]);
|
|
294
383
|
return histogram;
|
|
295
384
|
}
|
|
296
385
|
|
|
297
386
|
// src/image-editor/AdjustmentLayersPanel.tsx
|
|
298
|
-
var
|
|
387
|
+
var import_react7 = require("react");
|
|
299
388
|
var import_image_editor5 = require("@pixerate/editor/image-editor");
|
|
300
389
|
|
|
301
390
|
// src/image-editor/CurvesEditor.tsx
|
|
302
|
-
var
|
|
391
|
+
var import_react6 = require("react");
|
|
303
392
|
var import_image_editor4 = require("@pixerate/editor/image-editor");
|
|
304
|
-
var
|
|
393
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
305
394
|
var BOX = 256;
|
|
306
395
|
var STROKE = { master: "#e2e8f0", red: "#ef4444", green: "#22c55e", blue: "#3b82f6" };
|
|
307
396
|
var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 200 }) => {
|
|
308
|
-
const svgRef = (0,
|
|
309
|
-
const [drag, setDrag] = (0,
|
|
397
|
+
const svgRef = (0, import_react6.useRef)(null);
|
|
398
|
+
const [drag, setDrag] = (0, import_react6.useState)(null);
|
|
310
399
|
const toBox = (e) => {
|
|
311
400
|
const rect = svgRef.current?.getBoundingClientRect();
|
|
312
401
|
if (!rect || !rect.width || !rect.height) return { x: 0, y: 0 };
|
|
@@ -335,7 +424,7 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
335
424
|
if (index !== -1 && points.length > 2) onChange((0, import_image_editor4.removeCurvePoint)(points, index), true);
|
|
336
425
|
};
|
|
337
426
|
const histChannel = channel === "master" ? "luminance" : channel;
|
|
338
|
-
return /* @__PURE__ */ (0,
|
|
427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
339
428
|
"svg",
|
|
340
429
|
{
|
|
341
430
|
ref: svgRef,
|
|
@@ -352,16 +441,16 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
352
441
|
onPointerCancel: () => setDrag(null),
|
|
353
442
|
onDoubleClick,
|
|
354
443
|
children: [
|
|
355
|
-
histogram && histogram.samples > 0 && /* @__PURE__ */ (0,
|
|
356
|
-
[64, 128, 192].map((v) => /* @__PURE__ */ (0,
|
|
357
|
-
/* @__PURE__ */ (0,
|
|
358
|
-
/* @__PURE__ */ (0,
|
|
444
|
+
histogram && histogram.samples > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: (0, import_image_editor4.histogramPath)(histogram, histChannel, BOX, BOX), fill: "rgba(148, 163, 184, 0.25)" }),
|
|
445
|
+
[64, 128, 192].map((v) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("g", { stroke: "rgba(148, 163, 184, 0.2)", strokeWidth: 1, children: [
|
|
446
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { x1: v, y1: 0, x2: v, y2: BOX }),
|
|
447
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { x1: 0, y1: v, x2: BOX, y2: v })
|
|
359
448
|
] }, v)),
|
|
360
|
-
/* @__PURE__ */ (0,
|
|
361
|
-
/* @__PURE__ */ (0,
|
|
449
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { x1: 0, y1: BOX, x2: BOX, y2: 0, stroke: "rgba(148, 163, 184, 0.35)", strokeDasharray: "4 4" }),
|
|
450
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: (0, import_image_editor4.curveSvgPath)(points, BOX, BOX), fill: "none", stroke: STROKE[channel], strokeWidth: 2 }),
|
|
362
451
|
points.map((p, i) => {
|
|
363
452
|
const b = (0, import_image_editor4.curvePointToBox)(p, BOX, BOX);
|
|
364
|
-
return /* @__PURE__ */ (0,
|
|
453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
365
454
|
"circle",
|
|
366
455
|
{
|
|
367
456
|
cx: b.x,
|
|
@@ -381,7 +470,7 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
381
470
|
};
|
|
382
471
|
|
|
383
472
|
// src/image-editor/AdjustmentLayersPanel.tsx
|
|
384
|
-
var
|
|
473
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
385
474
|
var CHANNELS = [
|
|
386
475
|
{ id: "master", label: "RGB" },
|
|
387
476
|
{ id: "red", label: "Red" },
|
|
@@ -397,26 +486,26 @@ var selectClass = "bg-slate-800 border border-slate-700 rounded px-1.5 py-1 text
|
|
|
397
486
|
var chipClass = (on) => `px-2 py-0.5 rounded text-[10px] ${on ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-400 hover:text-slate-200"}`;
|
|
398
487
|
var HueRangeStrip = ({ bounds }) => {
|
|
399
488
|
const pts = Array.from({ length: 73 }, (_, i) => `${i / 72 * 360},${20 - (0, import_image_editor5.hueRangeWeight)({ bounds }, i * 5) * 18}`).join(" ");
|
|
400
|
-
return /* @__PURE__ */ (0,
|
|
401
|
-
/* @__PURE__ */ (0,
|
|
402
|
-
/* @__PURE__ */ (0,
|
|
403
|
-
/* @__PURE__ */ (0,
|
|
489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("svg", { viewBox: "0 0 360 20", preserveAspectRatio: "none", className: "w-full h-4 rounded", "data-testid": "hue-range-strip", children: [
|
|
490
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("linearGradient", { id: "pixerate-hue-strip", children: [0, 60, 120, 180, 240, 300, 360].map((h) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("stop", { offset: `${h / 360 * 100}%`, stopColor: `hsl(${h}, 90%, 50%)` }, h)) }) }),
|
|
491
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("rect", { width: 360, height: 20, fill: "url(#pixerate-hue-strip)", opacity: 0.6 }),
|
|
492
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("polyline", { points: pts, fill: "none", stroke: "#fff", strokeWidth: 1.5 })
|
|
404
493
|
] });
|
|
405
494
|
};
|
|
406
495
|
var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
407
496
|
const follow = layersProp === void 0;
|
|
408
|
-
const [, setTick] = (0,
|
|
409
|
-
(0,
|
|
497
|
+
const [, setTick] = (0, import_react7.useState)(0);
|
|
498
|
+
(0, import_react7.useEffect)(() => follow ? controller.subscribe(() => setTick((n) => n + 1)) : void 0, [controller, follow]);
|
|
410
499
|
const layers = layersProp ?? controller.getAdjustmentLayers();
|
|
411
|
-
const [newKind, setNewKind] = (0,
|
|
412
|
-
const [selectedId, setSelectedId] = (0,
|
|
413
|
-
const [channel, setChannel] = (0,
|
|
414
|
-
const [range, setRange] = (0,
|
|
415
|
-
const [tone, setTone] = (0,
|
|
500
|
+
const [newKind, setNewKind] = (0, import_react7.useState)("curves");
|
|
501
|
+
const [selectedId, setSelectedId] = (0, import_react7.useState)(null);
|
|
502
|
+
const [channel, setChannel] = (0, import_react7.useState)("master");
|
|
503
|
+
const [range, setRange] = (0, import_react7.useState)(-1);
|
|
504
|
+
const [tone, setTone] = (0, import_react7.useState)("midtones");
|
|
416
505
|
const selected = layers.find((l) => l.id === selectedId) ?? null;
|
|
417
506
|
const topFirst = [...layers].reverse();
|
|
418
507
|
const setParam = (layer, path, value, commit = true) => controller.updateAdjustmentLayer(layer.id, { params: (0, import_image_editor5.setControlPath)(layer.params, path, value) }, commit);
|
|
419
|
-
const slider = (layer, spec, label) => /* @__PURE__ */ (0,
|
|
508
|
+
const slider = (layer, spec, label) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
420
509
|
ControlSlider,
|
|
421
510
|
{
|
|
422
511
|
spec,
|
|
@@ -427,8 +516,8 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
427
516
|
spec.id
|
|
428
517
|
);
|
|
429
518
|
const controlsOf = (layer, filter = () => true) => import_image_editor5.ADJUSTMENT_LAYER_CONTROLS[layer.kind].filter(filter);
|
|
430
|
-
const checkbox = (layer, path, label) => /* @__PURE__ */ (0,
|
|
431
|
-
/* @__PURE__ */ (0,
|
|
519
|
+
const checkbox = (layer, path, label) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
|
|
520
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
432
521
|
"input",
|
|
433
522
|
{
|
|
434
523
|
type: "checkbox",
|
|
@@ -442,9 +531,9 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
442
531
|
const editor = (layer) => {
|
|
443
532
|
switch (layer.kind) {
|
|
444
533
|
case "curves":
|
|
445
|
-
return /* @__PURE__ */ (0,
|
|
446
|
-
/* @__PURE__ */ (0,
|
|
447
|
-
/* @__PURE__ */ (0,
|
|
534
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
535
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Curve channel", children: CHANNELS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: chipClass(channel === c.id), onClick: () => setChannel(c.id), children: c.label }, c.id)) }),
|
|
536
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
448
537
|
CurvesEditor,
|
|
449
538
|
{
|
|
450
539
|
points: layer.params[channel],
|
|
@@ -455,33 +544,33 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
455
544
|
)
|
|
456
545
|
] });
|
|
457
546
|
case "levels":
|
|
458
|
-
return /* @__PURE__ */ (0,
|
|
459
|
-
/* @__PURE__ */ (0,
|
|
547
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
548
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Levels channel", children: CHANNELS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: chipClass(channel === c.id), onClick: () => setChannel(c.id), children: c.label }, c.id)) }),
|
|
460
549
|
controlsOf(layer, (s) => s.id.startsWith(`${channel}.`)).map((s) => slider(layer, s))
|
|
461
550
|
] });
|
|
462
551
|
case "hueSaturation":
|
|
463
|
-
return /* @__PURE__ */ (0,
|
|
464
|
-
/* @__PURE__ */ (0,
|
|
465
|
-
/* @__PURE__ */ (0,
|
|
466
|
-
import_image_editor5.HUE_RANGE_LABELS.map((name, i) => /* @__PURE__ */ (0,
|
|
552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
553
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-wrap gap-1", role: "group", "aria-label": "Hue range", children: [
|
|
554
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: chipClass(range === -1), onClick: () => setRange(-1), children: "Master" }),
|
|
555
|
+
import_image_editor5.HUE_RANGE_LABELS.map((name, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: chipClass(range === i), onClick: () => setRange(i), disabled: layer.params.colorize, children: name }, name))
|
|
467
556
|
] }),
|
|
468
|
-
range >= 0 && !layer.params.colorize && /* @__PURE__ */ (0,
|
|
557
|
+
range >= 0 && !layer.params.colorize && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(HueRangeStrip, { bounds: layer.params.ranges[range].bounds }),
|
|
469
558
|
controlsOf(layer, (s) => range === -1 || layer.params.colorize ? !s.id.startsWith("ranges.") : s.id.startsWith(`ranges.${range}.`)).map(
|
|
470
559
|
(s) => slider(layer, s)
|
|
471
560
|
),
|
|
472
561
|
range === -1 && checkbox(layer, "colorize", "Colorize")
|
|
473
562
|
] });
|
|
474
563
|
case "colorBalance":
|
|
475
|
-
return /* @__PURE__ */ (0,
|
|
476
|
-
/* @__PURE__ */ (0,
|
|
564
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
565
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Tone", children: TONES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: chipClass(tone === t.id), onClick: () => setTone(t.id), children: t.label }, t.id)) }),
|
|
477
566
|
controlsOf(layer, (s) => s.id.startsWith(`${tone}.`)).map((s) => slider(layer, s)),
|
|
478
567
|
checkbox(layer, "preserveLuminosity", "Preserve luminosity")
|
|
479
568
|
] });
|
|
480
569
|
case "blackWhite":
|
|
481
|
-
return /* @__PURE__ */ (0,
|
|
570
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
482
571
|
controlsOf(layer).map((s) => slider(layer, s)),
|
|
483
|
-
/* @__PURE__ */ (0,
|
|
484
|
-
/* @__PURE__ */ (0,
|
|
572
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
|
|
573
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
485
574
|
"input",
|
|
486
575
|
{
|
|
487
576
|
type: "checkbox",
|
|
@@ -491,7 +580,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
491
580
|
}
|
|
492
581
|
),
|
|
493
582
|
"Tint",
|
|
494
|
-
layer.params.tint && /* @__PURE__ */ (0,
|
|
583
|
+
layer.params.tint && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
495
584
|
"input",
|
|
496
585
|
{
|
|
497
586
|
type: "color",
|
|
@@ -504,10 +593,10 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
504
593
|
] })
|
|
505
594
|
] });
|
|
506
595
|
case "photoFilter":
|
|
507
|
-
return /* @__PURE__ */ (0,
|
|
508
|
-
/* @__PURE__ */ (0,
|
|
596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
597
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
|
|
509
598
|
"Filter colour",
|
|
510
|
-
/* @__PURE__ */ (0,
|
|
599
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
511
600
|
"input",
|
|
512
601
|
{
|
|
513
602
|
type: "color",
|
|
@@ -522,25 +611,25 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
522
611
|
checkbox(layer, "preserveLuminosity", "Preserve luminosity")
|
|
523
612
|
] });
|
|
524
613
|
case "invert":
|
|
525
|
-
return /* @__PURE__ */ (0,
|
|
614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-slate-500 text-[11px]", children: "Invert has no settings." });
|
|
526
615
|
default:
|
|
527
|
-
return /* @__PURE__ */ (0,
|
|
616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex flex-col gap-2", children: controlsOf(layer).map((s) => slider(layer, s)) });
|
|
528
617
|
}
|
|
529
618
|
};
|
|
530
|
-
return /* @__PURE__ */ (0,
|
|
531
|
-
/* @__PURE__ */ (0,
|
|
532
|
-
/* @__PURE__ */ (0,
|
|
533
|
-
/* @__PURE__ */ (0,
|
|
619
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col gap-2 text-xs", "data-testid": "adjustment-layers-panel", children: [
|
|
620
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Adjustment Layers" }) }),
|
|
621
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex gap-1.5", children: [
|
|
622
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
534
623
|
"select",
|
|
535
624
|
{
|
|
536
625
|
"aria-label": "New adjustment layer kind",
|
|
537
626
|
className: `${selectClass} flex-1`,
|
|
538
627
|
value: newKind,
|
|
539
628
|
onChange: (e) => setNewKind(e.target.value),
|
|
540
|
-
children: import_image_editor5.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0,
|
|
629
|
+
children: import_image_editor5.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: k.kind, children: k.label }, k.kind))
|
|
541
630
|
}
|
|
542
631
|
),
|
|
543
|
-
/* @__PURE__ */ (0,
|
|
632
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
544
633
|
"button",
|
|
545
634
|
{
|
|
546
635
|
type: "button",
|
|
@@ -554,15 +643,15 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
554
643
|
}
|
|
555
644
|
)
|
|
556
645
|
] }),
|
|
557
|
-
topFirst.length > 0 && /* @__PURE__ */ (0,
|
|
646
|
+
topFirst.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Adjustment layers", children: topFirst.map((layer) => {
|
|
558
647
|
const index = layers.indexOf(layer);
|
|
559
648
|
const label = layer.name || (0, import_image_editor5.adjustmentKindLabel)(layer.kind);
|
|
560
|
-
return /* @__PURE__ */ (0,
|
|
649
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
561
650
|
"li",
|
|
562
651
|
{
|
|
563
652
|
className: `flex items-center gap-1.5 rounded px-1.5 py-1 ${layer.id === selectedId ? "bg-indigo-600/20 ring-1 ring-indigo-500/50" : "bg-slate-800/60"}`,
|
|
564
653
|
children: [
|
|
565
|
-
/* @__PURE__ */ (0,
|
|
654
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
566
655
|
"input",
|
|
567
656
|
{
|
|
568
657
|
type: "checkbox",
|
|
@@ -572,7 +661,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
572
661
|
className: "accent-indigo-500"
|
|
573
662
|
}
|
|
574
663
|
),
|
|
575
|
-
/* @__PURE__ */ (0,
|
|
664
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
576
665
|
"button",
|
|
577
666
|
{
|
|
578
667
|
type: "button",
|
|
@@ -582,7 +671,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
582
671
|
children: label
|
|
583
672
|
}
|
|
584
673
|
),
|
|
585
|
-
/* @__PURE__ */ (0,
|
|
674
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
586
675
|
"button",
|
|
587
676
|
{
|
|
588
677
|
type: "button",
|
|
@@ -593,7 +682,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
593
682
|
children: "\u2191"
|
|
594
683
|
}
|
|
595
684
|
),
|
|
596
|
-
/* @__PURE__ */ (0,
|
|
685
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
597
686
|
"button",
|
|
598
687
|
{
|
|
599
688
|
type: "button",
|
|
@@ -604,7 +693,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
604
693
|
children: "\u2193"
|
|
605
694
|
}
|
|
606
695
|
),
|
|
607
|
-
/* @__PURE__ */ (0,
|
|
696
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
608
697
|
"button",
|
|
609
698
|
{
|
|
610
699
|
type: "button",
|
|
@@ -622,21 +711,21 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
622
711
|
layer.id
|
|
623
712
|
);
|
|
624
713
|
}) }),
|
|
625
|
-
selected && /* @__PURE__ */ (0,
|
|
626
|
-
/* @__PURE__ */ (0,
|
|
627
|
-
/* @__PURE__ */ (0,
|
|
628
|
-
/* @__PURE__ */ (0,
|
|
714
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col gap-2 rounded border border-slate-700/60 p-2", "data-testid": "adjustment-layer-editor", children: [
|
|
715
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
716
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-slate-400", children: "Blend" }),
|
|
717
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
629
718
|
"select",
|
|
630
719
|
{
|
|
631
720
|
"aria-label": "Blend mode",
|
|
632
721
|
className: `${selectClass} flex-1`,
|
|
633
722
|
value: selected.blend,
|
|
634
723
|
onChange: (e) => controller.updateAdjustmentLayer(selected.id, { blend: e.target.value }),
|
|
635
|
-
children: import_image_editor5.BLEND_MODES.map((m) => /* @__PURE__ */ (0,
|
|
724
|
+
children: import_image_editor5.BLEND_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: m.id, children: m.label }, m.id))
|
|
636
725
|
}
|
|
637
726
|
)
|
|
638
727
|
] }),
|
|
639
|
-
/* @__PURE__ */ (0,
|
|
728
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
640
729
|
ControlSlider,
|
|
641
730
|
{
|
|
642
731
|
spec: import_image_editor5.ADJUSTMENT_LAYER_OPACITY_CONTROL,
|
|
@@ -651,19 +740,19 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
651
740
|
};
|
|
652
741
|
|
|
653
742
|
// src/image-editor/LayersPanel.tsx
|
|
654
|
-
var
|
|
743
|
+
var import_react9 = require("react");
|
|
655
744
|
|
|
656
745
|
// src/image-editor/LayerEffectsPanel.tsx
|
|
657
|
-
var
|
|
746
|
+
var import_react8 = require("react");
|
|
658
747
|
var import_image_editor6 = require("@pixerate/editor/image-editor");
|
|
659
|
-
var
|
|
748
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
660
749
|
var button = "px-1.5 py-0.5 rounded text-[10px] bg-slate-800 text-slate-300 hover:text-white disabled:opacity-40";
|
|
661
750
|
var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
662
|
-
const [, setTick] = (0,
|
|
663
|
-
(0,
|
|
664
|
-
const [open, setOpen] = (0,
|
|
665
|
-
const [error, setError] = (0,
|
|
666
|
-
const commitNext = (0,
|
|
751
|
+
const [, setTick] = (0, import_react8.useState)(0);
|
|
752
|
+
(0, import_react8.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
753
|
+
const [open, setOpen] = (0, import_react8.useState)(null);
|
|
754
|
+
const [error, setError] = (0, import_react8.useState)(null);
|
|
755
|
+
const commitNext = (0, import_react8.useRef)(true);
|
|
667
756
|
const layer = layerId ? controller.getLayer(layerId) : controller.getActiveLayer();
|
|
668
757
|
const model = (0, import_image_editor6.layerEffectsPanel)(layer);
|
|
669
758
|
const id = layer?.id;
|
|
@@ -681,7 +770,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
681
770
|
onKeyDown: () => commitNext.current = true
|
|
682
771
|
};
|
|
683
772
|
if (!model.available || !id) {
|
|
684
|
-
return /* @__PURE__ */ (0,
|
|
773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: `text-xs text-slate-500 ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
|
|
685
774
|
}
|
|
686
775
|
const effects = controller.getLayerEffects(id);
|
|
687
776
|
const patterns = controller.getDocumentPatterns();
|
|
@@ -696,14 +785,14 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
696
785
|
case "range": {
|
|
697
786
|
const k = c.percent ? 100 : 1;
|
|
698
787
|
const shown = Math.round(c.value * k * 100) / 100;
|
|
699
|
-
return /* @__PURE__ */ (0,
|
|
700
|
-
/* @__PURE__ */ (0,
|
|
788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
|
|
789
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "text-slate-400", children: [
|
|
701
790
|
label,
|
|
702
791
|
" ",
|
|
703
792
|
shown,
|
|
704
793
|
c.unit
|
|
705
794
|
] }),
|
|
706
|
-
/* @__PURE__ */ (0,
|
|
795
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
707
796
|
"input",
|
|
708
797
|
{
|
|
709
798
|
type: "range",
|
|
@@ -721,19 +810,19 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
721
810
|
] }, c.key);
|
|
722
811
|
}
|
|
723
812
|
case "color":
|
|
724
|
-
return /* @__PURE__ */ (0,
|
|
725
|
-
/* @__PURE__ */ (0,
|
|
813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-1.5 text-slate-300", children: [
|
|
814
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "color", "aria-label": label, value: c.value, disabled: model.readOnly, onChange: (e) => change(effectId, c, e.target.value) }),
|
|
726
815
|
label
|
|
727
816
|
] }, c.key);
|
|
728
817
|
case "checkbox":
|
|
729
|
-
return /* @__PURE__ */ (0,
|
|
730
|
-
/* @__PURE__ */ (0,
|
|
818
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-1.5 text-slate-300", children: [
|
|
819
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "checkbox", "aria-label": label, checked: c.value, disabled: model.readOnly, onChange: (e) => change(effectId, c, e.target.checked), className: "accent-indigo-500" }),
|
|
731
820
|
label
|
|
732
821
|
] }, c.key);
|
|
733
822
|
case "select":
|
|
734
|
-
return /* @__PURE__ */ (0,
|
|
735
|
-
/* @__PURE__ */ (0,
|
|
736
|
-
/* @__PURE__ */ (0,
|
|
823
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
|
|
824
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-slate-400", children: label }),
|
|
825
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
737
826
|
"select",
|
|
738
827
|
{
|
|
739
828
|
"aria-label": label,
|
|
@@ -741,17 +830,17 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
741
830
|
disabled: model.readOnly,
|
|
742
831
|
onChange: (e) => change(effectId, c, e.target.value),
|
|
743
832
|
className: "bg-slate-800 border border-slate-700 rounded px-1.5 py-1",
|
|
744
|
-
children: c.options.map((o) => /* @__PURE__ */ (0,
|
|
833
|
+
children: c.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: o.value, children: o.label }, o.value))
|
|
745
834
|
}
|
|
746
835
|
)
|
|
747
836
|
] }, c.key);
|
|
748
837
|
}
|
|
749
838
|
};
|
|
750
|
-
return /* @__PURE__ */ (0,
|
|
751
|
-
/* @__PURE__ */ (0,
|
|
752
|
-
/* @__PURE__ */ (0,
|
|
753
|
-
/* @__PURE__ */ (0,
|
|
754
|
-
/* @__PURE__ */ (0,
|
|
839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer effects", role: "group", children: [
|
|
840
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
841
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "font-semibold text-slate-300", children: "fx Effects" }),
|
|
842
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-1 text-slate-300", children: [
|
|
843
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
755
844
|
"input",
|
|
756
845
|
{
|
|
757
846
|
type: "checkbox",
|
|
@@ -764,9 +853,9 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
764
853
|
),
|
|
765
854
|
"On"
|
|
766
855
|
] }),
|
|
767
|
-
/* @__PURE__ */ (0,
|
|
856
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-1 text-slate-400", children: [
|
|
768
857
|
"Scale",
|
|
769
|
-
/* @__PURE__ */ (0,
|
|
858
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
770
859
|
"input",
|
|
771
860
|
{
|
|
772
861
|
type: "number",
|
|
@@ -785,7 +874,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
785
874
|
),
|
|
786
875
|
"%"
|
|
787
876
|
] }),
|
|
788
|
-
/* @__PURE__ */ (0,
|
|
877
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
789
878
|
"select",
|
|
790
879
|
{
|
|
791
880
|
"aria-label": "Add effect",
|
|
@@ -798,19 +887,19 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
798
887
|
},
|
|
799
888
|
className: "bg-slate-800 border border-slate-700 rounded px-1.5 py-1",
|
|
800
889
|
children: [
|
|
801
|
-
/* @__PURE__ */ (0,
|
|
802
|
-
import_image_editor6.LAYER_EFFECT_MENU.map((m) => /* @__PURE__ */ (0,
|
|
890
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "", children: "Add effect\u2026" }),
|
|
891
|
+
import_image_editor6.LAYER_EFFECT_MENU.map((m) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: m.kind, children: m.label }, m.kind))
|
|
803
892
|
]
|
|
804
893
|
}
|
|
805
894
|
)
|
|
806
895
|
] }),
|
|
807
|
-
model.readOnly && model.reason && /* @__PURE__ */ (0,
|
|
808
|
-
/* @__PURE__ */ (0,
|
|
896
|
+
model.readOnly && model.reason && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-slate-500", children: model.reason }),
|
|
897
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Effects", children: model.rows.map((row) => {
|
|
809
898
|
const effect = effects.items.find((e) => e.id === row.id);
|
|
810
899
|
const expanded = open === row.id;
|
|
811
|
-
return /* @__PURE__ */ (0,
|
|
812
|
-
/* @__PURE__ */ (0,
|
|
813
|
-
/* @__PURE__ */ (0,
|
|
900
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("li", { "data-effect-id": row.id, className: "rounded bg-slate-900/60 ring-1 ring-slate-800", children: [
|
|
901
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
|
|
902
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
814
903
|
"input",
|
|
815
904
|
{
|
|
816
905
|
type: "checkbox",
|
|
@@ -821,7 +910,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
821
910
|
className: "accent-indigo-500"
|
|
822
911
|
}
|
|
823
912
|
),
|
|
824
|
-
/* @__PURE__ */ (0,
|
|
913
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
825
914
|
"button",
|
|
826
915
|
{
|
|
827
916
|
type: "button",
|
|
@@ -831,18 +920,18 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
831
920
|
children: row.label
|
|
832
921
|
}
|
|
833
922
|
),
|
|
834
|
-
/* @__PURE__ */ (0,
|
|
923
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: button, "aria-label": `Remove ${row.label}`, disabled: model.readOnly, onClick: () => attempt(() => controller.removeLayerEffect(id, row.id)), children: "\u2715" })
|
|
835
924
|
] }),
|
|
836
|
-
expanded && /* @__PURE__ */ (0,
|
|
925
|
+
expanded && /* @__PURE__ */ (0, import_jsx_runtime7.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_editor6.layerEffectControls)(effect, patterns).map((c) => renderControl(row.id, c)) })
|
|
837
926
|
] }, row.id);
|
|
838
927
|
}) }),
|
|
839
|
-
error && /* @__PURE__ */ (0,
|
|
928
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { role: "alert", className: "text-rose-400", children: error })
|
|
840
929
|
] });
|
|
841
930
|
};
|
|
842
931
|
|
|
843
932
|
// src/image-editor/LayersPanel.tsx
|
|
844
933
|
var import_image_editor7 = require("@pixerate/editor/image-editor");
|
|
845
|
-
var
|
|
934
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
846
935
|
var iconButton = "px-1.5 py-0.5 rounded text-[10px] bg-slate-800 text-slate-300 hover:text-white disabled:opacity-40";
|
|
847
936
|
var rowClass = (active) => `flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer select-none ${active ? "bg-indigo-600/30 ring-1 ring-indigo-500" : "hover:bg-slate-800"}`;
|
|
848
937
|
var Thumbnail = ({
|
|
@@ -853,8 +942,8 @@ var Thumbnail = ({
|
|
|
853
942
|
selected,
|
|
854
943
|
testId
|
|
855
944
|
}) => {
|
|
856
|
-
const ref = (0,
|
|
857
|
-
(0,
|
|
945
|
+
const ref = (0, import_react9.useRef)(null);
|
|
946
|
+
(0, import_react9.useEffect)(() => {
|
|
858
947
|
const canvas = ref.current;
|
|
859
948
|
const ctx = canvas?.getContext("2d");
|
|
860
949
|
if (!canvas || !ctx || !pixels || typeof ctx.createImageData !== "function") return;
|
|
@@ -864,7 +953,7 @@ var Thumbnail = ({
|
|
|
864
953
|
img.data.set(pixels.data);
|
|
865
954
|
ctx.putImageData(img, 0, 0);
|
|
866
955
|
}, [pixels]);
|
|
867
|
-
return /* @__PURE__ */ (0,
|
|
956
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
868
957
|
"canvas",
|
|
869
958
|
{
|
|
870
959
|
ref,
|
|
@@ -878,14 +967,14 @@ var Thumbnail = ({
|
|
|
878
967
|
);
|
|
879
968
|
};
|
|
880
969
|
var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "image", effects = true, className }) => {
|
|
881
|
-
const [, setTick] = (0,
|
|
882
|
-
(0,
|
|
883
|
-
const [error, setError] = (0,
|
|
884
|
-
const [renaming, setRenaming] = (0,
|
|
885
|
-
const [menu, setMenu] = (0,
|
|
886
|
-
const [drag, setDrag] = (0,
|
|
887
|
-
const [psdNotes, setPsdNotes] = (0,
|
|
888
|
-
const fileInput = (0,
|
|
970
|
+
const [, setTick] = (0, import_react9.useState)(0);
|
|
971
|
+
(0, import_react9.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
972
|
+
const [error, setError] = (0, import_react9.useState)(null);
|
|
973
|
+
const [renaming, setRenaming] = (0, import_react9.useState)(null);
|
|
974
|
+
const [menu, setMenu] = (0, import_react9.useState)(null);
|
|
975
|
+
const [drag, setDrag] = (0, import_react9.useState)(null);
|
|
976
|
+
const [psdNotes, setPsdNotes] = (0, import_react9.useState)([]);
|
|
977
|
+
const fileInput = (0, import_react9.useRef)(null);
|
|
889
978
|
const psdTask = async (fn) => {
|
|
890
979
|
try {
|
|
891
980
|
setError(null);
|
|
@@ -894,7 +983,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
894
983
|
setError(err instanceof Error ? err.message : String(err));
|
|
895
984
|
}
|
|
896
985
|
};
|
|
897
|
-
const commitNext = (0,
|
|
986
|
+
const commitNext = (0, import_react9.useRef)(true);
|
|
898
987
|
const state = controller.getState();
|
|
899
988
|
const rows = (0, import_image_editor7.layerPanelRows)(state.layers, state.activeLayerId);
|
|
900
989
|
const active = controller.getActiveLayer();
|
|
@@ -932,14 +1021,14 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
932
1021
|
const thumb = (layer) => (0, import_image_editor7.layerHasThumbnail)(layer) ? controller.getLayerThumbnail(layer.id, { maxSide: 64 }) : null;
|
|
933
1022
|
const maskThumb = (layer) => layer.mask && !layer.mask.source ? controller.getLayerThumbnail(layer.id, { maxSide: 64, mask: true }) : null;
|
|
934
1023
|
const locked = (layer) => Boolean(layer.locks?.all || layer.locks?.pixels || layer.locks?.position || layer.locks?.transparency);
|
|
935
|
-
return /* @__PURE__ */ (0,
|
|
936
|
-
/* @__PURE__ */ (0,
|
|
937
|
-
/* @__PURE__ */ (0,
|
|
938
|
-
/* @__PURE__ */ (0,
|
|
939
|
-
/* @__PURE__ */ (0,
|
|
940
|
-
/* @__PURE__ */ (0,
|
|
941
|
-
/* @__PURE__ */ (0,
|
|
942
|
-
/* @__PURE__ */ (0,
|
|
1024
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "layers-panel", onClick: () => menu && setMenu(null), children: [
|
|
1025
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "toolbar", "aria-label": "Layer actions", children: [
|
|
1026
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: iconButton, onClick: () => run("new-layer"), children: "New Layer" }),
|
|
1027
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: iconButton, onClick: () => run("new-group"), children: "New Group" }),
|
|
1028
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: iconButton, disabled: !active, onClick: () => run("duplicate"), children: "Duplicate" }),
|
|
1029
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: iconButton, disabled: !active, onClick: () => run("add-mask"), children: "Add Mask" }),
|
|
1030
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: iconButton, disabled: !active, onClick: () => run("delete"), children: "Delete" }),
|
|
1031
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
943
1032
|
"button",
|
|
944
1033
|
{
|
|
945
1034
|
type: "button",
|
|
@@ -954,7 +1043,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
954
1043
|
children: "\u22EF"
|
|
955
1044
|
}
|
|
956
1045
|
),
|
|
957
|
-
/* @__PURE__ */ (0,
|
|
1046
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
958
1047
|
"select",
|
|
959
1048
|
{
|
|
960
1049
|
"aria-label": "Bits per channel",
|
|
@@ -962,13 +1051,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
962
1051
|
className: "rounded bg-slate-800 px-1 py-0.5 text-[11px] text-slate-200",
|
|
963
1052
|
value: controller.bitDepth,
|
|
964
1053
|
onChange: (e) => attempt(() => controller.setBitDepth(Number(e.target.value))),
|
|
965
|
-
children: import_image_editor7.BIT_DEPTH_OPTIONS.map((o) => /* @__PURE__ */ (0,
|
|
1054
|
+
children: import_image_editor7.BIT_DEPTH_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: o.depth, title: o.title, children: o.label }, o.depth))
|
|
966
1055
|
}
|
|
967
1056
|
),
|
|
968
|
-
psd && /* @__PURE__ */ (0,
|
|
969
|
-
/* @__PURE__ */ (0,
|
|
970
|
-
/* @__PURE__ */ (0,
|
|
971
|
-
/* @__PURE__ */ (0,
|
|
1057
|
+
psd && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
1058
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: iconButton, onClick: () => fileInput.current?.click(), children: "Open PSD\u2026" }),
|
|
1059
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: iconButton, onClick: () => psdTask(async () => (await (0, import_image_editor7.downloadPsd)(controller, psdFileName)).warnings), children: "Export PSD" }),
|
|
1060
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
972
1061
|
"input",
|
|
973
1062
|
{
|
|
974
1063
|
ref: fileInput,
|
|
@@ -986,18 +1075,18 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
986
1075
|
)
|
|
987
1076
|
] })
|
|
988
1077
|
] }),
|
|
989
|
-
psdNotes.length > 0 && /* @__PURE__ */ (0,
|
|
990
|
-
psdNotes.map((n) => /* @__PURE__ */ (0,
|
|
991
|
-
/* @__PURE__ */ (0,
|
|
1078
|
+
psdNotes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("ul", { className: "rounded bg-amber-900/30 text-amber-200 px-2 py-1 space-y-0.5", "data-testid": "psd-warnings", "aria-label": "PSD warnings", children: [
|
|
1079
|
+
psdNotes.map((n) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("li", { children: n }, n)),
|
|
1080
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: "underline", onClick: () => setPsdNotes([]), children: "Dismiss" }) })
|
|
992
1081
|
] }),
|
|
993
|
-
active && /* @__PURE__ */ (0,
|
|
994
|
-
/* @__PURE__ */ (0,
|
|
995
|
-
/* @__PURE__ */ (0,
|
|
1082
|
+
active && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 items-center", "data-testid": "layer-properties", children: [
|
|
1083
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
|
|
1084
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "text-slate-400", children: [
|
|
996
1085
|
"Opacity ",
|
|
997
1086
|
Math.round(active.opacity * 100),
|
|
998
1087
|
"%"
|
|
999
1088
|
] }),
|
|
1000
|
-
/* @__PURE__ */ (0,
|
|
1089
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1001
1090
|
"input",
|
|
1002
1091
|
{
|
|
1003
1092
|
type: "range",
|
|
@@ -1011,13 +1100,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1011
1100
|
}
|
|
1012
1101
|
)
|
|
1013
1102
|
] }),
|
|
1014
|
-
/* @__PURE__ */ (0,
|
|
1015
|
-
/* @__PURE__ */ (0,
|
|
1103
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
|
|
1104
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "text-slate-400", children: [
|
|
1016
1105
|
"Fill ",
|
|
1017
1106
|
Math.round(((active.type === "pixel" ? active.fillOpacity : void 0) ?? 1) * 100),
|
|
1018
1107
|
"%"
|
|
1019
1108
|
] }),
|
|
1020
|
-
/* @__PURE__ */ (0,
|
|
1109
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1021
1110
|
"input",
|
|
1022
1111
|
{
|
|
1023
1112
|
type: "range",
|
|
@@ -1032,7 +1121,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1032
1121
|
}
|
|
1033
1122
|
)
|
|
1034
1123
|
] }),
|
|
1035
|
-
/* @__PURE__ */ (0,
|
|
1124
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1036
1125
|
"select",
|
|
1037
1126
|
{
|
|
1038
1127
|
"aria-label": "Layer blend mode",
|
|
@@ -1040,13 +1129,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1040
1129
|
value: active.blend,
|
|
1041
1130
|
onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { blend: e.target.value })),
|
|
1042
1131
|
children: [
|
|
1043
|
-
active.type === "group" && /* @__PURE__ */ (0,
|
|
1044
|
-
import_image_editor7.BLEND_MODES.map((m) => /* @__PURE__ */ (0,
|
|
1132
|
+
active.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "pass-through", children: "Pass Through" }),
|
|
1133
|
+
import_image_editor7.BLEND_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: m.id, children: m.label }, m.id))
|
|
1045
1134
|
]
|
|
1046
1135
|
}
|
|
1047
1136
|
),
|
|
1048
|
-
/* @__PURE__ */ (0,
|
|
1049
|
-
/* @__PURE__ */ (0,
|
|
1137
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-1.5 text-slate-300", children: [
|
|
1138
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1050
1139
|
"input",
|
|
1051
1140
|
{
|
|
1052
1141
|
type: "checkbox",
|
|
@@ -1058,8 +1147,8 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1058
1147
|
),
|
|
1059
1148
|
"Clip to below"
|
|
1060
1149
|
] }),
|
|
1061
|
-
/* @__PURE__ */ (0,
|
|
1062
|
-
/* @__PURE__ */ (0,
|
|
1150
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "col-span-2 flex flex-wrap gap-2 text-slate-400", role: "group", "aria-label": "Layer locks", children: ["pixels", "transparency", "position", "all"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
1151
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1063
1152
|
"input",
|
|
1064
1153
|
{
|
|
1065
1154
|
type: "checkbox",
|
|
@@ -1072,10 +1161,10 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1072
1161
|
k
|
|
1073
1162
|
] }, k)) })
|
|
1074
1163
|
] }),
|
|
1075
|
-
effects && active && active.type !== "adjustment" && /* @__PURE__ */ (0,
|
|
1076
|
-
/* @__PURE__ */ (0,
|
|
1164
|
+
effects && active && active.type !== "adjustment" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(LayerEffectsPanel, { controller, className: "border-t border-slate-800 pt-1.5" }),
|
|
1165
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { className: "flex flex-col gap-0.5", role: "tree", "aria-label": "Layers", children: rows.map((row) => {
|
|
1077
1166
|
const { layer } = row;
|
|
1078
|
-
return /* @__PURE__ */ (0,
|
|
1167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1079
1168
|
"li",
|
|
1080
1169
|
{
|
|
1081
1170
|
role: "treeitem",
|
|
@@ -1105,7 +1194,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1105
1194
|
className: rowClass(row.active),
|
|
1106
1195
|
style: { paddingLeft: 6 + row.depth * 14 },
|
|
1107
1196
|
children: [
|
|
1108
|
-
/* @__PURE__ */ (0,
|
|
1197
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1109
1198
|
"button",
|
|
1110
1199
|
{
|
|
1111
1200
|
type: "button",
|
|
@@ -1119,7 +1208,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1119
1208
|
children: layer.visible ? "\u25CF" : "\u25CB"
|
|
1120
1209
|
}
|
|
1121
1210
|
),
|
|
1122
|
-
layer.type === "group" && /* @__PURE__ */ (0,
|
|
1211
|
+
layer.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1123
1212
|
"button",
|
|
1124
1213
|
{
|
|
1125
1214
|
type: "button",
|
|
@@ -1132,9 +1221,9 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1132
1221
|
children: layer.collapsed ? "\u25B8" : "\u25BE"
|
|
1133
1222
|
}
|
|
1134
1223
|
),
|
|
1135
|
-
row.clipped && /* @__PURE__ */ (0,
|
|
1136
|
-
(0, import_image_editor7.layerHasThumbnail)(layer) ? /* @__PURE__ */ (0,
|
|
1137
|
-
/* @__PURE__ */ (0,
|
|
1224
|
+
row.clipped && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-slate-500", "aria-label": "Clipped", children: "\u21B3" }),
|
|
1225
|
+
(0, import_image_editor7.layerHasThumbnail)(layer) ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "relative shrink-0", children: [
|
|
1226
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1138
1227
|
Thumbnail,
|
|
1139
1228
|
{
|
|
1140
1229
|
pixels: thumb(layer),
|
|
@@ -1143,7 +1232,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1143
1232
|
selected: row.active && state.activeTarget === "pixels" && Boolean(layer.mask)
|
|
1144
1233
|
}
|
|
1145
1234
|
),
|
|
1146
|
-
layer.type !== "pixel" && /* @__PURE__ */ (0,
|
|
1235
|
+
layer.type !== "pixel" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1147
1236
|
"span",
|
|
1148
1237
|
{
|
|
1149
1238
|
"data-testid": "layer-kind-badge",
|
|
@@ -1151,7 +1240,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1151
1240
|
children: (0, import_image_editor7.layerBadge)(layer)
|
|
1152
1241
|
}
|
|
1153
1242
|
)
|
|
1154
|
-
] }) : /* @__PURE__ */ (0,
|
|
1243
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1155
1244
|
"span",
|
|
1156
1245
|
{
|
|
1157
1246
|
className: "shrink-0 grid place-items-center rounded bg-slate-800 text-[9px] text-slate-400 ring-1 ring-slate-700",
|
|
@@ -1159,7 +1248,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1159
1248
|
children: (0, import_image_editor7.layerBadge)(layer)
|
|
1160
1249
|
}
|
|
1161
1250
|
),
|
|
1162
|
-
layer.mask && !layer.mask.source && layer.type === "pixel" && /* @__PURE__ */ (0,
|
|
1251
|
+
layer.mask && !layer.mask.source && layer.type === "pixel" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1163
1252
|
"button",
|
|
1164
1253
|
{
|
|
1165
1254
|
type: "button",
|
|
@@ -1175,7 +1264,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1175
1264
|
children: layer.mask.linked === false ? "\u26D3\uFE0E\u0338" : "\u26D3\uFE0E"
|
|
1176
1265
|
}
|
|
1177
1266
|
),
|
|
1178
|
-
layer.mask && /* @__PURE__ */ (0,
|
|
1267
|
+
layer.mask && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1179
1268
|
Thumbnail,
|
|
1180
1269
|
{
|
|
1181
1270
|
pixels: maskThumb(layer),
|
|
@@ -1190,7 +1279,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1190
1279
|
}
|
|
1191
1280
|
}
|
|
1192
1281
|
),
|
|
1193
|
-
renaming === layer.id ? /* @__PURE__ */ (0,
|
|
1282
|
+
renaming === layer.id ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1194
1283
|
"input",
|
|
1195
1284
|
{
|
|
1196
1285
|
autoFocus: true,
|
|
@@ -1207,7 +1296,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1207
1296
|
if (e.key === "Escape") setRenaming(null);
|
|
1208
1297
|
}
|
|
1209
1298
|
}
|
|
1210
|
-
) : /* @__PURE__ */ (0,
|
|
1299
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1211
1300
|
"span",
|
|
1212
1301
|
{
|
|
1213
1302
|
className: `flex-1 min-w-0 truncate ${layer.visible ? "" : "text-slate-500"}`,
|
|
@@ -1218,8 +1307,8 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1218
1307
|
children: row.label
|
|
1219
1308
|
}
|
|
1220
1309
|
),
|
|
1221
|
-
(0, import_image_editor7.layerWarning)(layer) && /* @__PURE__ */ (0,
|
|
1222
|
-
(0, import_image_editor7.layerEffectsBadge)(layer) && /* @__PURE__ */ (0,
|
|
1310
|
+
(0, import_image_editor7.layerWarning)(layer) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { role: "img", "data-testid": "layer-warning", "aria-label": (0, import_image_editor7.layerWarning)(layer), title: (0, import_image_editor7.layerWarning)(layer), className: "text-[10px] text-amber-400", children: "\u26A0" }),
|
|
1311
|
+
(0, import_image_editor7.layerEffectsBadge)(layer) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1223
1312
|
"button",
|
|
1224
1313
|
{
|
|
1225
1314
|
type: "button",
|
|
@@ -1234,15 +1323,15 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1234
1323
|
children: "fx"
|
|
1235
1324
|
}
|
|
1236
1325
|
),
|
|
1237
|
-
locked(layer) && /* @__PURE__ */ (0,
|
|
1238
|
-
layer.blend !== "normal" && layer.blend !== "pass-through" && /* @__PURE__ */ (0,
|
|
1326
|
+
locked(layer) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { "aria-label": "Locked", className: "text-slate-400", children: "\u{1F512}" }),
|
|
1327
|
+
layer.blend !== "normal" && layer.blend !== "pass-through" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-[9px] text-slate-500", children: layer.blend })
|
|
1239
1328
|
]
|
|
1240
1329
|
},
|
|
1241
1330
|
layer.id
|
|
1242
1331
|
);
|
|
1243
1332
|
}) }),
|
|
1244
|
-
error && /* @__PURE__ */ (0,
|
|
1245
|
-
menu && /* @__PURE__ */ (0,
|
|
1333
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { role: "alert", className: "text-rose-400", children: error }),
|
|
1334
|
+
menu && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1246
1335
|
"div",
|
|
1247
1336
|
{
|
|
1248
1337
|
role: "menu",
|
|
@@ -1251,7 +1340,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1251
1340
|
style: { left: menu.x, top: menu.y },
|
|
1252
1341
|
onClick: (e) => e.stopPropagation(),
|
|
1253
1342
|
onKeyDown: (e) => e.key === "Escape" && setMenu(null),
|
|
1254
|
-
children: (0, import_image_editor7.layerMenu)(controller).map((item) => /* @__PURE__ */ (0,
|
|
1343
|
+
children: (0, import_image_editor7.layerMenu)(controller).map((item) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1255
1344
|
"button",
|
|
1256
1345
|
{
|
|
1257
1346
|
type: "button",
|
|
@@ -1269,21 +1358,21 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1269
1358
|
};
|
|
1270
1359
|
|
|
1271
1360
|
// src/image-editor/ImageProviderEffectsPanel.tsx
|
|
1272
|
-
var
|
|
1361
|
+
var import_react15 = __toESM(require("react"), 1);
|
|
1273
1362
|
var import_image_editor8 = require("@pixerate/editor/image-editor");
|
|
1274
1363
|
|
|
1275
1364
|
// src/effects/useEffects.ts
|
|
1276
|
-
var
|
|
1365
|
+
var import_react10 = require("react");
|
|
1277
1366
|
function useEffects(host, provider) {
|
|
1278
|
-
(0,
|
|
1367
|
+
(0, import_react10.useEffect)(() => {
|
|
1279
1368
|
if (!host || !provider) return;
|
|
1280
1369
|
return host.useEffects(provider);
|
|
1281
1370
|
}, [host, provider]);
|
|
1282
1371
|
}
|
|
1283
1372
|
function useEffectDescription(provider, effect) {
|
|
1284
|
-
const [state, setState] = (0,
|
|
1373
|
+
const [state, setState] = (0, import_react10.useState)({ key: "", description: null, error: null });
|
|
1285
1374
|
const key = provider && effect ? `${provider.id}:${effect}` : "";
|
|
1286
|
-
(0,
|
|
1375
|
+
(0, import_react10.useEffect)(() => {
|
|
1287
1376
|
if (!provider || !effect) return;
|
|
1288
1377
|
let live = true;
|
|
1289
1378
|
Promise.resolve().then(() => provider.describe(effect)).then(
|
|
@@ -1298,13 +1387,13 @@ function useEffectDescription(provider, effect) {
|
|
|
1298
1387
|
}
|
|
1299
1388
|
|
|
1300
1389
|
// src/effects/EffectThumbnail.tsx
|
|
1301
|
-
var
|
|
1390
|
+
var import_react11 = require("react");
|
|
1302
1391
|
var import_effects = require("@pixerate/editor/effects");
|
|
1303
|
-
var
|
|
1392
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1304
1393
|
function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
|
|
1305
|
-
const ref = (0,
|
|
1306
|
-
const [failed, setFailed] = (0,
|
|
1307
|
-
(0,
|
|
1394
|
+
const ref = (0, import_react11.useRef)(null);
|
|
1395
|
+
const [failed, setFailed] = (0, import_react11.useState)(effect.kind === "motion");
|
|
1396
|
+
(0, import_react11.useEffect)(() => {
|
|
1308
1397
|
if (effect.kind === "motion") return;
|
|
1309
1398
|
let live = true;
|
|
1310
1399
|
(0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
|
|
@@ -1319,28 +1408,28 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
|
|
|
1319
1408
|
live = false;
|
|
1320
1409
|
};
|
|
1321
1410
|
}, [provider, effect, width, height]);
|
|
1322
|
-
return /* @__PURE__ */ (0,
|
|
1411
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1323
1412
|
"div",
|
|
1324
1413
|
{
|
|
1325
1414
|
className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
|
|
1326
1415
|
style: { aspectRatio: `${width} / ${height}` },
|
|
1327
1416
|
"data-effect-thumbnail": effect.id,
|
|
1328
|
-
children: failed ? /* @__PURE__ */ (0,
|
|
1417
|
+
children: failed ? /* @__PURE__ */ (0, import_jsx_runtime9.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_runtime9.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
|
|
1329
1418
|
}
|
|
1330
1419
|
);
|
|
1331
1420
|
}
|
|
1332
1421
|
|
|
1333
1422
|
// src/effects/EffectsBrowser.tsx
|
|
1334
|
-
var
|
|
1423
|
+
var import_react12 = require("react");
|
|
1335
1424
|
var import_effects2 = require("@pixerate/editor/effects");
|
|
1336
|
-
var
|
|
1425
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1337
1426
|
function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
|
|
1338
|
-
const [all, setAll] = (0,
|
|
1339
|
-
const [query, setQuery] = (0,
|
|
1340
|
-
const [category, setCategory] = (0,
|
|
1341
|
-
const [use, setUse] = (0,
|
|
1342
|
-
const [error, setError] = (0,
|
|
1343
|
-
(0,
|
|
1427
|
+
const [all, setAll] = (0, import_react12.useState)([]);
|
|
1428
|
+
const [query, setQuery] = (0, import_react12.useState)("");
|
|
1429
|
+
const [category, setCategory] = (0, import_react12.useState)("");
|
|
1430
|
+
const [use, setUse] = (0, import_react12.useState)("");
|
|
1431
|
+
const [error, setError] = (0, import_react12.useState)(null);
|
|
1432
|
+
(0, import_react12.useEffect)(() => {
|
|
1344
1433
|
if (!provider) return setAll([]);
|
|
1345
1434
|
let live = true;
|
|
1346
1435
|
Promise.resolve().then(() => provider.list()).then(
|
|
@@ -1351,8 +1440,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
1351
1440
|
live = false;
|
|
1352
1441
|
};
|
|
1353
1442
|
}, [provider]);
|
|
1354
|
-
const [found, setFound] = (0,
|
|
1355
|
-
(0,
|
|
1443
|
+
const [found, setFound] = (0, import_react12.useState)([]);
|
|
1444
|
+
(0, import_react12.useEffect)(() => {
|
|
1356
1445
|
if (!provider) return setFound([]);
|
|
1357
1446
|
let live = true;
|
|
1358
1447
|
Promise.resolve().then(() => provider.search(query, { ...category ? { category } : {}, ...use ? { use } : {} })).then((list) => live && setFound(list), () => live && setFound([]));
|
|
@@ -1361,14 +1450,14 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
1361
1450
|
};
|
|
1362
1451
|
}, [provider, query, category, use]);
|
|
1363
1452
|
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)));
|
|
1364
|
-
const categories = (0,
|
|
1453
|
+
const categories = (0, import_react12.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
|
|
1365
1454
|
const shown = found.filter(allowed);
|
|
1366
1455
|
if (!provider)
|
|
1367
|
-
return /* @__PURE__ */ (0,
|
|
1368
|
-
return /* @__PURE__ */ (0,
|
|
1369
|
-
title && /* @__PURE__ */ (0,
|
|
1370
|
-
/* @__PURE__ */ (0,
|
|
1371
|
-
/* @__PURE__ */ (0,
|
|
1456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.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." });
|
|
1457
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
|
|
1458
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h3", { className: "text-xs font-semibold", children: title }),
|
|
1459
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
1460
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1372
1461
|
"input",
|
|
1373
1462
|
{
|
|
1374
1463
|
type: "search",
|
|
@@ -1379,17 +1468,17 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
1379
1468
|
onChange: (e) => setQuery(e.currentTarget.value)
|
|
1380
1469
|
}
|
|
1381
1470
|
),
|
|
1382
|
-
/* @__PURE__ */ (0,
|
|
1383
|
-
/* @__PURE__ */ (0,
|
|
1384
|
-
categories.map((c) => /* @__PURE__ */ (0,
|
|
1471
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.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: [
|
|
1472
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "", children: "All categories" }),
|
|
1473
|
+
categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: c, children: c }, c))
|
|
1385
1474
|
] }),
|
|
1386
|
-
uses && uses.length > 1 && /* @__PURE__ */ (0,
|
|
1387
|
-
/* @__PURE__ */ (0,
|
|
1388
|
-
uses.map((u) => /* @__PURE__ */ (0,
|
|
1475
|
+
uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime10.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: [
|
|
1476
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "", children: "Any use" }),
|
|
1477
|
+
uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
|
|
1389
1478
|
] })
|
|
1390
1479
|
] }),
|
|
1391
|
-
error && /* @__PURE__ */ (0,
|
|
1392
|
-
/* @__PURE__ */ (0,
|
|
1480
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
|
|
1481
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.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_runtime10.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1393
1482
|
"button",
|
|
1394
1483
|
{
|
|
1395
1484
|
type: "button",
|
|
@@ -1398,25 +1487,25 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
1398
1487
|
"data-effect-id": e.id,
|
|
1399
1488
|
onClick: () => onPick(e),
|
|
1400
1489
|
children: [
|
|
1401
|
-
thumbnails && /* @__PURE__ */ (0,
|
|
1402
|
-
/* @__PURE__ */ (0,
|
|
1403
|
-
/* @__PURE__ */ (0,
|
|
1490
|
+
thumbnails && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(EffectThumbnail, { provider, effect: e }),
|
|
1491
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
|
|
1492
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
|
|
1404
1493
|
]
|
|
1405
1494
|
}
|
|
1406
1495
|
) }, e.id)) }),
|
|
1407
|
-
!shown.length && !error && /* @__PURE__ */ (0,
|
|
1496
|
+
!shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
|
|
1408
1497
|
] });
|
|
1409
1498
|
}
|
|
1410
1499
|
|
|
1411
1500
|
// src/effects/EffectParameters.tsx
|
|
1412
|
-
var
|
|
1501
|
+
var import_react14 = __toESM(require("react"), 1);
|
|
1413
1502
|
var import_effects3 = require("@pixerate/editor/effects");
|
|
1414
1503
|
var import_parameters2 = require("@pixerate/editor/parameters");
|
|
1415
1504
|
|
|
1416
1505
|
// src/parameters/fields.tsx
|
|
1417
|
-
var
|
|
1506
|
+
var import_react13 = require("react");
|
|
1418
1507
|
var import_parameters = require("@pixerate/editor/parameters");
|
|
1419
|
-
var
|
|
1508
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1420
1509
|
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";
|
|
1421
1510
|
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";
|
|
1422
1511
|
var rangeClass = "h-4 w-full min-w-0 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50";
|
|
@@ -1440,7 +1529,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
|
|
|
1440
1529
|
onKeyDown: keyDown,
|
|
1441
1530
|
...rest
|
|
1442
1531
|
};
|
|
1443
|
-
return multiline ? /* @__PURE__ */ (0,
|
|
1532
|
+
return multiline ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("textarea", { ...props, className: `${props.className} h-auto min-h-[3.5rem] py-1` }, value) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { type: "text", ...props }, value);
|
|
1444
1533
|
}
|
|
1445
1534
|
var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
|
|
1446
1535
|
function ParameterNumberInput({
|
|
@@ -1451,8 +1540,8 @@ function ParameterNumberInput({
|
|
|
1451
1540
|
id,
|
|
1452
1541
|
"aria-label": ariaLabel
|
|
1453
1542
|
}) {
|
|
1454
|
-
return /* @__PURE__ */ (0,
|
|
1455
|
-
/* @__PURE__ */ (0,
|
|
1543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
|
|
1544
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1456
1545
|
ParameterCommitInput,
|
|
1457
1546
|
{
|
|
1458
1547
|
id,
|
|
@@ -1474,21 +1563,21 @@ function ParameterNumberInput({
|
|
|
1474
1563
|
}
|
|
1475
1564
|
}
|
|
1476
1565
|
),
|
|
1477
|
-
field.unit && /* @__PURE__ */ (0,
|
|
1566
|
+
field.unit && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
|
|
1478
1567
|
] });
|
|
1479
1568
|
}
|
|
1480
1569
|
function ParameterSlider(props) {
|
|
1481
1570
|
const { field, value, onChange, onGestureStart, onGestureEnd, disabled } = props;
|
|
1482
|
-
const dragging = (0,
|
|
1571
|
+
const dragging = (0, import_react13.useRef)(false);
|
|
1483
1572
|
const end = () => {
|
|
1484
1573
|
if (!dragging.current) return;
|
|
1485
1574
|
dragging.current = false;
|
|
1486
1575
|
onGestureEnd?.();
|
|
1487
1576
|
};
|
|
1488
|
-
if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0,
|
|
1577
|
+
if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterNumberInput, { ...props });
|
|
1489
1578
|
const step = (0, import_parameters.parameterStep)(field);
|
|
1490
|
-
return /* @__PURE__ */ (0,
|
|
1491
|
-
/* @__PURE__ */ (0,
|
|
1579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1580
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1492
1581
|
"input",
|
|
1493
1582
|
{
|
|
1494
1583
|
type: "range",
|
|
@@ -1511,11 +1600,11 @@ function ParameterSlider(props) {
|
|
|
1511
1600
|
onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
|
|
1512
1601
|
}
|
|
1513
1602
|
),
|
|
1514
|
-
/* @__PURE__ */ (0,
|
|
1603
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
|
|
1515
1604
|
] });
|
|
1516
1605
|
}
|
|
1517
1606
|
function ParameterToggle({ field, value, onChange, disabled, id }) {
|
|
1518
|
-
return /* @__PURE__ */ (0,
|
|
1607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1519
1608
|
"button",
|
|
1520
1609
|
{
|
|
1521
1610
|
type: "button",
|
|
@@ -1526,7 +1615,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
|
|
|
1526
1615
|
disabled: disabled || field.readOnly,
|
|
1527
1616
|
onClick: () => onChange(!value),
|
|
1528
1617
|
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"}`,
|
|
1529
|
-
children: /* @__PURE__ */ (0,
|
|
1618
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1530
1619
|
"span",
|
|
1531
1620
|
{
|
|
1532
1621
|
className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
|
|
@@ -1539,7 +1628,7 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
|
|
|
1539
1628
|
const options = (0, import_parameters.getChoiceOptions)(field);
|
|
1540
1629
|
const off = disabled || field.readOnly;
|
|
1541
1630
|
if (field.control === "segmented") {
|
|
1542
|
-
return /* @__PURE__ */ (0,
|
|
1631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.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_runtime11.jsx)(
|
|
1543
1632
|
"button",
|
|
1544
1633
|
{
|
|
1545
1634
|
type: "button",
|
|
@@ -1555,7 +1644,7 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
|
|
|
1555
1644
|
)) });
|
|
1556
1645
|
}
|
|
1557
1646
|
const index = options.findIndex((o) => o.value === value);
|
|
1558
|
-
return /* @__PURE__ */ (0,
|
|
1647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1559
1648
|
"select",
|
|
1560
1649
|
{
|
|
1561
1650
|
id,
|
|
@@ -1567,12 +1656,12 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
|
|
|
1567
1656
|
if (option) onChange(option.value);
|
|
1568
1657
|
},
|
|
1569
1658
|
className: parameterInputClass,
|
|
1570
|
-
children: options.map((o, i) => /* @__PURE__ */ (0,
|
|
1659
|
+
children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: String(i), title: o.description, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
|
|
1571
1660
|
}
|
|
1572
1661
|
);
|
|
1573
1662
|
}
|
|
1574
1663
|
function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id }) {
|
|
1575
|
-
const picking = (0,
|
|
1664
|
+
const picking = (0, import_react13.useRef)(false);
|
|
1576
1665
|
const alpha = !!field.alpha;
|
|
1577
1666
|
const hex = (0, import_parameters.normalizeHexColor)(value, true) ?? "#000000ff";
|
|
1578
1667
|
const rgb = hex.slice(0, 7);
|
|
@@ -1588,11 +1677,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
1588
1677
|
picking.current = false;
|
|
1589
1678
|
onGestureEnd?.();
|
|
1590
1679
|
};
|
|
1591
|
-
return /* @__PURE__ */ (0,
|
|
1592
|
-
/* @__PURE__ */ (0,
|
|
1593
|
-
/* @__PURE__ */ (0,
|
|
1594
|
-
/* @__PURE__ */ (0,
|
|
1595
|
-
/* @__PURE__ */ (0,
|
|
1680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "space-y-1.5", children: [
|
|
1681
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1682
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { 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]", children: [
|
|
1683
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "absolute inset-0", style: { background: alpha ? hex : rgb } }),
|
|
1684
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1596
1685
|
"input",
|
|
1597
1686
|
{
|
|
1598
1687
|
type: "color",
|
|
@@ -1608,7 +1697,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
1608
1697
|
}
|
|
1609
1698
|
)
|
|
1610
1699
|
] }),
|
|
1611
|
-
/* @__PURE__ */ (0,
|
|
1700
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1612
1701
|
ParameterCommitInput,
|
|
1613
1702
|
{
|
|
1614
1703
|
id,
|
|
@@ -1624,7 +1713,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
1624
1713
|
}
|
|
1625
1714
|
)
|
|
1626
1715
|
] }),
|
|
1627
|
-
alpha && /* @__PURE__ */ (0,
|
|
1716
|
+
alpha && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1628
1717
|
"input",
|
|
1629
1718
|
{
|
|
1630
1719
|
type: "range",
|
|
@@ -1642,10 +1731,10 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
1642
1731
|
onChange: (e) => onChange(`${rgb}${Number(e.target.value).toString(16).padStart(2, "0")}`)
|
|
1643
1732
|
}
|
|
1644
1733
|
),
|
|
1645
|
-
field.swatches && field.swatches.length > 0 && /* @__PURE__ */ (0,
|
|
1734
|
+
field.swatches && field.swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex flex-wrap gap-1", children: field.swatches.map((s) => {
|
|
1646
1735
|
const swatch = (0, import_parameters.normalizeHexColor)(s, alpha);
|
|
1647
1736
|
if (!swatch) return null;
|
|
1648
|
-
return /* @__PURE__ */ (0,
|
|
1737
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1649
1738
|
"button",
|
|
1650
1739
|
{
|
|
1651
1740
|
type: "button",
|
|
@@ -1664,11 +1753,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
1664
1753
|
}
|
|
1665
1754
|
function ParameterVector({ field, value, onChange, disabled, id }) {
|
|
1666
1755
|
const size = (0, import_parameters.vectorSize)(field);
|
|
1667
|
-
return /* @__PURE__ */ (0,
|
|
1756
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
|
|
1668
1757
|
const component = (0, import_parameters.vectorComponentField)(field, i);
|
|
1669
|
-
return /* @__PURE__ */ (0,
|
|
1670
|
-
/* @__PURE__ */ (0,
|
|
1671
|
-
/* @__PURE__ */ (0,
|
|
1758
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
|
|
1759
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
|
|
1760
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1672
1761
|
ParameterNumberInput,
|
|
1673
1762
|
{
|
|
1674
1763
|
field: component,
|
|
@@ -1685,11 +1774,11 @@ function ParameterVector({ field, value, onChange, disabled, id }) {
|
|
|
1685
1774
|
function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
1686
1775
|
const off = disabled || field.readOnly;
|
|
1687
1776
|
const name = (0, import_parameters.parameterLabel)(field);
|
|
1688
|
-
return /* @__PURE__ */ (0,
|
|
1689
|
-
/* @__PURE__ */ (0,
|
|
1690
|
-
/* @__PURE__ */ (0,
|
|
1691
|
-
/* @__PURE__ */ (0,
|
|
1692
|
-
/* @__PURE__ */ (0,
|
|
1777
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "space-y-1.5", children: [
|
|
1778
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1779
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.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_runtime11.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
|
|
1780
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
1781
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1693
1782
|
ParameterCommitInput,
|
|
1694
1783
|
{
|
|
1695
1784
|
id,
|
|
@@ -1700,10 +1789,10 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
1700
1789
|
onCommit: (text) => onChange(text.trim())
|
|
1701
1790
|
}
|
|
1702
1791
|
),
|
|
1703
|
-
/* @__PURE__ */ (0,
|
|
1704
|
-
resolveFile && /* @__PURE__ */ (0,
|
|
1792
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex gap-1", children: [
|
|
1793
|
+
resolveFile && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`, children: [
|
|
1705
1794
|
"Choose file\u2026",
|
|
1706
|
-
/* @__PURE__ */ (0,
|
|
1795
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1707
1796
|
"input",
|
|
1708
1797
|
{
|
|
1709
1798
|
type: "file",
|
|
@@ -1719,11 +1808,11 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
1719
1808
|
}
|
|
1720
1809
|
)
|
|
1721
1810
|
] }),
|
|
1722
|
-
value && /* @__PURE__ */ (0,
|
|
1811
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: parameterButtonClass, disabled: off, onClick: () => onChange(""), "aria-label": `Clear ${name}`, children: "Clear" })
|
|
1723
1812
|
] })
|
|
1724
1813
|
] })
|
|
1725
1814
|
] }),
|
|
1726
|
-
field.options && field.options.length > 0 && /* @__PURE__ */ (0,
|
|
1815
|
+
field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1727
1816
|
"button",
|
|
1728
1817
|
{
|
|
1729
1818
|
type: "button",
|
|
@@ -1733,14 +1822,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
1733
1822
|
disabled: off,
|
|
1734
1823
|
onClick: () => onChange(o.url),
|
|
1735
1824
|
className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
|
|
1736
|
-
children: /* @__PURE__ */ (0,
|
|
1825
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
|
|
1737
1826
|
},
|
|
1738
1827
|
o.url
|
|
1739
1828
|
)) })
|
|
1740
1829
|
] });
|
|
1741
1830
|
}
|
|
1742
1831
|
function ParameterText({ field, value, onChange, disabled, id }) {
|
|
1743
|
-
return /* @__PURE__ */ (0,
|
|
1832
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1744
1833
|
ParameterCommitInput,
|
|
1745
1834
|
{
|
|
1746
1835
|
id,
|
|
@@ -1759,31 +1848,31 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
|
|
|
1759
1848
|
switch (field.type) {
|
|
1760
1849
|
case "number":
|
|
1761
1850
|
case "int":
|
|
1762
|
-
return /* @__PURE__ */ (0,
|
|
1851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
|
|
1763
1852
|
case "boolean":
|
|
1764
|
-
return /* @__PURE__ */ (0,
|
|
1853
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
|
|
1765
1854
|
case "choice":
|
|
1766
|
-
return /* @__PURE__ */ (0,
|
|
1855
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
|
|
1767
1856
|
case "color":
|
|
1768
|
-
return /* @__PURE__ */ (0,
|
|
1857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
|
|
1769
1858
|
case "vector":
|
|
1770
|
-
return /* @__PURE__ */ (0,
|
|
1859
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
|
|
1771
1860
|
case "image":
|
|
1772
|
-
return /* @__PURE__ */ (0,
|
|
1861
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
|
|
1773
1862
|
case "text":
|
|
1774
|
-
return /* @__PURE__ */ (0,
|
|
1863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterText, { field, value, onChange: set, ...rest });
|
|
1775
1864
|
}
|
|
1776
1865
|
}
|
|
1777
1866
|
|
|
1778
1867
|
// src/effects/EffectParameters.tsx
|
|
1779
|
-
var
|
|
1868
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1780
1869
|
function EffectParameters({ description, values, onChange, onReset, keyframed, onPreset, disabled = false, className = "" }) {
|
|
1781
|
-
const fields = (0,
|
|
1782
|
-
const idBase = (0,
|
|
1783
|
-
const gesture =
|
|
1784
|
-
const count =
|
|
1785
|
-
return /* @__PURE__ */ (0,
|
|
1786
|
-
onPreset && description.presets.length > 0 && /* @__PURE__ */ (0,
|
|
1870
|
+
const fields = (0, import_react14.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
|
|
1871
|
+
const idBase = (0, import_react14.useId)();
|
|
1872
|
+
const gesture = import_react14.default.useRef(null);
|
|
1873
|
+
const count = import_react14.default.useRef(0);
|
|
1874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
|
|
1875
|
+
onPreset && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1787
1876
|
"select",
|
|
1788
1877
|
{
|
|
1789
1878
|
className: "w-full rounded border border-border bg-transparent px-1 py-0.5 text-xs",
|
|
@@ -1795,8 +1884,8 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
|
|
|
1795
1884
|
if (preset) onPreset({ ...description.defaults, ...preset.values });
|
|
1796
1885
|
},
|
|
1797
1886
|
children: [
|
|
1798
|
-
/* @__PURE__ */ (0,
|
|
1799
|
-
description.presets.map((p) => /* @__PURE__ */ (0,
|
|
1887
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "", children: "Presets\u2026" }),
|
|
1888
|
+
description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: p.name, children: p.name }, p.name))
|
|
1800
1889
|
]
|
|
1801
1890
|
}
|
|
1802
1891
|
),
|
|
@@ -1806,13 +1895,13 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
|
|
|
1806
1895
|
const keyed = keyframed?.has(field.id) ?? false;
|
|
1807
1896
|
const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
|
|
1808
1897
|
const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
|
|
1809
|
-
return /* @__PURE__ */ (0,
|
|
1810
|
-
/* @__PURE__ */ (0,
|
|
1811
|
-
/* @__PURE__ */ (0,
|
|
1812
|
-
keyed && /* @__PURE__ */ (0,
|
|
1813
|
-
onReset && changed && !disabled && /* @__PURE__ */ (0,
|
|
1898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
|
|
1899
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
1900
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
|
|
1901
|
+
keyed && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
|
|
1902
|
+
onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime12.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" })
|
|
1814
1903
|
] }),
|
|
1815
|
-
/* @__PURE__ */ (0,
|
|
1904
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1816
1905
|
ParameterFieldControl,
|
|
1817
1906
|
{
|
|
1818
1907
|
field,
|
|
@@ -1826,12 +1915,12 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
|
|
|
1826
1915
|
)
|
|
1827
1916
|
] }, field.id);
|
|
1828
1917
|
}),
|
|
1829
|
-
!fields.length && /* @__PURE__ */ (0,
|
|
1918
|
+
!fields.length && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
|
|
1830
1919
|
] });
|
|
1831
1920
|
}
|
|
1832
1921
|
|
|
1833
1922
|
// src/image-editor/ImageProviderEffectsPanel.tsx
|
|
1834
|
-
var
|
|
1923
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1835
1924
|
var btn = "rounded border border-slate-700 px-1.5 py-0.5 text-[11px] text-slate-300 hover:text-white disabled:opacity-40";
|
|
1836
1925
|
function Controls({
|
|
1837
1926
|
provider,
|
|
@@ -1842,21 +1931,21 @@ function Controls({
|
|
|
1842
1931
|
onPreset
|
|
1843
1932
|
}) {
|
|
1844
1933
|
const { description, error } = useEffectDescription(provider, effect);
|
|
1845
|
-
if (!provider) return /* @__PURE__ */ (0,
|
|
1934
|
+
if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
|
|
1846
1935
|
'No effects provider: "',
|
|
1847
1936
|
name ?? effect,
|
|
1848
1937
|
'" is kept but not drawn.'
|
|
1849
1938
|
] });
|
|
1850
|
-
if (error) return /* @__PURE__ */ (0,
|
|
1851
|
-
if (!description) return /* @__PURE__ */ (0,
|
|
1852
|
-
return /* @__PURE__ */ (0,
|
|
1939
|
+
if (error) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
|
|
1940
|
+
if (!description) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
|
|
1941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EffectParameters, { description, values, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
|
|
1853
1942
|
}
|
|
1854
1943
|
function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
1855
|
-
const [, setTick] = (0,
|
|
1856
|
-
(0,
|
|
1857
|
-
const [browse, setBrowse] = (0,
|
|
1858
|
-
const [message, setMessage] = (0,
|
|
1859
|
-
const [open, setOpen] = (0,
|
|
1944
|
+
const [, setTick] = (0, import_react15.useState)(0);
|
|
1945
|
+
(0, import_react15.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
1946
|
+
const [browse, setBrowse] = (0, import_react15.useState)(null);
|
|
1947
|
+
const [message, setMessage] = (0, import_react15.useState)(null);
|
|
1948
|
+
const [open, setOpen] = (0, import_react15.useState)(null);
|
|
1860
1949
|
const provider = controller.effectsProvider;
|
|
1861
1950
|
const state = controller.getState();
|
|
1862
1951
|
const layer = state.activeLayerId ? (0, import_image_editor8.findLayer)(state.layers, state.activeLayerId)?.layer ?? null : null;
|
|
@@ -1864,7 +1953,7 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
1864
1953
|
setMessage(null);
|
|
1865
1954
|
Promise.resolve().then(work).catch((e) => setMessage(e instanceof Error ? e.message : String(e)));
|
|
1866
1955
|
};
|
|
1867
|
-
const drags =
|
|
1956
|
+
const drags = import_react15.default.useRef(/* @__PURE__ */ new Set());
|
|
1868
1957
|
const commit = (gesture) => {
|
|
1869
1958
|
if (gesture) {
|
|
1870
1959
|
if (!drags.current.has(gesture)) {
|
|
@@ -1878,21 +1967,21 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
1878
1967
|
const filters = layer?.type === "smart" ? (layer.smartFilters?.filters ?? []).filter((f) => f.kind === "effect") : [];
|
|
1879
1968
|
const generator = layer?.type === "pixel" ? layer.generator : void 0;
|
|
1880
1969
|
const canFilter = !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
|
|
1881
|
-
return /* @__PURE__ */ (0,
|
|
1882
|
-
/* @__PURE__ */ (0,
|
|
1883
|
-
/* @__PURE__ */ (0,
|
|
1884
|
-
/* @__PURE__ */ (0,
|
|
1885
|
-
/* @__PURE__ */ (0,
|
|
1970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Provider effects", "data-image-provider-effects": "", children: [
|
|
1971
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1972
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-slate-200", children: "Effects" }),
|
|
1973
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: btn, disabled: !provider || !canFilter, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Apply effect\u2026" }),
|
|
1974
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: btn, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => setBrowse(browse === "layer" ? null : "layer"), children: "Effect layer\u2026" })
|
|
1886
1975
|
] }),
|
|
1887
|
-
!provider && /* @__PURE__ */ (0,
|
|
1888
|
-
browse === "filter" && layer && /* @__PURE__ */ (0,
|
|
1889
|
-
browse === "layer" && /* @__PURE__ */ (0,
|
|
1890
|
-
generator && layer && /* @__PURE__ */ (0,
|
|
1891
|
-
/* @__PURE__ */ (0,
|
|
1892
|
-
/* @__PURE__ */ (0,
|
|
1893
|
-
/* @__PURE__ */ (0,
|
|
1976
|
+
!provider && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the document are kept." }),
|
|
1977
|
+
browse === "filter" && layer && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id))) }),
|
|
1978
|
+
browse === "layer" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EffectsBrowser, { provider, uses: ["generator", "overlay", "title"], title: "Generators and overlays", onPick: (e) => (setBrowse(null), run(() => controller.addEffectLayer(e.id))) }),
|
|
1979
|
+
generator && layer && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "space-y-1", "data-effect-part": "generator", children: [
|
|
1980
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1981
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "flex-1 font-medium text-slate-200", children: generator.name ?? generator.effect }),
|
|
1982
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: btn, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
|
|
1894
1983
|
] }),
|
|
1895
|
-
/* @__PURE__ */ (0,
|
|
1984
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1896
1985
|
Controls,
|
|
1897
1986
|
{
|
|
1898
1987
|
provider,
|
|
@@ -1904,26 +1993,26 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
1904
1993
|
}
|
|
1905
1994
|
)
|
|
1906
1995
|
] }),
|
|
1907
|
-
filters.length > 0 && layer && /* @__PURE__ */ (0,
|
|
1996
|
+
filters.length > 0 && layer && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ol", { className: "space-y-1", "data-effect-part": "filters", children: filters.map((f) => {
|
|
1908
1997
|
const label = f.kind === "effect" ? f.name ?? f.effect : f.kind;
|
|
1909
1998
|
const all = layer.smartFilters.filters;
|
|
1910
1999
|
const index = all.indexOf(f);
|
|
1911
2000
|
if (f.kind !== "effect") return null;
|
|
1912
|
-
return /* @__PURE__ */ (0,
|
|
1913
|
-
/* @__PURE__ */ (0,
|
|
1914
|
-
/* @__PURE__ */ (0,
|
|
2001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("li", { className: "rounded border border-slate-700 p-1", "data-smart-effect": f.id, children: [
|
|
2002
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2003
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "checkbox", checked: f.enabled, "aria-label": `${label} on`, onChange: (e) => {
|
|
1915
2004
|
const enabled = e.currentTarget.checked;
|
|
1916
2005
|
run(() => controller.updateEffectFilter(layer.id, f.id, { enabled }));
|
|
1917
2006
|
} }),
|
|
1918
|
-
/* @__PURE__ */ (0,
|
|
1919
|
-
/* @__PURE__ */ (0,
|
|
1920
|
-
/* @__PURE__ */ (0,
|
|
1921
|
-
/* @__PURE__ */ (0,
|
|
2007
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "min-w-0 flex-1 truncate text-left text-slate-200", "aria-expanded": open === f.id, onClick: () => setOpen(open === f.id ? null : f.id), children: label }),
|
|
2008
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: btn, disabled: index === all.length - 1, "aria-label": "Move up", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index + 1 })), children: "\u2191" }),
|
|
2009
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: btn, disabled: index === 0, "aria-label": "Move down", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index - 1 })), children: "\u2193" }),
|
|
2010
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: btn, "aria-label": `Remove ${label}`, onClick: () => run(() => controller.removeSmartFilter(layer.id, f.id)), children: "\u2715" })
|
|
1922
2011
|
] }),
|
|
1923
|
-
open === f.id && /* @__PURE__ */ (0,
|
|
1924
|
-
/* @__PURE__ */ (0,
|
|
1925
|
-
/* @__PURE__ */ (0,
|
|
1926
|
-
/* @__PURE__ */ (0,
|
|
2012
|
+
open === f.id && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "mt-1 space-y-2", children: [
|
|
2013
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
2014
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "w-14 text-[11px] text-slate-300", children: "Opacity" }),
|
|
2015
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1927
2016
|
"input",
|
|
1928
2017
|
{
|
|
1929
2018
|
type: "range",
|
|
@@ -1940,7 +2029,7 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
1940
2029
|
}
|
|
1941
2030
|
)
|
|
1942
2031
|
] }),
|
|
1943
|
-
/* @__PURE__ */ (0,
|
|
2032
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1944
2033
|
Controls,
|
|
1945
2034
|
{
|
|
1946
2035
|
provider,
|
|
@@ -1954,13 +2043,13 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
1954
2043
|
] })
|
|
1955
2044
|
] }, f.id);
|
|
1956
2045
|
}) }),
|
|
1957
|
-
!layer && /* @__PURE__ */ (0,
|
|
1958
|
-
message && /* @__PURE__ */ (0,
|
|
2046
|
+
!layer && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-[11px] text-slate-400", children: "Select a layer to apply effects to it." }),
|
|
2047
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { role: "alert", className: "text-[11px] text-rose-400", children: message })
|
|
1959
2048
|
] });
|
|
1960
2049
|
}
|
|
1961
2050
|
|
|
1962
2051
|
// src/image-editor/BrushOptionsBar.tsx
|
|
1963
|
-
var
|
|
2052
|
+
var import_react17 = require("react");
|
|
1964
2053
|
var import_image_editor10 = require("@pixerate/editor/image-editor");
|
|
1965
2054
|
var import_image_editor11 = require("@pixerate/editor/image-editor");
|
|
1966
2055
|
|
|
@@ -1968,8 +2057,8 @@ var import_image_editor11 = require("@pixerate/editor/image-editor");
|
|
|
1968
2057
|
var import_image_editor9 = require("@pixerate/editor/image-editor");
|
|
1969
2058
|
|
|
1970
2059
|
// src/paint-editor/PaintGradientEditorView.tsx
|
|
1971
|
-
var
|
|
1972
|
-
var
|
|
2060
|
+
var import_react16 = require("react");
|
|
2061
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1973
2062
|
var button2 = "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700 disabled:opacity-40";
|
|
1974
2063
|
var select = "rounded bg-slate-800 px-1 py-0.5 text-[11px]";
|
|
1975
2064
|
var number = "w-16 rounded bg-slate-800 px-1 py-0.5 text-[11px]";
|
|
@@ -1990,7 +2079,7 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
|
|
|
1990
2079
|
reversePaintGradient,
|
|
1991
2080
|
updatePaintGradientStop
|
|
1992
2081
|
} = kit;
|
|
1993
|
-
const [selected, setSelected] = (0,
|
|
2082
|
+
const [selected, setSelected] = (0, import_react16.useState)(0);
|
|
1994
2083
|
const sel = Math.min(selected, value.stops.length - 1);
|
|
1995
2084
|
const stop = value.stops[sel];
|
|
1996
2085
|
const map = value.map;
|
|
@@ -2000,15 +2089,15 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
|
|
|
2000
2089
|
setSelected(r.index);
|
|
2001
2090
|
onChange(r.paint);
|
|
2002
2091
|
};
|
|
2003
|
-
return /* @__PURE__ */ (0,
|
|
2004
|
-
/* @__PURE__ */ (0,
|
|
2005
|
-
/* @__PURE__ */ (0,
|
|
2006
|
-
/* @__PURE__ */ (0,
|
|
2007
|
-
PAINT_GRADIENT_PRESETS.map((p, i) => /* @__PURE__ */ (0,
|
|
2092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.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: [
|
|
2093
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2094
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.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: [
|
|
2095
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", children: "Presets\u2026" }),
|
|
2096
|
+
PAINT_GRADIENT_PRESETS.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: i, children: p.name }, p.name))
|
|
2008
2097
|
] }),
|
|
2009
|
-
/* @__PURE__ */ (0,
|
|
2098
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button2, onClick: () => onChange(reversePaintGradient(value)), children: "Reverse" })
|
|
2010
2099
|
] }),
|
|
2011
|
-
/* @__PURE__ */ (0,
|
|
2100
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2012
2101
|
"div",
|
|
2013
2102
|
{
|
|
2014
2103
|
role: "slider",
|
|
@@ -2030,7 +2119,7 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
|
|
|
2030
2119
|
}
|
|
2031
2120
|
}
|
|
2032
2121
|
),
|
|
2033
|
-
/* @__PURE__ */ (0,
|
|
2122
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "relative h-4", "aria-label": "Stops", children: value.stops.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2034
2123
|
"button",
|
|
2035
2124
|
{
|
|
2036
2125
|
type: "button",
|
|
@@ -2042,64 +2131,64 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
|
|
|
2042
2131
|
},
|
|
2043
2132
|
i
|
|
2044
2133
|
)) }),
|
|
2045
|
-
/* @__PURE__ */ (0,
|
|
2046
|
-
/* @__PURE__ */ (0,
|
|
2047
|
-
/* @__PURE__ */ (0,
|
|
2048
|
-
/* @__PURE__ */ (0,
|
|
2049
|
-
/* @__PURE__ */ (0,
|
|
2134
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-stop", children: [
|
|
2135
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.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: [
|
|
2136
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "color", children: "Colour" }),
|
|
2137
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "paint", children: "Paint colour" }),
|
|
2138
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "secondary", children: "Second colour" })
|
|
2050
2139
|
] }),
|
|
2051
|
-
stop.color !== "paint" && stop.color !== "secondary" && /* @__PURE__ */ (0,
|
|
2052
|
-
/* @__PURE__ */ (0,
|
|
2140
|
+
stop.color !== "paint" && stop.color !== "secondary" && /* @__PURE__ */ (0, import_jsx_runtime14.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" }),
|
|
2141
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
2053
2142
|
"At",
|
|
2054
|
-
/* @__PURE__ */ (0,
|
|
2143
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.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 }),
|
|
2055
2144
|
"%"
|
|
2056
2145
|
] }),
|
|
2057
|
-
/* @__PURE__ */ (0,
|
|
2146
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
2058
2147
|
"Opacity",
|
|
2059
|
-
/* @__PURE__ */ (0,
|
|
2148
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.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 }),
|
|
2060
2149
|
"%"
|
|
2061
2150
|
] }),
|
|
2062
|
-
sel < value.stops.length - 1 && /* @__PURE__ */ (0,
|
|
2151
|
+
sel < value.stops.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
2063
2152
|
"Midpoint",
|
|
2064
|
-
/* @__PURE__ */ (0,
|
|
2153
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.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 }),
|
|
2065
2154
|
"%"
|
|
2066
2155
|
] }),
|
|
2067
|
-
/* @__PURE__ */ (0,
|
|
2156
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button2, disabled: value.stops.length <= 2, onClick: () => (setSelected(Math.max(0, sel - 1)), onChange(removePaintGradientStop(value, sel))), children: "Remove stop" })
|
|
2068
2157
|
] }),
|
|
2069
|
-
/* @__PURE__ */ (0,
|
|
2070
|
-
/* @__PURE__ */ (0,
|
|
2071
|
-
map.by === "distance" && /* @__PURE__ */ (0,
|
|
2072
|
-
/* @__PURE__ */ (0,
|
|
2073
|
-
/* @__PURE__ */ (0,
|
|
2074
|
-
/* @__PURE__ */ (0,
|
|
2075
|
-
/* @__PURE__ */ (0,
|
|
2158
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-mapping", children: [
|
|
2159
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.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_runtime14.jsx)("option", { value: m, children: PAINT_GRADIENT_MAPPING_LABELS[m] }, m)) }),
|
|
2160
|
+
map.by === "distance" && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
2161
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.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 }),
|
|
2162
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("select", { "aria-label": "Gradient length unit", className: select, value: map.unit ?? "px", onChange: (e) => onChange({ ...value, map: { ...map, unit: e.target.value } }), children: [
|
|
2163
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "px", children: "px" }),
|
|
2164
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "dabs", children: "dabs" })
|
|
2076
2165
|
] })
|
|
2077
2166
|
] }),
|
|
2078
|
-
map.by === "time" && /* @__PURE__ */ (0,
|
|
2079
|
-
map.by === "random" && /* @__PURE__ */ (0,
|
|
2080
|
-
(map.by === "distance" || map.by === "time") && /* @__PURE__ */ (0,
|
|
2167
|
+
map.by === "time" && /* @__PURE__ */ (0, import_jsx_runtime14.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 }),
|
|
2168
|
+
map.by === "random" && /* @__PURE__ */ (0, import_jsx_runtime14.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 }),
|
|
2169
|
+
(map.by === "distance" || map.by === "time") && /* @__PURE__ */ (0, import_jsx_runtime14.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_runtime14.jsx)("option", { value: r, children: PAINT_GRADIENT_REPEAT_LABELS[r] }, r)) })
|
|
2081
2170
|
] }),
|
|
2082
|
-
/* @__PURE__ */ (0,
|
|
2083
|
-
/* @__PURE__ */ (0,
|
|
2084
|
-
/* @__PURE__ */ (0,
|
|
2171
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2172
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.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_runtime14.jsx)("option", { value: s, children: PAINT_GRADIENT_SPACE_LABELS[s] }, s)) }),
|
|
2173
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex flex-1 items-center gap-1", children: [
|
|
2085
2174
|
"Softness",
|
|
2086
|
-
/* @__PURE__ */ (0,
|
|
2175
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.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" })
|
|
2087
2176
|
] })
|
|
2088
2177
|
] })
|
|
2089
2178
|
] });
|
|
2090
2179
|
};
|
|
2091
2180
|
|
|
2092
2181
|
// src/image-editor/PaintGradientEditor.tsx
|
|
2093
|
-
var
|
|
2094
|
-
var PaintGradientEditor = (props) => /* @__PURE__ */ (0,
|
|
2182
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2183
|
+
var PaintGradientEditor = (props) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PaintGradientEditorView, { ...props, kit: import_image_editor9.PAINT_GRADIENT_KIT });
|
|
2095
2184
|
|
|
2096
2185
|
// src/image-editor/BrushOptionsBar.tsx
|
|
2097
|
-
var
|
|
2186
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2098
2187
|
var chip = (on) => `px-2 py-1 rounded text-[11px] ${on ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300 hover:text-white"}`;
|
|
2099
2188
|
var BrushOptionsBar = ({ controller, className }) => {
|
|
2100
|
-
const [, setTick] = (0,
|
|
2101
|
-
(0,
|
|
2102
|
-
const [error, setError] = (0,
|
|
2189
|
+
const [, setTick] = (0, import_react17.useState)(0);
|
|
2190
|
+
(0, import_react17.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
2191
|
+
const [error, setError] = (0, import_react17.useState)(null);
|
|
2103
2192
|
const state = controller.getState();
|
|
2104
2193
|
const { brush, foreground, background, mixer, mixerLoad, retouch, cloneSource, paint } = state.paint;
|
|
2105
2194
|
const tool = state.activeTool;
|
|
@@ -2111,8 +2200,8 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2111
2200
|
setError(err instanceof Error ? err.message : String(err));
|
|
2112
2201
|
}
|
|
2113
2202
|
};
|
|
2114
|
-
return /* @__PURE__ */ (0,
|
|
2115
|
-
/* @__PURE__ */ (0,
|
|
2203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "brush-options", children: [
|
|
2204
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: import_image_editor10.PAINT_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2116
2205
|
"button",
|
|
2117
2206
|
{
|
|
2118
2207
|
type: "button",
|
|
@@ -2124,9 +2213,9 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2124
2213
|
},
|
|
2125
2214
|
t.id
|
|
2126
2215
|
)) }),
|
|
2127
|
-
/* @__PURE__ */ (0,
|
|
2128
|
-
/* @__PURE__ */ (0,
|
|
2129
|
-
/* @__PURE__ */ (0,
|
|
2216
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", role: "group", "aria-label": "Colours", children: [
|
|
2217
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
2218
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2130
2219
|
"input",
|
|
2131
2220
|
{
|
|
2132
2221
|
type: "color",
|
|
@@ -2136,10 +2225,10 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2136
2225
|
className: "h-6 w-8 rounded border border-slate-700 bg-transparent"
|
|
2137
2226
|
}
|
|
2138
2227
|
),
|
|
2139
|
-
/* @__PURE__ */ (0,
|
|
2228
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-slate-400", children: "FG" })
|
|
2140
2229
|
] }),
|
|
2141
|
-
/* @__PURE__ */ (0,
|
|
2142
|
-
/* @__PURE__ */ (0,
|
|
2230
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
2231
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2143
2232
|
"input",
|
|
2144
2233
|
{
|
|
2145
2234
|
type: "color",
|
|
@@ -2149,11 +2238,11 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2149
2238
|
className: "h-6 w-8 rounded border border-slate-700 bg-transparent"
|
|
2150
2239
|
}
|
|
2151
2240
|
),
|
|
2152
|
-
/* @__PURE__ */ (0,
|
|
2241
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-slate-400", children: "BG" })
|
|
2153
2242
|
] }),
|
|
2154
|
-
/* @__PURE__ */ (0,
|
|
2155
|
-
/* @__PURE__ */ (0,
|
|
2156
|
-
state.activeTool === "brush" && /* @__PURE__ */ (0,
|
|
2243
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", title: "Swap colours (X)", className: chip(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
|
|
2244
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", title: "Default colours (D)", className: chip(false), onClick: () => controller.resetPaintColors(), children: "Default" }),
|
|
2245
|
+
state.activeTool === "brush" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2157
2246
|
"button",
|
|
2158
2247
|
{
|
|
2159
2248
|
type: "button",
|
|
@@ -2165,8 +2254,8 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2165
2254
|
}
|
|
2166
2255
|
)
|
|
2167
2256
|
] }),
|
|
2168
|
-
state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */ (0,
|
|
2169
|
-
import_image_editor10.BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0,
|
|
2257
|
+
state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PaintGradientEditor, { value: paint, colors: { paint: foreground, secondary: background }, onChange: (g) => attempt(() => controller.setPaintOptions({ paint: g })) }),
|
|
2258
|
+
import_image_editor10.BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2170
2259
|
ControlSlider,
|
|
2171
2260
|
{
|
|
2172
2261
|
spec,
|
|
@@ -2175,9 +2264,9 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2175
2264
|
},
|
|
2176
2265
|
spec.id
|
|
2177
2266
|
)),
|
|
2178
|
-
state.activeTool === "mixer" && /* @__PURE__ */ (0,
|
|
2179
|
-
/* @__PURE__ */ (0,
|
|
2180
|
-
/* @__PURE__ */ (0,
|
|
2267
|
+
state.activeTool === "mixer" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col gap-2 border-t border-slate-800 pt-2", role: "group", "aria-label": "Mixer Brush", "data-testid": "mixer-options", children: [
|
|
2268
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2269
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2181
2270
|
"span",
|
|
2182
2271
|
{
|
|
2183
2272
|
"aria-label": "Brush load",
|
|
@@ -2186,10 +2275,10 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2186
2275
|
style: { background: mixerLoad.reservoir ? (0, import_image_editor10.rgbUnitToHex)(mixerLoad.reservoir) : "transparent" }
|
|
2187
2276
|
}
|
|
2188
2277
|
),
|
|
2189
|
-
/* @__PURE__ */ (0,
|
|
2190
|
-
/* @__PURE__ */ (0,
|
|
2278
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", title: "Fill the reservoir with the foreground colour", className: chip(false), onClick: () => controller.loadMixerBrush(), children: "Load brush" }),
|
|
2279
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", title: "Empty the picked-up colour", className: chip(false), onClick: () => controller.cleanMixerBrush(), children: "Clean brush" })
|
|
2191
2280
|
] }),
|
|
2192
|
-
/* @__PURE__ */ (0,
|
|
2281
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children: import_image_editor10.MIXER_MIXING_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2193
2282
|
"button",
|
|
2194
2283
|
{
|
|
2195
2284
|
type: "button",
|
|
@@ -2201,10 +2290,10 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2201
2290
|
},
|
|
2202
2291
|
m.id
|
|
2203
2292
|
)) }),
|
|
2204
|
-
import_image_editor10.MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0,
|
|
2205
|
-
/* @__PURE__ */ (0,
|
|
2206
|
-
/* @__PURE__ */ (0,
|
|
2207
|
-
/* @__PURE__ */ (0,
|
|
2293
|
+
import_image_editor10.MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ControlSlider, { spec, value: mixer[spec.id], onChange: (v) => controller.setPaintOptions({ mixer: { [spec.id]: v } }) }, spec.id)),
|
|
2294
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap gap-3 text-slate-300", children: [
|
|
2295
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
2296
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2208
2297
|
"input",
|
|
2209
2298
|
{
|
|
2210
2299
|
type: "checkbox",
|
|
@@ -2216,8 +2305,8 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2216
2305
|
),
|
|
2217
2306
|
"Load each stroke"
|
|
2218
2307
|
] }),
|
|
2219
|
-
/* @__PURE__ */ (0,
|
|
2220
|
-
/* @__PURE__ */ (0,
|
|
2308
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
2309
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2221
2310
|
"input",
|
|
2222
2311
|
{
|
|
2223
2312
|
type: "checkbox",
|
|
@@ -2231,22 +2320,22 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2231
2320
|
] })
|
|
2232
2321
|
] })
|
|
2233
2322
|
] }),
|
|
2234
|
-
(0, import_image_editor10.isRetouchPaintTool)(tool) && /* @__PURE__ */ (0,
|
|
2235
|
-
(tool === "clone" || tool === "heal") && /* @__PURE__ */ (0,
|
|
2236
|
-
/* @__PURE__ */ (0,
|
|
2237
|
-
cloneSource && /* @__PURE__ */ (0,
|
|
2323
|
+
(0, import_image_editor10.isRetouchPaintTool)(tool) && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col gap-2 border-t border-slate-800 pt-2", role: "group", "aria-label": "Retouch options", "data-testid": "retouch-options", children: [
|
|
2324
|
+
(tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2325
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-slate-400", "data-testid": "clone-source", children: (0, import_image_editor10.cloneSourceLabel)(controller) }),
|
|
2326
|
+
cloneSource && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", title: "Forget the source point", className: chip(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
|
|
2238
2327
|
] }),
|
|
2239
|
-
(tool === "clone" || tool === "heal") && /* @__PURE__ */ (0,
|
|
2240
|
-
import_image_editor10.CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ (0,
|
|
2241
|
-
/* @__PURE__ */ (0,
|
|
2242
|
-
/* @__PURE__ */ (0,
|
|
2243
|
-
/* @__PURE__ */ (0,
|
|
2244
|
-
!(0, import_image_editor10.cloneTransformView)(controller).identity && /* @__PURE__ */ (0,
|
|
2328
|
+
(tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col gap-1", role: "group", "aria-label": "Clone source transform", "data-testid": "clone-transform", children: [
|
|
2329
|
+
import_image_editor10.CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ControlSlider, { spec, value: (0, import_image_editor10.cloneTransformView)(controller)[spec.id], onChange: (v) => (0, import_image_editor10.setCloneTransformValue)(controller, spec.id, v) }, spec.id)),
|
|
2330
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2331
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor10.cloneTransformView)(controller).flipH, title: "Mirror the source left to right", className: chip((0, import_image_editor10.cloneTransformView)(controller).flipH), onClick: () => (0, import_image_editor10.setCloneTransformValue)(controller, "flipH"), children: "Flip H" }),
|
|
2332
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor10.cloneTransformView)(controller).flipV, title: "Mirror the source top to bottom", className: chip((0, import_image_editor10.cloneTransformView)(controller).flipV), onClick: () => (0, import_image_editor10.setCloneTransformValue)(controller, "flipV"), children: "Flip V" }),
|
|
2333
|
+
!(0, import_image_editor10.cloneTransformView)(controller).identity && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className: chip(false), onClick: () => controller.setCloneTransform(null), children: "Reset transform" })
|
|
2245
2334
|
] })
|
|
2246
2335
|
] }),
|
|
2247
|
-
import_image_editor10.RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ (0,
|
|
2248
|
-
/* @__PURE__ */ (0,
|
|
2249
|
-
choice.options.map((o) => /* @__PURE__ */ (0,
|
|
2336
|
+
import_image_editor10.RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": choice.label, children: [
|
|
2337
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-slate-400", children: choice.label }),
|
|
2338
|
+
choice.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2250
2339
|
"button",
|
|
2251
2340
|
{
|
|
2252
2341
|
type: "button",
|
|
@@ -2259,9 +2348,9 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2259
2348
|
o.id
|
|
2260
2349
|
))
|
|
2261
2350
|
] }, choice.id)),
|
|
2262
|
-
import_image_editor10.RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ (0,
|
|
2263
|
-
/* @__PURE__ */ (0,
|
|
2264
|
-
/* @__PURE__ */ (0,
|
|
2351
|
+
import_image_editor10.RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ControlSlider, { spec, value: retouch[spec.id], onChange: (v) => controller.setPaintOptions({ retouch: { [spec.id]: v } }) }, spec.id)),
|
|
2352
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex flex-wrap gap-3 text-slate-300", children: import_image_editor10.RETOUCH_TOGGLES.filter((t) => t.tools.includes(tool)).map((t) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
2353
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2265
2354
|
"input",
|
|
2266
2355
|
{
|
|
2267
2356
|
type: "checkbox",
|
|
@@ -2274,9 +2363,9 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2274
2363
|
t.label
|
|
2275
2364
|
] }, t.id)) })
|
|
2276
2365
|
] }),
|
|
2277
|
-
/* @__PURE__ */ (0,
|
|
2278
|
-
/* @__PURE__ */ (0,
|
|
2279
|
-
/* @__PURE__ */ (0,
|
|
2366
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap gap-3 text-slate-300", role: "group", "aria-label": "Pressure", children: [
|
|
2367
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
2368
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2280
2369
|
"input",
|
|
2281
2370
|
{
|
|
2282
2371
|
type: "checkbox",
|
|
@@ -2288,8 +2377,8 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2288
2377
|
),
|
|
2289
2378
|
"Pressure size"
|
|
2290
2379
|
] }),
|
|
2291
|
-
/* @__PURE__ */ (0,
|
|
2292
|
-
/* @__PURE__ */ (0,
|
|
2380
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
2381
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2293
2382
|
"input",
|
|
2294
2383
|
{
|
|
2295
2384
|
type: "checkbox",
|
|
@@ -2302,27 +2391,27 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2302
2391
|
"Pressure opacity"
|
|
2303
2392
|
] })
|
|
2304
2393
|
] }),
|
|
2305
|
-
/* @__PURE__ */ (0,
|
|
2306
|
-
/* @__PURE__ */ (0,
|
|
2307
|
-
/* @__PURE__ */ (0,
|
|
2394
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex gap-1", children: [
|
|
2395
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: chip(false), onClick: () => attempt(() => controller.fillPixels()), children: "Fill" }),
|
|
2396
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: chip(false), onClick: () => attempt(() => controller.clearPixels()), children: "Clear" })
|
|
2308
2397
|
] }),
|
|
2309
|
-
error && /* @__PURE__ */ (0,
|
|
2398
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { role: "alert", className: "text-rose-400", children: error })
|
|
2310
2399
|
] });
|
|
2311
2400
|
};
|
|
2312
2401
|
|
|
2313
2402
|
// src/image-editor/ColorProfilePanel.tsx
|
|
2314
|
-
var
|
|
2403
|
+
var import_react18 = require("react");
|
|
2315
2404
|
var import_image_editor12 = require("@pixerate/editor/image-editor");
|
|
2316
|
-
var
|
|
2405
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2317
2406
|
var chip2 = "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-300 hover:text-white";
|
|
2318
2407
|
var select2 = "rounded bg-slate-800 px-1 py-0.5 text-[11px] text-slate-200";
|
|
2319
2408
|
var ColorProfilePanel = ({ controller, className }) => {
|
|
2320
|
-
const [, setTick] = (0,
|
|
2321
|
-
(0,
|
|
2322
|
-
const [target, setTarget] = (0,
|
|
2323
|
-
const [intent, setIntent] = (0,
|
|
2324
|
-
const [bpc, setBpc] = (0,
|
|
2325
|
-
const [error, setError] = (0,
|
|
2409
|
+
const [, setTick] = (0, import_react18.useState)(0);
|
|
2410
|
+
(0, import_react18.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
2411
|
+
const [target, setTarget] = (0, import_react18.useState)("display-p3");
|
|
2412
|
+
const [intent, setIntent] = (0, import_react18.useState)("relative");
|
|
2413
|
+
const [bpc, setBpc] = (0, import_react18.useState)(true);
|
|
2414
|
+
const [error, setError] = (0, import_react18.useState)(null);
|
|
2326
2415
|
const view = (0, import_image_editor12.colorPanelView)(controller);
|
|
2327
2416
|
const attempt = (fn) => {
|
|
2328
2417
|
try {
|
|
@@ -2344,29 +2433,29 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
2344
2433
|
})
|
|
2345
2434
|
);
|
|
2346
2435
|
};
|
|
2347
|
-
return /* @__PURE__ */ (0,
|
|
2348
|
-
/* @__PURE__ */ (0,
|
|
2349
|
-
/* @__PURE__ */ (0,
|
|
2350
|
-
/* @__PURE__ */ (0,
|
|
2436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "color-profile-panel", children: [
|
|
2437
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2438
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-slate-400", children: "Profile" }),
|
|
2439
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { "data-testid": "color-profile-name", children: view.profileName })
|
|
2351
2440
|
] }),
|
|
2352
|
-
/* @__PURE__ */ (0,
|
|
2353
|
-
/* @__PURE__ */ (0,
|
|
2354
|
-
/* @__PURE__ */ (0,
|
|
2355
|
-
view.cmykProfileName && /* @__PURE__ */ (0,
|
|
2441
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Colour mode", children: [
|
|
2442
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-slate-400", children: "Mode" }),
|
|
2443
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("select", { "aria-label": "Colour mode", className: select2, value: view.mode, onChange: (e) => attempt(() => controller.setColorMode(e.target.value)), children: import_image_editor12.COLOR_MODE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
|
|
2444
|
+
view.cmykProfileName && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-slate-400", children: view.cmykProfileName })
|
|
2356
2445
|
] }),
|
|
2357
|
-
/* @__PURE__ */ (0,
|
|
2358
|
-
/* @__PURE__ */ (0,
|
|
2359
|
-
/* @__PURE__ */ (0,
|
|
2360
|
-
/* @__PURE__ */ (0,
|
|
2361
|
-
/* @__PURE__ */ (0,
|
|
2446
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
|
|
2447
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("select", { "aria-label": "Target profile", className: select2, value: target, onChange: (e) => setTarget(e.target.value), children: import_image_editor12.WORKING_SPACE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
|
|
2448
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("select", { "aria-label": "Rendering intent", className: select2, value: intent, onChange: (e) => setIntent(e.target.value), children: import_image_editor12.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
|
|
2449
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
2450
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-indigo-500" }),
|
|
2362
2451
|
"BPC"
|
|
2363
2452
|
] }),
|
|
2364
|
-
/* @__PURE__ */ (0,
|
|
2365
|
-
/* @__PURE__ */ (0,
|
|
2453
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: chip2, title: "Edit \u203A Assign Profile: keep the numbers", onClick: () => attempt(() => controller.assignProfile(target)), children: "Assign" }),
|
|
2454
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: chip2, title: "Edit \u203A Convert to Profile: keep the look", onClick: () => attempt(() => controller.convertToProfile(target, { intent, bpc })), children: "Convert" })
|
|
2366
2455
|
] }),
|
|
2367
|
-
/* @__PURE__ */ (0,
|
|
2368
|
-
/* @__PURE__ */ (0,
|
|
2369
|
-
/* @__PURE__ */ (0,
|
|
2456
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Proof setup", children: [
|
|
2457
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-slate-400", children: "Proof" }),
|
|
2458
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2370
2459
|
"select",
|
|
2371
2460
|
{
|
|
2372
2461
|
"aria-label": "Proof profile",
|
|
@@ -2374,31 +2463,31 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
2374
2463
|
value: view.proof?.id ?? "",
|
|
2375
2464
|
onChange: (e) => e.target.value ? proofWith({ id: e.target.value }) : attempt(() => controller.setProofSetup(null)),
|
|
2376
2465
|
children: [
|
|
2377
|
-
/* @__PURE__ */ (0,
|
|
2378
|
-
import_image_editor12.PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */ (0,
|
|
2466
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "Off" }),
|
|
2467
|
+
import_image_editor12.PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: o.id, children: o.label }, o.id))
|
|
2379
2468
|
]
|
|
2380
2469
|
}
|
|
2381
2470
|
),
|
|
2382
|
-
view.proof && /* @__PURE__ */ (0,
|
|
2383
|
-
/* @__PURE__ */ (0,
|
|
2384
|
-
/* @__PURE__ */ (0,
|
|
2385
|
-
/* @__PURE__ */ (0,
|
|
2471
|
+
view.proof && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
2472
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("select", { "aria-label": "Proof intent", className: select2, value: view.proof.intent, onChange: (e) => proofWith({ intent: e.target.value }), children: import_image_editor12.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
|
|
2473
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
2474
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-indigo-500" }),
|
|
2386
2475
|
"Paper"
|
|
2387
2476
|
] }),
|
|
2388
|
-
/* @__PURE__ */ (0,
|
|
2389
|
-
/* @__PURE__ */ (0,
|
|
2477
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
2478
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-indigo-500" }),
|
|
2390
2479
|
"Gamut warning"
|
|
2391
2480
|
] })
|
|
2392
2481
|
] })
|
|
2393
2482
|
] }),
|
|
2394
|
-
error && /* @__PURE__ */ (0,
|
|
2483
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { role: "alert", className: "text-rose-400", children: error })
|
|
2395
2484
|
] });
|
|
2396
2485
|
};
|
|
2397
2486
|
|
|
2398
2487
|
// src/image-editor/SelectionOptionsBar.tsx
|
|
2399
|
-
var
|
|
2488
|
+
var import_react19 = require("react");
|
|
2400
2489
|
var import_image_editor13 = require("@pixerate/editor/image-editor");
|
|
2401
|
-
var
|
|
2490
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2402
2491
|
var MODIFY_OPS = [
|
|
2403
2492
|
{ op: "grow", label: "Grow" },
|
|
2404
2493
|
{ op: "shrink", label: "Shrink" },
|
|
@@ -2415,20 +2504,20 @@ var SelectionOptionsBar = ({
|
|
|
2415
2504
|
quickMask,
|
|
2416
2505
|
className = ""
|
|
2417
2506
|
}) => {
|
|
2418
|
-
const [radius, setRadius] = (0,
|
|
2507
|
+
const [radius, setRadius] = (0, import_react19.useState)(2);
|
|
2419
2508
|
const set = (patch) => onOptionsChange({ ...options, ...patch });
|
|
2420
2509
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
2421
2510
|
const qm = quickMask ?? Boolean(controller.getState().quickMask);
|
|
2422
|
-
return /* @__PURE__ */ (0,
|
|
2423
|
-
/* @__PURE__ */ (0,
|
|
2424
|
-
/* @__PURE__ */ (0,
|
|
2425
|
-
options.tool === "wand" && /* @__PURE__ */ (0,
|
|
2426
|
-
/* @__PURE__ */ (0,
|
|
2427
|
-
/* @__PURE__ */ (0,
|
|
2428
|
-
/* @__PURE__ */ (0,
|
|
2429
|
-
/* @__PURE__ */ (0,
|
|
2511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
2512
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor13.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn2(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
|
|
2513
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: import_image_editor13.SELECTION_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", "aria-pressed": options.mode === m, className: btn2(options.mode === m), onClick: () => set({ mode: m }), children: import_image_editor13.SELECTION_MODE_LABELS[m] }, m)) }),
|
|
2514
|
+
options.tool === "wand" && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
2515
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
2516
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "flex justify-between text-slate-400", children: [
|
|
2517
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "Tolerance" }),
|
|
2518
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "font-mono", children: options.tolerance })
|
|
2430
2519
|
] }),
|
|
2431
|
-
/* @__PURE__ */ (0,
|
|
2520
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2432
2521
|
"input",
|
|
2433
2522
|
{
|
|
2434
2523
|
type: "range",
|
|
@@ -2442,17 +2531,17 @@ var SelectionOptionsBar = ({
|
|
|
2442
2531
|
}
|
|
2443
2532
|
)
|
|
2444
2533
|
] }),
|
|
2445
|
-
/* @__PURE__ */ (0,
|
|
2446
|
-
/* @__PURE__ */ (0,
|
|
2534
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
|
|
2535
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "checkbox", checked: options.contiguous, onChange: (e) => set({ contiguous: e.target.checked }) }),
|
|
2447
2536
|
"Contiguous"
|
|
2448
2537
|
] }),
|
|
2449
|
-
/* @__PURE__ */ (0,
|
|
2450
|
-
/* @__PURE__ */ (0,
|
|
2538
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
|
|
2539
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "checkbox", checked: options.sampleMerged, onChange: (e) => set({ sampleMerged: e.target.checked }) }),
|
|
2451
2540
|
"Sample adjusted image"
|
|
2452
2541
|
] }),
|
|
2453
|
-
/* @__PURE__ */ (0,
|
|
2542
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
|
|
2454
2543
|
"Sample",
|
|
2455
|
-
/* @__PURE__ */ (0,
|
|
2544
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2456
2545
|
"select",
|
|
2457
2546
|
{
|
|
2458
2547
|
"aria-label": "Sample from",
|
|
@@ -2460,27 +2549,27 @@ var SelectionOptionsBar = ({
|
|
|
2460
2549
|
onChange: (e) => set({ sample: e.target.value }),
|
|
2461
2550
|
className: "bg-slate-800 border border-slate-700 rounded px-1 py-0.5",
|
|
2462
2551
|
children: [
|
|
2463
|
-
/* @__PURE__ */ (0,
|
|
2464
|
-
/* @__PURE__ */ (0,
|
|
2552
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "composite", children: "All layers" }),
|
|
2553
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "active-layer", children: "Active layer" })
|
|
2465
2554
|
]
|
|
2466
2555
|
}
|
|
2467
2556
|
)
|
|
2468
2557
|
] })
|
|
2469
2558
|
] }),
|
|
2470
|
-
/* @__PURE__ */ (0,
|
|
2471
|
-
/* @__PURE__ */ (0,
|
|
2559
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
|
|
2560
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "checkbox", checked: options.antiAlias, onChange: (e) => set({ antiAlias: e.target.checked }) }),
|
|
2472
2561
|
"Anti-alias"
|
|
2473
2562
|
] }),
|
|
2474
|
-
/* @__PURE__ */ (0,
|
|
2475
|
-
/* @__PURE__ */ (0,
|
|
2476
|
-
/* @__PURE__ */ (0,
|
|
2477
|
-
/* @__PURE__ */ (0,
|
|
2478
|
-
/* @__PURE__ */ (0,
|
|
2563
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
2564
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: btn2(false), onClick: () => controller.selectAll(), children: "Select All" }),
|
|
2565
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: btn2(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
|
|
2566
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: btn2(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
|
|
2567
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", "aria-pressed": qm, className: btn2(qm), onClick: () => controller.setQuickMask(!qm), children: "Quick Mask" })
|
|
2479
2568
|
] }),
|
|
2480
|
-
/* @__PURE__ */ (0,
|
|
2481
|
-
/* @__PURE__ */ (0,
|
|
2569
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2570
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1 text-slate-400", children: [
|
|
2482
2571
|
"Radius",
|
|
2483
|
-
/* @__PURE__ */ (0,
|
|
2572
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2484
2573
|
"input",
|
|
2485
2574
|
{
|
|
2486
2575
|
type: "number",
|
|
@@ -2494,24 +2583,24 @@ var SelectionOptionsBar = ({
|
|
|
2494
2583
|
}
|
|
2495
2584
|
)
|
|
2496
2585
|
] }),
|
|
2497
|
-
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0,
|
|
2586
|
+
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: btn2(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
|
|
2498
2587
|
] }),
|
|
2499
|
-
/* @__PURE__ */ (0,
|
|
2588
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { "data-testid": "selection-status", className: "text-slate-400", children: (0, import_image_editor13.describeSelection)(sel) })
|
|
2500
2589
|
] });
|
|
2501
2590
|
};
|
|
2502
2591
|
|
|
2503
2592
|
// src/image-editor/RefineEdgePanel.tsx
|
|
2504
|
-
var
|
|
2593
|
+
var import_react20 = require("react");
|
|
2505
2594
|
var import_image_editor14 = require("@pixerate/editor/image-editor");
|
|
2506
|
-
var
|
|
2595
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2507
2596
|
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
2508
2597
|
var button3 = "px-2 py-1 rounded-md border border-slate-800 bg-slate-950 text-[11px] text-slate-200 hover:text-white disabled:opacity-40";
|
|
2509
2598
|
var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
2510
|
-
const [params, setParams] = (0,
|
|
2511
|
-
const [busy, setBusy] = (0,
|
|
2512
|
-
const [error, setError] = (0,
|
|
2513
|
-
const [layerId, setLayerId] = (0,
|
|
2514
|
-
const [newKind, setNewKind] = (0,
|
|
2599
|
+
const [params, setParams] = (0, import_react20.useState)(DEFAULT_PARAMS);
|
|
2600
|
+
const [busy, setBusy] = (0, import_react20.useState)(false);
|
|
2601
|
+
const [error, setError] = (0, import_react20.useState)(null);
|
|
2602
|
+
const [layerId, setLayerId] = (0, import_react20.useState)("");
|
|
2603
|
+
const [newKind, setNewKind] = (0, import_react20.useState)("hueSaturation");
|
|
2515
2604
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
2516
2605
|
const list = layers ?? controller.getAdjustmentLayers();
|
|
2517
2606
|
const target = list.find((l) => l.id === layerId) ?? list[list.length - 1];
|
|
@@ -2526,17 +2615,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2526
2615
|
setBusy(false);
|
|
2527
2616
|
}
|
|
2528
2617
|
};
|
|
2529
|
-
return /* @__PURE__ */ (0,
|
|
2530
|
-
/* @__PURE__ */ (0,
|
|
2531
|
-
import_image_editor14.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0,
|
|
2532
|
-
/* @__PURE__ */ (0,
|
|
2533
|
-
/* @__PURE__ */ (0,
|
|
2534
|
-
/* @__PURE__ */ (0,
|
|
2618
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
2619
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Refine Edge" }),
|
|
2620
|
+
import_image_editor14.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
2621
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "flex justify-between text-slate-400", children: [
|
|
2622
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: c.label }),
|
|
2623
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "font-mono", children: [
|
|
2535
2624
|
params[c.id],
|
|
2536
2625
|
c.unit
|
|
2537
2626
|
] })
|
|
2538
2627
|
] }),
|
|
2539
|
-
/* @__PURE__ */ (0,
|
|
2628
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2540
2629
|
"input",
|
|
2541
2630
|
{
|
|
2542
2631
|
type: "range",
|
|
@@ -2550,28 +2639,28 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2550
2639
|
}
|
|
2551
2640
|
)
|
|
2552
2641
|
] }, c.id)),
|
|
2553
|
-
/* @__PURE__ */ (0,
|
|
2554
|
-
/* @__PURE__ */ (0,
|
|
2642
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
|
|
2643
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
2555
2644
|
"Smart Radius"
|
|
2556
2645
|
] }),
|
|
2557
|
-
/* @__PURE__ */ (0,
|
|
2558
|
-
/* @__PURE__ */ (0,
|
|
2559
|
-
/* @__PURE__ */ (0,
|
|
2646
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex gap-1", children: [
|
|
2647
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button3, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
2648
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button3, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
|
2560
2649
|
] }),
|
|
2561
|
-
error && /* @__PURE__ */ (0,
|
|
2562
|
-
/* @__PURE__ */ (0,
|
|
2563
|
-
/* @__PURE__ */ (0,
|
|
2564
|
-
/* @__PURE__ */ (0,
|
|
2650
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { role: "alert", className: "text-rose-400", children: error }),
|
|
2651
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
|
|
2652
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex gap-1 items-center", children: [
|
|
2653
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2565
2654
|
"select",
|
|
2566
2655
|
{
|
|
2567
2656
|
"aria-label": "New masked layer kind",
|
|
2568
2657
|
value: newKind,
|
|
2569
2658
|
onChange: (e) => setNewKind(e.target.value),
|
|
2570
2659
|
className: "flex-1 bg-slate-950 border border-slate-800 rounded px-1 py-1 text-slate-200",
|
|
2571
|
-
children: import_image_editor14.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0,
|
|
2660
|
+
children: import_image_editor14.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: k.kind, children: k.label }, k.kind))
|
|
2572
2661
|
}
|
|
2573
2662
|
),
|
|
2574
|
-
/* @__PURE__ */ (0,
|
|
2663
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2575
2664
|
"button",
|
|
2576
2665
|
{
|
|
2577
2666
|
type: "button",
|
|
@@ -2582,35 +2671,35 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2582
2671
|
}
|
|
2583
2672
|
)
|
|
2584
2673
|
] }),
|
|
2585
|
-
list.length > 0 && target && /* @__PURE__ */ (0,
|
|
2586
|
-
/* @__PURE__ */ (0,
|
|
2674
|
+
list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
2675
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2587
2676
|
"select",
|
|
2588
2677
|
{
|
|
2589
2678
|
"aria-label": "Mask layer",
|
|
2590
2679
|
value: target.id,
|
|
2591
2680
|
onChange: (e) => setLayerId(e.target.value),
|
|
2592
2681
|
className: "bg-slate-950 border border-slate-800 rounded px-1 py-1 text-slate-200",
|
|
2593
|
-
children: list.map((l) => /* @__PURE__ */ (0,
|
|
2682
|
+
children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("option", { value: l.id, children: [
|
|
2594
2683
|
l.name || (0, import_image_editor14.adjustmentKindLabel)(l.kind),
|
|
2595
2684
|
l.mask ? " (masked)" : ""
|
|
2596
2685
|
] }, l.id))
|
|
2597
2686
|
}
|
|
2598
2687
|
),
|
|
2599
|
-
/* @__PURE__ */ (0,
|
|
2600
|
-
/* @__PURE__ */ (0,
|
|
2601
|
-
/* @__PURE__ */ (0,
|
|
2602
|
-
/* @__PURE__ */ (0,
|
|
2688
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
2689
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button3, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
|
|
2690
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button3, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
|
|
2691
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button3, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
|
|
2603
2692
|
] }),
|
|
2604
|
-
target.mask && /* @__PURE__ */ (0,
|
|
2605
|
-
/* @__PURE__ */ (0,
|
|
2606
|
-
/* @__PURE__ */ (0,
|
|
2607
|
-
/* @__PURE__ */ (0,
|
|
2608
|
-
/* @__PURE__ */ (0,
|
|
2693
|
+
target.mask && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
2694
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
2695
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "flex justify-between text-slate-400", children: [
|
|
2696
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "Density" }),
|
|
2697
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "font-mono", children: [
|
|
2609
2698
|
Math.round((target.mask.density ?? 1) * 100),
|
|
2610
2699
|
"%"
|
|
2611
2700
|
] })
|
|
2612
2701
|
] }),
|
|
2613
|
-
/* @__PURE__ */ (0,
|
|
2702
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2614
2703
|
"input",
|
|
2615
2704
|
{
|
|
2616
2705
|
type: "range",
|
|
@@ -2624,15 +2713,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2624
2713
|
}
|
|
2625
2714
|
)
|
|
2626
2715
|
] }),
|
|
2627
|
-
/* @__PURE__ */ (0,
|
|
2628
|
-
/* @__PURE__ */ (0,
|
|
2629
|
-
/* @__PURE__ */ (0,
|
|
2630
|
-
/* @__PURE__ */ (0,
|
|
2716
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
2717
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "flex justify-between text-slate-400", children: [
|
|
2718
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "Mask Feather" }),
|
|
2719
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "font-mono", children: [
|
|
2631
2720
|
target.mask.feather ?? 0,
|
|
2632
2721
|
"px"
|
|
2633
2722
|
] })
|
|
2634
2723
|
] }),
|
|
2635
|
-
/* @__PURE__ */ (0,
|
|
2724
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2636
2725
|
"input",
|
|
2637
2726
|
{
|
|
2638
2727
|
type: "range",
|
|
@@ -2652,14 +2741,14 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2652
2741
|
};
|
|
2653
2742
|
|
|
2654
2743
|
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
2655
|
-
var
|
|
2744
|
+
var import_react21 = require("react");
|
|
2656
2745
|
var import_image_editor15 = require("@pixerate/editor/image-editor");
|
|
2657
|
-
var
|
|
2746
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2658
2747
|
var chip3 = (on) => `px-2 py-1 rounded text-[11px] ${on ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300 hover:text-white"}`;
|
|
2659
2748
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
2660
2749
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
2661
|
-
const [, setTick] = (0,
|
|
2662
|
-
(0,
|
|
2750
|
+
const [, setTick] = (0, import_react21.useState)(0);
|
|
2751
|
+
(0, import_react21.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
|
|
2663
2752
|
const bar = tool.bar();
|
|
2664
2753
|
if (!tool.active || !bar) return null;
|
|
2665
2754
|
const warp = tool.warpBar();
|
|
@@ -2671,17 +2760,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2671
2760
|
const v = Number(raw);
|
|
2672
2761
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
2673
2762
|
};
|
|
2674
|
-
return /* @__PURE__ */ (0,
|
|
2675
|
-
/* @__PURE__ */ (0,
|
|
2676
|
-
/* @__PURE__ */ (0,
|
|
2677
|
-
tool.mode === "warp" && /* @__PURE__ */ (0,
|
|
2678
|
-
/* @__PURE__ */ (0,
|
|
2679
|
-
/* @__PURE__ */ (0,
|
|
2680
|
-
/* @__PURE__ */ (0,
|
|
2763
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `flex flex-wrap items-center gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
|
|
2764
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor15.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: chip3(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
|
|
2765
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor15.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-slate-700 hover:bg-indigo-500", onClick: () => tool.setReference(a) }, a)) }),
|
|
2766
|
+
tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
2767
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
2768
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Warp" }),
|
|
2769
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: "rounded border border-slate-700 bg-slate-900 px-1 py-0.5", children: import_image_editor15.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: o.id, children: o.label }, o.id)) })
|
|
2681
2770
|
] }),
|
|
2682
|
-
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0,
|
|
2683
|
-
/* @__PURE__ */ (0,
|
|
2684
|
-
/* @__PURE__ */ (0,
|
|
2771
|
+
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
2772
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
2773
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2685
2774
|
"input",
|
|
2686
2775
|
{
|
|
2687
2776
|
type: "number",
|
|
@@ -2702,9 +2791,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2702
2791
|
},
|
|
2703
2792
|
`${k}:${warp[k]}`
|
|
2704
2793
|
),
|
|
2705
|
-
/* @__PURE__ */ (0,
|
|
2794
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-500", children: "%" })
|
|
2706
2795
|
] }, k)),
|
|
2707
|
-
/* @__PURE__ */ (0,
|
|
2796
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2708
2797
|
"button",
|
|
2709
2798
|
{
|
|
2710
2799
|
type: "button",
|
|
@@ -2716,9 +2805,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2716
2805
|
children: "Vertical"
|
|
2717
2806
|
}
|
|
2718
2807
|
),
|
|
2719
|
-
/* @__PURE__ */ (0,
|
|
2720
|
-
/* @__PURE__ */ (0,
|
|
2721
|
-
/* @__PURE__ */ (0,
|
|
2808
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
2809
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Grid" }),
|
|
2810
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2722
2811
|
"select",
|
|
2723
2812
|
{
|
|
2724
2813
|
"aria-label": "Warp grid",
|
|
@@ -2728,14 +2817,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2728
2817
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
2729
2818
|
},
|
|
2730
2819
|
className: "rounded border border-slate-700 bg-slate-900 px-1 py-0.5",
|
|
2731
|
-
children: import_image_editor15.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0,
|
|
2820
|
+
children: import_image_editor15.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: g.id, children: g.label }, g.id))
|
|
2732
2821
|
}
|
|
2733
2822
|
)
|
|
2734
2823
|
] })
|
|
2735
2824
|
] }),
|
|
2736
|
-
tool.mode !== "warp" && import_image_editor15.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0,
|
|
2737
|
-
/* @__PURE__ */ (0,
|
|
2738
|
-
/* @__PURE__ */ (0,
|
|
2825
|
+
tool.mode !== "warp" && import_image_editor15.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
2826
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: f.label }),
|
|
2827
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2739
2828
|
"input",
|
|
2740
2829
|
{
|
|
2741
2830
|
type: "number",
|
|
@@ -2755,8 +2844,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2755
2844
|
},
|
|
2756
2845
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
2757
2846
|
),
|
|
2758
|
-
/* @__PURE__ */ (0,
|
|
2759
|
-
f.id === "scaleX" && /* @__PURE__ */ (0,
|
|
2847
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-500", children: f.unit }),
|
|
2848
|
+
f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2760
2849
|
"button",
|
|
2761
2850
|
{
|
|
2762
2851
|
type: "button",
|
|
@@ -2771,34 +2860,34 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2771
2860
|
}
|
|
2772
2861
|
)
|
|
2773
2862
|
] }, f.id)),
|
|
2774
|
-
/* @__PURE__ */ (0,
|
|
2775
|
-
/* @__PURE__ */ (0,
|
|
2776
|
-
/* @__PURE__ */ (0,
|
|
2863
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
2864
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Interpolation" }),
|
|
2865
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2777
2866
|
"select",
|
|
2778
2867
|
{
|
|
2779
2868
|
"aria-label": "Interpolation",
|
|
2780
2869
|
value: tool.interpolation,
|
|
2781
2870
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
2782
2871
|
className: "rounded border border-slate-700 bg-slate-900 px-1 py-0.5",
|
|
2783
|
-
children: import_image_editor15.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0,
|
|
2872
|
+
children: import_image_editor15.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
2784
2873
|
}
|
|
2785
2874
|
)
|
|
2786
2875
|
] }),
|
|
2787
|
-
/* @__PURE__ */ (0,
|
|
2788
|
-
/* @__PURE__ */ (0,
|
|
2789
|
-
tool.error && /* @__PURE__ */ (0,
|
|
2876
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-emerald-600 text-white hover:bg-emerald-500", onClick: () => tool.commit(), children: "Commit" }),
|
|
2877
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: "Cancel (Esc)", className: chip3(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
2878
|
+
tool.error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { role: "alert", className: "text-rose-400", children: tool.error })
|
|
2790
2879
|
] });
|
|
2791
2880
|
};
|
|
2792
2881
|
|
|
2793
2882
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
2794
|
-
var
|
|
2883
|
+
var import_react22 = require("react");
|
|
2795
2884
|
var import_image_editor16 = require("@pixerate/editor/image-editor");
|
|
2796
|
-
var
|
|
2885
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2797
2886
|
var chip4 = (on) => `px-2 py-1 rounded text-[11px] ${on ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300 hover:text-white"}`;
|
|
2798
2887
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
2799
|
-
const [, setTick] = (0,
|
|
2800
|
-
(0,
|
|
2801
|
-
const [error, setError] = (0,
|
|
2888
|
+
const [, setTick] = (0, import_react22.useState)(0);
|
|
2889
|
+
(0, import_react22.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
2890
|
+
const [error, setError] = (0, import_react22.useState)(null);
|
|
2802
2891
|
const active = controller.getActiveLayer();
|
|
2803
2892
|
const shapeId = active?.type === "shape" ? active.id : null;
|
|
2804
2893
|
const set = (change) => {
|
|
@@ -2812,13 +2901,13 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2812
2901
|
}
|
|
2813
2902
|
};
|
|
2814
2903
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
2815
|
-
return /* @__PURE__ */ (0,
|
|
2816
|
-
/* @__PURE__ */ (0,
|
|
2817
|
-
/* @__PURE__ */ (0,
|
|
2818
|
-
/* @__PURE__ */ (0,
|
|
2819
|
-
/* @__PURE__ */ (0,
|
|
2904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
2905
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor16.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: chip4(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor16.SHAPE_KIND_LABELS[k] }, k)) }),
|
|
2906
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
2907
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
2908
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", "aria-label": "Fill", checked: options.fill !== null, onChange: (e) => set({ fill: e.target.checked ? "#4f46e5" : null }) }),
|
|
2820
2909
|
"Fill",
|
|
2821
|
-
/* @__PURE__ */ (0,
|
|
2910
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2822
2911
|
"input",
|
|
2823
2912
|
{
|
|
2824
2913
|
type: "color",
|
|
@@ -2830,10 +2919,10 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2830
2919
|
}
|
|
2831
2920
|
)
|
|
2832
2921
|
] }),
|
|
2833
|
-
/* @__PURE__ */ (0,
|
|
2834
|
-
/* @__PURE__ */ (0,
|
|
2922
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
2923
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", "aria-label": "Stroke", checked: options.stroke !== null, onChange: (e) => set({ stroke: e.target.checked ? "#000000" : null }) }),
|
|
2835
2924
|
"Stroke",
|
|
2836
|
-
/* @__PURE__ */ (0,
|
|
2925
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2837
2926
|
"input",
|
|
2838
2927
|
{
|
|
2839
2928
|
type: "color",
|
|
@@ -2845,9 +2934,9 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2845
2934
|
}
|
|
2846
2935
|
)
|
|
2847
2936
|
] }),
|
|
2848
|
-
/* @__PURE__ */ (0,
|
|
2937
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
2849
2938
|
"Width",
|
|
2850
|
-
/* @__PURE__ */ (0,
|
|
2939
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2851
2940
|
"input",
|
|
2852
2941
|
{
|
|
2853
2942
|
type: "number",
|
|
@@ -2861,23 +2950,23 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2861
2950
|
)
|
|
2862
2951
|
] })
|
|
2863
2952
|
] }),
|
|
2864
|
-
/* @__PURE__ */ (0,
|
|
2865
|
-
options.kind === "rect" && /* @__PURE__ */ (0,
|
|
2953
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
2954
|
+
options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
2866
2955
|
"Radius",
|
|
2867
|
-
/* @__PURE__ */ (0,
|
|
2956
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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 rounded border border-slate-700 bg-slate-950 px-1 py-0.5" })
|
|
2868
2957
|
] }),
|
|
2869
|
-
options.kind === "polygon" && /* @__PURE__ */ (0,
|
|
2958
|
+
options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
2870
2959
|
"Sides",
|
|
2871
|
-
/* @__PURE__ */ (0,
|
|
2960
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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 rounded border border-slate-700 bg-slate-950 px-1 py-0.5" })
|
|
2872
2961
|
] }),
|
|
2873
|
-
options.kind === "star" && /* @__PURE__ */ (0,
|
|
2874
|
-
/* @__PURE__ */ (0,
|
|
2962
|
+
options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
2963
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
2875
2964
|
"Points",
|
|
2876
|
-
/* @__PURE__ */ (0,
|
|
2965
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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 rounded border border-slate-700 bg-slate-950 px-1 py-0.5" })
|
|
2877
2966
|
] }),
|
|
2878
|
-
/* @__PURE__ */ (0,
|
|
2967
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
2879
2968
|
"Inner",
|
|
2880
|
-
/* @__PURE__ */ (0,
|
|
2969
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2881
2970
|
"input",
|
|
2882
2971
|
{
|
|
2883
2972
|
type: "range",
|
|
@@ -2892,33 +2981,33 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2892
2981
|
)
|
|
2893
2982
|
] })
|
|
2894
2983
|
] }),
|
|
2895
|
-
options.kind === "line" && /* @__PURE__ */ (0,
|
|
2896
|
-
/* @__PURE__ */ (0,
|
|
2984
|
+
options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
2985
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
2897
2986
|
"Weight",
|
|
2898
|
-
/* @__PURE__ */ (0,
|
|
2987
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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 rounded border border-slate-700 bg-slate-950 px-1 py-0.5" })
|
|
2899
2988
|
] }),
|
|
2900
|
-
/* @__PURE__ */ (0,
|
|
2901
|
-
/* @__PURE__ */ (0,
|
|
2989
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
2990
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", "aria-label": "Arrowhead", checked: options.arrow, onChange: (e) => set({ arrow: e.target.checked }) }),
|
|
2902
2991
|
"Arrowhead"
|
|
2903
2992
|
] })
|
|
2904
2993
|
] })
|
|
2905
2994
|
] }),
|
|
2906
|
-
/* @__PURE__ */ (0,
|
|
2907
|
-
error && /* @__PURE__ */ (0,
|
|
2995
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-[10px] text-slate-500", children: "Drag on the image to draw. Shift: square, circle or 45\xB0 line. Alt: from the centre." }),
|
|
2996
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { role: "alert", className: "text-rose-400", children: error })
|
|
2908
2997
|
] });
|
|
2909
2998
|
};
|
|
2910
2999
|
|
|
2911
3000
|
// src/image-editor/TypeOptionsBar.tsx
|
|
2912
|
-
var
|
|
3001
|
+
var import_react23 = require("react");
|
|
2913
3002
|
var import_image_editor17 = require("@pixerate/editor/image-editor");
|
|
2914
|
-
var
|
|
3003
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2915
3004
|
var chip5 = (on) => `px-2 py-1 rounded text-[11px] ${on ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300 hover:text-white"}`;
|
|
2916
3005
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
2917
3006
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
2918
|
-
const [, setTick] = (0,
|
|
2919
|
-
(0,
|
|
2920
|
-
(0,
|
|
2921
|
-
const [error, setError] = (0,
|
|
3007
|
+
const [, setTick] = (0, import_react23.useState)(0);
|
|
3008
|
+
(0, import_react23.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
3009
|
+
(0, import_react23.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
|
|
3010
|
+
const [error, setError] = (0, import_react23.useState)(null);
|
|
2922
3011
|
const active = controller.getActiveLayer();
|
|
2923
3012
|
const typeId = !session && active?.type === "type" ? active.id : null;
|
|
2924
3013
|
const here = session?.alive ? session.styleHere() : {};
|
|
@@ -2950,11 +3039,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
2950
3039
|
setError(e instanceof Error ? e.message : String(e));
|
|
2951
3040
|
}
|
|
2952
3041
|
};
|
|
2953
|
-
return /* @__PURE__ */ (0,
|
|
2954
|
-
/* @__PURE__ */ (0,
|
|
2955
|
-
/* @__PURE__ */ (0,
|
|
3042
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "type-options", children: [
|
|
3043
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
3044
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
2956
3045
|
"Font",
|
|
2957
|
-
/* @__PURE__ */ (0,
|
|
3046
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2958
3047
|
"input",
|
|
2959
3048
|
{
|
|
2960
3049
|
list: "pixerate-type-fonts",
|
|
@@ -2964,11 +3053,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
2964
3053
|
className: "w-32 rounded border border-slate-700 bg-slate-950 px-1 py-0.5"
|
|
2965
3054
|
}
|
|
2966
3055
|
),
|
|
2967
|
-
/* @__PURE__ */ (0,
|
|
3056
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: f }, f)) })
|
|
2968
3057
|
] }),
|
|
2969
|
-
/* @__PURE__ */ (0,
|
|
3058
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
2970
3059
|
"Size",
|
|
2971
|
-
/* @__PURE__ */ (0,
|
|
3060
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2972
3061
|
"input",
|
|
2973
3062
|
{
|
|
2974
3063
|
type: "number",
|
|
@@ -2981,24 +3070,24 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
2981
3070
|
}
|
|
2982
3071
|
)
|
|
2983
3072
|
] }),
|
|
2984
|
-
/* @__PURE__ */ (0,
|
|
2985
|
-
/* @__PURE__ */ (0,
|
|
2986
|
-
/* @__PURE__ */ (0,
|
|
3073
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${chip5(shown.fontWeight >= 600)} font-bold`, onClick: () => style({ fontWeight: shown.fontWeight >= 600 ? 400 : 700 }), children: "B" }),
|
|
3074
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${chip5(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
3075
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "color", "aria-label": "Text colour", value: shown.color, onChange: (e) => style({ color: e.target.value }), className: "h-6 w-8 rounded border border-slate-700 bg-transparent" })
|
|
2987
3076
|
] }),
|
|
2988
|
-
/* @__PURE__ */ (0,
|
|
2989
|
-
/* @__PURE__ */ (0,
|
|
2990
|
-
missing.length > 0 && /* @__PURE__ */ (0,
|
|
3077
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor17.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: chip5(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
3078
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[10px] text-slate-500", children: "Click to type point text, drag for a paragraph box, click text to edit it. Esc finishes." }),
|
|
3079
|
+
missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("p", { role: "status", className: "text-amber-400", "data-testid": "type-missing-fonts", children: [
|
|
2991
3080
|
"Missing ",
|
|
2992
3081
|
missing.length === 1 ? "font" : "fonts",
|
|
2993
3082
|
": ",
|
|
2994
3083
|
missing.join(", ")
|
|
2995
3084
|
] }),
|
|
2996
|
-
error && /* @__PURE__ */ (0,
|
|
3085
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { role: "alert", className: "text-rose-400", children: error })
|
|
2997
3086
|
] });
|
|
2998
3087
|
};
|
|
2999
3088
|
|
|
3000
3089
|
// src/image-editor/ImageEditor.tsx
|
|
3001
|
-
var
|
|
3090
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3002
3091
|
var ImageEditor = ({
|
|
3003
3092
|
editor: externalEditor,
|
|
3004
3093
|
src,
|
|
@@ -3009,7 +3098,10 @@ var ImageEditor = ({
|
|
|
3009
3098
|
onInpaint,
|
|
3010
3099
|
onRemoveBackground,
|
|
3011
3100
|
aiHooks,
|
|
3012
|
-
effects
|
|
3101
|
+
effects,
|
|
3102
|
+
playback,
|
|
3103
|
+
playbackId = "image",
|
|
3104
|
+
onPlaybackReveal
|
|
3013
3105
|
}) => {
|
|
3014
3106
|
const internalEditor = useImageEditor({ image: src });
|
|
3015
3107
|
const editor = externalEditor || internalEditor;
|
|
@@ -3019,29 +3111,91 @@ var ImageEditor = ({
|
|
|
3019
3111
|
return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
|
|
3020
3112
|
});
|
|
3021
3113
|
const legacyProcess = (0, import_image_editor18.normalizeProcessVersion)(state.adjustments.process) < import_image_editor18.LATEST_PROCESS_VERSION;
|
|
3022
|
-
const canvasRef = (0,
|
|
3023
|
-
const containerRef = (0,
|
|
3024
|
-
const [activeTab, setActiveTab] = (0,
|
|
3025
|
-
const
|
|
3026
|
-
const
|
|
3027
|
-
|
|
3114
|
+
const canvasRef = (0, import_react24.useRef)(null);
|
|
3115
|
+
const containerRef = (0, import_react24.useRef)(null);
|
|
3116
|
+
const [activeTab, setActiveTab] = (0, import_react24.useState)("crop");
|
|
3117
|
+
const rootRef = (0, import_react24.useRef)(null);
|
|
3118
|
+
const activeTabRef = (0, import_react24.useRef)(activeTab);
|
|
3119
|
+
activeTabRef.current = activeTab;
|
|
3120
|
+
const ambientPlayback = useAgentPlayback();
|
|
3121
|
+
const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
|
|
3122
|
+
const [locateLayer] = (0, import_react24.useState)(() => (0, import_image_editor18.createImagePlaybackLocator)(controller));
|
|
3123
|
+
const docToRoot = (p) => {
|
|
3124
|
+
const canvas = canvasRef.current;
|
|
3125
|
+
const root = rootRef.current;
|
|
3126
|
+
if (!canvas || !root || !canvas.width) return p;
|
|
3127
|
+
const r = canvas.getBoundingClientRect();
|
|
3128
|
+
const box = root.getBoundingClientRect();
|
|
3129
|
+
const c = (0, import_image_editor18.imageToCanvasPoint)(p, controller.getState(), canvas.width, canvas.height, activeTabRef.current === "crop");
|
|
3130
|
+
return { x: r.left - box.left + c.x * r.width / canvas.width, y: r.top - box.top + c.y * r.height / canvas.height };
|
|
3131
|
+
};
|
|
3132
|
+
const clientToDoc = (p) => {
|
|
3133
|
+
const canvas = canvasRef.current;
|
|
3134
|
+
if (!canvas || !canvas.width) return p;
|
|
3135
|
+
const r = canvas.getBoundingClientRect();
|
|
3136
|
+
const sx = r.width > 0 ? canvas.width / r.width : 1;
|
|
3137
|
+
const sy = r.height > 0 ? canvas.height / r.height : 1;
|
|
3138
|
+
return (0, import_image_editor18.canvasToImagePoint)({ x: (p.x - r.left) * sx, y: (p.y - r.top) * sy }, controller.getState(), canvas.width, canvas.height, activeTabRef.current === "crop");
|
|
3139
|
+
};
|
|
3140
|
+
const elementRect = (selector) => {
|
|
3141
|
+
const el = rootRef.current?.querySelector(selector);
|
|
3142
|
+
const r = el?.getBoundingClientRect();
|
|
3143
|
+
if (!r || r.width <= 0) return null;
|
|
3144
|
+
const a = clientToDoc({ x: r.left, y: r.top });
|
|
3145
|
+
const b = clientToDoc({ x: r.right, y: r.bottom });
|
|
3146
|
+
return { x: Math.min(a.x, b.x), y: Math.min(a.y, b.y), width: Math.abs(b.x - a.x), height: Math.abs(b.y - a.y) };
|
|
3147
|
+
};
|
|
3148
|
+
const agentPresence = usePlaybackSurface(playing, playbackId, {
|
|
3149
|
+
defaultKind: "layer",
|
|
3150
|
+
locate: (ref) => {
|
|
3151
|
+
if (ref.kind === "panel") return elementRect(`[data-image-tab="${CSS.escape(ref.id)}"]`);
|
|
3152
|
+
if (ref.kind === "control") return elementRect(`[data-control-id="${CSS.escape(ref.id)}"]`);
|
|
3153
|
+
return locateLayer(ref) ?? (ref.kind === "layer" || ref.kind === "item" ? elementRect(`[data-layer-id="${CSS.escape(ref.id)}"]`) : null);
|
|
3154
|
+
},
|
|
3155
|
+
open: async (ref) => {
|
|
3156
|
+
if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
|
|
3157
|
+
rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
|
|
3158
|
+
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
3159
|
+
},
|
|
3160
|
+
bounds: () => {
|
|
3161
|
+
const r = canvasRef.current?.getBoundingClientRect();
|
|
3162
|
+
if (!r || r.width <= 0) return null;
|
|
3163
|
+
const a = clientToDoc({ x: r.left, y: r.top });
|
|
3164
|
+
const b = clientToDoc({ x: r.right, y: r.bottom });
|
|
3165
|
+
return { x: Math.min(a.x, b.x), y: Math.min(a.y, b.y), width: Math.abs(b.x - a.x), height: Math.abs(b.y - a.y) };
|
|
3166
|
+
},
|
|
3167
|
+
visible: () => {
|
|
3168
|
+
const r = rootRef.current?.getBoundingClientRect();
|
|
3169
|
+
return !!r && r.width > 0 && r.height > 0 && !(typeof document !== "undefined" && document.visibilityState === "hidden");
|
|
3170
|
+
},
|
|
3171
|
+
toViewport: (p) => {
|
|
3172
|
+
const box = rootRef.current?.getBoundingClientRect();
|
|
3173
|
+
const q = docToRoot(p);
|
|
3174
|
+
return { x: (box?.left ?? 0) + q.x, y: (box?.top ?? 0) + q.y };
|
|
3175
|
+
},
|
|
3176
|
+
fromViewport: clientToDoc,
|
|
3177
|
+
reveal: () => onPlaybackReveal?.()
|
|
3178
|
+
});
|
|
3179
|
+
const [activeCropRatio, setActiveCropRatio] = (0, import_react24.useState)(null);
|
|
3180
|
+
const [selectionOptions, setSelectionOptions] = (0, import_react24.useState)(import_image_editor18.DEFAULT_SELECTION_TOOL_OPTIONS);
|
|
3181
|
+
const selectionOptionsRef = (0, import_react24.useRef)(selectionOptions);
|
|
3028
3182
|
selectionOptionsRef.current = selectionOptions;
|
|
3029
|
-
const selectionGestureRef = (0,
|
|
3183
|
+
const selectionGestureRef = (0, import_react24.useRef)(null);
|
|
3030
3184
|
if (!selectionGestureRef.current || selectionGestureRef.current.controller !== controller) {
|
|
3031
3185
|
selectionGestureRef.current = new import_image_editor18.SelectionGesture(controller, () => selectionOptionsRef.current);
|
|
3032
3186
|
}
|
|
3033
|
-
const selectionDraftRef = (0,
|
|
3034
|
-
const [selectionError, setSelectionError] = (0,
|
|
3035
|
-
const paintGestureRef = (0,
|
|
3036
|
-
const paintControllerRef = (0,
|
|
3187
|
+
const selectionDraftRef = (0, import_react24.useRef)(null);
|
|
3188
|
+
const [selectionError, setSelectionError] = (0, import_react24.useState)(null);
|
|
3189
|
+
const paintGestureRef = (0, import_react24.useRef)(null);
|
|
3190
|
+
const paintControllerRef = (0, import_react24.useRef)(controller);
|
|
3037
3191
|
if (!paintGestureRef.current || paintControllerRef.current !== controller) {
|
|
3038
3192
|
paintGestureRef.current = new import_image_editor18.PaintGesture(controller);
|
|
3039
3193
|
paintControllerRef.current = controller;
|
|
3040
3194
|
}
|
|
3041
|
-
const brushCursorRef = (0,
|
|
3042
|
-
const [paintError, setPaintError] = (0,
|
|
3043
|
-
const transformToolRef = (0,
|
|
3044
|
-
const transformControllerRef = (0,
|
|
3195
|
+
const brushCursorRef = (0, import_react24.useRef)(null);
|
|
3196
|
+
const [paintError, setPaintError] = (0, import_react24.useState)(null);
|
|
3197
|
+
const transformToolRef = (0, import_react24.useRef)(null);
|
|
3198
|
+
const transformControllerRef = (0, import_react24.useRef)(controller);
|
|
3045
3199
|
if (!transformToolRef.current || transformControllerRef.current !== controller) {
|
|
3046
3200
|
transformToolRef.current?.cancel();
|
|
3047
3201
|
transformToolRef.current = new import_image_editor18.FreeTransformTool(controller, {
|
|
@@ -3050,33 +3204,33 @@ var ImageEditor = ({
|
|
|
3050
3204
|
transformControllerRef.current = controller;
|
|
3051
3205
|
}
|
|
3052
3206
|
const transformTool = transformToolRef.current;
|
|
3053
|
-
const [, setTransformTick] = (0,
|
|
3054
|
-
const [transformCursor, setTransformCursor] = (0,
|
|
3055
|
-
const [shapeOptions, setShapeOptions] = (0,
|
|
3056
|
-
const shapeOptionsRef = (0,
|
|
3207
|
+
const [, setTransformTick] = (0, import_react24.useState)(0);
|
|
3208
|
+
const [transformCursor, setTransformCursor] = (0, import_react24.useState)("default");
|
|
3209
|
+
const [shapeOptions, setShapeOptions] = (0, import_react24.useState)(import_image_editor18.DEFAULT_SHAPE_TOOL_OPTIONS);
|
|
3210
|
+
const shapeOptionsRef = (0, import_react24.useRef)(shapeOptions);
|
|
3057
3211
|
shapeOptionsRef.current = shapeOptions;
|
|
3058
|
-
const [typeOptions, setTypeOptions] = (0,
|
|
3059
|
-
const typeOptionsRef = (0,
|
|
3212
|
+
const [typeOptions, setTypeOptions] = (0, import_react24.useState)(import_image_editor18.DEFAULT_TYPE_TOOL_OPTIONS);
|
|
3213
|
+
const typeOptionsRef = (0, import_react24.useRef)(typeOptions);
|
|
3060
3214
|
typeOptionsRef.current = typeOptions;
|
|
3061
|
-
const shapeGestureRef = (0,
|
|
3062
|
-
const typeToolRef = (0,
|
|
3063
|
-
const shapeTypeControllerRef = (0,
|
|
3215
|
+
const shapeGestureRef = (0, import_react24.useRef)(null);
|
|
3216
|
+
const typeToolRef = (0, import_react24.useRef)(null);
|
|
3217
|
+
const shapeTypeControllerRef = (0, import_react24.useRef)(controller);
|
|
3064
3218
|
if (!shapeGestureRef.current || !typeToolRef.current || shapeTypeControllerRef.current !== controller) {
|
|
3065
3219
|
typeToolRef.current?.finish();
|
|
3066
3220
|
shapeGestureRef.current = new import_image_editor18.ShapeDrawGesture(controller, () => shapeOptionsRef.current);
|
|
3067
3221
|
typeToolRef.current = new import_image_editor18.TypeToolGesture(controller, () => typeOptionsRef.current);
|
|
3068
3222
|
shapeTypeControllerRef.current = controller;
|
|
3069
3223
|
}
|
|
3070
|
-
const typeInputRef = (0,
|
|
3071
|
-
const [typeSession, setTypeSession] = (0,
|
|
3072
|
-
const [shapeTypeError, setShapeTypeError] = (0,
|
|
3073
|
-
const [inpaintPrompt, setInpaintPrompt] = (0,
|
|
3074
|
-
const [inpaintMaskMode, setInpaintMaskMode] = (0,
|
|
3075
|
-
const [isRemovingBg, setIsRemovingBg] = (0,
|
|
3076
|
-
const [isInpainting, setIsInpainting] = (0,
|
|
3077
|
-
const [aiError, setAiError] = (0,
|
|
3078
|
-
const [aiSuccess, setAiSuccess] = (0,
|
|
3079
|
-
const [aiTarget, setAiTarget] = (0,
|
|
3224
|
+
const typeInputRef = (0, import_react24.useRef)(null);
|
|
3225
|
+
const [typeSession, setTypeSession] = (0, import_react24.useState)(typeToolRef.current.session);
|
|
3226
|
+
const [shapeTypeError, setShapeTypeError] = (0, import_react24.useState)(null);
|
|
3227
|
+
const [inpaintPrompt, setInpaintPrompt] = (0, import_react24.useState)("");
|
|
3228
|
+
const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react24.useState)("annotations");
|
|
3229
|
+
const [isRemovingBg, setIsRemovingBg] = (0, import_react24.useState)(false);
|
|
3230
|
+
const [isInpainting, setIsInpainting] = (0, import_react24.useState)(false);
|
|
3231
|
+
const [aiError, setAiError] = (0, import_react24.useState)(null);
|
|
3232
|
+
const [aiSuccess, setAiSuccess] = (0, import_react24.useState)(null);
|
|
3233
|
+
const [aiTarget, setAiTarget] = (0, import_react24.useState)("auto");
|
|
3080
3234
|
const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
|
|
3081
3235
|
const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
|
|
3082
3236
|
const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
|
|
@@ -3139,18 +3293,18 @@ var ImageEditor = ({
|
|
|
3139
3293
|
setIsInpainting(false);
|
|
3140
3294
|
}
|
|
3141
3295
|
};
|
|
3142
|
-
const [activeColor, setActiveColor] = (0,
|
|
3143
|
-
const [strokeWidth, setStrokeWidth] = (0,
|
|
3144
|
-
const [fontSize, setFontSize] = (0,
|
|
3145
|
-
const [textInput, setTextInput] = (0,
|
|
3146
|
-
const draftAnnotationRef = (0,
|
|
3147
|
-
const draftCropRef = (0,
|
|
3148
|
-
const cropDragInfoRef = (0,
|
|
3149
|
-
const annotationDragInfoRef = (0,
|
|
3150
|
-
const isDrawingRef = (0,
|
|
3151
|
-
const currentPathRef = (0,
|
|
3152
|
-
const dragStartPointRef = (0,
|
|
3153
|
-
const renderCanvas = (0,
|
|
3296
|
+
const [activeColor, setActiveColor] = (0, import_react24.useState)("#ef4444");
|
|
3297
|
+
const [strokeWidth, setStrokeWidth] = (0, import_react24.useState)(3);
|
|
3298
|
+
const [fontSize, setFontSize] = (0, import_react24.useState)(24);
|
|
3299
|
+
const [textInput, setTextInput] = (0, import_react24.useState)("");
|
|
3300
|
+
const draftAnnotationRef = (0, import_react24.useRef)(null);
|
|
3301
|
+
const draftCropRef = (0, import_react24.useRef)(null);
|
|
3302
|
+
const cropDragInfoRef = (0, import_react24.useRef)(null);
|
|
3303
|
+
const annotationDragInfoRef = (0, import_react24.useRef)(null);
|
|
3304
|
+
const isDrawingRef = (0, import_react24.useRef)(false);
|
|
3305
|
+
const currentPathRef = (0, import_react24.useRef)([]);
|
|
3306
|
+
const dragStartPointRef = (0, import_react24.useRef)(null);
|
|
3307
|
+
const renderCanvas = (0, import_react24.useCallback)(
|
|
3154
3308
|
async (draftAnnotation, draftCrop) => {
|
|
3155
3309
|
const canvas = canvasRef.current;
|
|
3156
3310
|
const container = containerRef.current;
|
|
@@ -3173,8 +3327,8 @@ var ImageEditor = ({
|
|
|
3173
3327
|
},
|
|
3174
3328
|
[controller, activeTab, transformTool]
|
|
3175
3329
|
);
|
|
3176
|
-
(0,
|
|
3177
|
-
(0,
|
|
3330
|
+
(0, import_react24.useEffect)(() => typeSession?.subscribe(() => void renderCanvas()), [typeSession, renderCanvas]);
|
|
3331
|
+
(0, import_react24.useEffect)(() => {
|
|
3178
3332
|
if (activeTab === "annotate" && state.activeTool === "type") return;
|
|
3179
3333
|
if (typeToolRef.current?.session) {
|
|
3180
3334
|
typeToolRef.current.finish();
|
|
@@ -3209,7 +3363,7 @@ var ImageEditor = ({
|
|
|
3209
3363
|
el.value = "";
|
|
3210
3364
|
}
|
|
3211
3365
|
};
|
|
3212
|
-
(0,
|
|
3366
|
+
(0, import_react24.useEffect)(() => transformTool.subscribe(() => {
|
|
3213
3367
|
setTransformTick((n) => n + 1);
|
|
3214
3368
|
void renderCanvas();
|
|
3215
3369
|
}), [transformTool, renderCanvas]);
|
|
@@ -3252,7 +3406,7 @@ var ImageEditor = ({
|
|
|
3252
3406
|
transformTool.up();
|
|
3253
3407
|
return true;
|
|
3254
3408
|
};
|
|
3255
|
-
(0,
|
|
3409
|
+
(0, import_react24.useEffect)(() => {
|
|
3256
3410
|
if (typeof window === "undefined") return;
|
|
3257
3411
|
const onKey = (e) => {
|
|
3258
3412
|
if (transformTool.key(e)) e.preventDefault();
|
|
@@ -3260,7 +3414,7 @@ var ImageEditor = ({
|
|
|
3260
3414
|
window.addEventListener("keydown", onKey);
|
|
3261
3415
|
return () => window.removeEventListener("keydown", onKey);
|
|
3262
3416
|
}, [transformTool]);
|
|
3263
|
-
(0,
|
|
3417
|
+
(0, import_react24.useEffect)(() => {
|
|
3264
3418
|
const raf = typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : (cb) => setTimeout(cb, 0);
|
|
3265
3419
|
const caf = typeof cancelAnimationFrame !== "undefined" ? cancelAnimationFrame : (id) => clearTimeout(id);
|
|
3266
3420
|
const animId = raf(() => {
|
|
@@ -3268,12 +3422,12 @@ var ImageEditor = ({
|
|
|
3268
3422
|
});
|
|
3269
3423
|
return () => caf(animId);
|
|
3270
3424
|
}, [renderCanvas, state]);
|
|
3271
|
-
(0,
|
|
3425
|
+
(0, import_react24.useEffect)(() => {
|
|
3272
3426
|
if (activeTab === "crop" && editor.state.activeTool !== "crop") {
|
|
3273
3427
|
editor.setTool("crop");
|
|
3274
3428
|
}
|
|
3275
3429
|
}, [activeTab, editor]);
|
|
3276
|
-
(0,
|
|
3430
|
+
(0, import_react24.useEffect)(() => {
|
|
3277
3431
|
const container = containerRef.current;
|
|
3278
3432
|
if (!container) return;
|
|
3279
3433
|
if (typeof ResizeObserver !== "undefined") {
|
|
@@ -3341,7 +3495,7 @@ var ImageEditor = ({
|
|
|
3341
3495
|
if (g.error) setPaintError(g.error);
|
|
3342
3496
|
}
|
|
3343
3497
|
};
|
|
3344
|
-
(0,
|
|
3498
|
+
(0, import_react24.useEffect)(() => {
|
|
3345
3499
|
if (activeTab !== "paint" || typeof window === "undefined") return;
|
|
3346
3500
|
const onKey = (e) => {
|
|
3347
3501
|
if ((0, import_image_editor18.handlePaintShortcut)(controller, e)) e.preventDefault();
|
|
@@ -3736,18 +3890,21 @@ var ImageEditor = ({
|
|
|
3736
3890
|
link.click();
|
|
3737
3891
|
}
|
|
3738
3892
|
};
|
|
3739
|
-
return /* @__PURE__ */ (0,
|
|
3893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3740
3894
|
"div",
|
|
3741
3895
|
{
|
|
3742
|
-
|
|
3896
|
+
ref: rootRef,
|
|
3897
|
+
className: `relative flex flex-col bg-slate-900 border border-slate-800 rounded-xl overflow-hidden shadow-2xl text-slate-100 ${className}`,
|
|
3743
3898
|
style,
|
|
3744
3899
|
children: [
|
|
3745
|
-
/* @__PURE__ */ (0,
|
|
3746
|
-
|
|
3747
|
-
|
|
3900
|
+
playing && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
|
|
3901
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap items-center justify-between px-4 py-3 bg-slate-950/80 border-b border-slate-800 gap-3", children: [
|
|
3902
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-1 bg-slate-900 p-1 rounded-lg border border-slate-800 text-xs", children: [
|
|
3903
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3748
3904
|
"button",
|
|
3749
3905
|
{
|
|
3750
3906
|
type: "button",
|
|
3907
|
+
"data-image-tab": "crop",
|
|
3751
3908
|
onClick: () => {
|
|
3752
3909
|
setActiveTab("crop");
|
|
3753
3910
|
editor.setTool("crop");
|
|
@@ -3756,10 +3913,11 @@ var ImageEditor = ({
|
|
|
3756
3913
|
children: "Transform & Crop"
|
|
3757
3914
|
}
|
|
3758
3915
|
),
|
|
3759
|
-
/* @__PURE__ */ (0,
|
|
3916
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3760
3917
|
"button",
|
|
3761
3918
|
{
|
|
3762
3919
|
type: "button",
|
|
3920
|
+
"data-image-tab": "adjust",
|
|
3763
3921
|
onClick: () => {
|
|
3764
3922
|
setActiveTab("adjust");
|
|
3765
3923
|
editor.setTool("select");
|
|
@@ -3768,10 +3926,11 @@ var ImageEditor = ({
|
|
|
3768
3926
|
children: "Adjustments"
|
|
3769
3927
|
}
|
|
3770
3928
|
),
|
|
3771
|
-
/* @__PURE__ */ (0,
|
|
3929
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3772
3930
|
"button",
|
|
3773
3931
|
{
|
|
3774
3932
|
type: "button",
|
|
3933
|
+
"data-image-tab": "layers",
|
|
3775
3934
|
onClick: () => {
|
|
3776
3935
|
setActiveTab("layers");
|
|
3777
3936
|
editor.setTool("select");
|
|
@@ -3780,10 +3939,11 @@ var ImageEditor = ({
|
|
|
3780
3939
|
children: "Layers"
|
|
3781
3940
|
}
|
|
3782
3941
|
),
|
|
3783
|
-
/* @__PURE__ */ (0,
|
|
3942
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3784
3943
|
"button",
|
|
3785
3944
|
{
|
|
3786
3945
|
type: "button",
|
|
3946
|
+
"data-image-tab": "paint",
|
|
3787
3947
|
onClick: () => {
|
|
3788
3948
|
setActiveTab("paint");
|
|
3789
3949
|
editor.setTool("brush");
|
|
@@ -3792,10 +3952,11 @@ var ImageEditor = ({
|
|
|
3792
3952
|
children: "Paint"
|
|
3793
3953
|
}
|
|
3794
3954
|
),
|
|
3795
|
-
/* @__PURE__ */ (0,
|
|
3955
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3796
3956
|
"button",
|
|
3797
3957
|
{
|
|
3798
3958
|
type: "button",
|
|
3959
|
+
"data-image-tab": "select",
|
|
3799
3960
|
onClick: () => {
|
|
3800
3961
|
setActiveTab("select");
|
|
3801
3962
|
editor.setTool("select");
|
|
@@ -3804,10 +3965,11 @@ var ImageEditor = ({
|
|
|
3804
3965
|
children: "Select & Mask"
|
|
3805
3966
|
}
|
|
3806
3967
|
),
|
|
3807
|
-
/* @__PURE__ */ (0,
|
|
3968
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3808
3969
|
"button",
|
|
3809
3970
|
{
|
|
3810
3971
|
type: "button",
|
|
3972
|
+
"data-image-tab": "annotate",
|
|
3811
3973
|
onClick: () => {
|
|
3812
3974
|
setActiveTab("annotate");
|
|
3813
3975
|
editor.setTool("pen");
|
|
@@ -3816,10 +3978,11 @@ var ImageEditor = ({
|
|
|
3816
3978
|
children: "Annotations"
|
|
3817
3979
|
}
|
|
3818
3980
|
),
|
|
3819
|
-
/* @__PURE__ */ (0,
|
|
3981
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3820
3982
|
"button",
|
|
3821
3983
|
{
|
|
3822
3984
|
type: "button",
|
|
3985
|
+
"data-image-tab": "depth",
|
|
3823
3986
|
onClick: () => {
|
|
3824
3987
|
setActiveTab("depth");
|
|
3825
3988
|
editor.setTool("select");
|
|
@@ -3828,24 +3991,25 @@ var ImageEditor = ({
|
|
|
3828
3991
|
children: "Depth Mask"
|
|
3829
3992
|
}
|
|
3830
3993
|
),
|
|
3831
|
-
/* @__PURE__ */ (0,
|
|
3994
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3832
3995
|
"button",
|
|
3833
3996
|
{
|
|
3834
3997
|
type: "button",
|
|
3998
|
+
"data-image-tab": "ai",
|
|
3835
3999
|
onClick: () => {
|
|
3836
4000
|
setActiveTab("ai");
|
|
3837
4001
|
editor.setTool("select");
|
|
3838
4002
|
},
|
|
3839
4003
|
className: `px-3 py-1.5 rounded-md font-medium transition-colors flex items-center gap-1.5 ${activeTab === "ai" ? "bg-indigo-600 text-white shadow" : "text-slate-400 hover:text-slate-200"}`,
|
|
3840
4004
|
children: [
|
|
3841
|
-
/* @__PURE__ */ (0,
|
|
4005
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.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_runtime23.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" }) }),
|
|
3842
4006
|
"AI Tools"
|
|
3843
4007
|
]
|
|
3844
4008
|
}
|
|
3845
4009
|
)
|
|
3846
4010
|
] }),
|
|
3847
|
-
/* @__PURE__ */ (0,
|
|
3848
|
-
/* @__PURE__ */ (0,
|
|
4011
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
4012
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3849
4013
|
"button",
|
|
3850
4014
|
{
|
|
3851
4015
|
type: "button",
|
|
@@ -3856,7 +4020,7 @@ var ImageEditor = ({
|
|
|
3856
4020
|
children: "\u21A9"
|
|
3857
4021
|
}
|
|
3858
4022
|
),
|
|
3859
|
-
/* @__PURE__ */ (0,
|
|
4023
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3860
4024
|
"button",
|
|
3861
4025
|
{
|
|
3862
4026
|
type: "button",
|
|
@@ -3867,7 +4031,7 @@ var ImageEditor = ({
|
|
|
3867
4031
|
children: "\u21AA"
|
|
3868
4032
|
}
|
|
3869
4033
|
),
|
|
3870
|
-
/* @__PURE__ */ (0,
|
|
4034
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3871
4035
|
"button",
|
|
3872
4036
|
{
|
|
3873
4037
|
type: "button",
|
|
@@ -3876,8 +4040,8 @@ var ImageEditor = ({
|
|
|
3876
4040
|
children: "Reset"
|
|
3877
4041
|
}
|
|
3878
4042
|
),
|
|
3879
|
-
/* @__PURE__ */ (0,
|
|
3880
|
-
/* @__PURE__ */ (0,
|
|
4043
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "h-4 w-px bg-slate-800 mx-1" }),
|
|
4044
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3881
4045
|
"button",
|
|
3882
4046
|
{
|
|
3883
4047
|
type: "button",
|
|
@@ -3887,11 +4051,11 @@ var ImageEditor = ({
|
|
|
3887
4051
|
children: "-"
|
|
3888
4052
|
}
|
|
3889
4053
|
),
|
|
3890
|
-
/* @__PURE__ */ (0,
|
|
4054
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-mono text-slate-400 w-10 text-center", children: [
|
|
3891
4055
|
Math.round(state.zoom * 100),
|
|
3892
4056
|
"%"
|
|
3893
4057
|
] }),
|
|
3894
|
-
/* @__PURE__ */ (0,
|
|
4058
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3895
4059
|
"button",
|
|
3896
4060
|
{
|
|
3897
4061
|
type: "button",
|
|
@@ -3901,8 +4065,8 @@ var ImageEditor = ({
|
|
|
3901
4065
|
children: "+"
|
|
3902
4066
|
}
|
|
3903
4067
|
),
|
|
3904
|
-
/* @__PURE__ */ (0,
|
|
3905
|
-
/* @__PURE__ */ (0,
|
|
4068
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "h-4 w-px bg-slate-800 mx-1" }),
|
|
4069
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3906
4070
|
"button",
|
|
3907
4071
|
{
|
|
3908
4072
|
type: "button",
|
|
@@ -3913,7 +4077,7 @@ var ImageEditor = ({
|
|
|
3913
4077
|
children: "Hold Compare"
|
|
3914
4078
|
}
|
|
3915
4079
|
),
|
|
3916
|
-
/* @__PURE__ */ (0,
|
|
4080
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3917
4081
|
"button",
|
|
3918
4082
|
{
|
|
3919
4083
|
type: "button",
|
|
@@ -3924,16 +4088,16 @@ var ImageEditor = ({
|
|
|
3924
4088
|
)
|
|
3925
4089
|
] })
|
|
3926
4090
|
] }),
|
|
3927
|
-
transformTool.active && /* @__PURE__ */ (0,
|
|
3928
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */ (0,
|
|
3929
|
-
/* @__PURE__ */ (0,
|
|
3930
|
-
/* @__PURE__ */ (0,
|
|
4091
|
+
transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-slate-800 bg-slate-900/95 px-4 py-2" }),
|
|
4092
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { role: "alert", className: "border-b border-rose-900 bg-rose-950/80 px-4 py-1.5 text-xs text-rose-200", children: transformTool.error }),
|
|
4093
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
4094
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3931
4095
|
"div",
|
|
3932
4096
|
{
|
|
3933
4097
|
ref: containerRef,
|
|
3934
4098
|
className: "relative flex-1 h-[360px] md:h-full min-h-[320px] bg-slate-950 overflow-hidden select-none",
|
|
3935
4099
|
children: [
|
|
3936
|
-
/* @__PURE__ */ (0,
|
|
4100
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3937
4101
|
"canvas",
|
|
3938
4102
|
{
|
|
3939
4103
|
ref: canvasRef,
|
|
@@ -3950,7 +4114,7 @@ var ImageEditor = ({
|
|
|
3950
4114
|
className: `absolute inset-0 w-full h-full block ${transformTool.active ? "touch-none" : activeTab === "paint" ? "touch-none cursor-crosshair" : activeTab === "annotate" && state.activeTool === "type" ? "cursor-text" : activeTab === "annotate" && state.activeTool === "shape" ? "cursor-crosshair" : ""}`
|
|
3951
4115
|
}
|
|
3952
4116
|
),
|
|
3953
|
-
typeSession && /* @__PURE__ */ (0,
|
|
4117
|
+
typeSession && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3954
4118
|
"textarea",
|
|
3955
4119
|
{
|
|
3956
4120
|
ref: typeInputRef,
|
|
@@ -3972,11 +4136,11 @@ var ImageEditor = ({
|
|
|
3972
4136
|
]
|
|
3973
4137
|
}
|
|
3974
4138
|
),
|
|
3975
|
-
/* @__PURE__ */ (0,
|
|
3976
|
-
activeTab === "crop" && /* @__PURE__ */ (0,
|
|
3977
|
-
/* @__PURE__ */ (0,
|
|
3978
|
-
/* @__PURE__ */ (0,
|
|
3979
|
-
/* @__PURE__ */ (0,
|
|
4139
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "w-full md:w-80 bg-slate-900/90 border-t md:border-t-0 md:border-l border-slate-800 p-4 overflow-y-auto h-auto md:h-full md:max-h-[560px]", children: [
|
|
4140
|
+
activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
4141
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Aspect Ratio Presets" }),
|
|
4142
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
4143
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3980
4144
|
"button",
|
|
3981
4145
|
{
|
|
3982
4146
|
type: "button",
|
|
@@ -3988,7 +4152,7 @@ var ImageEditor = ({
|
|
|
3988
4152
|
children: "Freeform"
|
|
3989
4153
|
}
|
|
3990
4154
|
),
|
|
3991
|
-
/* @__PURE__ */ (0,
|
|
4155
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3992
4156
|
"button",
|
|
3993
4157
|
{
|
|
3994
4158
|
type: "button",
|
|
@@ -4000,7 +4164,7 @@ var ImageEditor = ({
|
|
|
4000
4164
|
children: "1:1 Square"
|
|
4001
4165
|
}
|
|
4002
4166
|
),
|
|
4003
|
-
/* @__PURE__ */ (0,
|
|
4167
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4004
4168
|
"button",
|
|
4005
4169
|
{
|
|
4006
4170
|
type: "button",
|
|
@@ -4012,7 +4176,7 @@ var ImageEditor = ({
|
|
|
4012
4176
|
children: "4:3 Standard"
|
|
4013
4177
|
}
|
|
4014
4178
|
),
|
|
4015
|
-
/* @__PURE__ */ (0,
|
|
4179
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4016
4180
|
"button",
|
|
4017
4181
|
{
|
|
4018
4182
|
type: "button",
|
|
@@ -4024,7 +4188,7 @@ var ImageEditor = ({
|
|
|
4024
4188
|
children: "16:9 Wide"
|
|
4025
4189
|
}
|
|
4026
4190
|
),
|
|
4027
|
-
/* @__PURE__ */ (0,
|
|
4191
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4028
4192
|
"button",
|
|
4029
4193
|
{
|
|
4030
4194
|
type: "button",
|
|
@@ -4036,7 +4200,7 @@ var ImageEditor = ({
|
|
|
4036
4200
|
children: "3:2 Photo"
|
|
4037
4201
|
}
|
|
4038
4202
|
),
|
|
4039
|
-
/* @__PURE__ */ (0,
|
|
4203
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4040
4204
|
"button",
|
|
4041
4205
|
{
|
|
4042
4206
|
type: "button",
|
|
@@ -4049,10 +4213,10 @@ var ImageEditor = ({
|
|
|
4049
4213
|
}
|
|
4050
4214
|
)
|
|
4051
4215
|
] }),
|
|
4052
|
-
/* @__PURE__ */ (0,
|
|
4053
|
-
/* @__PURE__ */ (0,
|
|
4054
|
-
/* @__PURE__ */ (0,
|
|
4055
|
-
/* @__PURE__ */ (0,
|
|
4216
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "h-px bg-slate-800 my-1" }),
|
|
4217
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Orientation & Flips" }),
|
|
4218
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
4219
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4056
4220
|
"button",
|
|
4057
4221
|
{
|
|
4058
4222
|
type: "button",
|
|
@@ -4061,7 +4225,7 @@ var ImageEditor = ({
|
|
|
4061
4225
|
children: "Rotate -90\xB0"
|
|
4062
4226
|
}
|
|
4063
4227
|
),
|
|
4064
|
-
/* @__PURE__ */ (0,
|
|
4228
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4065
4229
|
"button",
|
|
4066
4230
|
{
|
|
4067
4231
|
type: "button",
|
|
@@ -4070,7 +4234,7 @@ var ImageEditor = ({
|
|
|
4070
4234
|
children: "Rotate +90\xB0"
|
|
4071
4235
|
}
|
|
4072
4236
|
),
|
|
4073
|
-
/* @__PURE__ */ (0,
|
|
4237
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4074
4238
|
"button",
|
|
4075
4239
|
{
|
|
4076
4240
|
type: "button",
|
|
@@ -4079,7 +4243,7 @@ var ImageEditor = ({
|
|
|
4079
4243
|
children: "Flip Horizontal"
|
|
4080
4244
|
}
|
|
4081
4245
|
),
|
|
4082
|
-
/* @__PURE__ */ (0,
|
|
4246
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4083
4247
|
"button",
|
|
4084
4248
|
{
|
|
4085
4249
|
type: "button",
|
|
@@ -4090,10 +4254,10 @@ var ImageEditor = ({
|
|
|
4090
4254
|
)
|
|
4091
4255
|
] })
|
|
4092
4256
|
] }),
|
|
4093
|
-
activeTab === "adjust" && /* @__PURE__ */ (0,
|
|
4094
|
-
/* @__PURE__ */ (0,
|
|
4095
|
-
/* @__PURE__ */ (0,
|
|
4096
|
-
/* @__PURE__ */ (0,
|
|
4257
|
+
activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
4258
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
4259
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Color Adjustments" }),
|
|
4260
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4097
4261
|
"button",
|
|
4098
4262
|
{
|
|
4099
4263
|
type: "button",
|
|
@@ -4103,9 +4267,9 @@ var ImageEditor = ({
|
|
|
4103
4267
|
}
|
|
4104
4268
|
)
|
|
4105
4269
|
] }),
|
|
4106
|
-
/* @__PURE__ */ (0,
|
|
4107
|
-
import_image_editor18.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0,
|
|
4108
|
-
/* @__PURE__ */ (0,
|
|
4270
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Histogram, { histogram: editor.histogram }),
|
|
4271
|
+
import_image_editor18.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react24.default.Fragment, { children: [
|
|
4272
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4109
4273
|
ControlSlider,
|
|
4110
4274
|
{
|
|
4111
4275
|
spec,
|
|
@@ -4114,14 +4278,14 @@ var ImageEditor = ({
|
|
|
4114
4278
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
4115
4279
|
}
|
|
4116
4280
|
),
|
|
4117
|
-
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0,
|
|
4281
|
+
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
4118
4282
|
"div",
|
|
4119
4283
|
{
|
|
4120
4284
|
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-200",
|
|
4121
4285
|
"data-testid": "image-editor-process-notice",
|
|
4122
4286
|
children: [
|
|
4123
|
-
/* @__PURE__ */ (0,
|
|
4124
|
-
/* @__PURE__ */ (0,
|
|
4287
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
4288
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4125
4289
|
"button",
|
|
4126
4290
|
{
|
|
4127
4291
|
type: "button",
|
|
@@ -4134,7 +4298,7 @@ var ImageEditor = ({
|
|
|
4134
4298
|
}
|
|
4135
4299
|
)
|
|
4136
4300
|
] }, spec.id)),
|
|
4137
|
-
/* @__PURE__ */ (0,
|
|
4301
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "border-t border-slate-700/60 pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4138
4302
|
AdjustmentLayersPanel,
|
|
4139
4303
|
{
|
|
4140
4304
|
controller,
|
|
@@ -4143,9 +4307,9 @@ var ImageEditor = ({
|
|
|
4143
4307
|
}
|
|
4144
4308
|
) })
|
|
4145
4309
|
] }),
|
|
4146
|
-
activeTab === "layers" && /* @__PURE__ */ (0,
|
|
4147
|
-
/* @__PURE__ */ (0,
|
|
4148
|
-
/* @__PURE__ */ (0,
|
|
4310
|
+
activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
4311
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Layers" }),
|
|
4312
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4149
4313
|
"button",
|
|
4150
4314
|
{
|
|
4151
4315
|
type: "button",
|
|
@@ -4156,15 +4320,15 @@ var ImageEditor = ({
|
|
|
4156
4320
|
children: "Free Transform"
|
|
4157
4321
|
}
|
|
4158
4322
|
),
|
|
4159
|
-
/* @__PURE__ */ (0,
|
|
4160
|
-
effectsShown && /* @__PURE__ */ (0,
|
|
4161
|
-
/* @__PURE__ */ (0,
|
|
4162
|
-
/* @__PURE__ */ (0,
|
|
4323
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(LayersPanel, { controller }),
|
|
4324
|
+
effectsShown && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageProviderEffectsPanel, { controller, className: "border-t border-slate-700/60 pt-3" }),
|
|
4325
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Colour" }),
|
|
4326
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ColorProfilePanel, { controller })
|
|
4163
4327
|
] }),
|
|
4164
|
-
activeTab === "paint" && /* @__PURE__ */ (0,
|
|
4165
|
-
/* @__PURE__ */ (0,
|
|
4166
|
-
/* @__PURE__ */ (0,
|
|
4167
|
-
/* @__PURE__ */ (0,
|
|
4328
|
+
activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
4329
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Paint" }),
|
|
4330
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(BrushOptionsBar, { controller }),
|
|
4331
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4168
4332
|
"button",
|
|
4169
4333
|
{
|
|
4170
4334
|
type: "button",
|
|
@@ -4175,12 +4339,12 @@ var ImageEditor = ({
|
|
|
4175
4339
|
children: "Free Transform"
|
|
4176
4340
|
}
|
|
4177
4341
|
),
|
|
4178
|
-
paintError && /* @__PURE__ */ (0,
|
|
4179
|
-
/* @__PURE__ */ (0,
|
|
4342
|
+
paintError && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { role: "alert", className: "text-rose-400", "data-testid": "paint-error", children: paintError }),
|
|
4343
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "border-t border-slate-700/60 pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(LayersPanel, { controller }) })
|
|
4180
4344
|
] }),
|
|
4181
|
-
activeTab === "annotate" && /* @__PURE__ */ (0,
|
|
4182
|
-
/* @__PURE__ */ (0,
|
|
4183
|
-
/* @__PURE__ */ (0,
|
|
4345
|
+
activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
4346
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Shape & Type Layers" }),
|
|
4347
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4184
4348
|
"button",
|
|
4185
4349
|
{
|
|
4186
4350
|
type: "button",
|
|
@@ -4191,13 +4355,13 @@ var ImageEditor = ({
|
|
|
4191
4355
|
},
|
|
4192
4356
|
t
|
|
4193
4357
|
)) }),
|
|
4194
|
-
state.activeTool === "shape" && /* @__PURE__ */ (0,
|
|
4195
|
-
state.activeTool === "type" && /* @__PURE__ */ (0,
|
|
4196
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0,
|
|
4197
|
-
shapeTypeError && /* @__PURE__ */ (0,
|
|
4198
|
-
/* @__PURE__ */ (0,
|
|
4199
|
-
/* @__PURE__ */ (0,
|
|
4200
|
-
/* @__PURE__ */ (0,
|
|
4358
|
+
state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
4359
|
+
state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
|
|
4360
|
+
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-slate-800 px-2 py-1 text-[11px] text-slate-200 hover:bg-slate-700", children: "Done editing text" }),
|
|
4361
|
+
shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { role: "alert", className: "text-rose-400", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
4362
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "h-px bg-slate-800 my-1" }),
|
|
4363
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Draw & Annotate" }),
|
|
4364
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4201
4365
|
"button",
|
|
4202
4366
|
{
|
|
4203
4367
|
type: "button",
|
|
@@ -4207,9 +4371,9 @@ var ImageEditor = ({
|
|
|
4207
4371
|
},
|
|
4208
4372
|
t
|
|
4209
4373
|
)) }),
|
|
4210
|
-
/* @__PURE__ */ (0,
|
|
4211
|
-
/* @__PURE__ */ (0,
|
|
4212
|
-
/* @__PURE__ */ (0,
|
|
4374
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
4375
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("label", { className: "text-slate-400", children: "Color:" }),
|
|
4376
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4213
4377
|
"input",
|
|
4214
4378
|
{
|
|
4215
4379
|
type: "color",
|
|
@@ -4218,15 +4382,15 @@ var ImageEditor = ({
|
|
|
4218
4382
|
className: "w-8 h-8 rounded border border-slate-700 cursor-pointer bg-transparent"
|
|
4219
4383
|
}
|
|
4220
4384
|
),
|
|
4221
|
-
/* @__PURE__ */ (0,
|
|
4222
|
-
/* @__PURE__ */ (0,
|
|
4223
|
-
/* @__PURE__ */ (0,
|
|
4224
|
-
/* @__PURE__ */ (0,
|
|
4385
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex-1 ml-2", children: [
|
|
4386
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex justify-between text-slate-400 mb-0.5", children: [
|
|
4387
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Width:" }),
|
|
4388
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-mono", children: [
|
|
4225
4389
|
strokeWidth,
|
|
4226
4390
|
"px"
|
|
4227
4391
|
] })
|
|
4228
4392
|
] }),
|
|
4229
|
-
/* @__PURE__ */ (0,
|
|
4393
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4230
4394
|
"input",
|
|
4231
4395
|
{
|
|
4232
4396
|
type: "range",
|
|
@@ -4239,10 +4403,10 @@ var ImageEditor = ({
|
|
|
4239
4403
|
)
|
|
4240
4404
|
] })
|
|
4241
4405
|
] }),
|
|
4242
|
-
/* @__PURE__ */ (0,
|
|
4243
|
-
/* @__PURE__ */ (0,
|
|
4244
|
-
/* @__PURE__ */ (0,
|
|
4245
|
-
/* @__PURE__ */ (0,
|
|
4406
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "h-px bg-slate-800 my-1" }),
|
|
4407
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Add Text" }),
|
|
4408
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-2", children: [
|
|
4409
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4246
4410
|
"input",
|
|
4247
4411
|
{
|
|
4248
4412
|
type: "text",
|
|
@@ -4253,7 +4417,7 @@ var ImageEditor = ({
|
|
|
4253
4417
|
className: "flex-1 bg-slate-950 border border-slate-700 rounded-lg px-2.5 py-1.5 text-xs text-slate-100 placeholder-slate-500 focus:outline-none focus:border-indigo-500"
|
|
4254
4418
|
}
|
|
4255
4419
|
),
|
|
4256
|
-
/* @__PURE__ */ (0,
|
|
4420
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4257
4421
|
"button",
|
|
4258
4422
|
{
|
|
4259
4423
|
type: "button",
|
|
@@ -4263,14 +4427,14 @@ var ImageEditor = ({
|
|
|
4263
4427
|
}
|
|
4264
4428
|
)
|
|
4265
4429
|
] }),
|
|
4266
|
-
/* @__PURE__ */ (0,
|
|
4267
|
-
/* @__PURE__ */ (0,
|
|
4268
|
-
/* @__PURE__ */ (0,
|
|
4430
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between text-slate-400", children: [
|
|
4431
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Font Size:" }),
|
|
4432
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-mono", children: [
|
|
4269
4433
|
fontSize,
|
|
4270
4434
|
"px"
|
|
4271
4435
|
] })
|
|
4272
4436
|
] }),
|
|
4273
|
-
/* @__PURE__ */ (0,
|
|
4437
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4274
4438
|
"input",
|
|
4275
4439
|
{
|
|
4276
4440
|
type: "range",
|
|
@@ -4281,14 +4445,14 @@ var ImageEditor = ({
|
|
|
4281
4445
|
className: "w-full accent-indigo-500"
|
|
4282
4446
|
}
|
|
4283
4447
|
),
|
|
4284
|
-
/* @__PURE__ */ (0,
|
|
4285
|
-
/* @__PURE__ */ (0,
|
|
4286
|
-
/* @__PURE__ */ (0,
|
|
4448
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "h-px bg-slate-800 my-1" }),
|
|
4449
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
4450
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "text-slate-400", children: [
|
|
4287
4451
|
"Layers (",
|
|
4288
4452
|
state.annotations.length,
|
|
4289
4453
|
")"
|
|
4290
4454
|
] }),
|
|
4291
|
-
state.selectedAnnotationId && /* @__PURE__ */ (0,
|
|
4455
|
+
state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4292
4456
|
"button",
|
|
4293
4457
|
{
|
|
4294
4458
|
type: "button",
|
|
@@ -4297,7 +4461,7 @@ var ImageEditor = ({
|
|
|
4297
4461
|
children: "Delete Selected"
|
|
4298
4462
|
}
|
|
4299
4463
|
),
|
|
4300
|
-
state.annotations.length > 0 && /* @__PURE__ */ (0,
|
|
4464
|
+
state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4301
4465
|
"button",
|
|
4302
4466
|
{
|
|
4303
4467
|
type: "button",
|
|
@@ -4308,10 +4472,10 @@ var ImageEditor = ({
|
|
|
4308
4472
|
)
|
|
4309
4473
|
] })
|
|
4310
4474
|
] }),
|
|
4311
|
-
activeTab === "depth" && /* @__PURE__ */ (0,
|
|
4312
|
-
/* @__PURE__ */ (0,
|
|
4313
|
-
/* @__PURE__ */ (0,
|
|
4314
|
-
/* @__PURE__ */ (0,
|
|
4475
|
+
activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
4476
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
4477
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Depth Masking" }),
|
|
4478
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4315
4479
|
"button",
|
|
4316
4480
|
{
|
|
4317
4481
|
type: "button",
|
|
@@ -4321,8 +4485,8 @@ var ImageEditor = ({
|
|
|
4321
4485
|
}
|
|
4322
4486
|
)
|
|
4323
4487
|
] }),
|
|
4324
|
-
/* @__PURE__ */ (0,
|
|
4325
|
-
/* @__PURE__ */ (0,
|
|
4488
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-slate-300", children: [
|
|
4489
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4326
4490
|
"input",
|
|
4327
4491
|
{
|
|
4328
4492
|
type: "checkbox",
|
|
@@ -4331,12 +4495,12 @@ var ImageEditor = ({
|
|
|
4331
4495
|
className: "rounded accent-indigo-500"
|
|
4332
4496
|
}
|
|
4333
4497
|
),
|
|
4334
|
-
/* @__PURE__ */ (0,
|
|
4498
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Enable Depth / Alpha Mask" })
|
|
4335
4499
|
] }),
|
|
4336
|
-
state.depthMask.enabled && /* @__PURE__ */ (0,
|
|
4337
|
-
/* @__PURE__ */ (0,
|
|
4338
|
-
/* @__PURE__ */ (0,
|
|
4339
|
-
/* @__PURE__ */ (0,
|
|
4500
|
+
state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
4501
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { children: [
|
|
4502
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("label", { className: "text-slate-400 block mb-1", children: "Mask Image URL:" }),
|
|
4503
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4340
4504
|
"input",
|
|
4341
4505
|
{
|
|
4342
4506
|
type: "text",
|
|
@@ -4347,8 +4511,8 @@ var ImageEditor = ({
|
|
|
4347
4511
|
}
|
|
4348
4512
|
)
|
|
4349
4513
|
] }),
|
|
4350
|
-
/* @__PURE__ */ (0,
|
|
4351
|
-
/* @__PURE__ */ (0,
|
|
4514
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-2", children: [
|
|
4515
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4352
4516
|
"button",
|
|
4353
4517
|
{
|
|
4354
4518
|
type: "button",
|
|
@@ -4357,7 +4521,7 @@ var ImageEditor = ({
|
|
|
4357
4521
|
children: "Threshold Mode"
|
|
4358
4522
|
}
|
|
4359
4523
|
),
|
|
4360
|
-
/* @__PURE__ */ (0,
|
|
4524
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4361
4525
|
"button",
|
|
4362
4526
|
{
|
|
4363
4527
|
type: "button",
|
|
@@ -4367,12 +4531,12 @@ var ImageEditor = ({
|
|
|
4367
4531
|
}
|
|
4368
4532
|
)
|
|
4369
4533
|
] }),
|
|
4370
|
-
/* @__PURE__ */ (0,
|
|
4371
|
-
/* @__PURE__ */ (0,
|
|
4372
|
-
/* @__PURE__ */ (0,
|
|
4373
|
-
/* @__PURE__ */ (0,
|
|
4534
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { children: [
|
|
4535
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex justify-between text-slate-400 mb-1", children: [
|
|
4536
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Depth Start (Lower):" }),
|
|
4537
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
4374
4538
|
] }),
|
|
4375
|
-
/* @__PURE__ */ (0,
|
|
4539
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4376
4540
|
"input",
|
|
4377
4541
|
{
|
|
4378
4542
|
type: "range",
|
|
@@ -4386,12 +4550,12 @@ var ImageEditor = ({
|
|
|
4386
4550
|
}
|
|
4387
4551
|
)
|
|
4388
4552
|
] }),
|
|
4389
|
-
/* @__PURE__ */ (0,
|
|
4390
|
-
/* @__PURE__ */ (0,
|
|
4391
|
-
/* @__PURE__ */ (0,
|
|
4392
|
-
/* @__PURE__ */ (0,
|
|
4553
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { children: [
|
|
4554
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex justify-between text-slate-400 mb-1", children: [
|
|
4555
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Depth Stop (Upper):" }),
|
|
4556
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
4393
4557
|
] }),
|
|
4394
|
-
/* @__PURE__ */ (0,
|
|
4558
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4395
4559
|
"input",
|
|
4396
4560
|
{
|
|
4397
4561
|
type: "range",
|
|
@@ -4405,12 +4569,12 @@ var ImageEditor = ({
|
|
|
4405
4569
|
}
|
|
4406
4570
|
)
|
|
4407
4571
|
] }),
|
|
4408
|
-
/* @__PURE__ */ (0,
|
|
4409
|
-
/* @__PURE__ */ (0,
|
|
4410
|
-
/* @__PURE__ */ (0,
|
|
4411
|
-
/* @__PURE__ */ (0,
|
|
4572
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { children: [
|
|
4573
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex justify-between text-slate-400 mb-1", children: [
|
|
4574
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Softness:" }),
|
|
4575
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
|
|
4412
4576
|
] }),
|
|
4413
|
-
/* @__PURE__ */ (0,
|
|
4577
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4414
4578
|
"input",
|
|
4415
4579
|
{
|
|
4416
4580
|
type: "range",
|
|
@@ -4422,8 +4586,8 @@ var ImageEditor = ({
|
|
|
4422
4586
|
}
|
|
4423
4587
|
)
|
|
4424
4588
|
] }),
|
|
4425
|
-
/* @__PURE__ */ (0,
|
|
4426
|
-
/* @__PURE__ */ (0,
|
|
4589
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-slate-300 mt-1", children: [
|
|
4590
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4427
4591
|
"input",
|
|
4428
4592
|
{
|
|
4429
4593
|
type: "checkbox",
|
|
@@ -4432,12 +4596,12 @@ var ImageEditor = ({
|
|
|
4432
4596
|
className: "rounded accent-indigo-500"
|
|
4433
4597
|
}
|
|
4434
4598
|
),
|
|
4435
|
-
/* @__PURE__ */ (0,
|
|
4599
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Invert Mask" })
|
|
4436
4600
|
] })
|
|
4437
4601
|
] })
|
|
4438
4602
|
] }),
|
|
4439
|
-
activeTab === "select" && /* @__PURE__ */ (0,
|
|
4440
|
-
/* @__PURE__ */ (0,
|
|
4603
|
+
activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
4604
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4441
4605
|
SelectionOptionsBar,
|
|
4442
4606
|
{
|
|
4443
4607
|
controller,
|
|
@@ -4447,9 +4611,9 @@ var ImageEditor = ({
|
|
|
4447
4611
|
quickMask: Boolean(state.quickMask)
|
|
4448
4612
|
}
|
|
4449
4613
|
),
|
|
4450
|
-
selectionError && /* @__PURE__ */ (0,
|
|
4451
|
-
/* @__PURE__ */ (0,
|
|
4452
|
-
/* @__PURE__ */ (0,
|
|
4614
|
+
selectionError && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { role: "alert", className: "text-rose-400", children: selectionError }),
|
|
4615
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-1", children: [
|
|
4616
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4453
4617
|
"button",
|
|
4454
4618
|
{
|
|
4455
4619
|
type: "button",
|
|
@@ -4460,7 +4624,7 @@ var ImageEditor = ({
|
|
|
4460
4624
|
children: "Transform Selection"
|
|
4461
4625
|
}
|
|
4462
4626
|
),
|
|
4463
|
-
/* @__PURE__ */ (0,
|
|
4627
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4464
4628
|
"button",
|
|
4465
4629
|
{
|
|
4466
4630
|
type: "button",
|
|
@@ -4472,12 +4636,12 @@ var ImageEditor = ({
|
|
|
4472
4636
|
}
|
|
4473
4637
|
)
|
|
4474
4638
|
] }),
|
|
4475
|
-
/* @__PURE__ */ (0,
|
|
4639
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers })
|
|
4476
4640
|
] }),
|
|
4477
|
-
activeTab === "ai" && /* @__PURE__ */ (0,
|
|
4478
|
-
/* @__PURE__ */ (0,
|
|
4479
|
-
/* @__PURE__ */ (0,
|
|
4480
|
-
/* @__PURE__ */ (0,
|
|
4641
|
+
activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
4642
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center justify-between gap-2 text-slate-300", children: [
|
|
4643
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Results go to" }),
|
|
4644
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
4481
4645
|
"select",
|
|
4482
4646
|
{
|
|
4483
4647
|
"aria-label": "AI result target",
|
|
@@ -4485,54 +4649,54 @@ var ImageEditor = ({
|
|
|
4485
4649
|
onChange: (e) => setAiTarget(e.target.value),
|
|
4486
4650
|
className: "bg-slate-800 border border-slate-700 rounded px-1.5 py-1",
|
|
4487
4651
|
children: [
|
|
4488
|
-
/* @__PURE__ */ (0,
|
|
4489
|
-
/* @__PURE__ */ (0,
|
|
4490
|
-
/* @__PURE__ */ (0,
|
|
4652
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
4653
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
|
|
4654
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "replace", children: "Replace image" })
|
|
4491
4655
|
]
|
|
4492
4656
|
}
|
|
4493
4657
|
)
|
|
4494
4658
|
] }),
|
|
4495
|
-
/* @__PURE__ */ (0,
|
|
4496
|
-
/* @__PURE__ */ (0,
|
|
4497
|
-
/* @__PURE__ */ (0,
|
|
4498
|
-
/* @__PURE__ */ (0,
|
|
4659
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "p-3 rounded-lg bg-slate-950/60 border border-slate-800 flex flex-col gap-2.5", children: [
|
|
4660
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
4661
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
4662
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("svg", { className: "w-3.5 h-3.5 text-indigo-400", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime23.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" }) }),
|
|
4499
4663
|
"Background Removal"
|
|
4500
4664
|
] }),
|
|
4501
|
-
isRemovingBg && /* @__PURE__ */ (0,
|
|
4665
|
+
isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-indigo-900/60 text-indigo-300 animate-pulse", children: "Removing..." })
|
|
4502
4666
|
] }),
|
|
4503
|
-
/* @__PURE__ */ (0,
|
|
4504
|
-
/* @__PURE__ */ (0,
|
|
4667
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-slate-400 text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
4668
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4505
4669
|
"button",
|
|
4506
4670
|
{
|
|
4507
4671
|
type: "button",
|
|
4508
4672
|
onClick: handleRemoveBackground,
|
|
4509
4673
|
disabled: isRemovingBg || isInpainting,
|
|
4510
4674
|
className: "mt-1 px-3 py-2 rounded-lg bg-indigo-600 hover:bg-indigo-500 disabled:opacity-50 text-white font-medium shadow transition-colors flex items-center justify-center gap-2",
|
|
4511
|
-
children: isRemovingBg ? /* @__PURE__ */ (0,
|
|
4512
|
-
/* @__PURE__ */ (0,
|
|
4675
|
+
children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
4676
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin" }),
|
|
4513
4677
|
"Removing Background..."
|
|
4514
|
-
] }) : /* @__PURE__ */ (0,
|
|
4515
|
-
/* @__PURE__ */ (0,
|
|
4678
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
4679
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.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_runtime23.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" }) }),
|
|
4516
4680
|
"Remove Background"
|
|
4517
4681
|
] })
|
|
4518
4682
|
}
|
|
4519
4683
|
)
|
|
4520
4684
|
] }),
|
|
4521
|
-
/* @__PURE__ */ (0,
|
|
4522
|
-
/* @__PURE__ */ (0,
|
|
4523
|
-
/* @__PURE__ */ (0,
|
|
4524
|
-
/* @__PURE__ */ (0,
|
|
4525
|
-
/* @__PURE__ */ (0,
|
|
4526
|
-
/* @__PURE__ */ (0,
|
|
4685
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "p-3 rounded-lg bg-slate-950/60 border border-slate-800 flex flex-col gap-2.5", children: [
|
|
4686
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
4687
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
4688
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("svg", { className: "w-3.5 h-3.5 text-purple-400", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
4689
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.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" }),
|
|
4690
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "m14 7 3 3" })
|
|
4527
4691
|
] }),
|
|
4528
4692
|
"Generative Inpainting"
|
|
4529
4693
|
] }),
|
|
4530
|
-
isInpainting && /* @__PURE__ */ (0,
|
|
4694
|
+
isInpainting && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-purple-900/60 text-purple-300 animate-pulse", children: "Inpainting..." })
|
|
4531
4695
|
] }),
|
|
4532
|
-
/* @__PURE__ */ (0,
|
|
4533
|
-
/* @__PURE__ */ (0,
|
|
4534
|
-
/* @__PURE__ */ (0,
|
|
4535
|
-
/* @__PURE__ */ (0,
|
|
4696
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-slate-400 text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
|
|
4697
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
4698
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-slate-300 text-[11px] font-medium", children: "Prompt" }),
|
|
4699
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4536
4700
|
"textarea",
|
|
4537
4701
|
{
|
|
4538
4702
|
id: "ai-inpaint-prompt-react",
|
|
@@ -4544,10 +4708,10 @@ var ImageEditor = ({
|
|
|
4544
4708
|
}
|
|
4545
4709
|
)
|
|
4546
4710
|
] }),
|
|
4547
|
-
/* @__PURE__ */ (0,
|
|
4548
|
-
/* @__PURE__ */ (0,
|
|
4549
|
-
/* @__PURE__ */ (0,
|
|
4550
|
-
/* @__PURE__ */ (0,
|
|
4711
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
4712
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-slate-300 text-[11px] font-medium", children: "Target Mask Region" }),
|
|
4713
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
4714
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
4551
4715
|
"button",
|
|
4552
4716
|
{
|
|
4553
4717
|
type: "button",
|
|
@@ -4560,7 +4724,7 @@ var ImageEditor = ({
|
|
|
4560
4724
|
]
|
|
4561
4725
|
}
|
|
4562
4726
|
),
|
|
4563
|
-
/* @__PURE__ */ (0,
|
|
4727
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
4564
4728
|
"button",
|
|
4565
4729
|
{
|
|
4566
4730
|
type: "button",
|
|
@@ -4575,25 +4739,25 @@ var ImageEditor = ({
|
|
|
4575
4739
|
)
|
|
4576
4740
|
] })
|
|
4577
4741
|
] }),
|
|
4578
|
-
/* @__PURE__ */ (0,
|
|
4742
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4579
4743
|
"button",
|
|
4580
4744
|
{
|
|
4581
4745
|
type: "button",
|
|
4582
4746
|
onClick: handleInpaint,
|
|
4583
4747
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
4584
4748
|
className: "mt-1 px-3 py-2 rounded-lg bg-purple-600 hover:bg-purple-500 disabled:opacity-50 text-white font-medium shadow transition-colors flex items-center justify-center gap-2",
|
|
4585
|
-
children: isInpainting ? /* @__PURE__ */ (0,
|
|
4586
|
-
/* @__PURE__ */ (0,
|
|
4749
|
+
children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
4750
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin" }),
|
|
4587
4751
|
"Generating Inpaint..."
|
|
4588
|
-
] }) : /* @__PURE__ */ (0,
|
|
4589
|
-
/* @__PURE__ */ (0,
|
|
4752
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
4753
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.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_runtime23.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" }) }),
|
|
4590
4754
|
"Apply Inpainting"
|
|
4591
4755
|
] })
|
|
4592
4756
|
}
|
|
4593
4757
|
)
|
|
4594
4758
|
] }),
|
|
4595
|
-
aiError && /* @__PURE__ */ (0,
|
|
4596
|
-
aiSuccess && /* @__PURE__ */ (0,
|
|
4759
|
+
aiError && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "p-2.5 rounded-lg bg-rose-950/60 border border-rose-800 text-rose-300 text-[11px]", children: aiError }),
|
|
4760
|
+
aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-950/60 border border-emerald-800 text-emerald-300 text-[11px]", children: aiSuccess })
|
|
4597
4761
|
] })
|
|
4598
4762
|
] })
|
|
4599
4763
|
] })
|