@pixerate/editor-react 0.98.0 → 0.100.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animation-editor/index.cjs +11 -7
- package/dist/animation-editor/index.js +7 -7
- package/dist/canvas/index.cjs +20 -11
- package/dist/canvas/index.js +14 -9
- package/dist/canvas/useCanvasPlaybackSurface.d.cts +8 -2
- package/dist/canvas/useCanvasPlaybackSurface.d.ts +8 -2
- package/dist/chart/index.cjs +8 -4
- package/dist/chart/index.js +2 -2
- package/dist/{chunk-S6C2W5JW.js → chunk-EP6MSQN4.js} +1 -1
- package/dist/{chunk-AILJ4JOW.js → chunk-GDPWLGPD.js} +3 -3
- package/dist/{chunk-SI2V7XPZ.js → chunk-GNO54NFG.js} +5 -1
- package/dist/{chunk-TFEKLNC7.js → chunk-OTDAEVHW.js} +415 -358
- package/dist/{chunk-NEQI2ZIU.js → chunk-V2YC5T4R.js} +14 -8
- package/dist/image-editor/AdjustmentLayersPanel.d.cts +2 -0
- package/dist/image-editor/AdjustmentLayersPanel.d.ts +2 -0
- package/dist/image-editor/ControlSlider.d.cts +2 -0
- package/dist/image-editor/ControlSlider.d.ts +2 -0
- package/dist/image-editor/CurvesEditor.d.cts +2 -0
- package/dist/image-editor/CurvesEditor.d.ts +2 -0
- package/dist/image-editor/ImageEffectControls.d.cts +3 -1
- package/dist/image-editor/ImageEffectControls.d.ts +3 -1
- package/dist/image-editor/index.cjs +423 -361
- package/dist/image-editor/index.js +2 -2
- package/dist/image-editor/styles.d.cts +51 -0
- package/dist/image-editor/styles.d.ts +51 -0
- package/dist/index.cjs +461 -395
- package/dist/index.js +5 -5
- package/dist/paint-editor/index.cjs +8 -4
- package/dist/paint-editor/index.js +4 -4
- package/dist/parameters/index.cjs +18 -8
- package/dist/parameters/index.js +2 -2
- package/dist/playback/useElementPlaybackSurface.d.cts +5 -4
- package/dist/playback/useElementPlaybackSurface.d.ts +5 -4
- package/dist/spreadsheet/index.cjs +5 -1
- package/dist/spreadsheet/index.js +2 -2
- package/dist/vector/index.cjs +5 -1
- package/dist/vector/index.js +1 -1
- package/dist/video-editor/index.cjs +11 -7
- package/dist/video-editor/index.js +7 -7
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -824,7 +824,11 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
|
|
|
824
824
|
beginGesture: (key) => o().beginGesture?.(key),
|
|
825
825
|
endGesture: () => o().endGesture?.(),
|
|
826
826
|
reveal: () => o().reveal?.(),
|
|
827
|
-
open
|
|
827
|
+
// Only a surface whose options can open things has `open`, so playback skips `open` steps
|
|
828
|
+
// (and their wait) everywhere else. Read per step, like the other options.
|
|
829
|
+
get open() {
|
|
830
|
+
return o().open ? (ref) => o().open?.(ref) : void 0;
|
|
831
|
+
},
|
|
828
832
|
get defaultKind() {
|
|
829
833
|
return o().defaultKind;
|
|
830
834
|
}
|
|
@@ -840,19 +844,25 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
|
|
|
840
844
|
|
|
841
845
|
// src/playback/useElementPlaybackSurface.ts
|
|
842
846
|
var import_react15 = require("react");
|
|
847
|
+
var import_tools2 = require("@pixerate/editor/tools");
|
|
843
848
|
function useElementPlaybackSurface(playback, id, element, options) {
|
|
844
849
|
const latest = (0, import_react15.useRef)(options);
|
|
845
850
|
latest.current = options;
|
|
846
851
|
const box = () => element.current?.getBoundingClientRect() ?? null;
|
|
852
|
+
const fromViewport = (p) => {
|
|
853
|
+
const r = box();
|
|
854
|
+
return { x: p.x - (r?.left ?? 0), y: p.y - (r?.top ?? 0) };
|
|
855
|
+
};
|
|
847
856
|
return usePlaybackSurface(playback, id, {
|
|
848
857
|
get defaultKind() {
|
|
849
858
|
return latest.current.defaultKind;
|
|
850
859
|
},
|
|
851
860
|
locate: (ref) => {
|
|
852
|
-
const selector = latest.current.selectors[ref.kind]?.(ref.id);
|
|
861
|
+
const selector = latest.current.selectors?.[ref.kind]?.(ref.id);
|
|
853
862
|
const b = box();
|
|
854
863
|
const r = selector ? element.current?.querySelector(selector)?.getBoundingClientRect() : null;
|
|
855
|
-
|
|
864
|
+
if (b && r && r.width > 0) return { x: r.left - b.left, y: r.top - b.top, width: r.width, height: r.height };
|
|
865
|
+
return (0, import_tools2.locatePlaybackChrome)(ref, latest.current, fromViewport);
|
|
856
866
|
},
|
|
857
867
|
bounds: () => {
|
|
858
868
|
const r = box();
|
|
@@ -866,17 +876,17 @@ function useElementPlaybackSurface(playback, id, element, options) {
|
|
|
866
876
|
const r = box();
|
|
867
877
|
return { x: (r?.left ?? 0) + p.x, y: (r?.top ?? 0) + p.y };
|
|
868
878
|
},
|
|
869
|
-
fromViewport
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
879
|
+
fromViewport,
|
|
880
|
+
reveal: () => latest.current.reveal?.(),
|
|
881
|
+
get open() {
|
|
882
|
+
return latest.current.open ? (ref) => latest.current.open?.(ref) : void 0;
|
|
883
|
+
}
|
|
874
884
|
});
|
|
875
885
|
}
|
|
876
886
|
|
|
877
887
|
// src/hooks/useToolBridge.ts
|
|
878
888
|
var import_react16 = require("react");
|
|
879
|
-
var
|
|
889
|
+
var import_tools3 = require("@pixerate/editor/tools");
|
|
880
890
|
function useToolBridge(registry, options) {
|
|
881
891
|
const [state, setState] = (0, import_react16.useState)({ status: "off", editorId: null });
|
|
882
892
|
const key = options ? JSON.stringify([options.url, options.token, options.name, options.kind, options.reconnect]) : null;
|
|
@@ -886,7 +896,7 @@ function useToolBridge(registry, options) {
|
|
|
886
896
|
return;
|
|
887
897
|
}
|
|
888
898
|
let connection;
|
|
889
|
-
connection = (0,
|
|
899
|
+
connection = (0, import_tools3.connectToolBridge)(registry, {
|
|
890
900
|
...options,
|
|
891
901
|
onStatus: (status, detail) => {
|
|
892
902
|
setState({ status, detail, editorId: connection?.editorId ?? null });
|
|
@@ -2169,17 +2179,17 @@ var SpreadsheetValidationDialog = ({ prompt, onResolve }) => {
|
|
|
2169
2179
|
style === "warning" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-2", children: "Continue?" })
|
|
2170
2180
|
] })
|
|
2171
2181
|
] }),
|
|
2172
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "mt-4 flex justify-end gap-2", children: buttons.map((
|
|
2182
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "mt-4 flex justify-end gap-2", children: buttons.map((button3, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2173
2183
|
"button",
|
|
2174
2184
|
{
|
|
2175
2185
|
ref: i === 0 ? firstButton : void 0,
|
|
2176
2186
|
type: "button",
|
|
2177
|
-
"data-action":
|
|
2187
|
+
"data-action": button3.action,
|
|
2178
2188
|
className: `rounded border border-border px-3 py-1 ${i === 0 ? "bg-primary text-primary-foreground" : "hover:bg-muted"}`,
|
|
2179
|
-
onClick: () => onResolve(
|
|
2180
|
-
children:
|
|
2189
|
+
onClick: () => onResolve(button3.action),
|
|
2190
|
+
children: button3.label
|
|
2181
2191
|
},
|
|
2182
|
-
|
|
2192
|
+
button3.action
|
|
2183
2193
|
)) })
|
|
2184
2194
|
]
|
|
2185
2195
|
}
|
|
@@ -3991,11 +4001,11 @@ function useImageEditor(options = {}) {
|
|
|
3991
4001
|
);
|
|
3992
4002
|
}
|
|
3993
4003
|
function useImageEffectsTools(registry, controller, options = {}) {
|
|
3994
|
-
const { id, namespace, readOnly } = options;
|
|
4004
|
+
const { id, namespace, readOnly, playbackSurface } = options;
|
|
3995
4005
|
(0, import_react39.useEffect)(() => {
|
|
3996
4006
|
if (!registry) return;
|
|
3997
|
-
return registry.register((0, import_image_editor.createImageEffectsToolProvider)(controller, { id, namespace, readOnly }));
|
|
3998
|
-
}, [registry, controller, id, namespace, readOnly]);
|
|
4007
|
+
return registry.register((0, import_image_editor.createImageEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
|
|
4008
|
+
}, [registry, controller, id, namespace, readOnly, playbackSurface]);
|
|
3999
4009
|
}
|
|
4000
4010
|
|
|
4001
4011
|
// src/image-editor/ImageEditor.tsx
|
|
@@ -4005,6 +4015,7 @@ var import_image_editor19 = require("@pixerate/editor/image-editor");
|
|
|
4005
4015
|
// src/image-editor/ImageEditorCanvas.tsx
|
|
4006
4016
|
var import_react40 = require("react");
|
|
4007
4017
|
var import_image_editor2 = require("@pixerate/editor/image-editor");
|
|
4018
|
+
var import_tools4 = require("@pixerate/editor/tools");
|
|
4008
4019
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
4009
4020
|
var ImageEditorCanvas = ({
|
|
4010
4021
|
editor,
|
|
@@ -4175,6 +4186,29 @@ var ImageEditorCanvas = ({
|
|
|
4175
4186
|
},
|
|
4176
4187
|
[controller, mode, fit, transformTool]
|
|
4177
4188
|
);
|
|
4189
|
+
(0, import_react40.useEffect)(() => {
|
|
4190
|
+
let drafting = false;
|
|
4191
|
+
return agentPresence.subscribe(
|
|
4192
|
+
(0, import_tools4.trackPresenceDrag)({
|
|
4193
|
+
onDrag: (box) => {
|
|
4194
|
+
if (cropDragInfoRef.current || selectionGestureRef.current?.active) return;
|
|
4195
|
+
const draft = (0, import_image_editor2.agentDragDraft)(modeRef.current, box, controller.getState().imageDimensions);
|
|
4196
|
+
if (!draft) return;
|
|
4197
|
+
drafting = true;
|
|
4198
|
+
if ("crop" in draft) draftCropRef.current = draft.crop;
|
|
4199
|
+
else selectionDraftRef.current = draft.selectionPath;
|
|
4200
|
+
void renderCanvas();
|
|
4201
|
+
},
|
|
4202
|
+
onEnd: () => {
|
|
4203
|
+
if (!drafting) return;
|
|
4204
|
+
drafting = false;
|
|
4205
|
+
draftCropRef.current = null;
|
|
4206
|
+
selectionDraftRef.current = null;
|
|
4207
|
+
void renderCanvas();
|
|
4208
|
+
}
|
|
4209
|
+
})
|
|
4210
|
+
);
|
|
4211
|
+
}, [agentPresence, controller, renderCanvas]);
|
|
4178
4212
|
(0, import_react40.useEffect)(() => typeSession?.subscribe(() => void renderCanvas()), [typeSession, renderCanvas]);
|
|
4179
4213
|
const finishTyping = () => {
|
|
4180
4214
|
typeToolRef.current?.finish();
|
|
@@ -4714,11 +4748,11 @@ var ImageEditorCanvas = ({
|
|
|
4714
4748
|
// src/image-editor/ControlSlider.tsx
|
|
4715
4749
|
var import_image_editor3 = require("@pixerate/editor/image-editor");
|
|
4716
4750
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
4717
|
-
var ControlSlider = ({ spec, value, onChange, disabled, label }) => {
|
|
4751
|
+
var ControlSlider = ({ spec, value, onChange, disabled, label, className }) => {
|
|
4718
4752
|
const name = label ?? spec.label;
|
|
4719
4753
|
const track = (0, import_image_editor3.controlTrackBackground)(spec);
|
|
4720
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { "data-control-id": spec.id, children: [
|
|
4721
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex justify-between text-
|
|
4754
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { "data-control-id": spec.id, className, children: [
|
|
4755
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
4722
4756
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: name }),
|
|
4723
4757
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "font-mono", children: (0, import_image_editor3.formatControlValue)(spec, value) })
|
|
4724
4758
|
] }),
|
|
@@ -4733,7 +4767,7 @@ var ControlSlider = ({ spec, value, onChange, disabled, label }) => {
|
|
|
4733
4767
|
disabled,
|
|
4734
4768
|
value,
|
|
4735
4769
|
onChange: (e) => onChange(Number(e.target.value)),
|
|
4736
|
-
className: "w-full accent-
|
|
4770
|
+
className: "w-full accent-primary disabled:opacity-40"
|
|
4737
4771
|
}
|
|
4738
4772
|
),
|
|
4739
4773
|
track && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "h-0.5 rounded-full opacity-70", style: { background: track } })
|
|
@@ -4768,7 +4802,7 @@ var Histogram = ({ histogram, channel = "rgb", height = 64, className = "", styl
|
|
|
4768
4802
|
role: "img",
|
|
4769
4803
|
"aria-label": histogram ? `Histogram of ${histogram.samples} pixels` : "Histogram (no data)",
|
|
4770
4804
|
"data-testid": "image-editor-histogram",
|
|
4771
|
-
className: `w-full rounded bg-
|
|
4805
|
+
className: `w-full rounded bg-muted/40 ${className}`,
|
|
4772
4806
|
style: { height, ...style },
|
|
4773
4807
|
children: [
|
|
4774
4808
|
paths.map(({ c, d }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d, fill: FILL[c], stroke: "none" }, c)),
|
|
@@ -4793,8 +4827,8 @@ var import_react42 = require("react");
|
|
|
4793
4827
|
var import_image_editor5 = require("@pixerate/editor/image-editor");
|
|
4794
4828
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
4795
4829
|
var BOX = 256;
|
|
4796
|
-
var STROKE = { master: "#e2e8f0", red: "#ef4444", green: "#22c55e", blue: "#3b82f6" };
|
|
4797
|
-
var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 200 }) => {
|
|
4830
|
+
var STROKE = { master: "var(--foreground, #e2e8f0)", red: "#ef4444", green: "#22c55e", blue: "#3b82f6" };
|
|
4831
|
+
var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 200, className = "" }) => {
|
|
4798
4832
|
const svgRef = (0, import_react42.useRef)(null);
|
|
4799
4833
|
const [drag, setDrag] = (0, import_react42.useState)(null);
|
|
4800
4834
|
const toBox = (e) => {
|
|
@@ -4835,7 +4869,7 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
4835
4869
|
role: "application",
|
|
4836
4870
|
"aria-label": `${channel} curve`,
|
|
4837
4871
|
"data-testid": "curves-editor",
|
|
4838
|
-
className:
|
|
4872
|
+
className: `rounded bg-muted/40 touch-none select-none cursor-crosshair ${className}`.trim(),
|
|
4839
4873
|
onPointerDown,
|
|
4840
4874
|
onPointerMove,
|
|
4841
4875
|
onPointerUp: () => setDrag(null),
|
|
@@ -4857,7 +4891,7 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
4857
4891
|
cx: b.x,
|
|
4858
4892
|
cy: b.y,
|
|
4859
4893
|
r: 5,
|
|
4860
|
-
fill: drag === i ? STROKE[channel] : "#0f172a",
|
|
4894
|
+
fill: drag === i ? STROKE[channel] : "var(--background, #0f172a)",
|
|
4861
4895
|
stroke: STROKE[channel],
|
|
4862
4896
|
strokeWidth: 2,
|
|
4863
4897
|
"aria-label": `Point ${p.input} to ${p.output}`
|
|
@@ -4870,6 +4904,28 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
4870
4904
|
);
|
|
4871
4905
|
};
|
|
4872
4906
|
|
|
4907
|
+
// src/image-editor/styles.ts
|
|
4908
|
+
var imageEditorFrameClass = "relative flex flex-col bg-background border border-border rounded-xl overflow-hidden shadow-sm text-foreground";
|
|
4909
|
+
var imageEditorHeaderClass = "flex flex-wrap items-center justify-between px-4 py-3 bg-muted/40 border-b border-border gap-3";
|
|
4910
|
+
var imageTabListClass = "flex items-center gap-1 bg-background p-1 rounded-lg border border-border text-xs";
|
|
4911
|
+
var imageTabClass = (active) => `px-3 py-1.5 rounded-md font-medium transition-colors ${active ? "bg-primary text-primary-foreground shadow" : "text-muted-foreground hover:text-foreground hover:bg-muted"}`;
|
|
4912
|
+
var imageHeaderButtonClass = "p-1.5 rounded-lg border border-border bg-background text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed";
|
|
4913
|
+
var imagePrimaryButtonClass = "rounded-lg bg-primary hover:bg-primary/90 text-primary-foreground font-medium shadow transition-colors disabled:opacity-50";
|
|
4914
|
+
var imageSidebarClass = "w-full md:w-80 bg-background border-t md:border-t-0 md:border-l border-border p-4 overflow-y-auto h-auto md:h-full md:max-h-[560px]";
|
|
4915
|
+
var imageSectionTitleClass = "font-semibold text-foreground uppercase tracking-wider text-[11px]";
|
|
4916
|
+
var imageSectionClass = "border-t border-border pt-3";
|
|
4917
|
+
var imageDividerClass = "h-px bg-border my-1";
|
|
4918
|
+
var imageSmallButtonClass = "px-2 py-1 rounded text-[11px] bg-muted text-foreground hover:bg-accent hover:text-accent-foreground self-start disabled:opacity-40";
|
|
4919
|
+
var imageIconButtonClass = "px-1.5 py-0.5 rounded text-[10px] bg-muted text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
|
|
4920
|
+
var imageOutlineButtonClass = "rounded border border-border px-1.5 py-0.5 text-[11px] text-foreground hover:bg-muted disabled:opacity-40";
|
|
4921
|
+
var imageChipClass = (on) => `px-2 py-1 rounded text-[11px] ${on ? "bg-primary text-primary-foreground" : "bg-muted text-foreground hover:bg-accent hover:text-accent-foreground"}`;
|
|
4922
|
+
var imageFieldClass = "rounded border border-input bg-background px-1 py-0.5 text-foreground";
|
|
4923
|
+
var imageSelectClass = "rounded border border-input bg-background px-1.5 py-1 text-foreground";
|
|
4924
|
+
var imageColorInputClass = "h-6 w-8 rounded border border-border bg-transparent";
|
|
4925
|
+
var imageRangeClass = "w-full accent-primary";
|
|
4926
|
+
var imageErrorBannerClass = "border-b border-destructive/40 bg-destructive/10 px-4 py-1.5 text-xs text-destructive";
|
|
4927
|
+
var imageSpinnerClass = "w-3.5 h-3.5 border-2 border-primary-foreground/30 border-t-primary-foreground rounded-full animate-spin";
|
|
4928
|
+
|
|
4873
4929
|
// src/image-editor/AdjustmentLayersPanel.tsx
|
|
4874
4930
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4875
4931
|
var CHANNELS = [
|
|
@@ -4883,8 +4939,7 @@ var TONES = [
|
|
|
4883
4939
|
{ id: "midtones", label: "Midtones" },
|
|
4884
4940
|
{ id: "highlights", label: "Highlights" }
|
|
4885
4941
|
];
|
|
4886
|
-
var
|
|
4887
|
-
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"}`;
|
|
4942
|
+
var chipClass = (on) => `px-2 py-0.5 rounded text-[10px] ${on ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground hover:text-foreground"}`;
|
|
4888
4943
|
var HueRangeStrip = ({ bounds }) => {
|
|
4889
4944
|
const pts = Array.from({ length: 73 }, (_, i) => `${i / 72 * 360},${20 - (0, import_image_editor6.hueRangeWeight)({ bounds }, i * 5) * 18}`).join(" ");
|
|
4890
4945
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("svg", { viewBox: "0 0 360 20", preserveAspectRatio: "none", className: "w-full h-4 rounded", "data-testid": "hue-range-strip", children: [
|
|
@@ -4893,7 +4948,7 @@ var HueRangeStrip = ({ bounds }) => {
|
|
|
4893
4948
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("polyline", { points: pts, fill: "none", stroke: "#fff", strokeWidth: 1.5 })
|
|
4894
4949
|
] });
|
|
4895
4950
|
};
|
|
4896
|
-
var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
4951
|
+
var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, className = "" }) => {
|
|
4897
4952
|
const follow = layersProp === void 0;
|
|
4898
4953
|
const [, setTick] = (0, import_react43.useState)(0);
|
|
4899
4954
|
(0, import_react43.useEffect)(() => follow ? controller.subscribe(() => setTick((n) => n + 1)) : void 0, [controller, follow]);
|
|
@@ -4917,14 +4972,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
4917
4972
|
spec.id
|
|
4918
4973
|
);
|
|
4919
4974
|
const controlsOf = (layer, filter = () => true) => import_image_editor6.ADJUSTMENT_LAYER_CONTROLS[layer.kind].filter(filter);
|
|
4920
|
-
const checkbox = (layer, path, label) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
4975
|
+
const checkbox = (layer, path, label) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4921
4976
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4922
4977
|
"input",
|
|
4923
4978
|
{
|
|
4924
4979
|
type: "checkbox",
|
|
4925
4980
|
checked: Boolean((0, import_image_editor6.getControlPath)(layer.params, path)),
|
|
4926
4981
|
onChange: (e) => setParam(layer, path, e.target.checked),
|
|
4927
|
-
className: "accent-
|
|
4982
|
+
className: "accent-primary"
|
|
4928
4983
|
}
|
|
4929
4984
|
),
|
|
4930
4985
|
label
|
|
@@ -4970,14 +5025,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
4970
5025
|
case "blackWhite":
|
|
4971
5026
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
4972
5027
|
controlsOf(layer).map((s) => slider(layer, s)),
|
|
4973
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
5028
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4974
5029
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4975
5030
|
"input",
|
|
4976
5031
|
{
|
|
4977
5032
|
type: "checkbox",
|
|
4978
5033
|
checked: layer.params.tint !== null,
|
|
4979
5034
|
onChange: (e) => setParam(layer, "tint", e.target.checked ? "#e1d3b3" : null),
|
|
4980
|
-
className: "accent-
|
|
5035
|
+
className: "accent-primary"
|
|
4981
5036
|
}
|
|
4982
5037
|
),
|
|
4983
5038
|
"Tint",
|
|
@@ -4995,7 +5050,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
4995
5050
|
] });
|
|
4996
5051
|
case "photoFilter":
|
|
4997
5052
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
4998
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
5053
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4999
5054
|
"Filter colour",
|
|
5000
5055
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5001
5056
|
"input",
|
|
@@ -5012,19 +5067,19 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
5012
5067
|
checkbox(layer, "preserveLuminosity", "Preserve luminosity")
|
|
5013
5068
|
] });
|
|
5014
5069
|
case "invert":
|
|
5015
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-
|
|
5070
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-muted-foreground text-[11px]", children: "Invert has no settings." });
|
|
5016
5071
|
default:
|
|
5017
5072
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex flex-col gap-2", children: controlsOf(layer).map((s) => slider(layer, s)) });
|
|
5018
5073
|
}
|
|
5019
5074
|
};
|
|
5020
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className:
|
|
5021
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className:
|
|
5075
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: `flex flex-col gap-2 text-xs ${className}`.trim(), "data-testid": "adjustment-layers-panel", children: [
|
|
5076
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: imageSectionTitleClass, children: "Adjustment Layers" }) }),
|
|
5022
5077
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-1.5", children: [
|
|
5023
5078
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5024
5079
|
"select",
|
|
5025
5080
|
{
|
|
5026
5081
|
"aria-label": "New adjustment layer kind",
|
|
5027
|
-
className: `${
|
|
5082
|
+
className: `${imageSelectClass} flex-1`,
|
|
5028
5083
|
value: newKind,
|
|
5029
5084
|
onChange: (e) => setNewKind(e.target.value),
|
|
5030
5085
|
children: import_image_editor6.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: k.kind, children: k.label }, k.kind))
|
|
@@ -5034,7 +5089,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
5034
5089
|
"button",
|
|
5035
5090
|
{
|
|
5036
5091
|
type: "button",
|
|
5037
|
-
className: "px-2 py-1 rounded bg-
|
|
5092
|
+
className: "px-2 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90",
|
|
5038
5093
|
onClick: () => {
|
|
5039
5094
|
setSelectedId(controller.addAdjustmentLayer(newKind));
|
|
5040
5095
|
setChannel("master");
|
|
@@ -5050,7 +5105,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
5050
5105
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
5051
5106
|
"li",
|
|
5052
5107
|
{
|
|
5053
|
-
className: `flex items-center gap-1.5 rounded px-1.5 py-1 ${layer.id === selectedId ? "bg-
|
|
5108
|
+
className: `flex items-center gap-1.5 rounded px-1.5 py-1 ${layer.id === selectedId ? "bg-primary/20 ring-1 ring-primary/50" : "bg-muted/60"}`,
|
|
5054
5109
|
children: [
|
|
5055
5110
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5056
5111
|
"input",
|
|
@@ -5059,14 +5114,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
5059
5114
|
"aria-label": `Show ${label}`,
|
|
5060
5115
|
checked: layer.enabled,
|
|
5061
5116
|
onChange: () => controller.toggleAdjustmentLayer(layer.id),
|
|
5062
|
-
className: "accent-
|
|
5117
|
+
className: "accent-primary"
|
|
5063
5118
|
}
|
|
5064
5119
|
),
|
|
5065
5120
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5066
5121
|
"button",
|
|
5067
5122
|
{
|
|
5068
5123
|
type: "button",
|
|
5069
|
-
className: `flex-1 text-left truncate ${layer.enabled ? "text-
|
|
5124
|
+
className: `flex-1 text-left truncate ${layer.enabled ? "text-foreground" : "text-muted-foreground line-through"}`,
|
|
5070
5125
|
onClick: () => setSelectedId(layer.id === selectedId ? null : layer.id),
|
|
5071
5126
|
"aria-pressed": layer.id === selectedId,
|
|
5072
5127
|
children: label
|
|
@@ -5079,7 +5134,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
5079
5134
|
"aria-label": `Move ${label} up`,
|
|
5080
5135
|
disabled: index === layers.length - 1,
|
|
5081
5136
|
onClick: () => controller.moveAdjustmentLayer(layer.id, index + 1),
|
|
5082
|
-
className: "px-1 text-
|
|
5137
|
+
className: "px-1 text-muted-foreground hover:text-foreground disabled:opacity-30",
|
|
5083
5138
|
children: "\u2191"
|
|
5084
5139
|
}
|
|
5085
5140
|
),
|
|
@@ -5090,7 +5145,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
5090
5145
|
"aria-label": `Move ${label} down`,
|
|
5091
5146
|
disabled: index === 0,
|
|
5092
5147
|
onClick: () => controller.moveAdjustmentLayer(layer.id, index - 1),
|
|
5093
|
-
className: "px-1 text-
|
|
5148
|
+
className: "px-1 text-muted-foreground hover:text-foreground disabled:opacity-30",
|
|
5094
5149
|
children: "\u2193"
|
|
5095
5150
|
}
|
|
5096
5151
|
),
|
|
@@ -5103,7 +5158,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
5103
5158
|
controller.removeAdjustmentLayer(layer.id);
|
|
5104
5159
|
if (selectedId === layer.id) setSelectedId(null);
|
|
5105
5160
|
},
|
|
5106
|
-
className: "px-1 text-
|
|
5161
|
+
className: "px-1 text-destructive hover:text-destructive",
|
|
5107
5162
|
children: "\u2715"
|
|
5108
5163
|
}
|
|
5109
5164
|
)
|
|
@@ -5112,14 +5167,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
5112
5167
|
layer.id
|
|
5113
5168
|
);
|
|
5114
5169
|
}) }),
|
|
5115
|
-
selected && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-2 rounded border border-
|
|
5170
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-2 rounded border border-border p-2", "data-testid": "adjustment-layer-editor", children: [
|
|
5116
5171
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
5117
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-
|
|
5172
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-muted-foreground", children: "Blend" }),
|
|
5118
5173
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5119
5174
|
"select",
|
|
5120
5175
|
{
|
|
5121
5176
|
"aria-label": "Blend mode",
|
|
5122
|
-
className: `${
|
|
5177
|
+
className: `${imageSelectClass} flex-1`,
|
|
5123
5178
|
value: selected.blend,
|
|
5124
5179
|
onChange: (e) => controller.updateAdjustmentLayer(selected.id, { blend: e.target.value }),
|
|
5125
5180
|
children: import_image_editor6.BLEND_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: m.id, children: m.label }, m.id))
|
|
@@ -5147,7 +5202,6 @@ var import_react45 = require("react");
|
|
|
5147
5202
|
var import_react44 = require("react");
|
|
5148
5203
|
var import_image_editor7 = require("@pixerate/editor/image-editor");
|
|
5149
5204
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
5150
|
-
var button = "px-1.5 py-0.5 rounded text-[10px] bg-slate-800 text-slate-300 hover:text-white disabled:opacity-40";
|
|
5151
5205
|
var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
5152
5206
|
const [, setTick] = (0, import_react44.useState)(0);
|
|
5153
5207
|
(0, import_react44.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -5171,7 +5225,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
5171
5225
|
onKeyDown: () => commitNext.current = true
|
|
5172
5226
|
};
|
|
5173
5227
|
if (!model.available || !id) {
|
|
5174
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `text-xs text-
|
|
5228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `text-xs text-muted-foreground ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
|
|
5175
5229
|
}
|
|
5176
5230
|
const effects = controller.getLayerEffects(id);
|
|
5177
5231
|
const patterns = controller.getDocumentPatterns();
|
|
@@ -5187,7 +5241,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
5187
5241
|
const k = c.percent ? 100 : 1;
|
|
5188
5242
|
const shown = Math.round(c.value * k * 100) / 100;
|
|
5189
5243
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
|
|
5190
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "text-
|
|
5244
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
5191
5245
|
label,
|
|
5192
5246
|
" ",
|
|
5193
5247
|
shown,
|
|
@@ -5205,24 +5259,24 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
5205
5259
|
disabled: model.readOnly,
|
|
5206
5260
|
...sliderEvents,
|
|
5207
5261
|
onChange: (e) => change(effectId, c, Number(e.target.value) / k, true),
|
|
5208
|
-
className: "accent-
|
|
5262
|
+
className: "accent-primary"
|
|
5209
5263
|
}
|
|
5210
5264
|
)
|
|
5211
5265
|
] }, c.key);
|
|
5212
5266
|
}
|
|
5213
5267
|
case "color":
|
|
5214
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1.5 text-
|
|
5268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
5215
5269
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("input", { type: "color", "aria-label": label, value: c.value, disabled: model.readOnly, onChange: (e) => change(effectId, c, e.target.value) }),
|
|
5216
5270
|
label
|
|
5217
5271
|
] }, c.key);
|
|
5218
5272
|
case "checkbox":
|
|
5219
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1.5 text-
|
|
5220
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("input", { type: "checkbox", "aria-label": label, checked: c.value, disabled: model.readOnly, onChange: (e) => change(effectId, c, e.target.checked), className: "accent-
|
|
5273
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
5274
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("input", { type: "checkbox", "aria-label": label, checked: c.value, disabled: model.readOnly, onChange: (e) => change(effectId, c, e.target.checked), className: "accent-primary" }),
|
|
5221
5275
|
label
|
|
5222
5276
|
] }, c.key);
|
|
5223
5277
|
case "select":
|
|
5224
5278
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
|
|
5225
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-
|
|
5279
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: label }),
|
|
5226
5280
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5227
5281
|
"select",
|
|
5228
5282
|
{
|
|
@@ -5230,17 +5284,17 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
5230
5284
|
value: c.value,
|
|
5231
5285
|
disabled: model.readOnly,
|
|
5232
5286
|
onChange: (e) => change(effectId, c, e.target.value),
|
|
5233
|
-
className:
|
|
5287
|
+
className: imageSelectClass,
|
|
5234
5288
|
children: c.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: o.value, children: o.label }, o.value))
|
|
5235
5289
|
}
|
|
5236
5290
|
)
|
|
5237
5291
|
] }, c.key);
|
|
5238
5292
|
}
|
|
5239
5293
|
};
|
|
5240
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-
|
|
5294
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-foreground ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer effects", role: "group", children: [
|
|
5241
5295
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
5242
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "font-semibold text-
|
|
5243
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1 text-
|
|
5296
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "font-semibold text-foreground", children: "fx Effects" }),
|
|
5297
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
|
|
5244
5298
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5245
5299
|
"input",
|
|
5246
5300
|
{
|
|
@@ -5249,12 +5303,12 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
5249
5303
|
checked: model.enabled,
|
|
5250
5304
|
disabled: model.readOnly,
|
|
5251
5305
|
onChange: (e) => attempt(() => controller.setLayerEffectsEnabled(id, e.target.checked)),
|
|
5252
|
-
className: "accent-
|
|
5306
|
+
className: "accent-primary"
|
|
5253
5307
|
}
|
|
5254
5308
|
),
|
|
5255
5309
|
"On"
|
|
5256
5310
|
] }),
|
|
5257
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1 text-
|
|
5311
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
5258
5312
|
"Scale",
|
|
5259
5313
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5260
5314
|
"input",
|
|
@@ -5270,7 +5324,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
5270
5324
|
const v = Number(e.target.value);
|
|
5271
5325
|
if (v >= 1 && v <= 1e3) attempt(() => controller.setLayerEffectsEnabled(id, model.enabled, v / 100));
|
|
5272
5326
|
},
|
|
5273
|
-
className: "w-14 bg-
|
|
5327
|
+
className: "w-14 bg-muted border border-border rounded px-1"
|
|
5274
5328
|
}
|
|
5275
5329
|
),
|
|
5276
5330
|
"%"
|
|
@@ -5286,7 +5340,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
5286
5340
|
if (!kind) return;
|
|
5287
5341
|
attempt(() => setOpen(controller.addLayerEffect(id, kind).effect.id));
|
|
5288
5342
|
},
|
|
5289
|
-
className:
|
|
5343
|
+
className: imageSelectClass,
|
|
5290
5344
|
children: [
|
|
5291
5345
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "", children: "Add effect\u2026" }),
|
|
5292
5346
|
import_image_editor7.LAYER_EFFECT_MENU.map((m) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: m.kind, children: m.label }, m.kind))
|
|
@@ -5294,11 +5348,11 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
5294
5348
|
}
|
|
5295
5349
|
)
|
|
5296
5350
|
] }),
|
|
5297
|
-
model.readOnly && model.reason && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-
|
|
5351
|
+
model.readOnly && model.reason && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-muted-foreground", children: model.reason }),
|
|
5298
5352
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Effects", children: model.rows.map((row) => {
|
|
5299
5353
|
const effect = effects.items.find((e) => e.id === row.id);
|
|
5300
5354
|
const expanded = open === row.id;
|
|
5301
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("li", { "data-effect-id": row.id, className: "rounded bg-
|
|
5355
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("li", { "data-effect-id": row.id, className: "rounded bg-background/60 ring-1 ring-border", children: [
|
|
5302
5356
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
|
|
5303
5357
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5304
5358
|
"input",
|
|
@@ -5308,7 +5362,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
5308
5362
|
checked: row.enabled,
|
|
5309
5363
|
disabled: model.readOnly,
|
|
5310
5364
|
onChange: (e) => attempt(() => controller.updateLayerEffect(id, row.id, { enabled: e.target.checked })),
|
|
5311
|
-
className: "accent-
|
|
5365
|
+
className: "accent-primary"
|
|
5312
5366
|
}
|
|
5313
5367
|
),
|
|
5314
5368
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
@@ -5316,25 +5370,24 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
5316
5370
|
{
|
|
5317
5371
|
type: "button",
|
|
5318
5372
|
"aria-expanded": expanded,
|
|
5319
|
-
className: `flex-1 text-left ${row.enabled && model.enabled ? "" : "text-
|
|
5373
|
+
className: `flex-1 text-left ${row.enabled && model.enabled ? "" : "text-muted-foreground"}`,
|
|
5320
5374
|
onClick: () => setOpen(expanded ? null : row.id),
|
|
5321
5375
|
children: row.label
|
|
5322
5376
|
}
|
|
5323
5377
|
),
|
|
5324
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className:
|
|
5378
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: imageIconButtonClass, "aria-label": `Remove ${row.label}`, disabled: model.readOnly, onClick: () => attempt(() => controller.removeLayerEffect(id, row.id)), children: "\u2715" })
|
|
5325
5379
|
] }),
|
|
5326
5380
|
expanded && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 px-1.5 pb-1.5", "data-testid": "effect-settings", children: (0, import_image_editor7.layerEffectControls)(effect, patterns).map((c) => renderControl(row.id, c)) })
|
|
5327
5381
|
] }, row.id);
|
|
5328
5382
|
}) }),
|
|
5329
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { role: "alert", className: "text-
|
|
5383
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
5330
5384
|
] });
|
|
5331
5385
|
};
|
|
5332
5386
|
|
|
5333
5387
|
// src/image-editor/LayersPanel.tsx
|
|
5334
5388
|
var import_image_editor8 = require("@pixerate/editor/image-editor");
|
|
5335
5389
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
5336
|
-
var
|
|
5337
|
-
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"}`;
|
|
5390
|
+
var rowClass = (active) => `flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer select-none ${active ? "bg-primary/30 ring-1 ring-primary" : "hover:bg-muted"}`;
|
|
5338
5391
|
var Thumbnail = ({
|
|
5339
5392
|
pixels,
|
|
5340
5393
|
size,
|
|
@@ -5363,7 +5416,7 @@ var Thumbnail = ({
|
|
|
5363
5416
|
"data-testid": testId,
|
|
5364
5417
|
onClick,
|
|
5365
5418
|
style: { width: size, height: size },
|
|
5366
|
-
className: `shrink-0 rounded bg-[repeating-conic-gradient(#334155_0%_25%,#1e293b_0%_50%)] [background-size:8px_8px] object-contain ${selected ? "ring-2 ring-
|
|
5419
|
+
className: `shrink-0 rounded bg-[repeating-conic-gradient(#334155_0%_25%,#1e293b_0%_50%)] [background-size:8px_8px] object-contain ${selected ? "ring-2 ring-foreground" : "ring-1 ring-border"}`
|
|
5367
5420
|
}
|
|
5368
5421
|
);
|
|
5369
5422
|
};
|
|
@@ -5422,18 +5475,18 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5422
5475
|
const thumb = (layer) => (0, import_image_editor8.layerHasThumbnail)(layer) ? controller.getLayerThumbnail(layer.id, { maxSide: 64 }) : null;
|
|
5423
5476
|
const maskThumb = (layer) => layer.mask && !layer.mask.source ? controller.getLayerThumbnail(layer.id, { maxSide: 64, mask: true }) : null;
|
|
5424
5477
|
const locked = (layer) => Boolean(layer.locks?.all || layer.locks?.pixels || layer.locks?.position || layer.locks?.transparency);
|
|
5425
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-
|
|
5478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "layers-panel", onClick: () => menu && setMenu(null), children: [
|
|
5426
5479
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "toolbar", "aria-label": "Layer actions", children: [
|
|
5427
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className:
|
|
5428
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className:
|
|
5429
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className:
|
|
5430
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className:
|
|
5431
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className:
|
|
5480
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-layer"), children: "New Layer" }),
|
|
5481
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-group"), children: "New Group" }),
|
|
5482
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("duplicate"), children: "Duplicate" }),
|
|
5483
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("add-mask"), children: "Add Mask" }),
|
|
5484
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("delete"), children: "Delete" }),
|
|
5432
5485
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5433
5486
|
"button",
|
|
5434
5487
|
{
|
|
5435
5488
|
type: "button",
|
|
5436
|
-
className:
|
|
5489
|
+
className: imageIconButtonClass,
|
|
5437
5490
|
"aria-label": "Layer menu",
|
|
5438
5491
|
"aria-haspopup": "menu",
|
|
5439
5492
|
onClick: (e) => {
|
|
@@ -5449,15 +5502,15 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5449
5502
|
{
|
|
5450
5503
|
"aria-label": "Bits per channel",
|
|
5451
5504
|
title: "Image \u203A Mode: bits per channel",
|
|
5452
|
-
className: "rounded bg-
|
|
5505
|
+
className: "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground",
|
|
5453
5506
|
value: controller.bitDepth,
|
|
5454
5507
|
onChange: (e) => attempt(() => controller.setBitDepth(Number(e.target.value))),
|
|
5455
5508
|
children: import_image_editor8.BIT_DEPTH_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: o.depth, title: o.title, children: o.label }, o.depth))
|
|
5456
5509
|
}
|
|
5457
5510
|
),
|
|
5458
5511
|
psd && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
5459
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className:
|
|
5460
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className:
|
|
5512
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => fileInput.current?.click(), children: "Open PSD\u2026" }),
|
|
5513
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => psdTask(async () => (await (0, import_image_editor8.downloadPsd)(controller, psdFileName)).warnings), children: "Export PSD" }),
|
|
5461
5514
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5462
5515
|
"input",
|
|
5463
5516
|
{
|
|
@@ -5476,13 +5529,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5476
5529
|
)
|
|
5477
5530
|
] })
|
|
5478
5531
|
] }),
|
|
5479
|
-
psdNotes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("ul", { className: "rounded bg-amber-
|
|
5532
|
+
psdNotes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("ul", { className: "rounded bg-amber-500/10 text-amber-600 px-2 py-1 space-y-0.5", "data-testid": "psd-warnings", "aria-label": "PSD warnings", children: [
|
|
5480
5533
|
psdNotes.map((n) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("li", { children: n }, n)),
|
|
5481
5534
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: "underline", onClick: () => setPsdNotes([]), children: "Dismiss" }) })
|
|
5482
5535
|
] }),
|
|
5483
5536
|
active && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 items-center", "data-testid": "layer-properties", children: [
|
|
5484
5537
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
|
|
5485
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "text-
|
|
5538
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
5486
5539
|
"Opacity ",
|
|
5487
5540
|
Math.round(active.opacity * 100),
|
|
5488
5541
|
"%"
|
|
@@ -5497,12 +5550,12 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5497
5550
|
value: Math.round(active.opacity * 100),
|
|
5498
5551
|
...sliderEvents,
|
|
5499
5552
|
onChange: (e) => prop("opacity", Number(e.target.value) / 100),
|
|
5500
|
-
className: "accent-
|
|
5553
|
+
className: "accent-primary"
|
|
5501
5554
|
}
|
|
5502
5555
|
)
|
|
5503
5556
|
] }),
|
|
5504
5557
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
|
|
5505
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "text-
|
|
5558
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
5506
5559
|
"Fill ",
|
|
5507
5560
|
Math.round(((active.type === "pixel" ? active.fillOpacity : void 0) ?? 1) * 100),
|
|
5508
5561
|
"%"
|
|
@@ -5518,7 +5571,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5518
5571
|
value: Math.round(((active.type === "pixel" ? active.fillOpacity : void 0) ?? 1) * 100),
|
|
5519
5572
|
...sliderEvents,
|
|
5520
5573
|
onChange: (e) => prop("fillOpacity", Number(e.target.value) / 100),
|
|
5521
|
-
className: "accent-
|
|
5574
|
+
className: "accent-primary disabled:opacity-40"
|
|
5522
5575
|
}
|
|
5523
5576
|
)
|
|
5524
5577
|
] }),
|
|
@@ -5526,7 +5579,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5526
5579
|
"select",
|
|
5527
5580
|
{
|
|
5528
5581
|
"aria-label": "Layer blend mode",
|
|
5529
|
-
className:
|
|
5582
|
+
className: imageSelectClass,
|
|
5530
5583
|
value: active.blend,
|
|
5531
5584
|
onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { blend: e.target.value })),
|
|
5532
5585
|
children: [
|
|
@@ -5535,7 +5588,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5535
5588
|
]
|
|
5536
5589
|
}
|
|
5537
5590
|
),
|
|
5538
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1.5 text-
|
|
5591
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
5539
5592
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5540
5593
|
"input",
|
|
5541
5594
|
{
|
|
@@ -5543,12 +5596,12 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5543
5596
|
"aria-label": "Clip to layer below",
|
|
5544
5597
|
checked: Boolean(active.clipped),
|
|
5545
5598
|
onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { clipped: e.target.checked })),
|
|
5546
|
-
className: "accent-
|
|
5599
|
+
className: "accent-primary"
|
|
5547
5600
|
}
|
|
5548
5601
|
),
|
|
5549
5602
|
"Clip to below"
|
|
5550
5603
|
] }),
|
|
5551
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "col-span-2 flex flex-wrap gap-2 text-
|
|
5604
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "col-span-2 flex flex-wrap gap-2 text-muted-foreground", role: "group", "aria-label": "Layer locks", children: ["pixels", "transparency", "position", "all"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5552
5605
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5553
5606
|
"input",
|
|
5554
5607
|
{
|
|
@@ -5556,13 +5609,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5556
5609
|
"aria-label": `Lock ${k}`,
|
|
5557
5610
|
checked: Boolean(active.locks?.[k]),
|
|
5558
5611
|
onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { locks: { ...active.locks, [k]: e.target.checked } })),
|
|
5559
|
-
className: "accent-
|
|
5612
|
+
className: "accent-primary"
|
|
5560
5613
|
}
|
|
5561
5614
|
),
|
|
5562
5615
|
k
|
|
5563
5616
|
] }, k)) })
|
|
5564
5617
|
] }),
|
|
5565
|
-
effects && active && active.type !== "adjustment" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(LayerEffectsPanel, { controller, className: "border-t border-
|
|
5618
|
+
effects && active && active.type !== "adjustment" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(LayerEffectsPanel, { controller, className: "border-t border-border pt-1.5" }),
|
|
5566
5619
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("ul", { className: "flex flex-col gap-0.5", role: "tree", "aria-label": "Layers", children: rows.map((row) => {
|
|
5567
5620
|
const { layer } = row;
|
|
5568
5621
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
@@ -5601,7 +5654,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5601
5654
|
type: "button",
|
|
5602
5655
|
"aria-label": layer.visible ? `Hide ${row.label}` : `Show ${row.label}`,
|
|
5603
5656
|
"aria-pressed": layer.visible,
|
|
5604
|
-
className: "w-4 text-center text-
|
|
5657
|
+
className: "w-4 text-center text-foreground",
|
|
5605
5658
|
onClick: (e) => {
|
|
5606
5659
|
e.stopPropagation();
|
|
5607
5660
|
attempt(() => controller.setLayerProperties(layer.id, { visible: !layer.visible }));
|
|
@@ -5614,7 +5667,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5614
5667
|
{
|
|
5615
5668
|
type: "button",
|
|
5616
5669
|
"aria-label": layer.collapsed ? `Expand ${row.label}` : `Collapse ${row.label}`,
|
|
5617
|
-
className: "w-3 text-
|
|
5670
|
+
className: "w-3 text-muted-foreground",
|
|
5618
5671
|
onClick: (e) => {
|
|
5619
5672
|
e.stopPropagation();
|
|
5620
5673
|
attempt(() => controller.setLayerProperties(layer.id, { collapsed: !layer.collapsed }));
|
|
@@ -5622,7 +5675,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5622
5675
|
children: layer.collapsed ? "\u25B8" : "\u25BE"
|
|
5623
5676
|
}
|
|
5624
5677
|
),
|
|
5625
|
-
row.clipped && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-
|
|
5678
|
+
row.clipped && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", "aria-label": "Clipped", children: "\u21B3" }),
|
|
5626
5679
|
(0, import_image_editor8.layerHasThumbnail)(layer) ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "relative shrink-0", children: [
|
|
5627
5680
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5628
5681
|
Thumbnail,
|
|
@@ -5637,14 +5690,14 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5637
5690
|
"span",
|
|
5638
5691
|
{
|
|
5639
5692
|
"data-testid": "layer-kind-badge",
|
|
5640
|
-
className: "absolute -bottom-1 -right-1 rounded bg-
|
|
5693
|
+
className: "absolute -bottom-1 -right-1 rounded bg-accent px-0.5 text-[8px] font-bold leading-tight text-foreground ring-1 ring-background",
|
|
5641
5694
|
children: (0, import_image_editor8.layerBadge)(layer)
|
|
5642
5695
|
}
|
|
5643
5696
|
)
|
|
5644
5697
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5645
5698
|
"span",
|
|
5646
5699
|
{
|
|
5647
|
-
className: "shrink-0 grid place-items-center rounded bg-
|
|
5700
|
+
className: "shrink-0 grid place-items-center rounded bg-muted text-[9px] text-muted-foreground ring-1 ring-border",
|
|
5648
5701
|
style: { width: thumbnailSize, height: thumbnailSize },
|
|
5649
5702
|
children: (0, import_image_editor8.layerBadge)(layer)
|
|
5650
5703
|
}
|
|
@@ -5657,7 +5710,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5657
5710
|
"aria-pressed": layer.mask.linked !== false,
|
|
5658
5711
|
title: layer.mask.linked === false ? "Mask unlinked: it stays put when the layer moves or transforms. Click to link." : "Mask linked: it moves with the layer. Click to unlink.",
|
|
5659
5712
|
"data-testid": "layer-mask-link",
|
|
5660
|
-
className: `shrink-0 text-[10px] leading-none ${layer.mask.linked === false ? "text-
|
|
5713
|
+
className: `shrink-0 text-[10px] leading-none ${layer.mask.linked === false ? "text-muted-foreground/70" : "text-foreground"}`,
|
|
5661
5714
|
onClick: (e) => {
|
|
5662
5715
|
e.stopPropagation();
|
|
5663
5716
|
attempt(() => controller.setLayerMaskProps(layer.id, { linked: layer.mask.linked === false }));
|
|
@@ -5686,7 +5739,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5686
5739
|
autoFocus: true,
|
|
5687
5740
|
"aria-label": "Layer name",
|
|
5688
5741
|
defaultValue: layer.name || row.label,
|
|
5689
|
-
className: "flex-1 min-w-0 bg-
|
|
5742
|
+
className: "flex-1 min-w-0 bg-background border border-border rounded px-1",
|
|
5690
5743
|
onClick: (e) => e.stopPropagation(),
|
|
5691
5744
|
onBlur: (e) => {
|
|
5692
5745
|
setRenaming(null);
|
|
@@ -5700,7 +5753,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5700
5753
|
) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5701
5754
|
"span",
|
|
5702
5755
|
{
|
|
5703
|
-
className: `flex-1 min-w-0 truncate ${layer.visible ? "" : "text-
|
|
5756
|
+
className: `flex-1 min-w-0 truncate ${layer.visible ? "" : "text-muted-foreground"}`,
|
|
5704
5757
|
onDoubleClick: (e) => {
|
|
5705
5758
|
e.stopPropagation();
|
|
5706
5759
|
setRenaming(layer.id);
|
|
@@ -5708,7 +5761,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5708
5761
|
children: row.label
|
|
5709
5762
|
}
|
|
5710
5763
|
),
|
|
5711
|
-
(0, import_image_editor8.layerWarning)(layer) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { role: "img", "data-testid": "layer-warning", "aria-label": (0, import_image_editor8.layerWarning)(layer), title: (0, import_image_editor8.layerWarning)(layer), className: "text-[10px] text-amber-
|
|
5764
|
+
(0, import_image_editor8.layerWarning)(layer) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { role: "img", "data-testid": "layer-warning", "aria-label": (0, import_image_editor8.layerWarning)(layer), title: (0, import_image_editor8.layerWarning)(layer), className: "text-[10px] text-amber-600", children: "\u26A0" }),
|
|
5712
5765
|
(0, import_image_editor8.layerEffectsBadge)(layer) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5713
5766
|
"button",
|
|
5714
5767
|
{
|
|
@@ -5716,7 +5769,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5716
5769
|
"data-testid": "layer-fx-badge",
|
|
5717
5770
|
"aria-label": (0, import_image_editor8.layerEffectsBadge)(layer) === "on" ? `Turn effects off for ${row.label}` : `Turn effects on for ${row.label}`,
|
|
5718
5771
|
"aria-pressed": (0, import_image_editor8.layerEffectsBadge)(layer) === "on",
|
|
5719
|
-
className: `text-[9px] italic font-semibold ${(0, import_image_editor8.layerEffectsBadge)(layer) === "on" ? "text-
|
|
5772
|
+
className: `text-[9px] italic font-semibold ${(0, import_image_editor8.layerEffectsBadge)(layer) === "on" ? "text-primary" : "text-muted-foreground/70 line-through"}`,
|
|
5720
5773
|
onClick: (e) => {
|
|
5721
5774
|
e.stopPropagation();
|
|
5722
5775
|
attempt(() => controller.setLayerEffectsEnabled(layer.id, (0, import_image_editor8.layerEffectsBadge)(layer) !== "on"));
|
|
@@ -5724,20 +5777,20 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5724
5777
|
children: "fx"
|
|
5725
5778
|
}
|
|
5726
5779
|
),
|
|
5727
|
-
locked(layer) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { "aria-label": "Locked", className: "text-
|
|
5728
|
-
layer.blend !== "normal" && layer.blend !== "pass-through" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-[9px] text-
|
|
5780
|
+
locked(layer) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { "aria-label": "Locked", className: "text-muted-foreground", children: "\u{1F512}" }),
|
|
5781
|
+
layer.blend !== "normal" && layer.blend !== "pass-through" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-[9px] text-muted-foreground", children: layer.blend })
|
|
5729
5782
|
]
|
|
5730
5783
|
},
|
|
5731
5784
|
layer.id
|
|
5732
5785
|
);
|
|
5733
5786
|
}) }),
|
|
5734
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { role: "alert", className: "text-
|
|
5787
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
|
|
5735
5788
|
menu && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5736
5789
|
"div",
|
|
5737
5790
|
{
|
|
5738
5791
|
role: "menu",
|
|
5739
5792
|
"aria-label": "Layer menu",
|
|
5740
|
-
className: "fixed z-50 min-w-44 rounded border border-
|
|
5793
|
+
className: "fixed z-50 min-w-44 rounded border border-border bg-background py-1 shadow-xl",
|
|
5741
5794
|
style: { left: menu.x, top: menu.y },
|
|
5742
5795
|
onClick: (e) => e.stopPropagation(),
|
|
5743
5796
|
onKeyDown: (e) => e.key === "Escape" && setMenu(null),
|
|
@@ -5747,7 +5800,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5747
5800
|
type: "button",
|
|
5748
5801
|
role: "menuitem",
|
|
5749
5802
|
disabled: !item.enabled,
|
|
5750
|
-
className: "block w-full px-3 py-1 text-left hover:bg-
|
|
5803
|
+
className: "block w-full px-3 py-1 text-left hover:bg-muted disabled:opacity-40",
|
|
5751
5804
|
onClick: () => run(item.action),
|
|
5752
5805
|
children: item.label
|
|
5753
5806
|
},
|
|
@@ -7384,21 +7437,22 @@ function EffectParameters({
|
|
|
7384
7437
|
|
|
7385
7438
|
// src/image-editor/ImageEffectControls.tsx
|
|
7386
7439
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
7387
|
-
function ImageEffectControls({ provider, effect, name, values, onChange, onPreset }) {
|
|
7440
|
+
function ImageEffectControls({ provider, effect, name, values, onChange, onPreset, className }) {
|
|
7388
7441
|
const { description, error } = useEffectDescription(provider, effect);
|
|
7389
|
-
|
|
7442
|
+
let body;
|
|
7443
|
+
if (!provider) body = /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
7390
7444
|
'No effects provider: "',
|
|
7391
7445
|
name ?? effect,
|
|
7392
7446
|
'" is kept but not drawn.'
|
|
7393
7447
|
] });
|
|
7394
|
-
if (error)
|
|
7395
|
-
if (!description)
|
|
7396
|
-
|
|
7448
|
+
else if (error) body = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-[11px] text-amber-600", children: error });
|
|
7449
|
+
else if (!description) body = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
|
|
7450
|
+
else body = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(EffectParameters, { description, values, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
|
|
7451
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className, "data-testid": "image-effect-controls", children: body });
|
|
7397
7452
|
}
|
|
7398
7453
|
|
|
7399
7454
|
// src/image-editor/ImageProviderEffectsPanel.tsx
|
|
7400
7455
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
7401
|
-
var btn = "rounded border border-slate-700 px-1.5 py-0.5 text-[11px] text-slate-300 hover:text-white disabled:opacity-40";
|
|
7402
7456
|
function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
7403
7457
|
const [, setTick] = (0, import_react54.useState)(0);
|
|
7404
7458
|
(0, import_react54.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -7428,17 +7482,17 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
7428
7482
|
const canFilter = !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
|
|
7429
7483
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Provider effects", "data-image-provider-effects": "", children: [
|
|
7430
7484
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
7431
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-
|
|
7432
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className:
|
|
7433
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className:
|
|
7485
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Effects" }),
|
|
7486
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider || !canFilter, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Apply effect\u2026" }),
|
|
7487
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => setBrowse(browse === "layer" ? null : "layer"), children: "Effect layer\u2026" })
|
|
7434
7488
|
] }),
|
|
7435
|
-
!provider && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[11px] text-
|
|
7489
|
+
!provider && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the document are kept." }),
|
|
7436
7490
|
browse === "filter" && layer && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id))) }),
|
|
7437
7491
|
browse === "layer" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(EffectsBrowser, { provider, uses: ["generator", "overlay", "title"], title: "Generators and overlays", onPick: (e) => (setBrowse(null), run(() => controller.addEffectLayer(e.id))) }),
|
|
7438
7492
|
generator && layer && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "space-y-1", "data-effect-part": "generator", children: [
|
|
7439
7493
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
7440
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "flex-1 font-medium text-
|
|
7441
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className:
|
|
7494
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "flex-1 font-medium text-foreground", children: generator.name ?? generator.effect }),
|
|
7495
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: imageOutlineButtonClass, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
|
|
7442
7496
|
] }),
|
|
7443
7497
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
7444
7498
|
ImageEffectControls,
|
|
@@ -7457,20 +7511,20 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
7457
7511
|
const all = layer.smartFilters.filters;
|
|
7458
7512
|
const index = all.indexOf(f);
|
|
7459
7513
|
if (f.kind !== "effect") return null;
|
|
7460
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("li", { className: "rounded border border-
|
|
7514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("li", { className: "rounded border border-border p-1", "data-smart-effect": f.id, children: [
|
|
7461
7515
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
7462
7516
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { type: "checkbox", checked: f.enabled, "aria-label": `${label} on`, onChange: (e) => {
|
|
7463
7517
|
const enabled = e.currentTarget.checked;
|
|
7464
7518
|
run(() => controller.updateEffectFilter(layer.id, f.id, { enabled }));
|
|
7465
7519
|
} }),
|
|
7466
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: "min-w-0 flex-1 truncate text-left text-
|
|
7467
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className:
|
|
7468
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className:
|
|
7469
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className:
|
|
7520
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: "min-w-0 flex-1 truncate text-left text-foreground", "aria-expanded": open === f.id, onClick: () => setOpen(open === f.id ? null : f.id), children: label }),
|
|
7521
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: index === all.length - 1, "aria-label": "Move up", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index + 1 })), children: "\u2191" }),
|
|
7522
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: index === 0, "aria-label": "Move down", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index - 1 })), children: "\u2193" }),
|
|
7523
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: imageOutlineButtonClass, "aria-label": `Remove ${label}`, onClick: () => run(() => controller.removeSmartFilter(layer.id, f.id)), children: "\u2715" })
|
|
7470
7524
|
] }),
|
|
7471
7525
|
open === f.id && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "mt-1 space-y-2", children: [
|
|
7472
7526
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
7473
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "w-14 text-[11px] text-
|
|
7527
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "w-14 text-[11px] text-foreground", children: "Opacity" }),
|
|
7474
7528
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
7475
7529
|
"input",
|
|
7476
7530
|
{
|
|
@@ -7502,8 +7556,8 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
7502
7556
|
] })
|
|
7503
7557
|
] }, f.id);
|
|
7504
7558
|
}) }),
|
|
7505
|
-
!layer && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[11px] text-
|
|
7506
|
-
message && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { role: "alert", className: "text-[11px] text-
|
|
7559
|
+
!layer && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
|
|
7560
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
7507
7561
|
] });
|
|
7508
7562
|
}
|
|
7509
7563
|
|
|
@@ -7518,7 +7572,7 @@ var import_image_editor10 = require("@pixerate/editor/image-editor");
|
|
|
7518
7572
|
// src/paint-editor/PaintGradientEditorView.tsx
|
|
7519
7573
|
var import_react55 = require("react");
|
|
7520
7574
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
7521
|
-
var
|
|
7575
|
+
var button = "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700 disabled:opacity-40";
|
|
7522
7576
|
var select = "rounded bg-slate-800 px-1 py-0.5 text-[11px]";
|
|
7523
7577
|
var number = "w-16 rounded bg-slate-800 px-1 py-0.5 text-[11px]";
|
|
7524
7578
|
var pct = (v) => Math.round(v * 1e3) / 10;
|
|
@@ -7554,7 +7608,7 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
|
|
|
7554
7608
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "", children: "Presets\u2026" }),
|
|
7555
7609
|
PAINT_GRADIENT_PRESETS.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: i, children: p.name }, p.name))
|
|
7556
7610
|
] }),
|
|
7557
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className:
|
|
7611
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: button, onClick: () => onChange(reversePaintGradient(value)), children: "Reverse" })
|
|
7558
7612
|
] }),
|
|
7559
7613
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7560
7614
|
"div",
|
|
@@ -7612,7 +7666,7 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
|
|
|
7612
7666
|
/* @__PURE__ */ (0, import_jsx_runtime34.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 }),
|
|
7613
7667
|
"%"
|
|
7614
7668
|
] }),
|
|
7615
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className:
|
|
7669
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: button, disabled: value.stops.length <= 2, onClick: () => (setSelected(Math.max(0, sel - 1)), onChange(removePaintGradientStop(value, sel))), children: "Remove stop" })
|
|
7616
7670
|
] }),
|
|
7617
7671
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-mapping", children: [
|
|
7618
7672
|
/* @__PURE__ */ (0, import_jsx_runtime34.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_runtime34.jsx)("option", { value: m, children: PAINT_GRADIENT_MAPPING_LABELS[m] }, m)) }),
|
|
@@ -7643,7 +7697,6 @@ var PaintGradientEditor = (props) => /* @__PURE__ */ (0, import_jsx_runtime35.js
|
|
|
7643
7697
|
|
|
7644
7698
|
// src/image-editor/BrushOptionsBar.tsx
|
|
7645
7699
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
7646
|
-
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"}`;
|
|
7647
7700
|
var BrushOptionsBar = ({ controller, className }) => {
|
|
7648
7701
|
const [, setTick] = (0, import_react56.useState)(0);
|
|
7649
7702
|
(0, import_react56.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -7659,14 +7712,14 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
7659
7712
|
setError(err instanceof Error ? err.message : String(err));
|
|
7660
7713
|
}
|
|
7661
7714
|
};
|
|
7662
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-
|
|
7715
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "brush-options", children: [
|
|
7663
7716
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: import_image_editor11.PAINT_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7664
7717
|
"button",
|
|
7665
7718
|
{
|
|
7666
7719
|
type: "button",
|
|
7667
7720
|
"aria-pressed": state.activeTool === t.id,
|
|
7668
7721
|
title: t.shortcut ? `${t.label} (${t.shortcut})` : t.label,
|
|
7669
|
-
className:
|
|
7722
|
+
className: imageChipClass(state.activeTool === t.id),
|
|
7670
7723
|
onClick: () => controller.setTool(t.id),
|
|
7671
7724
|
children: t.label
|
|
7672
7725
|
},
|
|
@@ -7681,10 +7734,10 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
7681
7734
|
"aria-label": "Foreground colour",
|
|
7682
7735
|
value: foreground,
|
|
7683
7736
|
onChange: (e) => controller.setPaintOptions({ foreground: e.target.value }),
|
|
7684
|
-
className:
|
|
7737
|
+
className: imageColorInputClass
|
|
7685
7738
|
}
|
|
7686
7739
|
),
|
|
7687
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "text-
|
|
7740
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "text-muted-foreground", children: "FG" })
|
|
7688
7741
|
] }),
|
|
7689
7742
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
7690
7743
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
@@ -7694,20 +7747,20 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
7694
7747
|
"aria-label": "Background colour",
|
|
7695
7748
|
value: background,
|
|
7696
7749
|
onChange: (e) => controller.setPaintOptions({ background: e.target.value }),
|
|
7697
|
-
className:
|
|
7750
|
+
className: imageColorInputClass
|
|
7698
7751
|
}
|
|
7699
7752
|
),
|
|
7700
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "text-
|
|
7753
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "text-muted-foreground", children: "BG" })
|
|
7701
7754
|
] }),
|
|
7702
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", title: "Swap colours (X)", className:
|
|
7703
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", title: "Default colours (D)", className:
|
|
7755
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", title: "Swap colours (X)", className: imageChipClass(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
|
|
7756
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", title: "Default colours (D)", className: imageChipClass(false), onClick: () => controller.resetPaintColors(), children: "Default" }),
|
|
7704
7757
|
state.activeTool === "brush" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7705
7758
|
"button",
|
|
7706
7759
|
{
|
|
7707
7760
|
type: "button",
|
|
7708
7761
|
"aria-pressed": paint.type === "gradient",
|
|
7709
7762
|
title: "Gradient paint: the brush changes colour as the stroke goes",
|
|
7710
|
-
className:
|
|
7763
|
+
className: imageChipClass(paint.type === "gradient"),
|
|
7711
7764
|
onClick: () => attempt(() => controller.setPaintOptions(paint.type === "gradient" ? { foreground } : { paint: import_image_editor12.DEFAULT_PAINT_GRADIENT })),
|
|
7712
7765
|
children: "Gradient"
|
|
7713
7766
|
}
|
|
@@ -7723,19 +7776,19 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
7723
7776
|
},
|
|
7724
7777
|
spec.id
|
|
7725
7778
|
)),
|
|
7726
|
-
state.activeTool === "mixer" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-2 border-t border-
|
|
7779
|
+
state.activeTool === "mixer" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Mixer Brush", "data-testid": "mixer-options", children: [
|
|
7727
7780
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
7728
7781
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7729
7782
|
"span",
|
|
7730
7783
|
{
|
|
7731
7784
|
"aria-label": "Brush load",
|
|
7732
7785
|
title: mixerLoad.reservoir ? `Loaded ${(0, import_image_editor11.rgbUnitToHex)(mixerLoad.reservoir)}, ${Math.round(mixerLoad.amount * 100)}% left` : "Unloaded",
|
|
7733
|
-
className: "h-6 w-6 rounded border border-
|
|
7786
|
+
className: "h-6 w-6 rounded border border-border",
|
|
7734
7787
|
style: { background: mixerLoad.reservoir ? (0, import_image_editor11.rgbUnitToHex)(mixerLoad.reservoir) : "transparent" }
|
|
7735
7788
|
}
|
|
7736
7789
|
),
|
|
7737
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", title: "Fill the reservoir with the foreground colour", className:
|
|
7738
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", title: "Empty the picked-up colour", className:
|
|
7790
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", title: "Fill the reservoir with the foreground colour", className: imageChipClass(false), onClick: () => controller.loadMixerBrush(), children: "Load brush" }),
|
|
7791
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", title: "Empty the picked-up colour", className: imageChipClass(false), onClick: () => controller.cleanMixerBrush(), children: "Clean brush" })
|
|
7739
7792
|
] }),
|
|
7740
7793
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children: import_image_editor11.MIXER_MIXING_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7741
7794
|
"button",
|
|
@@ -7743,14 +7796,14 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
7743
7796
|
type: "button",
|
|
7744
7797
|
"aria-pressed": mixer.mixing === m.id,
|
|
7745
7798
|
title: m.title,
|
|
7746
|
-
className:
|
|
7799
|
+
className: imageChipClass(mixer.mixing === m.id),
|
|
7747
7800
|
onClick: () => controller.setPaintOptions({ mixer: { mixing: m.id } }),
|
|
7748
7801
|
children: m.label
|
|
7749
7802
|
},
|
|
7750
7803
|
m.id
|
|
7751
7804
|
)) }),
|
|
7752
7805
|
import_image_editor11.MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ControlSlider, { spec, value: mixer[spec.id], onChange: (v) => controller.setPaintOptions({ mixer: { [spec.id]: v } }) }, spec.id)),
|
|
7753
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-wrap gap-3 text-
|
|
7806
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-wrap gap-3 text-foreground", children: [
|
|
7754
7807
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
7755
7808
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7756
7809
|
"input",
|
|
@@ -7759,7 +7812,7 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
7759
7812
|
"aria-label": "Load the brush after each stroke",
|
|
7760
7813
|
checked: mixer.loadEachStroke,
|
|
7761
7814
|
onChange: (e) => controller.setPaintOptions({ mixer: { loadEachStroke: e.target.checked } }),
|
|
7762
|
-
className: "accent-
|
|
7815
|
+
className: "accent-primary"
|
|
7763
7816
|
}
|
|
7764
7817
|
),
|
|
7765
7818
|
"Load each stroke"
|
|
@@ -7772,35 +7825,35 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
7772
7825
|
"aria-label": "Clean the brush after each stroke",
|
|
7773
7826
|
checked: mixer.cleanEachStroke,
|
|
7774
7827
|
onChange: (e) => controller.setPaintOptions({ mixer: { cleanEachStroke: e.target.checked } }),
|
|
7775
|
-
className: "accent-
|
|
7828
|
+
className: "accent-primary"
|
|
7776
7829
|
}
|
|
7777
7830
|
),
|
|
7778
7831
|
"Clean each stroke"
|
|
7779
7832
|
] })
|
|
7780
7833
|
] })
|
|
7781
7834
|
] }),
|
|
7782
|
-
(0, import_image_editor11.isRetouchPaintTool)(tool) && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-2 border-t border-
|
|
7835
|
+
(0, import_image_editor11.isRetouchPaintTool)(tool) && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Retouch options", "data-testid": "retouch-options", children: [
|
|
7783
7836
|
(tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
7784
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "text-
|
|
7785
|
-
cloneSource && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", title: "Forget the source point", className:
|
|
7837
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "text-muted-foreground", "data-testid": "clone-source", children: (0, import_image_editor11.cloneSourceLabel)(controller) }),
|
|
7838
|
+
cloneSource && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", title: "Forget the source point", className: imageChipClass(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
|
|
7786
7839
|
] }),
|
|
7787
7840
|
(tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-1", role: "group", "aria-label": "Clone source transform", "data-testid": "clone-transform", children: [
|
|
7788
7841
|
import_image_editor11.CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ControlSlider, { spec, value: (0, import_image_editor11.cloneTransformView)(controller)[spec.id], onChange: (v) => (0, import_image_editor11.setCloneTransformValue)(controller, spec.id, v) }, spec.id)),
|
|
7789
7842
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
7790
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor11.cloneTransformView)(controller).flipH, title: "Mirror the source left to right", className:
|
|
7791
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor11.cloneTransformView)(controller).flipV, title: "Mirror the source top to bottom", className:
|
|
7792
|
-
!(0, import_image_editor11.cloneTransformView)(controller).identity && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className:
|
|
7843
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor11.cloneTransformView)(controller).flipH, title: "Mirror the source left to right", className: imageChipClass((0, import_image_editor11.cloneTransformView)(controller).flipH), onClick: () => (0, import_image_editor11.setCloneTransformValue)(controller, "flipH"), children: "Flip H" }),
|
|
7844
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor11.cloneTransformView)(controller).flipV, title: "Mirror the source top to bottom", className: imageChipClass((0, import_image_editor11.cloneTransformView)(controller).flipV), onClick: () => (0, import_image_editor11.setCloneTransformValue)(controller, "flipV"), children: "Flip V" }),
|
|
7845
|
+
!(0, import_image_editor11.cloneTransformView)(controller).identity && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className: imageChipClass(false), onClick: () => controller.setCloneTransform(null), children: "Reset transform" })
|
|
7793
7846
|
] })
|
|
7794
7847
|
] }),
|
|
7795
7848
|
import_image_editor11.RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": choice.label, children: [
|
|
7796
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "text-
|
|
7849
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "text-muted-foreground", children: choice.label }),
|
|
7797
7850
|
choice.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7798
7851
|
"button",
|
|
7799
7852
|
{
|
|
7800
7853
|
type: "button",
|
|
7801
7854
|
"aria-pressed": retouch[choice.id] === o.id,
|
|
7802
7855
|
title: o.title,
|
|
7803
|
-
className:
|
|
7856
|
+
className: imageChipClass(retouch[choice.id] === o.id),
|
|
7804
7857
|
onClick: () => (0, import_image_editor11.setRetouchChoice)(controller, choice.id, o.id),
|
|
7805
7858
|
children: o.label
|
|
7806
7859
|
},
|
|
@@ -7808,7 +7861,7 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
7808
7861
|
))
|
|
7809
7862
|
] }, choice.id)),
|
|
7810
7863
|
import_image_editor11.RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ControlSlider, { spec, value: retouch[spec.id], onChange: (v) => controller.setPaintOptions({ retouch: { [spec.id]: v } }) }, spec.id)),
|
|
7811
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "flex flex-wrap gap-3 text-
|
|
7864
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "flex flex-wrap gap-3 text-foreground", children: import_image_editor11.RETOUCH_TOGGLES.filter((t) => t.tools.includes(tool)).map((t) => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
7812
7865
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7813
7866
|
"input",
|
|
7814
7867
|
{
|
|
@@ -7816,13 +7869,13 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
7816
7869
|
"aria-label": t.label,
|
|
7817
7870
|
checked: retouch[t.id],
|
|
7818
7871
|
onChange: (e) => controller.setPaintOptions({ retouch: { [t.id]: e.target.checked } }),
|
|
7819
|
-
className: "accent-
|
|
7872
|
+
className: "accent-primary"
|
|
7820
7873
|
}
|
|
7821
7874
|
),
|
|
7822
7875
|
t.label
|
|
7823
7876
|
] }, t.id)) })
|
|
7824
7877
|
] }),
|
|
7825
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-wrap gap-3 text-
|
|
7878
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-wrap gap-3 text-foreground", role: "group", "aria-label": "Pressure", children: [
|
|
7826
7879
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
7827
7880
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7828
7881
|
"input",
|
|
@@ -7831,7 +7884,7 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
7831
7884
|
"aria-label": "Pressure controls size",
|
|
7832
7885
|
checked: brush.pressureSize,
|
|
7833
7886
|
onChange: (e) => controller.setPaintOptions({ brush: { pressureSize: e.target.checked } }),
|
|
7834
|
-
className: "accent-
|
|
7887
|
+
className: "accent-primary"
|
|
7835
7888
|
}
|
|
7836
7889
|
),
|
|
7837
7890
|
"Pressure size"
|
|
@@ -7844,17 +7897,17 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
7844
7897
|
"aria-label": "Pressure controls opacity",
|
|
7845
7898
|
checked: brush.pressureOpacity,
|
|
7846
7899
|
onChange: (e) => controller.setPaintOptions({ brush: { pressureOpacity: e.target.checked } }),
|
|
7847
|
-
className: "accent-
|
|
7900
|
+
className: "accent-primary"
|
|
7848
7901
|
}
|
|
7849
7902
|
),
|
|
7850
7903
|
"Pressure opacity"
|
|
7851
7904
|
] })
|
|
7852
7905
|
] }),
|
|
7853
7906
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex gap-1", children: [
|
|
7854
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", className:
|
|
7855
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", className:
|
|
7907
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.fillPixels()), children: "Fill" }),
|
|
7908
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.clearPixels()), children: "Clear" })
|
|
7856
7909
|
] }),
|
|
7857
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { role: "alert", className: "text-
|
|
7910
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
7858
7911
|
] });
|
|
7859
7912
|
};
|
|
7860
7913
|
|
|
@@ -7862,8 +7915,8 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
7862
7915
|
var import_react57 = require("react");
|
|
7863
7916
|
var import_image_editor13 = require("@pixerate/editor/image-editor");
|
|
7864
7917
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
7865
|
-
var
|
|
7866
|
-
var select2 = "rounded bg-
|
|
7918
|
+
var chip = imageChipClass(false);
|
|
7919
|
+
var select2 = "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground";
|
|
7867
7920
|
var ColorProfilePanel = ({ controller, className }) => {
|
|
7868
7921
|
const [, setTick] = (0, import_react57.useState)(0);
|
|
7869
7922
|
(0, import_react57.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -7892,28 +7945,28 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
7892
7945
|
})
|
|
7893
7946
|
);
|
|
7894
7947
|
};
|
|
7895
|
-
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-
|
|
7948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "color-profile-panel", children: [
|
|
7896
7949
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
7897
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-
|
|
7950
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-muted-foreground", children: "Profile" }),
|
|
7898
7951
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { "data-testid": "color-profile-name", children: view.profileName })
|
|
7899
7952
|
] }),
|
|
7900
7953
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Colour mode", children: [
|
|
7901
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-
|
|
7954
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-muted-foreground", children: "Mode" }),
|
|
7902
7955
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("select", { "aria-label": "Colour mode", className: select2, value: view.mode, onChange: (e) => attempt(() => controller.setColorMode(e.target.value)), children: import_image_editor13.COLOR_MODE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
|
|
7903
|
-
view.cmykProfileName && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-
|
|
7956
|
+
view.cmykProfileName && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-muted-foreground", children: view.cmykProfileName })
|
|
7904
7957
|
] }),
|
|
7905
7958
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
|
|
7906
7959
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("select", { "aria-label": "Target profile", className: select2, value: target, onChange: (e) => setTarget(e.target.value), children: import_image_editor13.WORKING_SPACE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
|
|
7907
7960
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("select", { "aria-label": "Rendering intent", className: select2, value: intent, onChange: (e) => setIntent(e.target.value), children: import_image_editor13.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
|
|
7908
7961
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
7909
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-
|
|
7962
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-primary" }),
|
|
7910
7963
|
"BPC"
|
|
7911
7964
|
] }),
|
|
7912
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", className:
|
|
7913
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", className:
|
|
7965
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", className: chip, title: "Edit \u203A Assign Profile: keep the numbers", onClick: () => attempt(() => controller.assignProfile(target)), children: "Assign" }),
|
|
7966
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", className: chip, title: "Edit \u203A Convert to Profile: keep the look", onClick: () => attempt(() => controller.convertToProfile(target, { intent, bpc })), children: "Convert" })
|
|
7914
7967
|
] }),
|
|
7915
7968
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Proof setup", children: [
|
|
7916
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-
|
|
7969
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-muted-foreground", children: "Proof" }),
|
|
7917
7970
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
7918
7971
|
"select",
|
|
7919
7972
|
{
|
|
@@ -7930,16 +7983,16 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
7930
7983
|
view.proof && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
7931
7984
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("select", { "aria-label": "Proof intent", className: select2, value: view.proof.intent, onChange: (e) => proofWith({ intent: e.target.value }), children: import_image_editor13.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
|
|
7932
7985
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
7933
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-
|
|
7986
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-primary" }),
|
|
7934
7987
|
"Paper"
|
|
7935
7988
|
] }),
|
|
7936
7989
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
7937
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-
|
|
7990
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-primary" }),
|
|
7938
7991
|
"Gamut warning"
|
|
7939
7992
|
] })
|
|
7940
7993
|
] })
|
|
7941
7994
|
] }),
|
|
7942
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { role: "alert", className: "text-
|
|
7995
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
7943
7996
|
] });
|
|
7944
7997
|
};
|
|
7945
7998
|
|
|
@@ -7954,7 +8007,7 @@ var MODIFY_OPS = [
|
|
|
7954
8007
|
{ op: "border", label: "Border" },
|
|
7955
8008
|
{ op: "smooth", label: "Smooth" }
|
|
7956
8009
|
];
|
|
7957
|
-
var
|
|
8010
|
+
var btn = (on) => `px-2 py-1 rounded-md border text-[11px] transition-colors ${on ? "bg-primary border-primary text-primary-foreground" : "bg-background border-border text-foreground hover:bg-accent hover:text-accent-foreground"}`;
|
|
7958
8011
|
var SelectionOptionsBar = ({
|
|
7959
8012
|
controller,
|
|
7960
8013
|
options,
|
|
@@ -7968,11 +8021,11 @@ var SelectionOptionsBar = ({
|
|
|
7968
8021
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
7969
8022
|
const qm = quickMask ?? Boolean(controller.getState().quickMask);
|
|
7970
8023
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
7971
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor14.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", "aria-pressed": options.tool === t.id, className:
|
|
7972
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: import_image_editor14.SELECTION_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", "aria-pressed": options.mode === m, className:
|
|
8024
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor14.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
|
|
8025
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: import_image_editor14.SELECTION_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: import_image_editor14.SELECTION_MODE_LABELS[m] }, m)) }),
|
|
7973
8026
|
options.tool === "wand" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
7974
8027
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
7975
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: "flex justify-between text-
|
|
8028
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
7976
8029
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "Tolerance" }),
|
|
7977
8030
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "font-mono", children: options.tolerance })
|
|
7978
8031
|
] }),
|
|
@@ -7986,19 +8039,19 @@ var SelectionOptionsBar = ({
|
|
|
7986
8039
|
"aria-label": "Tolerance",
|
|
7987
8040
|
value: options.tolerance,
|
|
7988
8041
|
onChange: (e) => set({ tolerance: Number(e.target.value) }),
|
|
7989
|
-
className:
|
|
8042
|
+
className: imageRangeClass
|
|
7990
8043
|
}
|
|
7991
8044
|
)
|
|
7992
8045
|
] }),
|
|
7993
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
8046
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
7994
8047
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("input", { type: "checkbox", checked: options.contiguous, onChange: (e) => set({ contiguous: e.target.checked }) }),
|
|
7995
8048
|
"Contiguous"
|
|
7996
8049
|
] }),
|
|
7997
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
8050
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
7998
8051
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("input", { type: "checkbox", checked: options.sampleMerged, onChange: (e) => set({ sampleMerged: e.target.checked }) }),
|
|
7999
8052
|
"Sample adjusted image"
|
|
8000
8053
|
] }),
|
|
8001
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
8054
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
8002
8055
|
"Sample",
|
|
8003
8056
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
8004
8057
|
"select",
|
|
@@ -8006,7 +8059,7 @@ var SelectionOptionsBar = ({
|
|
|
8006
8059
|
"aria-label": "Sample from",
|
|
8007
8060
|
value: options.sample ?? "composite",
|
|
8008
8061
|
onChange: (e) => set({ sample: e.target.value }),
|
|
8009
|
-
className: "bg-
|
|
8062
|
+
className: "bg-muted border border-border rounded px-1 py-0.5",
|
|
8010
8063
|
children: [
|
|
8011
8064
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("option", { value: "composite", children: "All layers" }),
|
|
8012
8065
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("option", { value: "active-layer", children: "Active layer" })
|
|
@@ -8015,18 +8068,18 @@ var SelectionOptionsBar = ({
|
|
|
8015
8068
|
)
|
|
8016
8069
|
] })
|
|
8017
8070
|
] }),
|
|
8018
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
8071
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
8019
8072
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("input", { type: "checkbox", checked: options.antiAlias, onChange: (e) => set({ antiAlias: e.target.checked }) }),
|
|
8020
8073
|
"Anti-alias"
|
|
8021
8074
|
] }),
|
|
8022
8075
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
8023
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", className:
|
|
8024
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", className:
|
|
8025
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", className:
|
|
8026
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", "aria-pressed": qm, className:
|
|
8076
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
|
|
8077
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
|
|
8078
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
|
|
8079
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", "aria-pressed": qm, className: btn(qm), onClick: () => controller.setQuickMask(!qm), children: "Quick Mask" })
|
|
8027
8080
|
] }),
|
|
8028
8081
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
8029
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-1 text-
|
|
8082
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
8030
8083
|
"Radius",
|
|
8031
8084
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
8032
8085
|
"input",
|
|
@@ -8038,13 +8091,13 @@ var SelectionOptionsBar = ({
|
|
|
8038
8091
|
"aria-label": "Modify radius",
|
|
8039
8092
|
value: radius,
|
|
8040
8093
|
onChange: (e) => setRadius(Math.max(0, Number(e.target.value) || 0)),
|
|
8041
|
-
className: "w-14 bg-
|
|
8094
|
+
className: "w-14 bg-background border border-border rounded px-1 py-0.5 text-foreground"
|
|
8042
8095
|
}
|
|
8043
8096
|
)
|
|
8044
8097
|
] }),
|
|
8045
|
-
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", className:
|
|
8098
|
+
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
|
|
8046
8099
|
] }),
|
|
8047
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { "data-testid": "selection-status", className: "text-
|
|
8100
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: (0, import_image_editor14.describeSelection)(sel) })
|
|
8048
8101
|
] });
|
|
8049
8102
|
};
|
|
8050
8103
|
|
|
@@ -8053,7 +8106,7 @@ var import_react59 = require("react");
|
|
|
8053
8106
|
var import_image_editor15 = require("@pixerate/editor/image-editor");
|
|
8054
8107
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
8055
8108
|
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
8056
|
-
var
|
|
8109
|
+
var button2 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
|
|
8057
8110
|
var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
8058
8111
|
const [params, setParams] = (0, import_react59.useState)(DEFAULT_PARAMS);
|
|
8059
8112
|
const [busy, setBusy] = (0, import_react59.useState)(false);
|
|
@@ -8075,9 +8128,9 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
8075
8128
|
}
|
|
8076
8129
|
};
|
|
8077
8130
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
8078
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className:
|
|
8131
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
|
|
8079
8132
|
import_image_editor15.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
8080
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "flex justify-between text-
|
|
8133
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
8081
8134
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: c.label }),
|
|
8082
8135
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "font-mono", children: [
|
|
8083
8136
|
params[c.id],
|
|
@@ -8094,20 +8147,20 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
8094
8147
|
"aria-label": c.label,
|
|
8095
8148
|
value: params[c.id],
|
|
8096
8149
|
onChange: (e) => setParams({ ...params, [c.id]: Number(e.target.value) }),
|
|
8097
|
-
className:
|
|
8150
|
+
className: imageRangeClass
|
|
8098
8151
|
}
|
|
8099
8152
|
)
|
|
8100
8153
|
] }, c.id)),
|
|
8101
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
8154
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
8102
8155
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
8103
8156
|
"Smart Radius"
|
|
8104
8157
|
] }),
|
|
8105
8158
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex gap-1", children: [
|
|
8106
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { type: "button", className:
|
|
8107
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { type: "button", className:
|
|
8159
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { type: "button", className: button2, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
8160
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { type: "button", className: button2, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
|
8108
8161
|
] }),
|
|
8109
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { role: "alert", className: "text-
|
|
8110
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "font-semibold text-
|
|
8162
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
|
|
8163
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
|
|
8111
8164
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex gap-1 items-center", children: [
|
|
8112
8165
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8113
8166
|
"select",
|
|
@@ -8115,7 +8168,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
8115
8168
|
"aria-label": "New masked layer kind",
|
|
8116
8169
|
value: newKind,
|
|
8117
8170
|
onChange: (e) => setNewKind(e.target.value),
|
|
8118
|
-
className: "flex-1 bg-
|
|
8171
|
+
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
8119
8172
|
children: import_image_editor15.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("option", { value: k.kind, children: k.label }, k.kind))
|
|
8120
8173
|
}
|
|
8121
8174
|
),
|
|
@@ -8123,7 +8176,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
8123
8176
|
"button",
|
|
8124
8177
|
{
|
|
8125
8178
|
type: "button",
|
|
8126
|
-
className:
|
|
8179
|
+
className: button2,
|
|
8127
8180
|
disabled: !sel,
|
|
8128
8181
|
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0, import_image_editor15.layerMaskFromSelection)(sel) })),
|
|
8129
8182
|
children: "New Masked Layer"
|
|
@@ -8137,7 +8190,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
8137
8190
|
"aria-label": "Mask layer",
|
|
8138
8191
|
value: target.id,
|
|
8139
8192
|
onChange: (e) => setLayerId(e.target.value),
|
|
8140
|
-
className: "bg-
|
|
8193
|
+
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
8141
8194
|
children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("option", { value: l.id, children: [
|
|
8142
8195
|
l.name || (0, import_image_editor15.adjustmentKindLabel)(l.kind),
|
|
8143
8196
|
l.mask ? " (masked)" : ""
|
|
@@ -8145,13 +8198,13 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
8145
8198
|
}
|
|
8146
8199
|
),
|
|
8147
8200
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
8148
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { type: "button", className:
|
|
8149
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { type: "button", className:
|
|
8150
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { type: "button", className:
|
|
8201
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { type: "button", className: button2, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
|
|
8202
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { type: "button", className: button2, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
|
|
8203
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { type: "button", className: button2, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
|
|
8151
8204
|
] }),
|
|
8152
8205
|
target.mask && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
8153
8206
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
8154
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "flex justify-between text-
|
|
8207
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
8155
8208
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: "Density" }),
|
|
8156
8209
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "font-mono", children: [
|
|
8157
8210
|
Math.round((target.mask.density ?? 1) * 100),
|
|
@@ -8168,12 +8221,12 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
8168
8221
|
"aria-label": "Mask density",
|
|
8169
8222
|
value: Math.round((target.mask.density ?? 1) * 100),
|
|
8170
8223
|
onChange: (e) => controller.setAdjustmentLayerMaskProps(target.id, { density: Number(e.target.value) / 100 }),
|
|
8171
|
-
className:
|
|
8224
|
+
className: imageRangeClass
|
|
8172
8225
|
}
|
|
8173
8226
|
)
|
|
8174
8227
|
] }),
|
|
8175
8228
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
8176
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "flex justify-between text-
|
|
8229
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
8177
8230
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: "Mask Feather" }),
|
|
8178
8231
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "font-mono", children: [
|
|
8179
8232
|
target.mask.feather ?? 0,
|
|
@@ -8190,7 +8243,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
8190
8243
|
"aria-label": "Mask feather",
|
|
8191
8244
|
value: target.mask.feather ?? 0,
|
|
8192
8245
|
onChange: (e) => controller.setAdjustmentLayerMaskProps(target.id, { feather: Number(e.target.value) }),
|
|
8193
|
-
className:
|
|
8246
|
+
className: imageRangeClass
|
|
8194
8247
|
}
|
|
8195
8248
|
)
|
|
8196
8249
|
] })
|
|
@@ -8203,7 +8256,6 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
8203
8256
|
var import_react60 = require("react");
|
|
8204
8257
|
var import_image_editor16 = require("@pixerate/editor/image-editor");
|
|
8205
8258
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
8206
|
-
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"}`;
|
|
8207
8259
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
8208
8260
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
8209
8261
|
const [, setTick] = (0, import_react60.useState)(0);
|
|
@@ -8219,16 +8271,16 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
8219
8271
|
const v = Number(raw);
|
|
8220
8272
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
8221
8273
|
};
|
|
8222
|
-
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: `flex flex-wrap items-center gap-2 text-xs text-
|
|
8223
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor16.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className:
|
|
8224
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor16.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-
|
|
8274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: `flex flex-wrap items-center gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
|
|
8275
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor16.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: imageChipClass(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
|
|
8276
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor16.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-accent hover:bg-primary/90", onClick: () => tool.setReference(a) }, a)) }),
|
|
8225
8277
|
tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
8226
8278
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8227
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-
|
|
8228
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className:
|
|
8279
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
8280
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor16.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("option", { value: o.id, children: o.label }, o.id)) })
|
|
8229
8281
|
] }),
|
|
8230
8282
|
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8231
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-
|
|
8283
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
8232
8284
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8233
8285
|
"input",
|
|
8234
8286
|
{
|
|
@@ -8238,7 +8290,7 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
8238
8290
|
min: -100,
|
|
8239
8291
|
max: 100,
|
|
8240
8292
|
disabled: warp.style === "custom",
|
|
8241
|
-
className: "w-14 rounded border border-
|
|
8293
|
+
className: "w-14 rounded border border-border bg-background px-1 py-0.5 text-right disabled:opacity-40",
|
|
8242
8294
|
onBlur: (e) => warpNumber(k, e.currentTarget.value),
|
|
8243
8295
|
onKeyDown: (e) => {
|
|
8244
8296
|
if (e.key === "Enter") {
|
|
@@ -8250,7 +8302,7 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
8250
8302
|
},
|
|
8251
8303
|
`${k}:${warp[k]}`
|
|
8252
8304
|
),
|
|
8253
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-
|
|
8305
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-muted-foreground", children: "%" })
|
|
8254
8306
|
] }, k)),
|
|
8255
8307
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8256
8308
|
"button",
|
|
@@ -8259,13 +8311,13 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
8259
8311
|
title: "Bend along the vertical axis",
|
|
8260
8312
|
"aria-pressed": warp.orientation === "vertical",
|
|
8261
8313
|
disabled: warp.style === "custom",
|
|
8262
|
-
className:
|
|
8314
|
+
className: imageChipClass(warp.orientation === "vertical"),
|
|
8263
8315
|
onClick: () => tool.setWarp({ orientation: warp.orientation === "vertical" ? "horizontal" : "vertical" }),
|
|
8264
8316
|
children: "Vertical"
|
|
8265
8317
|
}
|
|
8266
8318
|
),
|
|
8267
8319
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8268
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-
|
|
8320
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
8269
8321
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8270
8322
|
"select",
|
|
8271
8323
|
{
|
|
@@ -8275,14 +8327,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
8275
8327
|
const g = import_image_editor16.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
|
|
8276
8328
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
8277
8329
|
},
|
|
8278
|
-
className:
|
|
8330
|
+
className: imageFieldClass,
|
|
8279
8331
|
children: import_image_editor16.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("option", { value: g.id, children: g.label }, g.id))
|
|
8280
8332
|
}
|
|
8281
8333
|
)
|
|
8282
8334
|
] })
|
|
8283
8335
|
] }),
|
|
8284
8336
|
tool.mode !== "warp" && import_image_editor16.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
8285
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-
|
|
8337
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-muted-foreground", children: f.label }),
|
|
8286
8338
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8287
8339
|
"input",
|
|
8288
8340
|
{
|
|
@@ -8291,7 +8343,7 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
8291
8343
|
defaultValue: round(bar[f.id], f.unit),
|
|
8292
8344
|
disabled: !bar.affine,
|
|
8293
8345
|
step: f.unit === "px" ? 1 : 0.1,
|
|
8294
|
-
className: "w-16 rounded border border-
|
|
8346
|
+
className: "w-16 rounded border border-border bg-background px-1 py-0.5 text-right disabled:opacity-40",
|
|
8295
8347
|
onBlur: (e) => apply(f.id, e.currentTarget.value),
|
|
8296
8348
|
onKeyDown: (e) => {
|
|
8297
8349
|
if (e.key === "Enter") {
|
|
@@ -8303,14 +8355,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
8303
8355
|
},
|
|
8304
8356
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
8305
8357
|
),
|
|
8306
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-
|
|
8358
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
|
|
8307
8359
|
f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8308
8360
|
"button",
|
|
8309
8361
|
{
|
|
8310
8362
|
type: "button",
|
|
8311
8363
|
"aria-label": "Keep width and height proportional",
|
|
8312
8364
|
"aria-pressed": tool.proportional,
|
|
8313
|
-
className:
|
|
8365
|
+
className: imageChipClass(tool.proportional),
|
|
8314
8366
|
onClick: () => {
|
|
8315
8367
|
tool.proportional = !tool.proportional;
|
|
8316
8368
|
setTick((n) => n + 1);
|
|
@@ -8320,21 +8372,21 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
8320
8372
|
)
|
|
8321
8373
|
] }, f.id)),
|
|
8322
8374
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8323
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-
|
|
8375
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
8324
8376
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8325
8377
|
"select",
|
|
8326
8378
|
{
|
|
8327
8379
|
"aria-label": "Interpolation",
|
|
8328
8380
|
value: tool.interpolation,
|
|
8329
8381
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
8330
|
-
className:
|
|
8382
|
+
className: imageFieldClass,
|
|
8331
8383
|
children: import_image_editor16.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
8332
8384
|
}
|
|
8333
8385
|
)
|
|
8334
8386
|
] }),
|
|
8335
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-
|
|
8336
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("button", { type: "button", title: "Cancel (Esc)", className:
|
|
8337
|
-
tool.error && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { role: "alert", className: "text-
|
|
8387
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90", onClick: () => tool.commit(), children: "Commit" }),
|
|
8388
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
8389
|
+
tool.error && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
8338
8390
|
] });
|
|
8339
8391
|
};
|
|
8340
8392
|
|
|
@@ -8342,7 +8394,6 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
8342
8394
|
var import_react61 = require("react");
|
|
8343
8395
|
var import_image_editor17 = require("@pixerate/editor/image-editor");
|
|
8344
8396
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
8345
|
-
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"}`;
|
|
8346
8397
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
8347
8398
|
const [, setTick] = (0, import_react61.useState)(0);
|
|
8348
8399
|
(0, import_react61.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -8360,8 +8411,8 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
8360
8411
|
}
|
|
8361
8412
|
};
|
|
8362
8413
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
8363
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-
|
|
8364
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor17.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className:
|
|
8414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
8415
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor17.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor17.SHAPE_KIND_LABELS[k] }, k)) }),
|
|
8365
8416
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
8366
8417
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8367
8418
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("input", { type: "checkbox", "aria-label": "Fill", checked: options.fill !== null, onChange: (e) => set({ fill: e.target.checked ? "#4f46e5" : null }) }),
|
|
@@ -8374,7 +8425,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
8374
8425
|
disabled: options.fill === null,
|
|
8375
8426
|
value: options.fill ?? "#4f46e5",
|
|
8376
8427
|
onChange: (e) => set({ fill: e.target.value }),
|
|
8377
|
-
className:
|
|
8428
|
+
className: imageColorInputClass
|
|
8378
8429
|
}
|
|
8379
8430
|
)
|
|
8380
8431
|
] }),
|
|
@@ -8389,7 +8440,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
8389
8440
|
disabled: options.stroke === null,
|
|
8390
8441
|
value: options.stroke ?? "#000000",
|
|
8391
8442
|
onChange: (e) => set({ stroke: e.target.value }),
|
|
8392
|
-
className:
|
|
8443
|
+
className: imageColorInputClass
|
|
8393
8444
|
}
|
|
8394
8445
|
)
|
|
8395
8446
|
] }),
|
|
@@ -8404,7 +8455,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
8404
8455
|
max: 200,
|
|
8405
8456
|
value: options.strokeWidth,
|
|
8406
8457
|
onChange: (e) => set({ strokeWidth: num(e.target.value, 0, 200) }),
|
|
8407
|
-
className:
|
|
8458
|
+
className: `w-14 ${imageFieldClass}`
|
|
8408
8459
|
}
|
|
8409
8460
|
)
|
|
8410
8461
|
] })
|
|
@@ -8412,16 +8463,16 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
8412
8463
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
8413
8464
|
options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8414
8465
|
"Radius",
|
|
8415
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.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:
|
|
8466
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("input", { type: "number", "aria-label": "Corner radius", min: 0, max: 1e3, value: options.radius, onChange: (e) => set({ radius: num(e.target.value, 0, 1e3) }), className: `w-14 ${imageFieldClass}` })
|
|
8416
8467
|
] }),
|
|
8417
8468
|
options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8418
8469
|
"Sides",
|
|
8419
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.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:
|
|
8470
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("input", { type: "number", "aria-label": "Sides", min: 3, max: 100, value: options.sides, onChange: (e) => set({ sides: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
|
|
8420
8471
|
] }),
|
|
8421
8472
|
options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
8422
8473
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8423
8474
|
"Points",
|
|
8424
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.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:
|
|
8475
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("input", { type: "number", "aria-label": "Points", min: 3, max: 100, value: options.points, onChange: (e) => set({ points: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
|
|
8425
8476
|
] }),
|
|
8426
8477
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8427
8478
|
"Inner",
|
|
@@ -8435,7 +8486,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
8435
8486
|
step: 0.05,
|
|
8436
8487
|
value: options.innerRatio,
|
|
8437
8488
|
onChange: (e) => set({ innerRatio: Number(e.target.value) }),
|
|
8438
|
-
className: "accent-
|
|
8489
|
+
className: "accent-primary"
|
|
8439
8490
|
}
|
|
8440
8491
|
)
|
|
8441
8492
|
] })
|
|
@@ -8443,7 +8494,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
8443
8494
|
options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
8444
8495
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8445
8496
|
"Weight",
|
|
8446
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.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:
|
|
8497
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("input", { type: "number", "aria-label": "Line weight", min: 1, max: 200, value: options.weight, onChange: (e) => set({ weight: num(e.target.value, 1, 200) }), className: `w-14 ${imageFieldClass}` })
|
|
8447
8498
|
] }),
|
|
8448
8499
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8449
8500
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("input", { type: "checkbox", "aria-label": "Arrowhead", checked: options.arrow, onChange: (e) => set({ arrow: e.target.checked }) }),
|
|
@@ -8451,8 +8502,8 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
8451
8502
|
] })
|
|
8452
8503
|
] })
|
|
8453
8504
|
] }),
|
|
8454
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "text-[10px] text-
|
|
8455
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { role: "alert", className: "text-
|
|
8505
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Drag on the image to draw. Shift: square, circle or 45\xB0 line. Alt: from the centre." }),
|
|
8506
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
8456
8507
|
] });
|
|
8457
8508
|
};
|
|
8458
8509
|
|
|
@@ -8460,7 +8511,6 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
8460
8511
|
var import_react62 = require("react");
|
|
8461
8512
|
var import_image_editor18 = require("@pixerate/editor/image-editor");
|
|
8462
8513
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
8463
|
-
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"}`;
|
|
8464
8514
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
8465
8515
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
8466
8516
|
const [, setTick] = (0, import_react62.useState)(0);
|
|
@@ -8498,7 +8548,7 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
8498
8548
|
setError(e instanceof Error ? e.message : String(e));
|
|
8499
8549
|
}
|
|
8500
8550
|
};
|
|
8501
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-
|
|
8551
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
|
|
8502
8552
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
8503
8553
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8504
8554
|
"Font",
|
|
@@ -8509,7 +8559,7 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
8509
8559
|
"aria-label": "Font family",
|
|
8510
8560
|
value: shown.fontFamily,
|
|
8511
8561
|
onChange: (e) => e.target.value.trim() && style({ fontFamily: e.target.value }),
|
|
8512
|
-
className: "w-32 rounded border border-
|
|
8562
|
+
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
8513
8563
|
}
|
|
8514
8564
|
),
|
|
8515
8565
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("option", { value: f }, f)) })
|
|
@@ -8525,23 +8575,23 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
8525
8575
|
max: 2e3,
|
|
8526
8576
|
value: Math.round(shown.fontSize * 10) / 10,
|
|
8527
8577
|
onChange: (e) => Number(e.target.value) > 0 && style({ fontSize: Number(e.target.value) }),
|
|
8528
|
-
className: "w-16 rounded border border-
|
|
8578
|
+
className: "w-16 rounded border border-border bg-background px-1 py-0.5"
|
|
8529
8579
|
}
|
|
8530
8580
|
)
|
|
8531
8581
|
] }),
|
|
8532
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${
|
|
8533
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${
|
|
8534
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("input", { type: "color", "aria-label": "Text colour", value: shown.color, onChange: (e) => style({ color: e.target.value }), className:
|
|
8582
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${imageChipClass(shown.fontWeight >= 600)} font-bold`, onClick: () => style({ fontWeight: shown.fontWeight >= 600 ? 400 : 700 }), children: "B" }),
|
|
8583
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
8584
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("input", { type: "color", "aria-label": "Text colour", value: shown.color, onChange: (e) => style({ color: e.target.value }), className: imageColorInputClass })
|
|
8535
8585
|
] }),
|
|
8536
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor18.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("button", { type: "button", "aria-pressed": options.align === a, className:
|
|
8537
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "text-[10px] text-
|
|
8538
|
-
missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("p", { role: "status", className: "text-amber-
|
|
8586
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor18.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
8587
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text, drag for a paragraph box, click text to edit it. Esc finishes." }),
|
|
8588
|
+
missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
8539
8589
|
"Missing ",
|
|
8540
8590
|
missing.length === 1 ? "font" : "fonts",
|
|
8541
8591
|
": ",
|
|
8542
8592
|
missing.join(", ")
|
|
8543
8593
|
] }),
|
|
8544
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { role: "alert", className: "text-
|
|
8594
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
8545
8595
|
] });
|
|
8546
8596
|
};
|
|
8547
8597
|
|
|
@@ -8713,11 +8763,11 @@ var ImageEditor = ({
|
|
|
8713
8763
|
"div",
|
|
8714
8764
|
{
|
|
8715
8765
|
ref: rootRef,
|
|
8716
|
-
className:
|
|
8766
|
+
className: `${imageEditorFrameClass} ${className}`,
|
|
8717
8767
|
style,
|
|
8718
8768
|
children: [
|
|
8719
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className:
|
|
8720
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", {
|
|
8769
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: imageEditorHeaderClass, children: [
|
|
8770
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
|
|
8721
8771
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
8722
8772
|
"button",
|
|
8723
8773
|
{
|
|
@@ -8727,7 +8777,9 @@ var ImageEditor = ({
|
|
|
8727
8777
|
setActiveTab("crop");
|
|
8728
8778
|
editor.setTool("crop");
|
|
8729
8779
|
},
|
|
8730
|
-
|
|
8780
|
+
role: "tab",
|
|
8781
|
+
"aria-selected": activeTab === "crop",
|
|
8782
|
+
className: `${imageTabClass(activeTab === "crop")}`,
|
|
8731
8783
|
children: "Transform & Crop"
|
|
8732
8784
|
}
|
|
8733
8785
|
),
|
|
@@ -8740,7 +8792,9 @@ var ImageEditor = ({
|
|
|
8740
8792
|
setActiveTab("adjust");
|
|
8741
8793
|
editor.setTool("select");
|
|
8742
8794
|
},
|
|
8743
|
-
|
|
8795
|
+
role: "tab",
|
|
8796
|
+
"aria-selected": activeTab === "adjust",
|
|
8797
|
+
className: `${imageTabClass(activeTab === "adjust")}`,
|
|
8744
8798
|
children: "Adjustments"
|
|
8745
8799
|
}
|
|
8746
8800
|
),
|
|
@@ -8753,7 +8807,9 @@ var ImageEditor = ({
|
|
|
8753
8807
|
setActiveTab("layers");
|
|
8754
8808
|
editor.setTool("select");
|
|
8755
8809
|
},
|
|
8756
|
-
|
|
8810
|
+
role: "tab",
|
|
8811
|
+
"aria-selected": activeTab === "layers",
|
|
8812
|
+
className: `${imageTabClass(activeTab === "layers")}`,
|
|
8757
8813
|
children: "Layers"
|
|
8758
8814
|
}
|
|
8759
8815
|
),
|
|
@@ -8766,7 +8822,9 @@ var ImageEditor = ({
|
|
|
8766
8822
|
setActiveTab("paint");
|
|
8767
8823
|
editor.setTool("brush");
|
|
8768
8824
|
},
|
|
8769
|
-
|
|
8825
|
+
role: "tab",
|
|
8826
|
+
"aria-selected": activeTab === "paint",
|
|
8827
|
+
className: `${imageTabClass(activeTab === "paint")}`,
|
|
8770
8828
|
children: "Paint"
|
|
8771
8829
|
}
|
|
8772
8830
|
),
|
|
@@ -8779,7 +8837,9 @@ var ImageEditor = ({
|
|
|
8779
8837
|
setActiveTab("select");
|
|
8780
8838
|
editor.setTool("select");
|
|
8781
8839
|
},
|
|
8782
|
-
|
|
8840
|
+
role: "tab",
|
|
8841
|
+
"aria-selected": activeTab === "select",
|
|
8842
|
+
className: `${imageTabClass(activeTab === "select")}`,
|
|
8783
8843
|
children: "Select & Mask"
|
|
8784
8844
|
}
|
|
8785
8845
|
),
|
|
@@ -8792,7 +8852,9 @@ var ImageEditor = ({
|
|
|
8792
8852
|
setActiveTab("annotate");
|
|
8793
8853
|
editor.setTool("pen");
|
|
8794
8854
|
},
|
|
8795
|
-
|
|
8855
|
+
role: "tab",
|
|
8856
|
+
"aria-selected": activeTab === "annotate",
|
|
8857
|
+
className: `${imageTabClass(activeTab === "annotate")}`,
|
|
8796
8858
|
children: "Annotations"
|
|
8797
8859
|
}
|
|
8798
8860
|
),
|
|
@@ -8805,7 +8867,9 @@ var ImageEditor = ({
|
|
|
8805
8867
|
setActiveTab("depth");
|
|
8806
8868
|
editor.setTool("select");
|
|
8807
8869
|
},
|
|
8808
|
-
|
|
8870
|
+
role: "tab",
|
|
8871
|
+
"aria-selected": activeTab === "depth",
|
|
8872
|
+
className: `${imageTabClass(activeTab === "depth")}`,
|
|
8809
8873
|
children: "Depth Mask"
|
|
8810
8874
|
}
|
|
8811
8875
|
),
|
|
@@ -8818,7 +8882,9 @@ var ImageEditor = ({
|
|
|
8818
8882
|
setActiveTab("ai");
|
|
8819
8883
|
editor.setTool("select");
|
|
8820
8884
|
},
|
|
8821
|
-
|
|
8885
|
+
role: "tab",
|
|
8886
|
+
"aria-selected": activeTab === "ai",
|
|
8887
|
+
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
8822
8888
|
children: [
|
|
8823
8889
|
/* @__PURE__ */ (0, import_jsx_runtime43.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_runtime43.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" }) }),
|
|
8824
8890
|
"AI Tools"
|
|
@@ -8833,7 +8899,7 @@ var ImageEditor = ({
|
|
|
8833
8899
|
type: "button",
|
|
8834
8900
|
disabled: !editor.canUndo,
|
|
8835
8901
|
onClick: () => editor.undo(),
|
|
8836
|
-
className:
|
|
8902
|
+
className: imageHeaderButtonClass,
|
|
8837
8903
|
title: "Undo",
|
|
8838
8904
|
children: "\u21A9"
|
|
8839
8905
|
}
|
|
@@ -8844,7 +8910,7 @@ var ImageEditor = ({
|
|
|
8844
8910
|
type: "button",
|
|
8845
8911
|
disabled: !editor.canRedo,
|
|
8846
8912
|
onClick: () => editor.redo(),
|
|
8847
|
-
className:
|
|
8913
|
+
className: imageHeaderButtonClass,
|
|
8848
8914
|
title: "Redo",
|
|
8849
8915
|
children: "\u21AA"
|
|
8850
8916
|
}
|
|
@@ -8854,22 +8920,22 @@ var ImageEditor = ({
|
|
|
8854
8920
|
{
|
|
8855
8921
|
type: "button",
|
|
8856
8922
|
onClick: () => editor.reset(),
|
|
8857
|
-
className:
|
|
8923
|
+
className: `${imageHeaderButtonClass} px-2 text-muted-foreground`,
|
|
8858
8924
|
children: "Reset"
|
|
8859
8925
|
}
|
|
8860
8926
|
),
|
|
8861
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "h-4 w-px bg-
|
|
8927
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
8862
8928
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
8863
8929
|
"button",
|
|
8864
8930
|
{
|
|
8865
8931
|
type: "button",
|
|
8866
8932
|
onClick: () => editor.zoomOut(),
|
|
8867
|
-
className:
|
|
8933
|
+
className: imageHeaderButtonClass,
|
|
8868
8934
|
title: "Zoom Out",
|
|
8869
8935
|
children: "-"
|
|
8870
8936
|
}
|
|
8871
8937
|
),
|
|
8872
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "font-mono text-
|
|
8938
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
8873
8939
|
Math.round(state.zoom * 100),
|
|
8874
8940
|
"%"
|
|
8875
8941
|
] }),
|
|
@@ -8878,12 +8944,12 @@ var ImageEditor = ({
|
|
|
8878
8944
|
{
|
|
8879
8945
|
type: "button",
|
|
8880
8946
|
onClick: () => editor.zoomIn(),
|
|
8881
|
-
className:
|
|
8947
|
+
className: imageHeaderButtonClass,
|
|
8882
8948
|
title: "Zoom In",
|
|
8883
8949
|
children: "+"
|
|
8884
8950
|
}
|
|
8885
8951
|
),
|
|
8886
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "h-4 w-px bg-
|
|
8952
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
8887
8953
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
8888
8954
|
"button",
|
|
8889
8955
|
{
|
|
@@ -8891,7 +8957,7 @@ var ImageEditor = ({
|
|
|
8891
8957
|
onMouseDown: () => editor.setComparing(true),
|
|
8892
8958
|
onMouseUp: () => editor.setComparing(false),
|
|
8893
8959
|
onMouseLeave: () => editor.setComparing(false),
|
|
8894
|
-
className: "px-2.5 py-1.5 rounded-lg border border-
|
|
8960
|
+
className: "px-2.5 py-1.5 rounded-lg border border-border bg-background text-amber-600 hover:bg-muted select-none active:bg-amber-500/10",
|
|
8895
8961
|
children: "Hold Compare"
|
|
8896
8962
|
}
|
|
8897
8963
|
),
|
|
@@ -8900,14 +8966,14 @@ var ImageEditor = ({
|
|
|
8900
8966
|
{
|
|
8901
8967
|
type: "button",
|
|
8902
8968
|
onClick: handleExport,
|
|
8903
|
-
className:
|
|
8969
|
+
className: `${imagePrimaryButtonClass} px-4 py-1.5`,
|
|
8904
8970
|
children: "Export Image"
|
|
8905
8971
|
}
|
|
8906
8972
|
)
|
|
8907
8973
|
] })
|
|
8908
8974
|
] }),
|
|
8909
|
-
transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-
|
|
8910
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { role: "alert", className:
|
|
8975
|
+
transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
8976
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
8911
8977
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
8912
8978
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
8913
8979
|
ImageEditorCanvas,
|
|
@@ -8930,12 +8996,12 @@ var ImageEditor = ({
|
|
|
8930
8996
|
onPlaybackReveal,
|
|
8931
8997
|
chromeRoot: rootRef,
|
|
8932
8998
|
open: openPanel,
|
|
8933
|
-
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-
|
|
8999
|
+
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
8934
9000
|
}
|
|
8935
9001
|
),
|
|
8936
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className:
|
|
9002
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: imageSidebarClass, children: [
|
|
8937
9003
|
activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
8938
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className:
|
|
9004
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
8939
9005
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
8940
9006
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
8941
9007
|
"button",
|
|
@@ -8945,7 +9011,7 @@ var ImageEditor = ({
|
|
|
8945
9011
|
setActiveCropRatio(null);
|
|
8946
9012
|
editor.applyCropPreset(null);
|
|
8947
9013
|
},
|
|
8948
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === null && state.crop ? "bg-
|
|
9014
|
+
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === null && state.crop ? "bg-primary border-primary text-primary-foreground" : "bg-muted hover:bg-accent text-foreground border-border"}`,
|
|
8949
9015
|
children: "Freeform"
|
|
8950
9016
|
}
|
|
8951
9017
|
),
|
|
@@ -8957,7 +9023,7 @@ var ImageEditor = ({
|
|
|
8957
9023
|
setActiveCropRatio(1);
|
|
8958
9024
|
editor.applyCropPreset(1);
|
|
8959
9025
|
},
|
|
8960
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 1 ? "bg-
|
|
9026
|
+
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 1 ? "bg-primary border-primary text-primary-foreground" : "bg-muted hover:bg-accent text-foreground border-border"}`,
|
|
8961
9027
|
children: "1:1 Square"
|
|
8962
9028
|
}
|
|
8963
9029
|
),
|
|
@@ -8969,7 +9035,7 @@ var ImageEditor = ({
|
|
|
8969
9035
|
setActiveCropRatio(4 / 3);
|
|
8970
9036
|
editor.applyCropPreset(4 / 3);
|
|
8971
9037
|
},
|
|
8972
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 4 / 3 ? "bg-
|
|
9038
|
+
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 4 / 3 ? "bg-primary border-primary text-primary-foreground" : "bg-muted hover:bg-accent text-foreground border-border"}`,
|
|
8973
9039
|
children: "4:3 Standard"
|
|
8974
9040
|
}
|
|
8975
9041
|
),
|
|
@@ -8981,7 +9047,7 @@ var ImageEditor = ({
|
|
|
8981
9047
|
setActiveCropRatio(16 / 9);
|
|
8982
9048
|
editor.applyCropPreset(16 / 9);
|
|
8983
9049
|
},
|
|
8984
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 16 / 9 ? "bg-
|
|
9050
|
+
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 16 / 9 ? "bg-primary border-primary text-primary-foreground" : "bg-muted hover:bg-accent text-foreground border-border"}`,
|
|
8985
9051
|
children: "16:9 Wide"
|
|
8986
9052
|
}
|
|
8987
9053
|
),
|
|
@@ -8993,7 +9059,7 @@ var ImageEditor = ({
|
|
|
8993
9059
|
setActiveCropRatio(3 / 2);
|
|
8994
9060
|
editor.applyCropPreset(3 / 2);
|
|
8995
9061
|
},
|
|
8996
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 3 / 2 ? "bg-
|
|
9062
|
+
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 3 / 2 ? "bg-primary border-primary text-primary-foreground" : "bg-muted hover:bg-accent text-foreground border-border"}`,
|
|
8997
9063
|
children: "3:2 Photo"
|
|
8998
9064
|
}
|
|
8999
9065
|
),
|
|
@@ -9005,20 +9071,20 @@ var ImageEditor = ({
|
|
|
9005
9071
|
setActiveCropRatio(null);
|
|
9006
9072
|
editor.resetCrop();
|
|
9007
9073
|
},
|
|
9008
|
-
className: "px-2.5 py-2 rounded-lg bg-
|
|
9074
|
+
className: "px-2.5 py-2 rounded-lg bg-destructive/10 hover:bg-destructive/20 text-destructive border border-destructive/40 font-medium",
|
|
9009
9075
|
children: "Clear Crop"
|
|
9010
9076
|
}
|
|
9011
9077
|
)
|
|
9012
9078
|
] }),
|
|
9013
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className:
|
|
9014
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className:
|
|
9079
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: imageDividerClass }),
|
|
9080
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
9015
9081
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
9016
9082
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9017
9083
|
"button",
|
|
9018
9084
|
{
|
|
9019
9085
|
type: "button",
|
|
9020
9086
|
onClick: () => editor.rotate(-90),
|
|
9021
|
-
className: "px-3 py-2 rounded-lg bg-
|
|
9087
|
+
className: "px-3 py-2 rounded-lg bg-muted hover:bg-accent text-foreground border border-border",
|
|
9022
9088
|
children: "Rotate -90\xB0"
|
|
9023
9089
|
}
|
|
9024
9090
|
),
|
|
@@ -9027,7 +9093,7 @@ var ImageEditor = ({
|
|
|
9027
9093
|
{
|
|
9028
9094
|
type: "button",
|
|
9029
9095
|
onClick: () => editor.rotate(90),
|
|
9030
|
-
className: "px-3 py-2 rounded-lg bg-
|
|
9096
|
+
className: "px-3 py-2 rounded-lg bg-muted hover:bg-accent text-foreground border border-border",
|
|
9031
9097
|
children: "Rotate +90\xB0"
|
|
9032
9098
|
}
|
|
9033
9099
|
),
|
|
@@ -9036,7 +9102,7 @@ var ImageEditor = ({
|
|
|
9036
9102
|
{
|
|
9037
9103
|
type: "button",
|
|
9038
9104
|
onClick: () => editor.flipHorizontal(),
|
|
9039
|
-
className: `px-3 py-2 rounded-lg border transition-colors ${state.transform.flipH ? "bg-
|
|
9105
|
+
className: `px-3 py-2 rounded-lg border transition-colors ${state.transform.flipH ? "bg-primary border-primary text-primary-foreground" : "bg-muted border-border text-foreground hover:bg-accent"}`,
|
|
9040
9106
|
children: "Flip Horizontal"
|
|
9041
9107
|
}
|
|
9042
9108
|
),
|
|
@@ -9045,7 +9111,7 @@ var ImageEditor = ({
|
|
|
9045
9111
|
{
|
|
9046
9112
|
type: "button",
|
|
9047
9113
|
onClick: () => editor.flipVertical(),
|
|
9048
|
-
className: `px-3 py-2 rounded-lg border transition-colors ${state.transform.flipV ? "bg-
|
|
9114
|
+
className: `px-3 py-2 rounded-lg border transition-colors ${state.transform.flipV ? "bg-primary border-primary text-primary-foreground" : "bg-muted border-border text-foreground hover:bg-accent"}`,
|
|
9049
9115
|
children: "Flip Vertical"
|
|
9050
9116
|
}
|
|
9051
9117
|
)
|
|
@@ -9053,13 +9119,13 @@ var ImageEditor = ({
|
|
|
9053
9119
|
] }),
|
|
9054
9120
|
activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
9055
9121
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
9056
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className:
|
|
9122
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
9057
9123
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9058
9124
|
"button",
|
|
9059
9125
|
{
|
|
9060
9126
|
type: "button",
|
|
9061
9127
|
onClick: () => editor.resetAdjustments(),
|
|
9062
|
-
className: "text-[10px] text-
|
|
9128
|
+
className: "text-[10px] text-destructive hover:underline",
|
|
9063
9129
|
children: "Reset Sliders"
|
|
9064
9130
|
}
|
|
9065
9131
|
)
|
|
@@ -9078,7 +9144,7 @@ var ImageEditor = ({
|
|
|
9078
9144
|
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
9079
9145
|
"div",
|
|
9080
9146
|
{
|
|
9081
|
-
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-
|
|
9147
|
+
className: "flex items-center justify-between gap-2 rounded border border-amber-500/30 bg-amber-500/10 px-2 py-1.5 text-[10px] text-amber-600",
|
|
9082
9148
|
"data-testid": "image-editor-process-notice",
|
|
9083
9149
|
children: [
|
|
9084
9150
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
@@ -9095,7 +9161,7 @@ var ImageEditor = ({
|
|
|
9095
9161
|
}
|
|
9096
9162
|
)
|
|
9097
9163
|
] }, spec.id)),
|
|
9098
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className:
|
|
9164
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9099
9165
|
AdjustmentLayersPanel,
|
|
9100
9166
|
{
|
|
9101
9167
|
controller,
|
|
@@ -9105,82 +9171,82 @@ var ImageEditor = ({
|
|
|
9105
9171
|
) })
|
|
9106
9172
|
] }),
|
|
9107
9173
|
activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
9108
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className:
|
|
9174
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
9109
9175
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9110
9176
|
"button",
|
|
9111
9177
|
{
|
|
9112
9178
|
type: "button",
|
|
9113
9179
|
title: "Edit \u203A Free Transform (Ctrl/Cmd+T): the selected pixels, or the whole active layer",
|
|
9114
|
-
className:
|
|
9180
|
+
className: imageSmallButtonClass,
|
|
9115
9181
|
disabled: transformTool.active,
|
|
9116
9182
|
onClick: () => transformTool.begin(),
|
|
9117
9183
|
children: "Free Transform"
|
|
9118
9184
|
}
|
|
9119
9185
|
),
|
|
9120
9186
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(LayersPanel, { controller }),
|
|
9121
|
-
effectsShown && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ImageProviderEffectsPanel, { controller, className:
|
|
9122
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className:
|
|
9187
|
+
effectsShown && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
9188
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
9123
9189
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ColorProfilePanel, { controller })
|
|
9124
9190
|
] }),
|
|
9125
9191
|
activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
9126
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className:
|
|
9192
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
9127
9193
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BrushOptionsBar, { controller }),
|
|
9128
9194
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9129
9195
|
"button",
|
|
9130
9196
|
{
|
|
9131
9197
|
type: "button",
|
|
9132
9198
|
title: "Edit \u203A Free Transform (Ctrl/Cmd+T): the selected pixels, or the whole active layer",
|
|
9133
|
-
className: "px-2 py-1 rounded text-[11px] bg-
|
|
9199
|
+
className: "px-2 py-1 rounded text-[11px] bg-muted text-foreground hover:bg-accent hover:text-accent-foreground self-start",
|
|
9134
9200
|
disabled: transformTool.active,
|
|
9135
9201
|
onClick: () => transformTool.begin(),
|
|
9136
9202
|
children: "Free Transform"
|
|
9137
9203
|
}
|
|
9138
9204
|
),
|
|
9139
|
-
paintError && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { role: "alert", className: "text-
|
|
9140
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className:
|
|
9205
|
+
paintError && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
9206
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(LayersPanel, { controller }) })
|
|
9141
9207
|
] }),
|
|
9142
9208
|
activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
9143
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className:
|
|
9209
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
|
|
9144
9210
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9145
9211
|
"button",
|
|
9146
9212
|
{
|
|
9147
9213
|
type: "button",
|
|
9148
9214
|
"aria-pressed": state.activeTool === t,
|
|
9149
9215
|
onClick: () => editor.setTool(t),
|
|
9150
|
-
className: `py-1.5 px-2 rounded-lg font-medium border transition-colors ${state.activeTool === t ? "bg-
|
|
9216
|
+
className: `py-1.5 px-2 rounded-lg font-medium border transition-colors ${state.activeTool === t ? "bg-primary border-primary text-primary-foreground" : "bg-muted border-border text-foreground hover:bg-accent"}`,
|
|
9151
9217
|
children: t === "shape" ? "Shape" : "Type"
|
|
9152
9218
|
},
|
|
9153
9219
|
t
|
|
9154
9220
|
)) }),
|
|
9155
9221
|
state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
9156
9222
|
state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
|
|
9157
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-
|
|
9158
|
-
shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { role: "alert", className: "text-
|
|
9159
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className:
|
|
9160
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className:
|
|
9223
|
+
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-muted px-2 py-1 text-[11px] text-foreground hover:bg-accent", children: "Done editing text" }),
|
|
9224
|
+
shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
9225
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: imageDividerClass }),
|
|
9226
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
9161
9227
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9162
9228
|
"button",
|
|
9163
9229
|
{
|
|
9164
9230
|
type: "button",
|
|
9165
9231
|
onClick: () => editor.setTool(t),
|
|
9166
|
-
className: `py-1.5 px-2 rounded-lg font-medium capitalize border transition-colors ${state.activeTool === t ? "bg-
|
|
9232
|
+
className: `py-1.5 px-2 rounded-lg font-medium capitalize border transition-colors ${state.activeTool === t ? "bg-primary border-primary text-primary-foreground" : "bg-muted border-border text-foreground hover:bg-accent"}`,
|
|
9167
9233
|
children: t
|
|
9168
9234
|
},
|
|
9169
9235
|
t
|
|
9170
9236
|
)) }),
|
|
9171
9237
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
9172
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("label", { className: "text-
|
|
9238
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
9173
9239
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9174
9240
|
"input",
|
|
9175
9241
|
{
|
|
9176
9242
|
type: "color",
|
|
9177
9243
|
value: activeColor,
|
|
9178
9244
|
onChange: (e) => setActiveColor(e.target.value),
|
|
9179
|
-
className: "w-8 h-8 rounded border border-
|
|
9245
|
+
className: "w-8 h-8 rounded border border-border cursor-pointer bg-transparent"
|
|
9180
9246
|
}
|
|
9181
9247
|
),
|
|
9182
9248
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex-1 ml-2", children: [
|
|
9183
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex justify-between text-
|
|
9249
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
9184
9250
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Width:" }),
|
|
9185
9251
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "font-mono", children: [
|
|
9186
9252
|
strokeWidth,
|
|
@@ -9195,13 +9261,13 @@ var ImageEditor = ({
|
|
|
9195
9261
|
max: "20",
|
|
9196
9262
|
value: strokeWidth,
|
|
9197
9263
|
onChange: (e) => setStrokeWidth(Number(e.target.value)),
|
|
9198
|
-
className:
|
|
9264
|
+
className: imageRangeClass
|
|
9199
9265
|
}
|
|
9200
9266
|
)
|
|
9201
9267
|
] })
|
|
9202
9268
|
] }),
|
|
9203
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className:
|
|
9204
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className:
|
|
9269
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: imageDividerClass }),
|
|
9270
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
9205
9271
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex gap-2", children: [
|
|
9206
9272
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9207
9273
|
"input",
|
|
@@ -9211,7 +9277,7 @@ var ImageEditor = ({
|
|
|
9211
9277
|
value: textInput,
|
|
9212
9278
|
onChange: (e) => setTextInput(e.target.value),
|
|
9213
9279
|
onKeyDown: (e) => e.key === "Enter" && handleAddText(),
|
|
9214
|
-
className: "flex-1 bg-
|
|
9280
|
+
className: "flex-1 bg-background border border-border rounded-lg px-2.5 py-1.5 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:border-primary"
|
|
9215
9281
|
}
|
|
9216
9282
|
),
|
|
9217
9283
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
@@ -9219,12 +9285,12 @@ var ImageEditor = ({
|
|
|
9219
9285
|
{
|
|
9220
9286
|
type: "button",
|
|
9221
9287
|
onClick: handleAddText,
|
|
9222
|
-
className: "px-3 py-1.5 rounded-lg bg-
|
|
9288
|
+
className: "px-3 py-1.5 rounded-lg bg-primary hover:bg-primary/90 text-primary-foreground font-medium shadow",
|
|
9223
9289
|
children: "Add"
|
|
9224
9290
|
}
|
|
9225
9291
|
)
|
|
9226
9292
|
] }),
|
|
9227
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-center justify-between text-
|
|
9293
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
9228
9294
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Font Size:" }),
|
|
9229
9295
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "font-mono", children: [
|
|
9230
9296
|
fontSize,
|
|
@@ -9239,12 +9305,12 @@ var ImageEditor = ({
|
|
|
9239
9305
|
max: "72",
|
|
9240
9306
|
value: fontSize,
|
|
9241
9307
|
onChange: (e) => setFontSize(Number(e.target.value)),
|
|
9242
|
-
className:
|
|
9308
|
+
className: imageRangeClass
|
|
9243
9309
|
}
|
|
9244
9310
|
),
|
|
9245
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className:
|
|
9311
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: imageDividerClass }),
|
|
9246
9312
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
9247
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "text-
|
|
9313
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
9248
9314
|
"Layers (",
|
|
9249
9315
|
state.annotations.length,
|
|
9250
9316
|
")"
|
|
@@ -9254,7 +9320,7 @@ var ImageEditor = ({
|
|
|
9254
9320
|
{
|
|
9255
9321
|
type: "button",
|
|
9256
9322
|
onClick: () => editor.removeAnnotation(state.selectedAnnotationId),
|
|
9257
|
-
className: "text-
|
|
9323
|
+
className: "text-destructive hover:underline text-[11px]",
|
|
9258
9324
|
children: "Delete Selected"
|
|
9259
9325
|
}
|
|
9260
9326
|
),
|
|
@@ -9263,7 +9329,7 @@ var ImageEditor = ({
|
|
|
9263
9329
|
{
|
|
9264
9330
|
type: "button",
|
|
9265
9331
|
onClick: () => editor.clearAnnotations(),
|
|
9266
|
-
className: "text-
|
|
9332
|
+
className: "text-muted-foreground hover:text-foreground text-[11px]",
|
|
9267
9333
|
children: "Clear All"
|
|
9268
9334
|
}
|
|
9269
9335
|
)
|
|
@@ -9271,32 +9337,32 @@ var ImageEditor = ({
|
|
|
9271
9337
|
] }),
|
|
9272
9338
|
activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
9273
9339
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
9274
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className:
|
|
9340
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
9275
9341
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9276
9342
|
"button",
|
|
9277
9343
|
{
|
|
9278
9344
|
type: "button",
|
|
9279
9345
|
onClick: () => editor.resetDepthMask(),
|
|
9280
|
-
className: "text-[10px] text-
|
|
9346
|
+
className: "text-[10px] text-destructive hover:underline",
|
|
9281
9347
|
children: "Reset Mask"
|
|
9282
9348
|
}
|
|
9283
9349
|
)
|
|
9284
9350
|
] }),
|
|
9285
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-
|
|
9351
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
9286
9352
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9287
9353
|
"input",
|
|
9288
9354
|
{
|
|
9289
9355
|
type: "checkbox",
|
|
9290
9356
|
checked: state.depthMask.enabled,
|
|
9291
9357
|
onChange: (e) => editor.setDepthMask({ enabled: e.target.checked }),
|
|
9292
|
-
className: "rounded accent-
|
|
9358
|
+
className: "rounded accent-primary"
|
|
9293
9359
|
}
|
|
9294
9360
|
),
|
|
9295
9361
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Enable Depth / Alpha Mask" })
|
|
9296
9362
|
] }),
|
|
9297
9363
|
state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
9298
9364
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
|
|
9299
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("label", { className: "text-
|
|
9365
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
9300
9366
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9301
9367
|
"input",
|
|
9302
9368
|
{
|
|
@@ -9304,7 +9370,7 @@ var ImageEditor = ({
|
|
|
9304
9370
|
placeholder: "https://.../depthmap.png",
|
|
9305
9371
|
value: state.depthMask.maskSource || "",
|
|
9306
9372
|
onChange: (e) => editor.setDepthMask({ maskSource: e.target.value || null }),
|
|
9307
|
-
className: "w-full bg-
|
|
9373
|
+
className: "w-full bg-background border border-border rounded-lg px-2.5 py-1.5 text-xs text-foreground placeholder:text-muted-foreground"
|
|
9308
9374
|
}
|
|
9309
9375
|
)
|
|
9310
9376
|
] }),
|
|
@@ -9314,7 +9380,7 @@ var ImageEditor = ({
|
|
|
9314
9380
|
{
|
|
9315
9381
|
type: "button",
|
|
9316
9382
|
onClick: () => editor.setDepthMask({ mode: "threshold" }),
|
|
9317
|
-
className: `flex-1 py-1.5 rounded-lg border text-xs font-medium ${state.depthMask.mode === "threshold" ? "bg-
|
|
9383
|
+
className: `flex-1 py-1.5 rounded-lg border text-xs font-medium ${state.depthMask.mode === "threshold" ? "bg-primary border-primary text-primary-foreground" : "bg-muted border-border text-foreground"}`,
|
|
9318
9384
|
children: "Threshold Mode"
|
|
9319
9385
|
}
|
|
9320
9386
|
),
|
|
@@ -9323,13 +9389,13 @@ var ImageEditor = ({
|
|
|
9323
9389
|
{
|
|
9324
9390
|
type: "button",
|
|
9325
9391
|
onClick: () => editor.setDepthMask({ mode: "brightness" }),
|
|
9326
|
-
className: `flex-1 py-1.5 rounded-lg border text-xs font-medium ${state.depthMask.mode === "brightness" ? "bg-
|
|
9392
|
+
className: `flex-1 py-1.5 rounded-lg border text-xs font-medium ${state.depthMask.mode === "brightness" ? "bg-primary border-primary text-primary-foreground" : "bg-muted border-border text-foreground"}`,
|
|
9327
9393
|
children: "Brightness Mode"
|
|
9328
9394
|
}
|
|
9329
9395
|
)
|
|
9330
9396
|
] }),
|
|
9331
9397
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
|
|
9332
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex justify-between text-
|
|
9398
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
9333
9399
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Depth Start (Lower):" }),
|
|
9334
9400
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
9335
9401
|
] }),
|
|
@@ -9343,12 +9409,12 @@ var ImageEditor = ({
|
|
|
9343
9409
|
onChange: (e) => editor.setDepthMask({
|
|
9344
9410
|
depthRange: [Number(e.target.value), state.depthMask.depthRange[1]]
|
|
9345
9411
|
}),
|
|
9346
|
-
className:
|
|
9412
|
+
className: imageRangeClass
|
|
9347
9413
|
}
|
|
9348
9414
|
)
|
|
9349
9415
|
] }),
|
|
9350
9416
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
|
|
9351
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex justify-between text-
|
|
9417
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
9352
9418
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Depth Stop (Upper):" }),
|
|
9353
9419
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
9354
9420
|
] }),
|
|
@@ -9362,12 +9428,12 @@ var ImageEditor = ({
|
|
|
9362
9428
|
onChange: (e) => editor.setDepthMask({
|
|
9363
9429
|
depthRange: [state.depthMask.depthRange[0], Number(e.target.value)]
|
|
9364
9430
|
}),
|
|
9365
|
-
className:
|
|
9431
|
+
className: imageRangeClass
|
|
9366
9432
|
}
|
|
9367
9433
|
)
|
|
9368
9434
|
] }),
|
|
9369
9435
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
|
|
9370
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex justify-between text-
|
|
9436
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
9371
9437
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Softness:" }),
|
|
9372
9438
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
|
|
9373
9439
|
] }),
|
|
@@ -9379,18 +9445,18 @@ var ImageEditor = ({
|
|
|
9379
9445
|
max: "50",
|
|
9380
9446
|
value: state.depthMask.softness,
|
|
9381
9447
|
onChange: (e) => editor.setDepthMask({ softness: Number(e.target.value) }),
|
|
9382
|
-
className:
|
|
9448
|
+
className: imageRangeClass
|
|
9383
9449
|
}
|
|
9384
9450
|
)
|
|
9385
9451
|
] }),
|
|
9386
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-
|
|
9452
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
9387
9453
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9388
9454
|
"input",
|
|
9389
9455
|
{
|
|
9390
9456
|
type: "checkbox",
|
|
9391
9457
|
checked: state.depthMask.invert,
|
|
9392
9458
|
onChange: (e) => editor.setDepthMask({ invert: e.target.checked }),
|
|
9393
|
-
className: "rounded accent-
|
|
9459
|
+
className: "rounded accent-primary"
|
|
9394
9460
|
}
|
|
9395
9461
|
),
|
|
9396
9462
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Invert Mask" })
|
|
@@ -9408,14 +9474,14 @@ var ImageEditor = ({
|
|
|
9408
9474
|
quickMask: Boolean(state.quickMask)
|
|
9409
9475
|
}
|
|
9410
9476
|
),
|
|
9411
|
-
selectionError && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { role: "alert", className: "text-
|
|
9477
|
+
selectionError && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
9412
9478
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex gap-1", children: [
|
|
9413
9479
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9414
9480
|
"button",
|
|
9415
9481
|
{
|
|
9416
9482
|
type: "button",
|
|
9417
9483
|
title: "Select \u203A Transform Selection: the outline only",
|
|
9418
|
-
className:
|
|
9484
|
+
className: imageSmallButtonClass,
|
|
9419
9485
|
disabled: transformTool.active,
|
|
9420
9486
|
onClick: () => transformTool.begin({ content: "selection-outline" }),
|
|
9421
9487
|
children: "Transform Selection"
|
|
@@ -9426,7 +9492,7 @@ var ImageEditor = ({
|
|
|
9426
9492
|
{
|
|
9427
9493
|
type: "button",
|
|
9428
9494
|
title: "Edit \u203A Free Transform: the selected pixels of the active layer",
|
|
9429
|
-
className:
|
|
9495
|
+
className: imageSmallButtonClass,
|
|
9430
9496
|
disabled: transformTool.active,
|
|
9431
9497
|
onClick: () => transformTool.begin({ content: "selection" }),
|
|
9432
9498
|
children: "Free Transform Pixels"
|
|
@@ -9436,7 +9502,7 @@ var ImageEditor = ({
|
|
|
9436
9502
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers })
|
|
9437
9503
|
] }),
|
|
9438
9504
|
activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
9439
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: "flex items-center justify-between gap-2 text-
|
|
9505
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
9440
9506
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Results go to" }),
|
|
9441
9507
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
9442
9508
|
"select",
|
|
@@ -9444,7 +9510,7 @@ var ImageEditor = ({
|
|
|
9444
9510
|
"aria-label": "AI result target",
|
|
9445
9511
|
value: aiTarget,
|
|
9446
9512
|
onChange: (e) => setAiTarget(e.target.value),
|
|
9447
|
-
className:
|
|
9513
|
+
className: imageSelectClass,
|
|
9448
9514
|
children: [
|
|
9449
9515
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
9450
9516
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
|
|
@@ -9453,24 +9519,24 @@ var ImageEditor = ({
|
|
|
9453
9519
|
}
|
|
9454
9520
|
)
|
|
9455
9521
|
] }),
|
|
9456
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "p-3 rounded-lg bg-
|
|
9522
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
9457
9523
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
9458
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "font-semibold text-
|
|
9459
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("svg", { className: "w-3.5 h-3.5 text-
|
|
9524
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
9525
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime43.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" }) }),
|
|
9460
9526
|
"Background Removal"
|
|
9461
9527
|
] }),
|
|
9462
|
-
isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-
|
|
9528
|
+
isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Removing..." })
|
|
9463
9529
|
] }),
|
|
9464
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "text-
|
|
9530
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
9465
9531
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9466
9532
|
"button",
|
|
9467
9533
|
{
|
|
9468
9534
|
type: "button",
|
|
9469
9535
|
onClick: handleRemoveBackground,
|
|
9470
9536
|
disabled: isRemovingBg || isInpainting,
|
|
9471
|
-
className: "mt-1 px-3 py-2 rounded-lg bg-
|
|
9537
|
+
className: "mt-1 px-3 py-2 rounded-lg bg-primary hover:bg-primary/90 disabled:opacity-50 text-primary-foreground font-medium shadow transition-colors flex items-center justify-center gap-2",
|
|
9472
9538
|
children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
9473
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className:
|
|
9539
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: imageSpinnerClass }),
|
|
9474
9540
|
"Removing Background..."
|
|
9475
9541
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
9476
9542
|
/* @__PURE__ */ (0, import_jsx_runtime43.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_runtime43.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" }) }),
|
|
@@ -9479,20 +9545,20 @@ var ImageEditor = ({
|
|
|
9479
9545
|
}
|
|
9480
9546
|
)
|
|
9481
9547
|
] }),
|
|
9482
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "p-3 rounded-lg bg-
|
|
9548
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
9483
9549
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
9484
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "font-semibold text-
|
|
9485
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("svg", { className: "w-3.5 h-3.5 text-
|
|
9550
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
9551
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
9486
9552
|
/* @__PURE__ */ (0, import_jsx_runtime43.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" }),
|
|
9487
9553
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("path", { d: "m14 7 3 3" })
|
|
9488
9554
|
] }),
|
|
9489
9555
|
"Generative Inpainting"
|
|
9490
9556
|
] }),
|
|
9491
|
-
isInpainting && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-
|
|
9557
|
+
isInpainting && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Inpainting..." })
|
|
9492
9558
|
] }),
|
|
9493
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "text-
|
|
9559
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
|
|
9494
9560
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
9495
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-
|
|
9561
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
9496
9562
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9497
9563
|
"textarea",
|
|
9498
9564
|
{
|
|
@@ -9501,19 +9567,19 @@ var ImageEditor = ({
|
|
|
9501
9567
|
onChange: (e) => setInpaintPrompt(e.target.value),
|
|
9502
9568
|
placeholder: "e.g. replace sunglasses with steampunk goggles, remove person in background...",
|
|
9503
9569
|
rows: 3,
|
|
9504
|
-
className: "w-full bg-
|
|
9570
|
+
className: "w-full bg-background border border-border rounded-lg p-2 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:border-primary resize-none"
|
|
9505
9571
|
}
|
|
9506
9572
|
)
|
|
9507
9573
|
] }),
|
|
9508
9574
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
9509
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "text-
|
|
9575
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
9510
9576
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
9511
9577
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
9512
9578
|
"button",
|
|
9513
9579
|
{
|
|
9514
9580
|
type: "button",
|
|
9515
9581
|
onClick: () => setInpaintMaskMode("annotations"),
|
|
9516
|
-
className: `px-2 py-1.5 rounded border text-[11px] font-medium text-left transition-colors ${inpaintMaskMode === "annotations" ? "bg-
|
|
9582
|
+
className: `px-2 py-1.5 rounded border text-[11px] font-medium text-left transition-colors ${inpaintMaskMode === "annotations" ? "bg-primary/30 border-primary text-primary" : "bg-background border-border text-muted-foreground hover:text-foreground"}`,
|
|
9517
9583
|
children: [
|
|
9518
9584
|
"Drawn Shapes (",
|
|
9519
9585
|
state.annotations.length,
|
|
@@ -9526,7 +9592,7 @@ var ImageEditor = ({
|
|
|
9526
9592
|
{
|
|
9527
9593
|
type: "button",
|
|
9528
9594
|
onClick: () => setInpaintMaskMode("crop"),
|
|
9529
|
-
className: `px-2 py-1.5 rounded border text-[11px] font-medium text-left transition-colors ${inpaintMaskMode === "crop" ? "bg-
|
|
9595
|
+
className: `px-2 py-1.5 rounded border text-[11px] font-medium text-left transition-colors ${inpaintMaskMode === "crop" ? "bg-primary/30 border-primary text-primary" : "bg-background border-border text-muted-foreground hover:text-foreground"}`,
|
|
9530
9596
|
children: [
|
|
9531
9597
|
"Crop Box (",
|
|
9532
9598
|
state.crop ? "Selected" : "Full",
|
|
@@ -9542,9 +9608,9 @@ var ImageEditor = ({
|
|
|
9542
9608
|
type: "button",
|
|
9543
9609
|
onClick: handleInpaint,
|
|
9544
9610
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
9545
|
-
className: "mt-1 px-3 py-2 rounded-lg bg-
|
|
9611
|
+
className: "mt-1 px-3 py-2 rounded-lg bg-primary hover:bg-primary/90 disabled:opacity-50 text-primary-foreground font-medium shadow transition-colors flex items-center justify-center gap-2",
|
|
9546
9612
|
children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
9547
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className:
|
|
9613
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: imageSpinnerClass }),
|
|
9548
9614
|
"Generating Inpaint..."
|
|
9549
9615
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
9550
9616
|
/* @__PURE__ */ (0, import_jsx_runtime43.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_runtime43.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" }) }),
|
|
@@ -9553,8 +9619,8 @@ var ImageEditor = ({
|
|
|
9553
9619
|
}
|
|
9554
9620
|
)
|
|
9555
9621
|
] }),
|
|
9556
|
-
aiError && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "p-2.5 rounded-lg bg-
|
|
9557
|
-
aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-
|
|
9622
|
+
aiError && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
|
|
9623
|
+
aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
|
|
9558
9624
|
] })
|
|
9559
9625
|
] })
|
|
9560
9626
|
] })
|
|
@@ -10556,18 +10622,18 @@ var AssetMentionChips = ({
|
|
|
10556
10622
|
document.addEventListener("mousedown", onPointer);
|
|
10557
10623
|
return () => document.removeEventListener("mousedown", onPointer);
|
|
10558
10624
|
}, [open]);
|
|
10559
|
-
const pick = (
|
|
10625
|
+
const pick = (chip2, role) => {
|
|
10560
10626
|
setOpen(null);
|
|
10561
|
-
if (
|
|
10562
|
-
onChange((0, import_generation3.setMentionRoleInText)(content,
|
|
10627
|
+
if (chip2.start === void 0) return;
|
|
10628
|
+
onChange((0, import_generation3.setMentionRoleInText)(content, chip2.start, role));
|
|
10563
10629
|
};
|
|
10564
10630
|
if (chips.length === 0) return null;
|
|
10565
|
-
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { ref: rootRef, className: `flex flex-wrap gap-1.5 ${className}`, "data-asset-mention-chips": "", children: chips.map((
|
|
10566
|
-
const error =
|
|
10567
|
-
const warning =
|
|
10631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { ref: rootRef, className: `flex flex-wrap gap-1.5 ${className}`, "data-asset-mention-chips": "", children: chips.map((chip2) => {
|
|
10632
|
+
const error = chip2.issues.find((issue) => issue.severity === "error");
|
|
10633
|
+
const warning = chip2.issues.find((issue) => issue.severity === "warning");
|
|
10568
10634
|
const problem = error ?? warning;
|
|
10569
|
-
const isOpen = open ===
|
|
10570
|
-
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "relative inline-flex", "data-asset-chip":
|
|
10635
|
+
const isOpen = open === chip2.index;
|
|
10636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "relative inline-flex", "data-asset-chip": chip2.asset.id, children: [
|
|
10571
10637
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
10572
10638
|
"button",
|
|
10573
10639
|
{
|
|
@@ -10576,19 +10642,19 @@ var AssetMentionChips = ({
|
|
|
10576
10642
|
"aria-expanded": isOpen,
|
|
10577
10643
|
title: problem?.message,
|
|
10578
10644
|
"data-issue": problem?.code,
|
|
10579
|
-
onClick: () => setOpen(isOpen ? null :
|
|
10645
|
+
onClick: () => setOpen(isOpen ? null : chip2.index),
|
|
10580
10646
|
onKeyDown: (e) => {
|
|
10581
10647
|
if (e.key === "Escape") setOpen(null);
|
|
10582
10648
|
},
|
|
10583
10649
|
className: `inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs ${error ? "border-red-500/60" : warning ? "border-amber-500/60" : "border-border"} bg-muted/40 hover:bg-muted`,
|
|
10584
10650
|
children: [
|
|
10585
|
-
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { children: renderAsset ? renderAsset(
|
|
10651
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { children: renderAsset ? renderAsset(chip2) : `@${chip2.asset.label ?? chip2.handle}` }),
|
|
10586
10652
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
10587
10653
|
"span",
|
|
10588
10654
|
{
|
|
10589
|
-
className: `rounded px-1 text-[10px] uppercase tracking-wide ${
|
|
10590
|
-
"data-role-badge":
|
|
10591
|
-
children:
|
|
10655
|
+
className: `rounded px-1 text-[10px] uppercase tracking-wide ${chip2.role ? "bg-primary/15" : "opacity-60"}`,
|
|
10656
|
+
"data-role-badge": chip2.role ?? "",
|
|
10657
|
+
children: chip2.roleLabel ?? "No role"
|
|
10592
10658
|
}
|
|
10593
10659
|
)
|
|
10594
10660
|
]
|
|
@@ -10598,7 +10664,7 @@ var AssetMentionChips = ({
|
|
|
10598
10664
|
"div",
|
|
10599
10665
|
{
|
|
10600
10666
|
role: "listbox",
|
|
10601
|
-
"aria-label": `Role for ${
|
|
10667
|
+
"aria-label": `Role for ${chip2.asset.label ?? chip2.handle}`,
|
|
10602
10668
|
className: "absolute left-0 top-full z-50 mt-1 flex min-w-[12rem] flex-col rounded-md border border-border bg-background p-1 text-xs shadow-lg",
|
|
10603
10669
|
"data-role-picker": "",
|
|
10604
10670
|
onKeyDown: (e) => {
|
|
@@ -10610,10 +10676,10 @@ var AssetMentionChips = ({
|
|
|
10610
10676
|
{
|
|
10611
10677
|
type: "button",
|
|
10612
10678
|
role: "option",
|
|
10613
|
-
"aria-selected":
|
|
10679
|
+
"aria-selected": chip2.role === option.role,
|
|
10614
10680
|
"data-role-option": option.role,
|
|
10615
10681
|
title: option.description,
|
|
10616
|
-
onClick: () => pick(
|
|
10682
|
+
onClick: () => pick(chip2, option.role),
|
|
10617
10683
|
className: "flex items-center justify-between gap-2 rounded px-2 py-1 text-left hover:bg-muted",
|
|
10618
10684
|
children: [
|
|
10619
10685
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { children: option.label }),
|
|
@@ -10627,18 +10693,18 @@ var AssetMentionChips = ({
|
|
|
10627
10693
|
{
|
|
10628
10694
|
type: "button",
|
|
10629
10695
|
role: "option",
|
|
10630
|
-
"aria-selected": !
|
|
10696
|
+
"aria-selected": !chip2.role,
|
|
10631
10697
|
"data-role-option": "",
|
|
10632
|
-
onClick: () => pick(
|
|
10698
|
+
onClick: () => pick(chip2, null),
|
|
10633
10699
|
className: "rounded px-2 py-1 text-left opacity-70 hover:bg-muted",
|
|
10634
10700
|
children: "No role"
|
|
10635
10701
|
}
|
|
10636
10702
|
),
|
|
10637
|
-
|
|
10703
|
+
chip2.issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("ul", { className: "mt-1 border-t border-border px-2 pt-1 text-[10px]", "data-chip-issues": "", children: chip2.issues.map((issue, i) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("li", { className: issue.severity === "error" ? "text-red-500" : "text-amber-500", children: issue.message }, i)) })
|
|
10638
10704
|
]
|
|
10639
10705
|
}
|
|
10640
10706
|
)
|
|
10641
|
-
] }, `${
|
|
10707
|
+
] }, `${chip2.start}-${chip2.index}`);
|
|
10642
10708
|
}) });
|
|
10643
10709
|
};
|
|
10644
10710
|
|