@pixerate/editor-react 0.98.0 → 0.99.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-TFEKLNC7.js → chunk-EFF4YWJK.js} +390 -358
- 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-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 +397 -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 +437 -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
|
|
@@ -4714,11 +4724,11 @@ var ImageEditorCanvas = ({
|
|
|
4714
4724
|
// src/image-editor/ControlSlider.tsx
|
|
4715
4725
|
var import_image_editor3 = require("@pixerate/editor/image-editor");
|
|
4716
4726
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
4717
|
-
var ControlSlider = ({ spec, value, onChange, disabled, label }) => {
|
|
4727
|
+
var ControlSlider = ({ spec, value, onChange, disabled, label, className }) => {
|
|
4718
4728
|
const name = label ?? spec.label;
|
|
4719
4729
|
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-
|
|
4730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { "data-control-id": spec.id, className, children: [
|
|
4731
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
4722
4732
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: name }),
|
|
4723
4733
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "font-mono", children: (0, import_image_editor3.formatControlValue)(spec, value) })
|
|
4724
4734
|
] }),
|
|
@@ -4733,7 +4743,7 @@ var ControlSlider = ({ spec, value, onChange, disabled, label }) => {
|
|
|
4733
4743
|
disabled,
|
|
4734
4744
|
value,
|
|
4735
4745
|
onChange: (e) => onChange(Number(e.target.value)),
|
|
4736
|
-
className: "w-full accent-
|
|
4746
|
+
className: "w-full accent-primary disabled:opacity-40"
|
|
4737
4747
|
}
|
|
4738
4748
|
),
|
|
4739
4749
|
track && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "h-0.5 rounded-full opacity-70", style: { background: track } })
|
|
@@ -4768,7 +4778,7 @@ var Histogram = ({ histogram, channel = "rgb", height = 64, className = "", styl
|
|
|
4768
4778
|
role: "img",
|
|
4769
4779
|
"aria-label": histogram ? `Histogram of ${histogram.samples} pixels` : "Histogram (no data)",
|
|
4770
4780
|
"data-testid": "image-editor-histogram",
|
|
4771
|
-
className: `w-full rounded bg-
|
|
4781
|
+
className: `w-full rounded bg-muted/40 ${className}`,
|
|
4772
4782
|
style: { height, ...style },
|
|
4773
4783
|
children: [
|
|
4774
4784
|
paths.map(({ c, d }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d, fill: FILL[c], stroke: "none" }, c)),
|
|
@@ -4793,8 +4803,8 @@ var import_react42 = require("react");
|
|
|
4793
4803
|
var import_image_editor5 = require("@pixerate/editor/image-editor");
|
|
4794
4804
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
4795
4805
|
var BOX = 256;
|
|
4796
|
-
var STROKE = { master: "#e2e8f0", red: "#ef4444", green: "#22c55e", blue: "#3b82f6" };
|
|
4797
|
-
var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 200 }) => {
|
|
4806
|
+
var STROKE = { master: "var(--foreground, #e2e8f0)", red: "#ef4444", green: "#22c55e", blue: "#3b82f6" };
|
|
4807
|
+
var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 200, className = "" }) => {
|
|
4798
4808
|
const svgRef = (0, import_react42.useRef)(null);
|
|
4799
4809
|
const [drag, setDrag] = (0, import_react42.useState)(null);
|
|
4800
4810
|
const toBox = (e) => {
|
|
@@ -4835,7 +4845,7 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
4835
4845
|
role: "application",
|
|
4836
4846
|
"aria-label": `${channel} curve`,
|
|
4837
4847
|
"data-testid": "curves-editor",
|
|
4838
|
-
className:
|
|
4848
|
+
className: `rounded bg-muted/40 touch-none select-none cursor-crosshair ${className}`.trim(),
|
|
4839
4849
|
onPointerDown,
|
|
4840
4850
|
onPointerMove,
|
|
4841
4851
|
onPointerUp: () => setDrag(null),
|
|
@@ -4857,7 +4867,7 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
4857
4867
|
cx: b.x,
|
|
4858
4868
|
cy: b.y,
|
|
4859
4869
|
r: 5,
|
|
4860
|
-
fill: drag === i ? STROKE[channel] : "#0f172a",
|
|
4870
|
+
fill: drag === i ? STROKE[channel] : "var(--background, #0f172a)",
|
|
4861
4871
|
stroke: STROKE[channel],
|
|
4862
4872
|
strokeWidth: 2,
|
|
4863
4873
|
"aria-label": `Point ${p.input} to ${p.output}`
|
|
@@ -4870,6 +4880,28 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
4870
4880
|
);
|
|
4871
4881
|
};
|
|
4872
4882
|
|
|
4883
|
+
// src/image-editor/styles.ts
|
|
4884
|
+
var imageEditorFrameClass = "relative flex flex-col bg-background border border-border rounded-xl overflow-hidden shadow-sm text-foreground";
|
|
4885
|
+
var imageEditorHeaderClass = "flex flex-wrap items-center justify-between px-4 py-3 bg-muted/40 border-b border-border gap-3";
|
|
4886
|
+
var imageTabListClass = "flex items-center gap-1 bg-background p-1 rounded-lg border border-border text-xs";
|
|
4887
|
+
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"}`;
|
|
4888
|
+
var imageHeaderButtonClass = "p-1.5 rounded-lg border border-border bg-background text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed";
|
|
4889
|
+
var imagePrimaryButtonClass = "rounded-lg bg-primary hover:bg-primary/90 text-primary-foreground font-medium shadow transition-colors disabled:opacity-50";
|
|
4890
|
+
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]";
|
|
4891
|
+
var imageSectionTitleClass = "font-semibold text-foreground uppercase tracking-wider text-[11px]";
|
|
4892
|
+
var imageSectionClass = "border-t border-border pt-3";
|
|
4893
|
+
var imageDividerClass = "h-px bg-border my-1";
|
|
4894
|
+
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";
|
|
4895
|
+
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";
|
|
4896
|
+
var imageOutlineButtonClass = "rounded border border-border px-1.5 py-0.5 text-[11px] text-foreground hover:bg-muted disabled:opacity-40";
|
|
4897
|
+
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"}`;
|
|
4898
|
+
var imageFieldClass = "rounded border border-input bg-background px-1 py-0.5 text-foreground";
|
|
4899
|
+
var imageSelectClass = "rounded border border-input bg-background px-1.5 py-1 text-foreground";
|
|
4900
|
+
var imageColorInputClass = "h-6 w-8 rounded border border-border bg-transparent";
|
|
4901
|
+
var imageRangeClass = "w-full accent-primary";
|
|
4902
|
+
var imageErrorBannerClass = "border-b border-destructive/40 bg-destructive/10 px-4 py-1.5 text-xs text-destructive";
|
|
4903
|
+
var imageSpinnerClass = "w-3.5 h-3.5 border-2 border-primary-foreground/30 border-t-primary-foreground rounded-full animate-spin";
|
|
4904
|
+
|
|
4873
4905
|
// src/image-editor/AdjustmentLayersPanel.tsx
|
|
4874
4906
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4875
4907
|
var CHANNELS = [
|
|
@@ -4883,8 +4915,7 @@ var TONES = [
|
|
|
4883
4915
|
{ id: "midtones", label: "Midtones" },
|
|
4884
4916
|
{ id: "highlights", label: "Highlights" }
|
|
4885
4917
|
];
|
|
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"}`;
|
|
4918
|
+
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
4919
|
var HueRangeStrip = ({ bounds }) => {
|
|
4889
4920
|
const pts = Array.from({ length: 73 }, (_, i) => `${i / 72 * 360},${20 - (0, import_image_editor6.hueRangeWeight)({ bounds }, i * 5) * 18}`).join(" ");
|
|
4890
4921
|
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 +4924,7 @@ var HueRangeStrip = ({ bounds }) => {
|
|
|
4893
4924
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("polyline", { points: pts, fill: "none", stroke: "#fff", strokeWidth: 1.5 })
|
|
4894
4925
|
] });
|
|
4895
4926
|
};
|
|
4896
|
-
var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
4927
|
+
var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, className = "" }) => {
|
|
4897
4928
|
const follow = layersProp === void 0;
|
|
4898
4929
|
const [, setTick] = (0, import_react43.useState)(0);
|
|
4899
4930
|
(0, import_react43.useEffect)(() => follow ? controller.subscribe(() => setTick((n) => n + 1)) : void 0, [controller, follow]);
|
|
@@ -4917,14 +4948,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
4917
4948
|
spec.id
|
|
4918
4949
|
);
|
|
4919
4950
|
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-
|
|
4951
|
+
const checkbox = (layer, path, label) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4921
4952
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4922
4953
|
"input",
|
|
4923
4954
|
{
|
|
4924
4955
|
type: "checkbox",
|
|
4925
4956
|
checked: Boolean((0, import_image_editor6.getControlPath)(layer.params, path)),
|
|
4926
4957
|
onChange: (e) => setParam(layer, path, e.target.checked),
|
|
4927
|
-
className: "accent-
|
|
4958
|
+
className: "accent-primary"
|
|
4928
4959
|
}
|
|
4929
4960
|
),
|
|
4930
4961
|
label
|
|
@@ -4970,14 +5001,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
4970
5001
|
case "blackWhite":
|
|
4971
5002
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
4972
5003
|
controlsOf(layer).map((s) => slider(layer, s)),
|
|
4973
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
5004
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4974
5005
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4975
5006
|
"input",
|
|
4976
5007
|
{
|
|
4977
5008
|
type: "checkbox",
|
|
4978
5009
|
checked: layer.params.tint !== null,
|
|
4979
5010
|
onChange: (e) => setParam(layer, "tint", e.target.checked ? "#e1d3b3" : null),
|
|
4980
|
-
className: "accent-
|
|
5011
|
+
className: "accent-primary"
|
|
4981
5012
|
}
|
|
4982
5013
|
),
|
|
4983
5014
|
"Tint",
|
|
@@ -4995,7 +5026,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
4995
5026
|
] });
|
|
4996
5027
|
case "photoFilter":
|
|
4997
5028
|
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-
|
|
5029
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4999
5030
|
"Filter colour",
|
|
5000
5031
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5001
5032
|
"input",
|
|
@@ -5012,19 +5043,19 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
5012
5043
|
checkbox(layer, "preserveLuminosity", "Preserve luminosity")
|
|
5013
5044
|
] });
|
|
5014
5045
|
case "invert":
|
|
5015
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-
|
|
5046
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-muted-foreground text-[11px]", children: "Invert has no settings." });
|
|
5016
5047
|
default:
|
|
5017
5048
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex flex-col gap-2", children: controlsOf(layer).map((s) => slider(layer, s)) });
|
|
5018
5049
|
}
|
|
5019
5050
|
};
|
|
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:
|
|
5051
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: `flex flex-col gap-2 text-xs ${className}`.trim(), "data-testid": "adjustment-layers-panel", children: [
|
|
5052
|
+
/* @__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
5053
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-1.5", children: [
|
|
5023
5054
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5024
5055
|
"select",
|
|
5025
5056
|
{
|
|
5026
5057
|
"aria-label": "New adjustment layer kind",
|
|
5027
|
-
className: `${
|
|
5058
|
+
className: `${imageSelectClass} flex-1`,
|
|
5028
5059
|
value: newKind,
|
|
5029
5060
|
onChange: (e) => setNewKind(e.target.value),
|
|
5030
5061
|
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 +5065,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
5034
5065
|
"button",
|
|
5035
5066
|
{
|
|
5036
5067
|
type: "button",
|
|
5037
|
-
className: "px-2 py-1 rounded bg-
|
|
5068
|
+
className: "px-2 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90",
|
|
5038
5069
|
onClick: () => {
|
|
5039
5070
|
setSelectedId(controller.addAdjustmentLayer(newKind));
|
|
5040
5071
|
setChannel("master");
|
|
@@ -5050,7 +5081,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
5050
5081
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
5051
5082
|
"li",
|
|
5052
5083
|
{
|
|
5053
|
-
className: `flex items-center gap-1.5 rounded px-1.5 py-1 ${layer.id === selectedId ? "bg-
|
|
5084
|
+
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
5085
|
children: [
|
|
5055
5086
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5056
5087
|
"input",
|
|
@@ -5059,14 +5090,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
5059
5090
|
"aria-label": `Show ${label}`,
|
|
5060
5091
|
checked: layer.enabled,
|
|
5061
5092
|
onChange: () => controller.toggleAdjustmentLayer(layer.id),
|
|
5062
|
-
className: "accent-
|
|
5093
|
+
className: "accent-primary"
|
|
5063
5094
|
}
|
|
5064
5095
|
),
|
|
5065
5096
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5066
5097
|
"button",
|
|
5067
5098
|
{
|
|
5068
5099
|
type: "button",
|
|
5069
|
-
className: `flex-1 text-left truncate ${layer.enabled ? "text-
|
|
5100
|
+
className: `flex-1 text-left truncate ${layer.enabled ? "text-foreground" : "text-muted-foreground line-through"}`,
|
|
5070
5101
|
onClick: () => setSelectedId(layer.id === selectedId ? null : layer.id),
|
|
5071
5102
|
"aria-pressed": layer.id === selectedId,
|
|
5072
5103
|
children: label
|
|
@@ -5079,7 +5110,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
5079
5110
|
"aria-label": `Move ${label} up`,
|
|
5080
5111
|
disabled: index === layers.length - 1,
|
|
5081
5112
|
onClick: () => controller.moveAdjustmentLayer(layer.id, index + 1),
|
|
5082
|
-
className: "px-1 text-
|
|
5113
|
+
className: "px-1 text-muted-foreground hover:text-foreground disabled:opacity-30",
|
|
5083
5114
|
children: "\u2191"
|
|
5084
5115
|
}
|
|
5085
5116
|
),
|
|
@@ -5090,7 +5121,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
5090
5121
|
"aria-label": `Move ${label} down`,
|
|
5091
5122
|
disabled: index === 0,
|
|
5092
5123
|
onClick: () => controller.moveAdjustmentLayer(layer.id, index - 1),
|
|
5093
|
-
className: "px-1 text-
|
|
5124
|
+
className: "px-1 text-muted-foreground hover:text-foreground disabled:opacity-30",
|
|
5094
5125
|
children: "\u2193"
|
|
5095
5126
|
}
|
|
5096
5127
|
),
|
|
@@ -5103,7 +5134,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
5103
5134
|
controller.removeAdjustmentLayer(layer.id);
|
|
5104
5135
|
if (selectedId === layer.id) setSelectedId(null);
|
|
5105
5136
|
},
|
|
5106
|
-
className: "px-1 text-
|
|
5137
|
+
className: "px-1 text-destructive hover:text-destructive",
|
|
5107
5138
|
children: "\u2715"
|
|
5108
5139
|
}
|
|
5109
5140
|
)
|
|
@@ -5112,14 +5143,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
5112
5143
|
layer.id
|
|
5113
5144
|
);
|
|
5114
5145
|
}) }),
|
|
5115
|
-
selected && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-2 rounded border border-
|
|
5146
|
+
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
5147
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
5117
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-
|
|
5148
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-muted-foreground", children: "Blend" }),
|
|
5118
5149
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5119
5150
|
"select",
|
|
5120
5151
|
{
|
|
5121
5152
|
"aria-label": "Blend mode",
|
|
5122
|
-
className: `${
|
|
5153
|
+
className: `${imageSelectClass} flex-1`,
|
|
5123
5154
|
value: selected.blend,
|
|
5124
5155
|
onChange: (e) => controller.updateAdjustmentLayer(selected.id, { blend: e.target.value }),
|
|
5125
5156
|
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 +5178,6 @@ var import_react45 = require("react");
|
|
|
5147
5178
|
var import_react44 = require("react");
|
|
5148
5179
|
var import_image_editor7 = require("@pixerate/editor/image-editor");
|
|
5149
5180
|
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
5181
|
var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
5152
5182
|
const [, setTick] = (0, import_react44.useState)(0);
|
|
5153
5183
|
(0, import_react44.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -5171,7 +5201,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
5171
5201
|
onKeyDown: () => commitNext.current = true
|
|
5172
5202
|
};
|
|
5173
5203
|
if (!model.available || !id) {
|
|
5174
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `text-xs text-
|
|
5204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `text-xs text-muted-foreground ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
|
|
5175
5205
|
}
|
|
5176
5206
|
const effects = controller.getLayerEffects(id);
|
|
5177
5207
|
const patterns = controller.getDocumentPatterns();
|
|
@@ -5187,7 +5217,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
5187
5217
|
const k = c.percent ? 100 : 1;
|
|
5188
5218
|
const shown = Math.round(c.value * k * 100) / 100;
|
|
5189
5219
|
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-
|
|
5220
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
5191
5221
|
label,
|
|
5192
5222
|
" ",
|
|
5193
5223
|
shown,
|
|
@@ -5205,24 +5235,24 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
5205
5235
|
disabled: model.readOnly,
|
|
5206
5236
|
...sliderEvents,
|
|
5207
5237
|
onChange: (e) => change(effectId, c, Number(e.target.value) / k, true),
|
|
5208
|
-
className: "accent-
|
|
5238
|
+
className: "accent-primary"
|
|
5209
5239
|
}
|
|
5210
5240
|
)
|
|
5211
5241
|
] }, c.key);
|
|
5212
5242
|
}
|
|
5213
5243
|
case "color":
|
|
5214
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1.5 text-
|
|
5244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
5215
5245
|
/* @__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
5246
|
label
|
|
5217
5247
|
] }, c.key);
|
|
5218
5248
|
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-
|
|
5249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
5250
|
+
/* @__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
5251
|
label
|
|
5222
5252
|
] }, c.key);
|
|
5223
5253
|
case "select":
|
|
5224
5254
|
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-
|
|
5255
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: label }),
|
|
5226
5256
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5227
5257
|
"select",
|
|
5228
5258
|
{
|
|
@@ -5230,17 +5260,17 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
5230
5260
|
value: c.value,
|
|
5231
5261
|
disabled: model.readOnly,
|
|
5232
5262
|
onChange: (e) => change(effectId, c, e.target.value),
|
|
5233
|
-
className:
|
|
5263
|
+
className: imageSelectClass,
|
|
5234
5264
|
children: c.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: o.value, children: o.label }, o.value))
|
|
5235
5265
|
}
|
|
5236
5266
|
)
|
|
5237
5267
|
] }, c.key);
|
|
5238
5268
|
}
|
|
5239
5269
|
};
|
|
5240
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-
|
|
5270
|
+
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
5271
|
/* @__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-
|
|
5272
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "font-semibold text-foreground", children: "fx Effects" }),
|
|
5273
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
|
|
5244
5274
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5245
5275
|
"input",
|
|
5246
5276
|
{
|
|
@@ -5249,12 +5279,12 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
5249
5279
|
checked: model.enabled,
|
|
5250
5280
|
disabled: model.readOnly,
|
|
5251
5281
|
onChange: (e) => attempt(() => controller.setLayerEffectsEnabled(id, e.target.checked)),
|
|
5252
|
-
className: "accent-
|
|
5282
|
+
className: "accent-primary"
|
|
5253
5283
|
}
|
|
5254
5284
|
),
|
|
5255
5285
|
"On"
|
|
5256
5286
|
] }),
|
|
5257
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1 text-
|
|
5287
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
5258
5288
|
"Scale",
|
|
5259
5289
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5260
5290
|
"input",
|
|
@@ -5270,7 +5300,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
5270
5300
|
const v = Number(e.target.value);
|
|
5271
5301
|
if (v >= 1 && v <= 1e3) attempt(() => controller.setLayerEffectsEnabled(id, model.enabled, v / 100));
|
|
5272
5302
|
},
|
|
5273
|
-
className: "w-14 bg-
|
|
5303
|
+
className: "w-14 bg-muted border border-border rounded px-1"
|
|
5274
5304
|
}
|
|
5275
5305
|
),
|
|
5276
5306
|
"%"
|
|
@@ -5286,7 +5316,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
5286
5316
|
if (!kind) return;
|
|
5287
5317
|
attempt(() => setOpen(controller.addLayerEffect(id, kind).effect.id));
|
|
5288
5318
|
},
|
|
5289
|
-
className:
|
|
5319
|
+
className: imageSelectClass,
|
|
5290
5320
|
children: [
|
|
5291
5321
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "", children: "Add effect\u2026" }),
|
|
5292
5322
|
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 +5324,11 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
5294
5324
|
}
|
|
5295
5325
|
)
|
|
5296
5326
|
] }),
|
|
5297
|
-
model.readOnly && model.reason && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-
|
|
5327
|
+
model.readOnly && model.reason && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-muted-foreground", children: model.reason }),
|
|
5298
5328
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Effects", children: model.rows.map((row) => {
|
|
5299
5329
|
const effect = effects.items.find((e) => e.id === row.id);
|
|
5300
5330
|
const expanded = open === row.id;
|
|
5301
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("li", { "data-effect-id": row.id, className: "rounded bg-
|
|
5331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("li", { "data-effect-id": row.id, className: "rounded bg-background/60 ring-1 ring-border", children: [
|
|
5302
5332
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
|
|
5303
5333
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5304
5334
|
"input",
|
|
@@ -5308,7 +5338,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
5308
5338
|
checked: row.enabled,
|
|
5309
5339
|
disabled: model.readOnly,
|
|
5310
5340
|
onChange: (e) => attempt(() => controller.updateLayerEffect(id, row.id, { enabled: e.target.checked })),
|
|
5311
|
-
className: "accent-
|
|
5341
|
+
className: "accent-primary"
|
|
5312
5342
|
}
|
|
5313
5343
|
),
|
|
5314
5344
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
@@ -5316,25 +5346,24 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
5316
5346
|
{
|
|
5317
5347
|
type: "button",
|
|
5318
5348
|
"aria-expanded": expanded,
|
|
5319
|
-
className: `flex-1 text-left ${row.enabled && model.enabled ? "" : "text-
|
|
5349
|
+
className: `flex-1 text-left ${row.enabled && model.enabled ? "" : "text-muted-foreground"}`,
|
|
5320
5350
|
onClick: () => setOpen(expanded ? null : row.id),
|
|
5321
5351
|
children: row.label
|
|
5322
5352
|
}
|
|
5323
5353
|
),
|
|
5324
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className:
|
|
5354
|
+
/* @__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
5355
|
] }),
|
|
5326
5356
|
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
5357
|
] }, row.id);
|
|
5328
5358
|
}) }),
|
|
5329
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { role: "alert", className: "text-
|
|
5359
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
5330
5360
|
] });
|
|
5331
5361
|
};
|
|
5332
5362
|
|
|
5333
5363
|
// src/image-editor/LayersPanel.tsx
|
|
5334
5364
|
var import_image_editor8 = require("@pixerate/editor/image-editor");
|
|
5335
5365
|
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"}`;
|
|
5366
|
+
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
5367
|
var Thumbnail = ({
|
|
5339
5368
|
pixels,
|
|
5340
5369
|
size,
|
|
@@ -5363,7 +5392,7 @@ var Thumbnail = ({
|
|
|
5363
5392
|
"data-testid": testId,
|
|
5364
5393
|
onClick,
|
|
5365
5394
|
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-
|
|
5395
|
+
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
5396
|
}
|
|
5368
5397
|
);
|
|
5369
5398
|
};
|
|
@@ -5422,18 +5451,18 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5422
5451
|
const thumb = (layer) => (0, import_image_editor8.layerHasThumbnail)(layer) ? controller.getLayerThumbnail(layer.id, { maxSide: 64 }) : null;
|
|
5423
5452
|
const maskThumb = (layer) => layer.mask && !layer.mask.source ? controller.getLayerThumbnail(layer.id, { maxSide: 64, mask: true }) : null;
|
|
5424
5453
|
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-
|
|
5454
|
+
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
5455
|
/* @__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:
|
|
5456
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-layer"), children: "New Layer" }),
|
|
5457
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-group"), children: "New Group" }),
|
|
5458
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("duplicate"), children: "Duplicate" }),
|
|
5459
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("add-mask"), children: "Add Mask" }),
|
|
5460
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("delete"), children: "Delete" }),
|
|
5432
5461
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5433
5462
|
"button",
|
|
5434
5463
|
{
|
|
5435
5464
|
type: "button",
|
|
5436
|
-
className:
|
|
5465
|
+
className: imageIconButtonClass,
|
|
5437
5466
|
"aria-label": "Layer menu",
|
|
5438
5467
|
"aria-haspopup": "menu",
|
|
5439
5468
|
onClick: (e) => {
|
|
@@ -5449,15 +5478,15 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5449
5478
|
{
|
|
5450
5479
|
"aria-label": "Bits per channel",
|
|
5451
5480
|
title: "Image \u203A Mode: bits per channel",
|
|
5452
|
-
className: "rounded bg-
|
|
5481
|
+
className: "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground",
|
|
5453
5482
|
value: controller.bitDepth,
|
|
5454
5483
|
onChange: (e) => attempt(() => controller.setBitDepth(Number(e.target.value))),
|
|
5455
5484
|
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
5485
|
}
|
|
5457
5486
|
),
|
|
5458
5487
|
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:
|
|
5488
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => fileInput.current?.click(), children: "Open PSD\u2026" }),
|
|
5489
|
+
/* @__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
5490
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5462
5491
|
"input",
|
|
5463
5492
|
{
|
|
@@ -5476,13 +5505,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5476
5505
|
)
|
|
5477
5506
|
] })
|
|
5478
5507
|
] }),
|
|
5479
|
-
psdNotes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("ul", { className: "rounded bg-amber-
|
|
5508
|
+
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
5509
|
psdNotes.map((n) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("li", { children: n }, n)),
|
|
5481
5510
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: "underline", onClick: () => setPsdNotes([]), children: "Dismiss" }) })
|
|
5482
5511
|
] }),
|
|
5483
5512
|
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
5513
|
/* @__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-
|
|
5514
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
5486
5515
|
"Opacity ",
|
|
5487
5516
|
Math.round(active.opacity * 100),
|
|
5488
5517
|
"%"
|
|
@@ -5497,12 +5526,12 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5497
5526
|
value: Math.round(active.opacity * 100),
|
|
5498
5527
|
...sliderEvents,
|
|
5499
5528
|
onChange: (e) => prop("opacity", Number(e.target.value) / 100),
|
|
5500
|
-
className: "accent-
|
|
5529
|
+
className: "accent-primary"
|
|
5501
5530
|
}
|
|
5502
5531
|
)
|
|
5503
5532
|
] }),
|
|
5504
5533
|
/* @__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-
|
|
5534
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
5506
5535
|
"Fill ",
|
|
5507
5536
|
Math.round(((active.type === "pixel" ? active.fillOpacity : void 0) ?? 1) * 100),
|
|
5508
5537
|
"%"
|
|
@@ -5518,7 +5547,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5518
5547
|
value: Math.round(((active.type === "pixel" ? active.fillOpacity : void 0) ?? 1) * 100),
|
|
5519
5548
|
...sliderEvents,
|
|
5520
5549
|
onChange: (e) => prop("fillOpacity", Number(e.target.value) / 100),
|
|
5521
|
-
className: "accent-
|
|
5550
|
+
className: "accent-primary disabled:opacity-40"
|
|
5522
5551
|
}
|
|
5523
5552
|
)
|
|
5524
5553
|
] }),
|
|
@@ -5526,7 +5555,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5526
5555
|
"select",
|
|
5527
5556
|
{
|
|
5528
5557
|
"aria-label": "Layer blend mode",
|
|
5529
|
-
className:
|
|
5558
|
+
className: imageSelectClass,
|
|
5530
5559
|
value: active.blend,
|
|
5531
5560
|
onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { blend: e.target.value })),
|
|
5532
5561
|
children: [
|
|
@@ -5535,7 +5564,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5535
5564
|
]
|
|
5536
5565
|
}
|
|
5537
5566
|
),
|
|
5538
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1.5 text-
|
|
5567
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
5539
5568
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5540
5569
|
"input",
|
|
5541
5570
|
{
|
|
@@ -5543,12 +5572,12 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5543
5572
|
"aria-label": "Clip to layer below",
|
|
5544
5573
|
checked: Boolean(active.clipped),
|
|
5545
5574
|
onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { clipped: e.target.checked })),
|
|
5546
|
-
className: "accent-
|
|
5575
|
+
className: "accent-primary"
|
|
5547
5576
|
}
|
|
5548
5577
|
),
|
|
5549
5578
|
"Clip to below"
|
|
5550
5579
|
] }),
|
|
5551
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "col-span-2 flex flex-wrap gap-2 text-
|
|
5580
|
+
/* @__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
5581
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5553
5582
|
"input",
|
|
5554
5583
|
{
|
|
@@ -5556,13 +5585,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5556
5585
|
"aria-label": `Lock ${k}`,
|
|
5557
5586
|
checked: Boolean(active.locks?.[k]),
|
|
5558
5587
|
onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { locks: { ...active.locks, [k]: e.target.checked } })),
|
|
5559
|
-
className: "accent-
|
|
5588
|
+
className: "accent-primary"
|
|
5560
5589
|
}
|
|
5561
5590
|
),
|
|
5562
5591
|
k
|
|
5563
5592
|
] }, k)) })
|
|
5564
5593
|
] }),
|
|
5565
|
-
effects && active && active.type !== "adjustment" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(LayerEffectsPanel, { controller, className: "border-t border-
|
|
5594
|
+
effects && active && active.type !== "adjustment" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(LayerEffectsPanel, { controller, className: "border-t border-border pt-1.5" }),
|
|
5566
5595
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("ul", { className: "flex flex-col gap-0.5", role: "tree", "aria-label": "Layers", children: rows.map((row) => {
|
|
5567
5596
|
const { layer } = row;
|
|
5568
5597
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
@@ -5601,7 +5630,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5601
5630
|
type: "button",
|
|
5602
5631
|
"aria-label": layer.visible ? `Hide ${row.label}` : `Show ${row.label}`,
|
|
5603
5632
|
"aria-pressed": layer.visible,
|
|
5604
|
-
className: "w-4 text-center text-
|
|
5633
|
+
className: "w-4 text-center text-foreground",
|
|
5605
5634
|
onClick: (e) => {
|
|
5606
5635
|
e.stopPropagation();
|
|
5607
5636
|
attempt(() => controller.setLayerProperties(layer.id, { visible: !layer.visible }));
|
|
@@ -5614,7 +5643,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5614
5643
|
{
|
|
5615
5644
|
type: "button",
|
|
5616
5645
|
"aria-label": layer.collapsed ? `Expand ${row.label}` : `Collapse ${row.label}`,
|
|
5617
|
-
className: "w-3 text-
|
|
5646
|
+
className: "w-3 text-muted-foreground",
|
|
5618
5647
|
onClick: (e) => {
|
|
5619
5648
|
e.stopPropagation();
|
|
5620
5649
|
attempt(() => controller.setLayerProperties(layer.id, { collapsed: !layer.collapsed }));
|
|
@@ -5622,7 +5651,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5622
5651
|
children: layer.collapsed ? "\u25B8" : "\u25BE"
|
|
5623
5652
|
}
|
|
5624
5653
|
),
|
|
5625
|
-
row.clipped && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-
|
|
5654
|
+
row.clipped && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", "aria-label": "Clipped", children: "\u21B3" }),
|
|
5626
5655
|
(0, import_image_editor8.layerHasThumbnail)(layer) ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "relative shrink-0", children: [
|
|
5627
5656
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5628
5657
|
Thumbnail,
|
|
@@ -5637,14 +5666,14 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5637
5666
|
"span",
|
|
5638
5667
|
{
|
|
5639
5668
|
"data-testid": "layer-kind-badge",
|
|
5640
|
-
className: "absolute -bottom-1 -right-1 rounded bg-
|
|
5669
|
+
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
5670
|
children: (0, import_image_editor8.layerBadge)(layer)
|
|
5642
5671
|
}
|
|
5643
5672
|
)
|
|
5644
5673
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5645
5674
|
"span",
|
|
5646
5675
|
{
|
|
5647
|
-
className: "shrink-0 grid place-items-center rounded bg-
|
|
5676
|
+
className: "shrink-0 grid place-items-center rounded bg-muted text-[9px] text-muted-foreground ring-1 ring-border",
|
|
5648
5677
|
style: { width: thumbnailSize, height: thumbnailSize },
|
|
5649
5678
|
children: (0, import_image_editor8.layerBadge)(layer)
|
|
5650
5679
|
}
|
|
@@ -5657,7 +5686,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5657
5686
|
"aria-pressed": layer.mask.linked !== false,
|
|
5658
5687
|
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
5688
|
"data-testid": "layer-mask-link",
|
|
5660
|
-
className: `shrink-0 text-[10px] leading-none ${layer.mask.linked === false ? "text-
|
|
5689
|
+
className: `shrink-0 text-[10px] leading-none ${layer.mask.linked === false ? "text-muted-foreground/70" : "text-foreground"}`,
|
|
5661
5690
|
onClick: (e) => {
|
|
5662
5691
|
e.stopPropagation();
|
|
5663
5692
|
attempt(() => controller.setLayerMaskProps(layer.id, { linked: layer.mask.linked === false }));
|
|
@@ -5686,7 +5715,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5686
5715
|
autoFocus: true,
|
|
5687
5716
|
"aria-label": "Layer name",
|
|
5688
5717
|
defaultValue: layer.name || row.label,
|
|
5689
|
-
className: "flex-1 min-w-0 bg-
|
|
5718
|
+
className: "flex-1 min-w-0 bg-background border border-border rounded px-1",
|
|
5690
5719
|
onClick: (e) => e.stopPropagation(),
|
|
5691
5720
|
onBlur: (e) => {
|
|
5692
5721
|
setRenaming(null);
|
|
@@ -5700,7 +5729,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5700
5729
|
) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5701
5730
|
"span",
|
|
5702
5731
|
{
|
|
5703
|
-
className: `flex-1 min-w-0 truncate ${layer.visible ? "" : "text-
|
|
5732
|
+
className: `flex-1 min-w-0 truncate ${layer.visible ? "" : "text-muted-foreground"}`,
|
|
5704
5733
|
onDoubleClick: (e) => {
|
|
5705
5734
|
e.stopPropagation();
|
|
5706
5735
|
setRenaming(layer.id);
|
|
@@ -5708,7 +5737,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5708
5737
|
children: row.label
|
|
5709
5738
|
}
|
|
5710
5739
|
),
|
|
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-
|
|
5740
|
+
(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
5741
|
(0, import_image_editor8.layerEffectsBadge)(layer) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5713
5742
|
"button",
|
|
5714
5743
|
{
|
|
@@ -5716,7 +5745,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5716
5745
|
"data-testid": "layer-fx-badge",
|
|
5717
5746
|
"aria-label": (0, import_image_editor8.layerEffectsBadge)(layer) === "on" ? `Turn effects off for ${row.label}` : `Turn effects on for ${row.label}`,
|
|
5718
5747
|
"aria-pressed": (0, import_image_editor8.layerEffectsBadge)(layer) === "on",
|
|
5719
|
-
className: `text-[9px] italic font-semibold ${(0, import_image_editor8.layerEffectsBadge)(layer) === "on" ? "text-
|
|
5748
|
+
className: `text-[9px] italic font-semibold ${(0, import_image_editor8.layerEffectsBadge)(layer) === "on" ? "text-primary" : "text-muted-foreground/70 line-through"}`,
|
|
5720
5749
|
onClick: (e) => {
|
|
5721
5750
|
e.stopPropagation();
|
|
5722
5751
|
attempt(() => controller.setLayerEffectsEnabled(layer.id, (0, import_image_editor8.layerEffectsBadge)(layer) !== "on"));
|
|
@@ -5724,20 +5753,20 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5724
5753
|
children: "fx"
|
|
5725
5754
|
}
|
|
5726
5755
|
),
|
|
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-
|
|
5756
|
+
locked(layer) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { "aria-label": "Locked", className: "text-muted-foreground", children: "\u{1F512}" }),
|
|
5757
|
+
layer.blend !== "normal" && layer.blend !== "pass-through" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-[9px] text-muted-foreground", children: layer.blend })
|
|
5729
5758
|
]
|
|
5730
5759
|
},
|
|
5731
5760
|
layer.id
|
|
5732
5761
|
);
|
|
5733
5762
|
}) }),
|
|
5734
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { role: "alert", className: "text-
|
|
5763
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
|
|
5735
5764
|
menu && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5736
5765
|
"div",
|
|
5737
5766
|
{
|
|
5738
5767
|
role: "menu",
|
|
5739
5768
|
"aria-label": "Layer menu",
|
|
5740
|
-
className: "fixed z-50 min-w-44 rounded border border-
|
|
5769
|
+
className: "fixed z-50 min-w-44 rounded border border-border bg-background py-1 shadow-xl",
|
|
5741
5770
|
style: { left: menu.x, top: menu.y },
|
|
5742
5771
|
onClick: (e) => e.stopPropagation(),
|
|
5743
5772
|
onKeyDown: (e) => e.key === "Escape" && setMenu(null),
|
|
@@ -5747,7 +5776,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5747
5776
|
type: "button",
|
|
5748
5777
|
role: "menuitem",
|
|
5749
5778
|
disabled: !item.enabled,
|
|
5750
|
-
className: "block w-full px-3 py-1 text-left hover:bg-
|
|
5779
|
+
className: "block w-full px-3 py-1 text-left hover:bg-muted disabled:opacity-40",
|
|
5751
5780
|
onClick: () => run(item.action),
|
|
5752
5781
|
children: item.label
|
|
5753
5782
|
},
|
|
@@ -7384,21 +7413,22 @@ function EffectParameters({
|
|
|
7384
7413
|
|
|
7385
7414
|
// src/image-editor/ImageEffectControls.tsx
|
|
7386
7415
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
7387
|
-
function ImageEffectControls({ provider, effect, name, values, onChange, onPreset }) {
|
|
7416
|
+
function ImageEffectControls({ provider, effect, name, values, onChange, onPreset, className }) {
|
|
7388
7417
|
const { description, error } = useEffectDescription(provider, effect);
|
|
7389
|
-
|
|
7418
|
+
let body;
|
|
7419
|
+
if (!provider) body = /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
7390
7420
|
'No effects provider: "',
|
|
7391
7421
|
name ?? effect,
|
|
7392
7422
|
'" is kept but not drawn.'
|
|
7393
7423
|
] });
|
|
7394
|
-
if (error)
|
|
7395
|
-
if (!description)
|
|
7396
|
-
|
|
7424
|
+
else if (error) body = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-[11px] text-amber-600", children: error });
|
|
7425
|
+
else if (!description) body = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
|
|
7426
|
+
else body = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(EffectParameters, { description, values, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
|
|
7427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className, "data-testid": "image-effect-controls", children: body });
|
|
7397
7428
|
}
|
|
7398
7429
|
|
|
7399
7430
|
// src/image-editor/ImageProviderEffectsPanel.tsx
|
|
7400
7431
|
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
7432
|
function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
7403
7433
|
const [, setTick] = (0, import_react54.useState)(0);
|
|
7404
7434
|
(0, import_react54.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -7428,17 +7458,17 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
7428
7458
|
const canFilter = !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
|
|
7429
7459
|
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
7460
|
/* @__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:
|
|
7461
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Effects" }),
|
|
7462
|
+
/* @__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" }),
|
|
7463
|
+
/* @__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
7464
|
] }),
|
|
7435
|
-
!provider && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[11px] text-
|
|
7465
|
+
!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
7466
|
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
7467
|
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
7468
|
generator && layer && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "space-y-1", "data-effect-part": "generator", children: [
|
|
7439
7469
|
/* @__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:
|
|
7470
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "flex-1 font-medium text-foreground", children: generator.name ?? generator.effect }),
|
|
7471
|
+
/* @__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
7472
|
] }),
|
|
7443
7473
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
7444
7474
|
ImageEffectControls,
|
|
@@ -7457,20 +7487,20 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
7457
7487
|
const all = layer.smartFilters.filters;
|
|
7458
7488
|
const index = all.indexOf(f);
|
|
7459
7489
|
if (f.kind !== "effect") return null;
|
|
7460
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("li", { className: "rounded border border-
|
|
7490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("li", { className: "rounded border border-border p-1", "data-smart-effect": f.id, children: [
|
|
7461
7491
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
7462
7492
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { type: "checkbox", checked: f.enabled, "aria-label": `${label} on`, onChange: (e) => {
|
|
7463
7493
|
const enabled = e.currentTarget.checked;
|
|
7464
7494
|
run(() => controller.updateEffectFilter(layer.id, f.id, { enabled }));
|
|
7465
7495
|
} }),
|
|
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:
|
|
7496
|
+
/* @__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 }),
|
|
7497
|
+
/* @__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" }),
|
|
7498
|
+
/* @__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" }),
|
|
7499
|
+
/* @__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
7500
|
] }),
|
|
7471
7501
|
open === f.id && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "mt-1 space-y-2", children: [
|
|
7472
7502
|
/* @__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-
|
|
7503
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "w-14 text-[11px] text-foreground", children: "Opacity" }),
|
|
7474
7504
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
7475
7505
|
"input",
|
|
7476
7506
|
{
|
|
@@ -7502,8 +7532,8 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
7502
7532
|
] })
|
|
7503
7533
|
] }, f.id);
|
|
7504
7534
|
}) }),
|
|
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-
|
|
7535
|
+
!layer && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
|
|
7536
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
7507
7537
|
] });
|
|
7508
7538
|
}
|
|
7509
7539
|
|
|
@@ -7518,7 +7548,7 @@ var import_image_editor10 = require("@pixerate/editor/image-editor");
|
|
|
7518
7548
|
// src/paint-editor/PaintGradientEditorView.tsx
|
|
7519
7549
|
var import_react55 = require("react");
|
|
7520
7550
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
7521
|
-
var
|
|
7551
|
+
var button = "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700 disabled:opacity-40";
|
|
7522
7552
|
var select = "rounded bg-slate-800 px-1 py-0.5 text-[11px]";
|
|
7523
7553
|
var number = "w-16 rounded bg-slate-800 px-1 py-0.5 text-[11px]";
|
|
7524
7554
|
var pct = (v) => Math.round(v * 1e3) / 10;
|
|
@@ -7554,7 +7584,7 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
|
|
|
7554
7584
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "", children: "Presets\u2026" }),
|
|
7555
7585
|
PAINT_GRADIENT_PRESETS.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: i, children: p.name }, p.name))
|
|
7556
7586
|
] }),
|
|
7557
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className:
|
|
7587
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: button, onClick: () => onChange(reversePaintGradient(value)), children: "Reverse" })
|
|
7558
7588
|
] }),
|
|
7559
7589
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7560
7590
|
"div",
|
|
@@ -7612,7 +7642,7 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
|
|
|
7612
7642
|
/* @__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
7643
|
"%"
|
|
7614
7644
|
] }),
|
|
7615
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className:
|
|
7645
|
+
/* @__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
7646
|
] }),
|
|
7617
7647
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-mapping", children: [
|
|
7618
7648
|
/* @__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 +7673,6 @@ var PaintGradientEditor = (props) => /* @__PURE__ */ (0, import_jsx_runtime35.js
|
|
|
7643
7673
|
|
|
7644
7674
|
// src/image-editor/BrushOptionsBar.tsx
|
|
7645
7675
|
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
7676
|
var BrushOptionsBar = ({ controller, className }) => {
|
|
7648
7677
|
const [, setTick] = (0, import_react56.useState)(0);
|
|
7649
7678
|
(0, import_react56.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -7659,14 +7688,14 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
7659
7688
|
setError(err instanceof Error ? err.message : String(err));
|
|
7660
7689
|
}
|
|
7661
7690
|
};
|
|
7662
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-
|
|
7691
|
+
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
7692
|
/* @__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
7693
|
"button",
|
|
7665
7694
|
{
|
|
7666
7695
|
type: "button",
|
|
7667
7696
|
"aria-pressed": state.activeTool === t.id,
|
|
7668
7697
|
title: t.shortcut ? `${t.label} (${t.shortcut})` : t.label,
|
|
7669
|
-
className:
|
|
7698
|
+
className: imageChipClass(state.activeTool === t.id),
|
|
7670
7699
|
onClick: () => controller.setTool(t.id),
|
|
7671
7700
|
children: t.label
|
|
7672
7701
|
},
|
|
@@ -7681,10 +7710,10 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
7681
7710
|
"aria-label": "Foreground colour",
|
|
7682
7711
|
value: foreground,
|
|
7683
7712
|
onChange: (e) => controller.setPaintOptions({ foreground: e.target.value }),
|
|
7684
|
-
className:
|
|
7713
|
+
className: imageColorInputClass
|
|
7685
7714
|
}
|
|
7686
7715
|
),
|
|
7687
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "text-
|
|
7716
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "text-muted-foreground", children: "FG" })
|
|
7688
7717
|
] }),
|
|
7689
7718
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
7690
7719
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
@@ -7694,20 +7723,20 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
7694
7723
|
"aria-label": "Background colour",
|
|
7695
7724
|
value: background,
|
|
7696
7725
|
onChange: (e) => controller.setPaintOptions({ background: e.target.value }),
|
|
7697
|
-
className:
|
|
7726
|
+
className: imageColorInputClass
|
|
7698
7727
|
}
|
|
7699
7728
|
),
|
|
7700
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "text-
|
|
7729
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "text-muted-foreground", children: "BG" })
|
|
7701
7730
|
] }),
|
|
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:
|
|
7731
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", title: "Swap colours (X)", className: imageChipClass(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
|
|
7732
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", title: "Default colours (D)", className: imageChipClass(false), onClick: () => controller.resetPaintColors(), children: "Default" }),
|
|
7704
7733
|
state.activeTool === "brush" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7705
7734
|
"button",
|
|
7706
7735
|
{
|
|
7707
7736
|
type: "button",
|
|
7708
7737
|
"aria-pressed": paint.type === "gradient",
|
|
7709
7738
|
title: "Gradient paint: the brush changes colour as the stroke goes",
|
|
7710
|
-
className:
|
|
7739
|
+
className: imageChipClass(paint.type === "gradient"),
|
|
7711
7740
|
onClick: () => attempt(() => controller.setPaintOptions(paint.type === "gradient" ? { foreground } : { paint: import_image_editor12.DEFAULT_PAINT_GRADIENT })),
|
|
7712
7741
|
children: "Gradient"
|
|
7713
7742
|
}
|
|
@@ -7723,19 +7752,19 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
7723
7752
|
},
|
|
7724
7753
|
spec.id
|
|
7725
7754
|
)),
|
|
7726
|
-
state.activeTool === "mixer" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-2 border-t border-
|
|
7755
|
+
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
7756
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
7728
7757
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7729
7758
|
"span",
|
|
7730
7759
|
{
|
|
7731
7760
|
"aria-label": "Brush load",
|
|
7732
7761
|
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-
|
|
7762
|
+
className: "h-6 w-6 rounded border border-border",
|
|
7734
7763
|
style: { background: mixerLoad.reservoir ? (0, import_image_editor11.rgbUnitToHex)(mixerLoad.reservoir) : "transparent" }
|
|
7735
7764
|
}
|
|
7736
7765
|
),
|
|
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:
|
|
7766
|
+
/* @__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" }),
|
|
7767
|
+
/* @__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
7768
|
] }),
|
|
7740
7769
|
/* @__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
7770
|
"button",
|
|
@@ -7743,14 +7772,14 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
7743
7772
|
type: "button",
|
|
7744
7773
|
"aria-pressed": mixer.mixing === m.id,
|
|
7745
7774
|
title: m.title,
|
|
7746
|
-
className:
|
|
7775
|
+
className: imageChipClass(mixer.mixing === m.id),
|
|
7747
7776
|
onClick: () => controller.setPaintOptions({ mixer: { mixing: m.id } }),
|
|
7748
7777
|
children: m.label
|
|
7749
7778
|
},
|
|
7750
7779
|
m.id
|
|
7751
7780
|
)) }),
|
|
7752
7781
|
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-
|
|
7782
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-wrap gap-3 text-foreground", children: [
|
|
7754
7783
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
7755
7784
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7756
7785
|
"input",
|
|
@@ -7759,7 +7788,7 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
7759
7788
|
"aria-label": "Load the brush after each stroke",
|
|
7760
7789
|
checked: mixer.loadEachStroke,
|
|
7761
7790
|
onChange: (e) => controller.setPaintOptions({ mixer: { loadEachStroke: e.target.checked } }),
|
|
7762
|
-
className: "accent-
|
|
7791
|
+
className: "accent-primary"
|
|
7763
7792
|
}
|
|
7764
7793
|
),
|
|
7765
7794
|
"Load each stroke"
|
|
@@ -7772,35 +7801,35 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
7772
7801
|
"aria-label": "Clean the brush after each stroke",
|
|
7773
7802
|
checked: mixer.cleanEachStroke,
|
|
7774
7803
|
onChange: (e) => controller.setPaintOptions({ mixer: { cleanEachStroke: e.target.checked } }),
|
|
7775
|
-
className: "accent-
|
|
7804
|
+
className: "accent-primary"
|
|
7776
7805
|
}
|
|
7777
7806
|
),
|
|
7778
7807
|
"Clean each stroke"
|
|
7779
7808
|
] })
|
|
7780
7809
|
] })
|
|
7781
7810
|
] }),
|
|
7782
|
-
(0, import_image_editor11.isRetouchPaintTool)(tool) && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-2 border-t border-
|
|
7811
|
+
(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
7812
|
(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:
|
|
7813
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "text-muted-foreground", "data-testid": "clone-source", children: (0, import_image_editor11.cloneSourceLabel)(controller) }),
|
|
7814
|
+
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
7815
|
] }),
|
|
7787
7816
|
(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
7817
|
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
7818
|
/* @__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:
|
|
7819
|
+
/* @__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" }),
|
|
7820
|
+
/* @__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" }),
|
|
7821
|
+
!(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
7822
|
] })
|
|
7794
7823
|
] }),
|
|
7795
7824
|
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-
|
|
7825
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "text-muted-foreground", children: choice.label }),
|
|
7797
7826
|
choice.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7798
7827
|
"button",
|
|
7799
7828
|
{
|
|
7800
7829
|
type: "button",
|
|
7801
7830
|
"aria-pressed": retouch[choice.id] === o.id,
|
|
7802
7831
|
title: o.title,
|
|
7803
|
-
className:
|
|
7832
|
+
className: imageChipClass(retouch[choice.id] === o.id),
|
|
7804
7833
|
onClick: () => (0, import_image_editor11.setRetouchChoice)(controller, choice.id, o.id),
|
|
7805
7834
|
children: o.label
|
|
7806
7835
|
},
|
|
@@ -7808,7 +7837,7 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
7808
7837
|
))
|
|
7809
7838
|
] }, choice.id)),
|
|
7810
7839
|
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-
|
|
7840
|
+
/* @__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
7841
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7813
7842
|
"input",
|
|
7814
7843
|
{
|
|
@@ -7816,13 +7845,13 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
7816
7845
|
"aria-label": t.label,
|
|
7817
7846
|
checked: retouch[t.id],
|
|
7818
7847
|
onChange: (e) => controller.setPaintOptions({ retouch: { [t.id]: e.target.checked } }),
|
|
7819
|
-
className: "accent-
|
|
7848
|
+
className: "accent-primary"
|
|
7820
7849
|
}
|
|
7821
7850
|
),
|
|
7822
7851
|
t.label
|
|
7823
7852
|
] }, t.id)) })
|
|
7824
7853
|
] }),
|
|
7825
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-wrap gap-3 text-
|
|
7854
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-wrap gap-3 text-foreground", role: "group", "aria-label": "Pressure", children: [
|
|
7826
7855
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
7827
7856
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7828
7857
|
"input",
|
|
@@ -7831,7 +7860,7 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
7831
7860
|
"aria-label": "Pressure controls size",
|
|
7832
7861
|
checked: brush.pressureSize,
|
|
7833
7862
|
onChange: (e) => controller.setPaintOptions({ brush: { pressureSize: e.target.checked } }),
|
|
7834
|
-
className: "accent-
|
|
7863
|
+
className: "accent-primary"
|
|
7835
7864
|
}
|
|
7836
7865
|
),
|
|
7837
7866
|
"Pressure size"
|
|
@@ -7844,17 +7873,17 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
7844
7873
|
"aria-label": "Pressure controls opacity",
|
|
7845
7874
|
checked: brush.pressureOpacity,
|
|
7846
7875
|
onChange: (e) => controller.setPaintOptions({ brush: { pressureOpacity: e.target.checked } }),
|
|
7847
|
-
className: "accent-
|
|
7876
|
+
className: "accent-primary"
|
|
7848
7877
|
}
|
|
7849
7878
|
),
|
|
7850
7879
|
"Pressure opacity"
|
|
7851
7880
|
] })
|
|
7852
7881
|
] }),
|
|
7853
7882
|
/* @__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:
|
|
7883
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.fillPixels()), children: "Fill" }),
|
|
7884
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.clearPixels()), children: "Clear" })
|
|
7856
7885
|
] }),
|
|
7857
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { role: "alert", className: "text-
|
|
7886
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
7858
7887
|
] });
|
|
7859
7888
|
};
|
|
7860
7889
|
|
|
@@ -7862,8 +7891,8 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
7862
7891
|
var import_react57 = require("react");
|
|
7863
7892
|
var import_image_editor13 = require("@pixerate/editor/image-editor");
|
|
7864
7893
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
7865
|
-
var
|
|
7866
|
-
var select2 = "rounded bg-
|
|
7894
|
+
var chip = imageChipClass(false);
|
|
7895
|
+
var select2 = "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground";
|
|
7867
7896
|
var ColorProfilePanel = ({ controller, className }) => {
|
|
7868
7897
|
const [, setTick] = (0, import_react57.useState)(0);
|
|
7869
7898
|
(0, import_react57.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -7892,28 +7921,28 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
7892
7921
|
})
|
|
7893
7922
|
);
|
|
7894
7923
|
};
|
|
7895
|
-
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-
|
|
7924
|
+
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
7925
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
7897
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-
|
|
7926
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-muted-foreground", children: "Profile" }),
|
|
7898
7927
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { "data-testid": "color-profile-name", children: view.profileName })
|
|
7899
7928
|
] }),
|
|
7900
7929
|
/* @__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-
|
|
7930
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-muted-foreground", children: "Mode" }),
|
|
7902
7931
|
/* @__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-
|
|
7932
|
+
view.cmykProfileName && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-muted-foreground", children: view.cmykProfileName })
|
|
7904
7933
|
] }),
|
|
7905
7934
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
|
|
7906
7935
|
/* @__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
7936
|
/* @__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
7937
|
/* @__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-
|
|
7938
|
+
/* @__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
7939
|
"BPC"
|
|
7911
7940
|
] }),
|
|
7912
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", className:
|
|
7913
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", className:
|
|
7941
|
+
/* @__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" }),
|
|
7942
|
+
/* @__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
7943
|
] }),
|
|
7915
7944
|
/* @__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-
|
|
7945
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-muted-foreground", children: "Proof" }),
|
|
7917
7946
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
7918
7947
|
"select",
|
|
7919
7948
|
{
|
|
@@ -7930,16 +7959,16 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
7930
7959
|
view.proof && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
7931
7960
|
/* @__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
7961
|
/* @__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-
|
|
7962
|
+
/* @__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
7963
|
"Paper"
|
|
7935
7964
|
] }),
|
|
7936
7965
|
/* @__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-
|
|
7966
|
+
/* @__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
7967
|
"Gamut warning"
|
|
7939
7968
|
] })
|
|
7940
7969
|
] })
|
|
7941
7970
|
] }),
|
|
7942
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { role: "alert", className: "text-
|
|
7971
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
7943
7972
|
] });
|
|
7944
7973
|
};
|
|
7945
7974
|
|
|
@@ -7954,7 +7983,7 @@ var MODIFY_OPS = [
|
|
|
7954
7983
|
{ op: "border", label: "Border" },
|
|
7955
7984
|
{ op: "smooth", label: "Smooth" }
|
|
7956
7985
|
];
|
|
7957
|
-
var
|
|
7986
|
+
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
7987
|
var SelectionOptionsBar = ({
|
|
7959
7988
|
controller,
|
|
7960
7989
|
options,
|
|
@@ -7968,11 +7997,11 @@ var SelectionOptionsBar = ({
|
|
|
7968
7997
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
7969
7998
|
const qm = quickMask ?? Boolean(controller.getState().quickMask);
|
|
7970
7999
|
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:
|
|
8000
|
+
/* @__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)) }),
|
|
8001
|
+
/* @__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
8002
|
options.tool === "wand" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
7974
8003
|
/* @__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-
|
|
8004
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
7976
8005
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "Tolerance" }),
|
|
7977
8006
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "font-mono", children: options.tolerance })
|
|
7978
8007
|
] }),
|
|
@@ -7986,19 +8015,19 @@ var SelectionOptionsBar = ({
|
|
|
7986
8015
|
"aria-label": "Tolerance",
|
|
7987
8016
|
value: options.tolerance,
|
|
7988
8017
|
onChange: (e) => set({ tolerance: Number(e.target.value) }),
|
|
7989
|
-
className:
|
|
8018
|
+
className: imageRangeClass
|
|
7990
8019
|
}
|
|
7991
8020
|
)
|
|
7992
8021
|
] }),
|
|
7993
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
8022
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
7994
8023
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("input", { type: "checkbox", checked: options.contiguous, onChange: (e) => set({ contiguous: e.target.checked }) }),
|
|
7995
8024
|
"Contiguous"
|
|
7996
8025
|
] }),
|
|
7997
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
8026
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
7998
8027
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("input", { type: "checkbox", checked: options.sampleMerged, onChange: (e) => set({ sampleMerged: e.target.checked }) }),
|
|
7999
8028
|
"Sample adjusted image"
|
|
8000
8029
|
] }),
|
|
8001
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
8030
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
8002
8031
|
"Sample",
|
|
8003
8032
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
8004
8033
|
"select",
|
|
@@ -8006,7 +8035,7 @@ var SelectionOptionsBar = ({
|
|
|
8006
8035
|
"aria-label": "Sample from",
|
|
8007
8036
|
value: options.sample ?? "composite",
|
|
8008
8037
|
onChange: (e) => set({ sample: e.target.value }),
|
|
8009
|
-
className: "bg-
|
|
8038
|
+
className: "bg-muted border border-border rounded px-1 py-0.5",
|
|
8010
8039
|
children: [
|
|
8011
8040
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("option", { value: "composite", children: "All layers" }),
|
|
8012
8041
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("option", { value: "active-layer", children: "Active layer" })
|
|
@@ -8015,18 +8044,18 @@ var SelectionOptionsBar = ({
|
|
|
8015
8044
|
)
|
|
8016
8045
|
] })
|
|
8017
8046
|
] }),
|
|
8018
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
8047
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
8019
8048
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("input", { type: "checkbox", checked: options.antiAlias, onChange: (e) => set({ antiAlias: e.target.checked }) }),
|
|
8020
8049
|
"Anti-alias"
|
|
8021
8050
|
] }),
|
|
8022
8051
|
/* @__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:
|
|
8052
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
|
|
8053
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
|
|
8054
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
|
|
8055
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", "aria-pressed": qm, className: btn(qm), onClick: () => controller.setQuickMask(!qm), children: "Quick Mask" })
|
|
8027
8056
|
] }),
|
|
8028
8057
|
/* @__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-
|
|
8058
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
8030
8059
|
"Radius",
|
|
8031
8060
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
8032
8061
|
"input",
|
|
@@ -8038,13 +8067,13 @@ var SelectionOptionsBar = ({
|
|
|
8038
8067
|
"aria-label": "Modify radius",
|
|
8039
8068
|
value: radius,
|
|
8040
8069
|
onChange: (e) => setRadius(Math.max(0, Number(e.target.value) || 0)),
|
|
8041
|
-
className: "w-14 bg-
|
|
8070
|
+
className: "w-14 bg-background border border-border rounded px-1 py-0.5 text-foreground"
|
|
8042
8071
|
}
|
|
8043
8072
|
)
|
|
8044
8073
|
] }),
|
|
8045
|
-
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", className:
|
|
8074
|
+
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
8075
|
] }),
|
|
8047
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { "data-testid": "selection-status", className: "text-
|
|
8076
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: (0, import_image_editor14.describeSelection)(sel) })
|
|
8048
8077
|
] });
|
|
8049
8078
|
};
|
|
8050
8079
|
|
|
@@ -8053,7 +8082,7 @@ var import_react59 = require("react");
|
|
|
8053
8082
|
var import_image_editor15 = require("@pixerate/editor/image-editor");
|
|
8054
8083
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
8055
8084
|
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
8056
|
-
var
|
|
8085
|
+
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
8086
|
var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
8058
8087
|
const [params, setParams] = (0, import_react59.useState)(DEFAULT_PARAMS);
|
|
8059
8088
|
const [busy, setBusy] = (0, import_react59.useState)(false);
|
|
@@ -8075,9 +8104,9 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
8075
8104
|
}
|
|
8076
8105
|
};
|
|
8077
8106
|
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:
|
|
8107
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
|
|
8079
8108
|
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-
|
|
8109
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
8081
8110
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: c.label }),
|
|
8082
8111
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "font-mono", children: [
|
|
8083
8112
|
params[c.id],
|
|
@@ -8094,20 +8123,20 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
8094
8123
|
"aria-label": c.label,
|
|
8095
8124
|
value: params[c.id],
|
|
8096
8125
|
onChange: (e) => setParams({ ...params, [c.id]: Number(e.target.value) }),
|
|
8097
|
-
className:
|
|
8126
|
+
className: imageRangeClass
|
|
8098
8127
|
}
|
|
8099
8128
|
)
|
|
8100
8129
|
] }, c.id)),
|
|
8101
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
8130
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
8102
8131
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
8103
8132
|
"Smart Radius"
|
|
8104
8133
|
] }),
|
|
8105
8134
|
/* @__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:
|
|
8135
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { type: "button", className: button2, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
8136
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { type: "button", className: button2, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
|
8108
8137
|
] }),
|
|
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-
|
|
8138
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
|
|
8139
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
|
|
8111
8140
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex gap-1 items-center", children: [
|
|
8112
8141
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8113
8142
|
"select",
|
|
@@ -8115,7 +8144,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
8115
8144
|
"aria-label": "New masked layer kind",
|
|
8116
8145
|
value: newKind,
|
|
8117
8146
|
onChange: (e) => setNewKind(e.target.value),
|
|
8118
|
-
className: "flex-1 bg-
|
|
8147
|
+
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
8119
8148
|
children: import_image_editor15.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("option", { value: k.kind, children: k.label }, k.kind))
|
|
8120
8149
|
}
|
|
8121
8150
|
),
|
|
@@ -8123,7 +8152,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
8123
8152
|
"button",
|
|
8124
8153
|
{
|
|
8125
8154
|
type: "button",
|
|
8126
|
-
className:
|
|
8155
|
+
className: button2,
|
|
8127
8156
|
disabled: !sel,
|
|
8128
8157
|
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0, import_image_editor15.layerMaskFromSelection)(sel) })),
|
|
8129
8158
|
children: "New Masked Layer"
|
|
@@ -8137,7 +8166,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
8137
8166
|
"aria-label": "Mask layer",
|
|
8138
8167
|
value: target.id,
|
|
8139
8168
|
onChange: (e) => setLayerId(e.target.value),
|
|
8140
|
-
className: "bg-
|
|
8169
|
+
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
8141
8170
|
children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("option", { value: l.id, children: [
|
|
8142
8171
|
l.name || (0, import_image_editor15.adjustmentKindLabel)(l.kind),
|
|
8143
8172
|
l.mask ? " (masked)" : ""
|
|
@@ -8145,13 +8174,13 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
8145
8174
|
}
|
|
8146
8175
|
),
|
|
8147
8176
|
/* @__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:
|
|
8177
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { type: "button", className: button2, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
|
|
8178
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { type: "button", className: button2, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
|
|
8179
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { type: "button", className: button2, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
|
|
8151
8180
|
] }),
|
|
8152
8181
|
target.mask && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
8153
8182
|
/* @__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-
|
|
8183
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
8155
8184
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: "Density" }),
|
|
8156
8185
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "font-mono", children: [
|
|
8157
8186
|
Math.round((target.mask.density ?? 1) * 100),
|
|
@@ -8168,12 +8197,12 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
8168
8197
|
"aria-label": "Mask density",
|
|
8169
8198
|
value: Math.round((target.mask.density ?? 1) * 100),
|
|
8170
8199
|
onChange: (e) => controller.setAdjustmentLayerMaskProps(target.id, { density: Number(e.target.value) / 100 }),
|
|
8171
|
-
className:
|
|
8200
|
+
className: imageRangeClass
|
|
8172
8201
|
}
|
|
8173
8202
|
)
|
|
8174
8203
|
] }),
|
|
8175
8204
|
/* @__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-
|
|
8205
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
8177
8206
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: "Mask Feather" }),
|
|
8178
8207
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "font-mono", children: [
|
|
8179
8208
|
target.mask.feather ?? 0,
|
|
@@ -8190,7 +8219,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
8190
8219
|
"aria-label": "Mask feather",
|
|
8191
8220
|
value: target.mask.feather ?? 0,
|
|
8192
8221
|
onChange: (e) => controller.setAdjustmentLayerMaskProps(target.id, { feather: Number(e.target.value) }),
|
|
8193
|
-
className:
|
|
8222
|
+
className: imageRangeClass
|
|
8194
8223
|
}
|
|
8195
8224
|
)
|
|
8196
8225
|
] })
|
|
@@ -8203,7 +8232,6 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
8203
8232
|
var import_react60 = require("react");
|
|
8204
8233
|
var import_image_editor16 = require("@pixerate/editor/image-editor");
|
|
8205
8234
|
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
8235
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
8208
8236
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
8209
8237
|
const [, setTick] = (0, import_react60.useState)(0);
|
|
@@ -8219,16 +8247,16 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
8219
8247
|
const v = Number(raw);
|
|
8220
8248
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
8221
8249
|
};
|
|
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-
|
|
8250
|
+
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: [
|
|
8251
|
+
/* @__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)) }),
|
|
8252
|
+
/* @__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
8253
|
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
8254
|
/* @__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:
|
|
8255
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
8256
|
+
/* @__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
8257
|
] }),
|
|
8230
8258
|
["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-
|
|
8259
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
8232
8260
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8233
8261
|
"input",
|
|
8234
8262
|
{
|
|
@@ -8238,7 +8266,7 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
8238
8266
|
min: -100,
|
|
8239
8267
|
max: 100,
|
|
8240
8268
|
disabled: warp.style === "custom",
|
|
8241
|
-
className: "w-14 rounded border border-
|
|
8269
|
+
className: "w-14 rounded border border-border bg-background px-1 py-0.5 text-right disabled:opacity-40",
|
|
8242
8270
|
onBlur: (e) => warpNumber(k, e.currentTarget.value),
|
|
8243
8271
|
onKeyDown: (e) => {
|
|
8244
8272
|
if (e.key === "Enter") {
|
|
@@ -8250,7 +8278,7 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
8250
8278
|
},
|
|
8251
8279
|
`${k}:${warp[k]}`
|
|
8252
8280
|
),
|
|
8253
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-
|
|
8281
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-muted-foreground", children: "%" })
|
|
8254
8282
|
] }, k)),
|
|
8255
8283
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8256
8284
|
"button",
|
|
@@ -8259,13 +8287,13 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
8259
8287
|
title: "Bend along the vertical axis",
|
|
8260
8288
|
"aria-pressed": warp.orientation === "vertical",
|
|
8261
8289
|
disabled: warp.style === "custom",
|
|
8262
|
-
className:
|
|
8290
|
+
className: imageChipClass(warp.orientation === "vertical"),
|
|
8263
8291
|
onClick: () => tool.setWarp({ orientation: warp.orientation === "vertical" ? "horizontal" : "vertical" }),
|
|
8264
8292
|
children: "Vertical"
|
|
8265
8293
|
}
|
|
8266
8294
|
),
|
|
8267
8295
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8268
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-
|
|
8296
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
8269
8297
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8270
8298
|
"select",
|
|
8271
8299
|
{
|
|
@@ -8275,14 +8303,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
8275
8303
|
const g = import_image_editor16.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
|
|
8276
8304
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
8277
8305
|
},
|
|
8278
|
-
className:
|
|
8306
|
+
className: imageFieldClass,
|
|
8279
8307
|
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
8308
|
}
|
|
8281
8309
|
)
|
|
8282
8310
|
] })
|
|
8283
8311
|
] }),
|
|
8284
8312
|
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-
|
|
8313
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-muted-foreground", children: f.label }),
|
|
8286
8314
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8287
8315
|
"input",
|
|
8288
8316
|
{
|
|
@@ -8291,7 +8319,7 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
8291
8319
|
defaultValue: round(bar[f.id], f.unit),
|
|
8292
8320
|
disabled: !bar.affine,
|
|
8293
8321
|
step: f.unit === "px" ? 1 : 0.1,
|
|
8294
|
-
className: "w-16 rounded border border-
|
|
8322
|
+
className: "w-16 rounded border border-border bg-background px-1 py-0.5 text-right disabled:opacity-40",
|
|
8295
8323
|
onBlur: (e) => apply(f.id, e.currentTarget.value),
|
|
8296
8324
|
onKeyDown: (e) => {
|
|
8297
8325
|
if (e.key === "Enter") {
|
|
@@ -8303,14 +8331,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
8303
8331
|
},
|
|
8304
8332
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
8305
8333
|
),
|
|
8306
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-
|
|
8334
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
|
|
8307
8335
|
f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8308
8336
|
"button",
|
|
8309
8337
|
{
|
|
8310
8338
|
type: "button",
|
|
8311
8339
|
"aria-label": "Keep width and height proportional",
|
|
8312
8340
|
"aria-pressed": tool.proportional,
|
|
8313
|
-
className:
|
|
8341
|
+
className: imageChipClass(tool.proportional),
|
|
8314
8342
|
onClick: () => {
|
|
8315
8343
|
tool.proportional = !tool.proportional;
|
|
8316
8344
|
setTick((n) => n + 1);
|
|
@@ -8320,21 +8348,21 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
8320
8348
|
)
|
|
8321
8349
|
] }, f.id)),
|
|
8322
8350
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8323
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-
|
|
8351
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
8324
8352
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8325
8353
|
"select",
|
|
8326
8354
|
{
|
|
8327
8355
|
"aria-label": "Interpolation",
|
|
8328
8356
|
value: tool.interpolation,
|
|
8329
8357
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
8330
|
-
className:
|
|
8358
|
+
className: imageFieldClass,
|
|
8331
8359
|
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
8360
|
}
|
|
8333
8361
|
)
|
|
8334
8362
|
] }),
|
|
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-
|
|
8363
|
+
/* @__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" }),
|
|
8364
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
8365
|
+
tool.error && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
8338
8366
|
] });
|
|
8339
8367
|
};
|
|
8340
8368
|
|
|
@@ -8342,7 +8370,6 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
8342
8370
|
var import_react61 = require("react");
|
|
8343
8371
|
var import_image_editor17 = require("@pixerate/editor/image-editor");
|
|
8344
8372
|
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
8373
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
8347
8374
|
const [, setTick] = (0, import_react61.useState)(0);
|
|
8348
8375
|
(0, import_react61.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -8360,8 +8387,8 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
8360
8387
|
}
|
|
8361
8388
|
};
|
|
8362
8389
|
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:
|
|
8390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
8391
|
+
/* @__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
8392
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
8366
8393
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8367
8394
|
/* @__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 +8401,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
8374
8401
|
disabled: options.fill === null,
|
|
8375
8402
|
value: options.fill ?? "#4f46e5",
|
|
8376
8403
|
onChange: (e) => set({ fill: e.target.value }),
|
|
8377
|
-
className:
|
|
8404
|
+
className: imageColorInputClass
|
|
8378
8405
|
}
|
|
8379
8406
|
)
|
|
8380
8407
|
] }),
|
|
@@ -8389,7 +8416,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
8389
8416
|
disabled: options.stroke === null,
|
|
8390
8417
|
value: options.stroke ?? "#000000",
|
|
8391
8418
|
onChange: (e) => set({ stroke: e.target.value }),
|
|
8392
|
-
className:
|
|
8419
|
+
className: imageColorInputClass
|
|
8393
8420
|
}
|
|
8394
8421
|
)
|
|
8395
8422
|
] }),
|
|
@@ -8404,7 +8431,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
8404
8431
|
max: 200,
|
|
8405
8432
|
value: options.strokeWidth,
|
|
8406
8433
|
onChange: (e) => set({ strokeWidth: num(e.target.value, 0, 200) }),
|
|
8407
|
-
className:
|
|
8434
|
+
className: `w-14 ${imageFieldClass}`
|
|
8408
8435
|
}
|
|
8409
8436
|
)
|
|
8410
8437
|
] })
|
|
@@ -8412,16 +8439,16 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
8412
8439
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
8413
8440
|
options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8414
8441
|
"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:
|
|
8442
|
+
/* @__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
8443
|
] }),
|
|
8417
8444
|
options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8418
8445
|
"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:
|
|
8446
|
+
/* @__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
8447
|
] }),
|
|
8421
8448
|
options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
8422
8449
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8423
8450
|
"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:
|
|
8451
|
+
/* @__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
8452
|
] }),
|
|
8426
8453
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8427
8454
|
"Inner",
|
|
@@ -8435,7 +8462,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
8435
8462
|
step: 0.05,
|
|
8436
8463
|
value: options.innerRatio,
|
|
8437
8464
|
onChange: (e) => set({ innerRatio: Number(e.target.value) }),
|
|
8438
|
-
className: "accent-
|
|
8465
|
+
className: "accent-primary"
|
|
8439
8466
|
}
|
|
8440
8467
|
)
|
|
8441
8468
|
] })
|
|
@@ -8443,7 +8470,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
8443
8470
|
options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
8444
8471
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8445
8472
|
"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:
|
|
8473
|
+
/* @__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
8474
|
] }),
|
|
8448
8475
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8449
8476
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("input", { type: "checkbox", "aria-label": "Arrowhead", checked: options.arrow, onChange: (e) => set({ arrow: e.target.checked }) }),
|
|
@@ -8451,8 +8478,8 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
8451
8478
|
] })
|
|
8452
8479
|
] })
|
|
8453
8480
|
] }),
|
|
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-
|
|
8481
|
+
/* @__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." }),
|
|
8482
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
8456
8483
|
] });
|
|
8457
8484
|
};
|
|
8458
8485
|
|
|
@@ -8460,7 +8487,6 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
8460
8487
|
var import_react62 = require("react");
|
|
8461
8488
|
var import_image_editor18 = require("@pixerate/editor/image-editor");
|
|
8462
8489
|
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
8490
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
8465
8491
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
8466
8492
|
const [, setTick] = (0, import_react62.useState)(0);
|
|
@@ -8498,7 +8524,7 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
8498
8524
|
setError(e instanceof Error ? e.message : String(e));
|
|
8499
8525
|
}
|
|
8500
8526
|
};
|
|
8501
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-
|
|
8527
|
+
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
8528
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
8503
8529
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8504
8530
|
"Font",
|
|
@@ -8509,7 +8535,7 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
8509
8535
|
"aria-label": "Font family",
|
|
8510
8536
|
value: shown.fontFamily,
|
|
8511
8537
|
onChange: (e) => e.target.value.trim() && style({ fontFamily: e.target.value }),
|
|
8512
|
-
className: "w-32 rounded border border-
|
|
8538
|
+
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
8513
8539
|
}
|
|
8514
8540
|
),
|
|
8515
8541
|
/* @__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 +8551,23 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
8525
8551
|
max: 2e3,
|
|
8526
8552
|
value: Math.round(shown.fontSize * 10) / 10,
|
|
8527
8553
|
onChange: (e) => Number(e.target.value) > 0 && style({ fontSize: Number(e.target.value) }),
|
|
8528
|
-
className: "w-16 rounded border border-
|
|
8554
|
+
className: "w-16 rounded border border-border bg-background px-1 py-0.5"
|
|
8529
8555
|
}
|
|
8530
8556
|
)
|
|
8531
8557
|
] }),
|
|
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:
|
|
8558
|
+
/* @__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" }),
|
|
8559
|
+
/* @__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" }),
|
|
8560
|
+
/* @__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
8561
|
] }),
|
|
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-
|
|
8562
|
+
/* @__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)) }),
|
|
8563
|
+
/* @__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." }),
|
|
8564
|
+
missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
8539
8565
|
"Missing ",
|
|
8540
8566
|
missing.length === 1 ? "font" : "fonts",
|
|
8541
8567
|
": ",
|
|
8542
8568
|
missing.join(", ")
|
|
8543
8569
|
] }),
|
|
8544
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { role: "alert", className: "text-
|
|
8570
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
8545
8571
|
] });
|
|
8546
8572
|
};
|
|
8547
8573
|
|
|
@@ -8713,11 +8739,11 @@ var ImageEditor = ({
|
|
|
8713
8739
|
"div",
|
|
8714
8740
|
{
|
|
8715
8741
|
ref: rootRef,
|
|
8716
|
-
className:
|
|
8742
|
+
className: `${imageEditorFrameClass} ${className}`,
|
|
8717
8743
|
style,
|
|
8718
8744
|
children: [
|
|
8719
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className:
|
|
8720
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", {
|
|
8745
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: imageEditorHeaderClass, children: [
|
|
8746
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
|
|
8721
8747
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
8722
8748
|
"button",
|
|
8723
8749
|
{
|
|
@@ -8727,7 +8753,9 @@ var ImageEditor = ({
|
|
|
8727
8753
|
setActiveTab("crop");
|
|
8728
8754
|
editor.setTool("crop");
|
|
8729
8755
|
},
|
|
8730
|
-
|
|
8756
|
+
role: "tab",
|
|
8757
|
+
"aria-selected": activeTab === "crop",
|
|
8758
|
+
className: `${imageTabClass(activeTab === "crop")}`,
|
|
8731
8759
|
children: "Transform & Crop"
|
|
8732
8760
|
}
|
|
8733
8761
|
),
|
|
@@ -8740,7 +8768,9 @@ var ImageEditor = ({
|
|
|
8740
8768
|
setActiveTab("adjust");
|
|
8741
8769
|
editor.setTool("select");
|
|
8742
8770
|
},
|
|
8743
|
-
|
|
8771
|
+
role: "tab",
|
|
8772
|
+
"aria-selected": activeTab === "adjust",
|
|
8773
|
+
className: `${imageTabClass(activeTab === "adjust")}`,
|
|
8744
8774
|
children: "Adjustments"
|
|
8745
8775
|
}
|
|
8746
8776
|
),
|
|
@@ -8753,7 +8783,9 @@ var ImageEditor = ({
|
|
|
8753
8783
|
setActiveTab("layers");
|
|
8754
8784
|
editor.setTool("select");
|
|
8755
8785
|
},
|
|
8756
|
-
|
|
8786
|
+
role: "tab",
|
|
8787
|
+
"aria-selected": activeTab === "layers",
|
|
8788
|
+
className: `${imageTabClass(activeTab === "layers")}`,
|
|
8757
8789
|
children: "Layers"
|
|
8758
8790
|
}
|
|
8759
8791
|
),
|
|
@@ -8766,7 +8798,9 @@ var ImageEditor = ({
|
|
|
8766
8798
|
setActiveTab("paint");
|
|
8767
8799
|
editor.setTool("brush");
|
|
8768
8800
|
},
|
|
8769
|
-
|
|
8801
|
+
role: "tab",
|
|
8802
|
+
"aria-selected": activeTab === "paint",
|
|
8803
|
+
className: `${imageTabClass(activeTab === "paint")}`,
|
|
8770
8804
|
children: "Paint"
|
|
8771
8805
|
}
|
|
8772
8806
|
),
|
|
@@ -8779,7 +8813,9 @@ var ImageEditor = ({
|
|
|
8779
8813
|
setActiveTab("select");
|
|
8780
8814
|
editor.setTool("select");
|
|
8781
8815
|
},
|
|
8782
|
-
|
|
8816
|
+
role: "tab",
|
|
8817
|
+
"aria-selected": activeTab === "select",
|
|
8818
|
+
className: `${imageTabClass(activeTab === "select")}`,
|
|
8783
8819
|
children: "Select & Mask"
|
|
8784
8820
|
}
|
|
8785
8821
|
),
|
|
@@ -8792,7 +8828,9 @@ var ImageEditor = ({
|
|
|
8792
8828
|
setActiveTab("annotate");
|
|
8793
8829
|
editor.setTool("pen");
|
|
8794
8830
|
},
|
|
8795
|
-
|
|
8831
|
+
role: "tab",
|
|
8832
|
+
"aria-selected": activeTab === "annotate",
|
|
8833
|
+
className: `${imageTabClass(activeTab === "annotate")}`,
|
|
8796
8834
|
children: "Annotations"
|
|
8797
8835
|
}
|
|
8798
8836
|
),
|
|
@@ -8805,7 +8843,9 @@ var ImageEditor = ({
|
|
|
8805
8843
|
setActiveTab("depth");
|
|
8806
8844
|
editor.setTool("select");
|
|
8807
8845
|
},
|
|
8808
|
-
|
|
8846
|
+
role: "tab",
|
|
8847
|
+
"aria-selected": activeTab === "depth",
|
|
8848
|
+
className: `${imageTabClass(activeTab === "depth")}`,
|
|
8809
8849
|
children: "Depth Mask"
|
|
8810
8850
|
}
|
|
8811
8851
|
),
|
|
@@ -8818,7 +8858,9 @@ var ImageEditor = ({
|
|
|
8818
8858
|
setActiveTab("ai");
|
|
8819
8859
|
editor.setTool("select");
|
|
8820
8860
|
},
|
|
8821
|
-
|
|
8861
|
+
role: "tab",
|
|
8862
|
+
"aria-selected": activeTab === "ai",
|
|
8863
|
+
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
8822
8864
|
children: [
|
|
8823
8865
|
/* @__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
8866
|
"AI Tools"
|
|
@@ -8833,7 +8875,7 @@ var ImageEditor = ({
|
|
|
8833
8875
|
type: "button",
|
|
8834
8876
|
disabled: !editor.canUndo,
|
|
8835
8877
|
onClick: () => editor.undo(),
|
|
8836
|
-
className:
|
|
8878
|
+
className: imageHeaderButtonClass,
|
|
8837
8879
|
title: "Undo",
|
|
8838
8880
|
children: "\u21A9"
|
|
8839
8881
|
}
|
|
@@ -8844,7 +8886,7 @@ var ImageEditor = ({
|
|
|
8844
8886
|
type: "button",
|
|
8845
8887
|
disabled: !editor.canRedo,
|
|
8846
8888
|
onClick: () => editor.redo(),
|
|
8847
|
-
className:
|
|
8889
|
+
className: imageHeaderButtonClass,
|
|
8848
8890
|
title: "Redo",
|
|
8849
8891
|
children: "\u21AA"
|
|
8850
8892
|
}
|
|
@@ -8854,22 +8896,22 @@ var ImageEditor = ({
|
|
|
8854
8896
|
{
|
|
8855
8897
|
type: "button",
|
|
8856
8898
|
onClick: () => editor.reset(),
|
|
8857
|
-
className:
|
|
8899
|
+
className: `${imageHeaderButtonClass} px-2 text-muted-foreground`,
|
|
8858
8900
|
children: "Reset"
|
|
8859
8901
|
}
|
|
8860
8902
|
),
|
|
8861
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "h-4 w-px bg-
|
|
8903
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
8862
8904
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
8863
8905
|
"button",
|
|
8864
8906
|
{
|
|
8865
8907
|
type: "button",
|
|
8866
8908
|
onClick: () => editor.zoomOut(),
|
|
8867
|
-
className:
|
|
8909
|
+
className: imageHeaderButtonClass,
|
|
8868
8910
|
title: "Zoom Out",
|
|
8869
8911
|
children: "-"
|
|
8870
8912
|
}
|
|
8871
8913
|
),
|
|
8872
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "font-mono text-
|
|
8914
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
8873
8915
|
Math.round(state.zoom * 100),
|
|
8874
8916
|
"%"
|
|
8875
8917
|
] }),
|
|
@@ -8878,12 +8920,12 @@ var ImageEditor = ({
|
|
|
8878
8920
|
{
|
|
8879
8921
|
type: "button",
|
|
8880
8922
|
onClick: () => editor.zoomIn(),
|
|
8881
|
-
className:
|
|
8923
|
+
className: imageHeaderButtonClass,
|
|
8882
8924
|
title: "Zoom In",
|
|
8883
8925
|
children: "+"
|
|
8884
8926
|
}
|
|
8885
8927
|
),
|
|
8886
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "h-4 w-px bg-
|
|
8928
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
8887
8929
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
8888
8930
|
"button",
|
|
8889
8931
|
{
|
|
@@ -8891,7 +8933,7 @@ var ImageEditor = ({
|
|
|
8891
8933
|
onMouseDown: () => editor.setComparing(true),
|
|
8892
8934
|
onMouseUp: () => editor.setComparing(false),
|
|
8893
8935
|
onMouseLeave: () => editor.setComparing(false),
|
|
8894
|
-
className: "px-2.5 py-1.5 rounded-lg border border-
|
|
8936
|
+
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
8937
|
children: "Hold Compare"
|
|
8896
8938
|
}
|
|
8897
8939
|
),
|
|
@@ -8900,14 +8942,14 @@ var ImageEditor = ({
|
|
|
8900
8942
|
{
|
|
8901
8943
|
type: "button",
|
|
8902
8944
|
onClick: handleExport,
|
|
8903
|
-
className:
|
|
8945
|
+
className: `${imagePrimaryButtonClass} px-4 py-1.5`,
|
|
8904
8946
|
children: "Export Image"
|
|
8905
8947
|
}
|
|
8906
8948
|
)
|
|
8907
8949
|
] })
|
|
8908
8950
|
] }),
|
|
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:
|
|
8951
|
+
transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
8952
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
8911
8953
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
8912
8954
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
8913
8955
|
ImageEditorCanvas,
|
|
@@ -8930,12 +8972,12 @@ var ImageEditor = ({
|
|
|
8930
8972
|
onPlaybackReveal,
|
|
8931
8973
|
chromeRoot: rootRef,
|
|
8932
8974
|
open: openPanel,
|
|
8933
|
-
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-
|
|
8975
|
+
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
8934
8976
|
}
|
|
8935
8977
|
),
|
|
8936
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className:
|
|
8978
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: imageSidebarClass, children: [
|
|
8937
8979
|
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:
|
|
8980
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
8939
8981
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
8940
8982
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
8941
8983
|
"button",
|
|
@@ -8945,7 +8987,7 @@ var ImageEditor = ({
|
|
|
8945
8987
|
setActiveCropRatio(null);
|
|
8946
8988
|
editor.applyCropPreset(null);
|
|
8947
8989
|
},
|
|
8948
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === null && state.crop ? "bg-
|
|
8990
|
+
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
8991
|
children: "Freeform"
|
|
8950
8992
|
}
|
|
8951
8993
|
),
|
|
@@ -8957,7 +8999,7 @@ var ImageEditor = ({
|
|
|
8957
8999
|
setActiveCropRatio(1);
|
|
8958
9000
|
editor.applyCropPreset(1);
|
|
8959
9001
|
},
|
|
8960
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 1 ? "bg-
|
|
9002
|
+
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
9003
|
children: "1:1 Square"
|
|
8962
9004
|
}
|
|
8963
9005
|
),
|
|
@@ -8969,7 +9011,7 @@ var ImageEditor = ({
|
|
|
8969
9011
|
setActiveCropRatio(4 / 3);
|
|
8970
9012
|
editor.applyCropPreset(4 / 3);
|
|
8971
9013
|
},
|
|
8972
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 4 / 3 ? "bg-
|
|
9014
|
+
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
9015
|
children: "4:3 Standard"
|
|
8974
9016
|
}
|
|
8975
9017
|
),
|
|
@@ -8981,7 +9023,7 @@ var ImageEditor = ({
|
|
|
8981
9023
|
setActiveCropRatio(16 / 9);
|
|
8982
9024
|
editor.applyCropPreset(16 / 9);
|
|
8983
9025
|
},
|
|
8984
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 16 / 9 ? "bg-
|
|
9026
|
+
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
9027
|
children: "16:9 Wide"
|
|
8986
9028
|
}
|
|
8987
9029
|
),
|
|
@@ -8993,7 +9035,7 @@ var ImageEditor = ({
|
|
|
8993
9035
|
setActiveCropRatio(3 / 2);
|
|
8994
9036
|
editor.applyCropPreset(3 / 2);
|
|
8995
9037
|
},
|
|
8996
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 3 / 2 ? "bg-
|
|
9038
|
+
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
9039
|
children: "3:2 Photo"
|
|
8998
9040
|
}
|
|
8999
9041
|
),
|
|
@@ -9005,20 +9047,20 @@ var ImageEditor = ({
|
|
|
9005
9047
|
setActiveCropRatio(null);
|
|
9006
9048
|
editor.resetCrop();
|
|
9007
9049
|
},
|
|
9008
|
-
className: "px-2.5 py-2 rounded-lg bg-
|
|
9050
|
+
className: "px-2.5 py-2 rounded-lg bg-destructive/10 hover:bg-destructive/20 text-destructive border border-destructive/40 font-medium",
|
|
9009
9051
|
children: "Clear Crop"
|
|
9010
9052
|
}
|
|
9011
9053
|
)
|
|
9012
9054
|
] }),
|
|
9013
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className:
|
|
9014
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className:
|
|
9055
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: imageDividerClass }),
|
|
9056
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
9015
9057
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
9016
9058
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9017
9059
|
"button",
|
|
9018
9060
|
{
|
|
9019
9061
|
type: "button",
|
|
9020
9062
|
onClick: () => editor.rotate(-90),
|
|
9021
|
-
className: "px-3 py-2 rounded-lg bg-
|
|
9063
|
+
className: "px-3 py-2 rounded-lg bg-muted hover:bg-accent text-foreground border border-border",
|
|
9022
9064
|
children: "Rotate -90\xB0"
|
|
9023
9065
|
}
|
|
9024
9066
|
),
|
|
@@ -9027,7 +9069,7 @@ var ImageEditor = ({
|
|
|
9027
9069
|
{
|
|
9028
9070
|
type: "button",
|
|
9029
9071
|
onClick: () => editor.rotate(90),
|
|
9030
|
-
className: "px-3 py-2 rounded-lg bg-
|
|
9072
|
+
className: "px-3 py-2 rounded-lg bg-muted hover:bg-accent text-foreground border border-border",
|
|
9031
9073
|
children: "Rotate +90\xB0"
|
|
9032
9074
|
}
|
|
9033
9075
|
),
|
|
@@ -9036,7 +9078,7 @@ var ImageEditor = ({
|
|
|
9036
9078
|
{
|
|
9037
9079
|
type: "button",
|
|
9038
9080
|
onClick: () => editor.flipHorizontal(),
|
|
9039
|
-
className: `px-3 py-2 rounded-lg border transition-colors ${state.transform.flipH ? "bg-
|
|
9081
|
+
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
9082
|
children: "Flip Horizontal"
|
|
9041
9083
|
}
|
|
9042
9084
|
),
|
|
@@ -9045,7 +9087,7 @@ var ImageEditor = ({
|
|
|
9045
9087
|
{
|
|
9046
9088
|
type: "button",
|
|
9047
9089
|
onClick: () => editor.flipVertical(),
|
|
9048
|
-
className: `px-3 py-2 rounded-lg border transition-colors ${state.transform.flipV ? "bg-
|
|
9090
|
+
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
9091
|
children: "Flip Vertical"
|
|
9050
9092
|
}
|
|
9051
9093
|
)
|
|
@@ -9053,13 +9095,13 @@ var ImageEditor = ({
|
|
|
9053
9095
|
] }),
|
|
9054
9096
|
activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
9055
9097
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
9056
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className:
|
|
9098
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
9057
9099
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9058
9100
|
"button",
|
|
9059
9101
|
{
|
|
9060
9102
|
type: "button",
|
|
9061
9103
|
onClick: () => editor.resetAdjustments(),
|
|
9062
|
-
className: "text-[10px] text-
|
|
9104
|
+
className: "text-[10px] text-destructive hover:underline",
|
|
9063
9105
|
children: "Reset Sliders"
|
|
9064
9106
|
}
|
|
9065
9107
|
)
|
|
@@ -9078,7 +9120,7 @@ var ImageEditor = ({
|
|
|
9078
9120
|
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
9079
9121
|
"div",
|
|
9080
9122
|
{
|
|
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-
|
|
9123
|
+
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
9124
|
"data-testid": "image-editor-process-notice",
|
|
9083
9125
|
children: [
|
|
9084
9126
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
@@ -9095,7 +9137,7 @@ var ImageEditor = ({
|
|
|
9095
9137
|
}
|
|
9096
9138
|
)
|
|
9097
9139
|
] }, spec.id)),
|
|
9098
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className:
|
|
9140
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9099
9141
|
AdjustmentLayersPanel,
|
|
9100
9142
|
{
|
|
9101
9143
|
controller,
|
|
@@ -9105,82 +9147,82 @@ var ImageEditor = ({
|
|
|
9105
9147
|
) })
|
|
9106
9148
|
] }),
|
|
9107
9149
|
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:
|
|
9150
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
9109
9151
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9110
9152
|
"button",
|
|
9111
9153
|
{
|
|
9112
9154
|
type: "button",
|
|
9113
9155
|
title: "Edit \u203A Free Transform (Ctrl/Cmd+T): the selected pixels, or the whole active layer",
|
|
9114
|
-
className:
|
|
9156
|
+
className: imageSmallButtonClass,
|
|
9115
9157
|
disabled: transformTool.active,
|
|
9116
9158
|
onClick: () => transformTool.begin(),
|
|
9117
9159
|
children: "Free Transform"
|
|
9118
9160
|
}
|
|
9119
9161
|
),
|
|
9120
9162
|
/* @__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:
|
|
9163
|
+
effectsShown && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
9164
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
9123
9165
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ColorProfilePanel, { controller })
|
|
9124
9166
|
] }),
|
|
9125
9167
|
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:
|
|
9168
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
9127
9169
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BrushOptionsBar, { controller }),
|
|
9128
9170
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9129
9171
|
"button",
|
|
9130
9172
|
{
|
|
9131
9173
|
type: "button",
|
|
9132
9174
|
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-
|
|
9175
|
+
className: "px-2 py-1 rounded text-[11px] bg-muted text-foreground hover:bg-accent hover:text-accent-foreground self-start",
|
|
9134
9176
|
disabled: transformTool.active,
|
|
9135
9177
|
onClick: () => transformTool.begin(),
|
|
9136
9178
|
children: "Free Transform"
|
|
9137
9179
|
}
|
|
9138
9180
|
),
|
|
9139
|
-
paintError && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { role: "alert", className: "text-
|
|
9140
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className:
|
|
9181
|
+
paintError && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
9182
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(LayersPanel, { controller }) })
|
|
9141
9183
|
] }),
|
|
9142
9184
|
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:
|
|
9185
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
|
|
9144
9186
|
/* @__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
9187
|
"button",
|
|
9146
9188
|
{
|
|
9147
9189
|
type: "button",
|
|
9148
9190
|
"aria-pressed": state.activeTool === t,
|
|
9149
9191
|
onClick: () => editor.setTool(t),
|
|
9150
|
-
className: `py-1.5 px-2 rounded-lg font-medium border transition-colors ${state.activeTool === t ? "bg-
|
|
9192
|
+
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
9193
|
children: t === "shape" ? "Shape" : "Type"
|
|
9152
9194
|
},
|
|
9153
9195
|
t
|
|
9154
9196
|
)) }),
|
|
9155
9197
|
state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
9156
9198
|
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:
|
|
9199
|
+
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" }),
|
|
9200
|
+
shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
9201
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: imageDividerClass }),
|
|
9202
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
9161
9203
|
/* @__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
9204
|
"button",
|
|
9163
9205
|
{
|
|
9164
9206
|
type: "button",
|
|
9165
9207
|
onClick: () => editor.setTool(t),
|
|
9166
|
-
className: `py-1.5 px-2 rounded-lg font-medium capitalize border transition-colors ${state.activeTool === t ? "bg-
|
|
9208
|
+
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
9209
|
children: t
|
|
9168
9210
|
},
|
|
9169
9211
|
t
|
|
9170
9212
|
)) }),
|
|
9171
9213
|
/* @__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-
|
|
9214
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
9173
9215
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9174
9216
|
"input",
|
|
9175
9217
|
{
|
|
9176
9218
|
type: "color",
|
|
9177
9219
|
value: activeColor,
|
|
9178
9220
|
onChange: (e) => setActiveColor(e.target.value),
|
|
9179
|
-
className: "w-8 h-8 rounded border border-
|
|
9221
|
+
className: "w-8 h-8 rounded border border-border cursor-pointer bg-transparent"
|
|
9180
9222
|
}
|
|
9181
9223
|
),
|
|
9182
9224
|
/* @__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-
|
|
9225
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
9184
9226
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Width:" }),
|
|
9185
9227
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "font-mono", children: [
|
|
9186
9228
|
strokeWidth,
|
|
@@ -9195,13 +9237,13 @@ var ImageEditor = ({
|
|
|
9195
9237
|
max: "20",
|
|
9196
9238
|
value: strokeWidth,
|
|
9197
9239
|
onChange: (e) => setStrokeWidth(Number(e.target.value)),
|
|
9198
|
-
className:
|
|
9240
|
+
className: imageRangeClass
|
|
9199
9241
|
}
|
|
9200
9242
|
)
|
|
9201
9243
|
] })
|
|
9202
9244
|
] }),
|
|
9203
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className:
|
|
9204
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className:
|
|
9245
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: imageDividerClass }),
|
|
9246
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
9205
9247
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex gap-2", children: [
|
|
9206
9248
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9207
9249
|
"input",
|
|
@@ -9211,7 +9253,7 @@ var ImageEditor = ({
|
|
|
9211
9253
|
value: textInput,
|
|
9212
9254
|
onChange: (e) => setTextInput(e.target.value),
|
|
9213
9255
|
onKeyDown: (e) => e.key === "Enter" && handleAddText(),
|
|
9214
|
-
className: "flex-1 bg-
|
|
9256
|
+
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
9257
|
}
|
|
9216
9258
|
),
|
|
9217
9259
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
@@ -9219,12 +9261,12 @@ var ImageEditor = ({
|
|
|
9219
9261
|
{
|
|
9220
9262
|
type: "button",
|
|
9221
9263
|
onClick: handleAddText,
|
|
9222
|
-
className: "px-3 py-1.5 rounded-lg bg-
|
|
9264
|
+
className: "px-3 py-1.5 rounded-lg bg-primary hover:bg-primary/90 text-primary-foreground font-medium shadow",
|
|
9223
9265
|
children: "Add"
|
|
9224
9266
|
}
|
|
9225
9267
|
)
|
|
9226
9268
|
] }),
|
|
9227
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-center justify-between text-
|
|
9269
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
9228
9270
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Font Size:" }),
|
|
9229
9271
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "font-mono", children: [
|
|
9230
9272
|
fontSize,
|
|
@@ -9239,12 +9281,12 @@ var ImageEditor = ({
|
|
|
9239
9281
|
max: "72",
|
|
9240
9282
|
value: fontSize,
|
|
9241
9283
|
onChange: (e) => setFontSize(Number(e.target.value)),
|
|
9242
|
-
className:
|
|
9284
|
+
className: imageRangeClass
|
|
9243
9285
|
}
|
|
9244
9286
|
),
|
|
9245
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className:
|
|
9287
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: imageDividerClass }),
|
|
9246
9288
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
9247
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "text-
|
|
9289
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
9248
9290
|
"Layers (",
|
|
9249
9291
|
state.annotations.length,
|
|
9250
9292
|
")"
|
|
@@ -9254,7 +9296,7 @@ var ImageEditor = ({
|
|
|
9254
9296
|
{
|
|
9255
9297
|
type: "button",
|
|
9256
9298
|
onClick: () => editor.removeAnnotation(state.selectedAnnotationId),
|
|
9257
|
-
className: "text-
|
|
9299
|
+
className: "text-destructive hover:underline text-[11px]",
|
|
9258
9300
|
children: "Delete Selected"
|
|
9259
9301
|
}
|
|
9260
9302
|
),
|
|
@@ -9263,7 +9305,7 @@ var ImageEditor = ({
|
|
|
9263
9305
|
{
|
|
9264
9306
|
type: "button",
|
|
9265
9307
|
onClick: () => editor.clearAnnotations(),
|
|
9266
|
-
className: "text-
|
|
9308
|
+
className: "text-muted-foreground hover:text-foreground text-[11px]",
|
|
9267
9309
|
children: "Clear All"
|
|
9268
9310
|
}
|
|
9269
9311
|
)
|
|
@@ -9271,32 +9313,32 @@ var ImageEditor = ({
|
|
|
9271
9313
|
] }),
|
|
9272
9314
|
activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
9273
9315
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
9274
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className:
|
|
9316
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
9275
9317
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9276
9318
|
"button",
|
|
9277
9319
|
{
|
|
9278
9320
|
type: "button",
|
|
9279
9321
|
onClick: () => editor.resetDepthMask(),
|
|
9280
|
-
className: "text-[10px] text-
|
|
9322
|
+
className: "text-[10px] text-destructive hover:underline",
|
|
9281
9323
|
children: "Reset Mask"
|
|
9282
9324
|
}
|
|
9283
9325
|
)
|
|
9284
9326
|
] }),
|
|
9285
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-
|
|
9327
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
9286
9328
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9287
9329
|
"input",
|
|
9288
9330
|
{
|
|
9289
9331
|
type: "checkbox",
|
|
9290
9332
|
checked: state.depthMask.enabled,
|
|
9291
9333
|
onChange: (e) => editor.setDepthMask({ enabled: e.target.checked }),
|
|
9292
|
-
className: "rounded accent-
|
|
9334
|
+
className: "rounded accent-primary"
|
|
9293
9335
|
}
|
|
9294
9336
|
),
|
|
9295
9337
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Enable Depth / Alpha Mask" })
|
|
9296
9338
|
] }),
|
|
9297
9339
|
state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
9298
9340
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
|
|
9299
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("label", { className: "text-
|
|
9341
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
9300
9342
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9301
9343
|
"input",
|
|
9302
9344
|
{
|
|
@@ -9304,7 +9346,7 @@ var ImageEditor = ({
|
|
|
9304
9346
|
placeholder: "https://.../depthmap.png",
|
|
9305
9347
|
value: state.depthMask.maskSource || "",
|
|
9306
9348
|
onChange: (e) => editor.setDepthMask({ maskSource: e.target.value || null }),
|
|
9307
|
-
className: "w-full bg-
|
|
9349
|
+
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
9350
|
}
|
|
9309
9351
|
)
|
|
9310
9352
|
] }),
|
|
@@ -9314,7 +9356,7 @@ var ImageEditor = ({
|
|
|
9314
9356
|
{
|
|
9315
9357
|
type: "button",
|
|
9316
9358
|
onClick: () => editor.setDepthMask({ mode: "threshold" }),
|
|
9317
|
-
className: `flex-1 py-1.5 rounded-lg border text-xs font-medium ${state.depthMask.mode === "threshold" ? "bg-
|
|
9359
|
+
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
9360
|
children: "Threshold Mode"
|
|
9319
9361
|
}
|
|
9320
9362
|
),
|
|
@@ -9323,13 +9365,13 @@ var ImageEditor = ({
|
|
|
9323
9365
|
{
|
|
9324
9366
|
type: "button",
|
|
9325
9367
|
onClick: () => editor.setDepthMask({ mode: "brightness" }),
|
|
9326
|
-
className: `flex-1 py-1.5 rounded-lg border text-xs font-medium ${state.depthMask.mode === "brightness" ? "bg-
|
|
9368
|
+
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
9369
|
children: "Brightness Mode"
|
|
9328
9370
|
}
|
|
9329
9371
|
)
|
|
9330
9372
|
] }),
|
|
9331
9373
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
|
|
9332
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex justify-between text-
|
|
9374
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
9333
9375
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Depth Start (Lower):" }),
|
|
9334
9376
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
9335
9377
|
] }),
|
|
@@ -9343,12 +9385,12 @@ var ImageEditor = ({
|
|
|
9343
9385
|
onChange: (e) => editor.setDepthMask({
|
|
9344
9386
|
depthRange: [Number(e.target.value), state.depthMask.depthRange[1]]
|
|
9345
9387
|
}),
|
|
9346
|
-
className:
|
|
9388
|
+
className: imageRangeClass
|
|
9347
9389
|
}
|
|
9348
9390
|
)
|
|
9349
9391
|
] }),
|
|
9350
9392
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
|
|
9351
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex justify-between text-
|
|
9393
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
9352
9394
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Depth Stop (Upper):" }),
|
|
9353
9395
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
9354
9396
|
] }),
|
|
@@ -9362,12 +9404,12 @@ var ImageEditor = ({
|
|
|
9362
9404
|
onChange: (e) => editor.setDepthMask({
|
|
9363
9405
|
depthRange: [state.depthMask.depthRange[0], Number(e.target.value)]
|
|
9364
9406
|
}),
|
|
9365
|
-
className:
|
|
9407
|
+
className: imageRangeClass
|
|
9366
9408
|
}
|
|
9367
9409
|
)
|
|
9368
9410
|
] }),
|
|
9369
9411
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
|
|
9370
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex justify-between text-
|
|
9412
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
9371
9413
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Softness:" }),
|
|
9372
9414
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
|
|
9373
9415
|
] }),
|
|
@@ -9379,18 +9421,18 @@ var ImageEditor = ({
|
|
|
9379
9421
|
max: "50",
|
|
9380
9422
|
value: state.depthMask.softness,
|
|
9381
9423
|
onChange: (e) => editor.setDepthMask({ softness: Number(e.target.value) }),
|
|
9382
|
-
className:
|
|
9424
|
+
className: imageRangeClass
|
|
9383
9425
|
}
|
|
9384
9426
|
)
|
|
9385
9427
|
] }),
|
|
9386
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-
|
|
9428
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
9387
9429
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9388
9430
|
"input",
|
|
9389
9431
|
{
|
|
9390
9432
|
type: "checkbox",
|
|
9391
9433
|
checked: state.depthMask.invert,
|
|
9392
9434
|
onChange: (e) => editor.setDepthMask({ invert: e.target.checked }),
|
|
9393
|
-
className: "rounded accent-
|
|
9435
|
+
className: "rounded accent-primary"
|
|
9394
9436
|
}
|
|
9395
9437
|
),
|
|
9396
9438
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Invert Mask" })
|
|
@@ -9408,14 +9450,14 @@ var ImageEditor = ({
|
|
|
9408
9450
|
quickMask: Boolean(state.quickMask)
|
|
9409
9451
|
}
|
|
9410
9452
|
),
|
|
9411
|
-
selectionError && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { role: "alert", className: "text-
|
|
9453
|
+
selectionError && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
9412
9454
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex gap-1", children: [
|
|
9413
9455
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9414
9456
|
"button",
|
|
9415
9457
|
{
|
|
9416
9458
|
type: "button",
|
|
9417
9459
|
title: "Select \u203A Transform Selection: the outline only",
|
|
9418
|
-
className:
|
|
9460
|
+
className: imageSmallButtonClass,
|
|
9419
9461
|
disabled: transformTool.active,
|
|
9420
9462
|
onClick: () => transformTool.begin({ content: "selection-outline" }),
|
|
9421
9463
|
children: "Transform Selection"
|
|
@@ -9426,7 +9468,7 @@ var ImageEditor = ({
|
|
|
9426
9468
|
{
|
|
9427
9469
|
type: "button",
|
|
9428
9470
|
title: "Edit \u203A Free Transform: the selected pixels of the active layer",
|
|
9429
|
-
className:
|
|
9471
|
+
className: imageSmallButtonClass,
|
|
9430
9472
|
disabled: transformTool.active,
|
|
9431
9473
|
onClick: () => transformTool.begin({ content: "selection" }),
|
|
9432
9474
|
children: "Free Transform Pixels"
|
|
@@ -9436,7 +9478,7 @@ var ImageEditor = ({
|
|
|
9436
9478
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers })
|
|
9437
9479
|
] }),
|
|
9438
9480
|
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-
|
|
9481
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
9440
9482
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Results go to" }),
|
|
9441
9483
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
9442
9484
|
"select",
|
|
@@ -9444,7 +9486,7 @@ var ImageEditor = ({
|
|
|
9444
9486
|
"aria-label": "AI result target",
|
|
9445
9487
|
value: aiTarget,
|
|
9446
9488
|
onChange: (e) => setAiTarget(e.target.value),
|
|
9447
|
-
className:
|
|
9489
|
+
className: imageSelectClass,
|
|
9448
9490
|
children: [
|
|
9449
9491
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
9450
9492
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
|
|
@@ -9453,24 +9495,24 @@ var ImageEditor = ({
|
|
|
9453
9495
|
}
|
|
9454
9496
|
)
|
|
9455
9497
|
] }),
|
|
9456
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "p-3 rounded-lg bg-
|
|
9498
|
+
/* @__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
9499
|
/* @__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-
|
|
9500
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
9501
|
+
/* @__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
9502
|
"Background Removal"
|
|
9461
9503
|
] }),
|
|
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-
|
|
9504
|
+
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
9505
|
] }),
|
|
9464
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "text-
|
|
9506
|
+
/* @__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
9507
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9466
9508
|
"button",
|
|
9467
9509
|
{
|
|
9468
9510
|
type: "button",
|
|
9469
9511
|
onClick: handleRemoveBackground,
|
|
9470
9512
|
disabled: isRemovingBg || isInpainting,
|
|
9471
|
-
className: "mt-1 px-3 py-2 rounded-lg bg-
|
|
9513
|
+
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
9514
|
children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
9473
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className:
|
|
9515
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: imageSpinnerClass }),
|
|
9474
9516
|
"Removing Background..."
|
|
9475
9517
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
9476
9518
|
/* @__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 +9521,20 @@ var ImageEditor = ({
|
|
|
9479
9521
|
}
|
|
9480
9522
|
)
|
|
9481
9523
|
] }),
|
|
9482
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "p-3 rounded-lg bg-
|
|
9524
|
+
/* @__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
9525
|
/* @__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-
|
|
9526
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
9527
|
+
/* @__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
9528
|
/* @__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
9529
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("path", { d: "m14 7 3 3" })
|
|
9488
9530
|
] }),
|
|
9489
9531
|
"Generative Inpainting"
|
|
9490
9532
|
] }),
|
|
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-
|
|
9533
|
+
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
9534
|
] }),
|
|
9493
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "text-
|
|
9535
|
+
/* @__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
9536
|
/* @__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-
|
|
9537
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
9496
9538
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9497
9539
|
"textarea",
|
|
9498
9540
|
{
|
|
@@ -9501,19 +9543,19 @@ var ImageEditor = ({
|
|
|
9501
9543
|
onChange: (e) => setInpaintPrompt(e.target.value),
|
|
9502
9544
|
placeholder: "e.g. replace sunglasses with steampunk goggles, remove person in background...",
|
|
9503
9545
|
rows: 3,
|
|
9504
|
-
className: "w-full bg-
|
|
9546
|
+
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
9547
|
}
|
|
9506
9548
|
)
|
|
9507
9549
|
] }),
|
|
9508
9550
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
9509
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "text-
|
|
9551
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
9510
9552
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
9511
9553
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
9512
9554
|
"button",
|
|
9513
9555
|
{
|
|
9514
9556
|
type: "button",
|
|
9515
9557
|
onClick: () => setInpaintMaskMode("annotations"),
|
|
9516
|
-
className: `px-2 py-1.5 rounded border text-[11px] font-medium text-left transition-colors ${inpaintMaskMode === "annotations" ? "bg-
|
|
9558
|
+
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
9559
|
children: [
|
|
9518
9560
|
"Drawn Shapes (",
|
|
9519
9561
|
state.annotations.length,
|
|
@@ -9526,7 +9568,7 @@ var ImageEditor = ({
|
|
|
9526
9568
|
{
|
|
9527
9569
|
type: "button",
|
|
9528
9570
|
onClick: () => setInpaintMaskMode("crop"),
|
|
9529
|
-
className: `px-2 py-1.5 rounded border text-[11px] font-medium text-left transition-colors ${inpaintMaskMode === "crop" ? "bg-
|
|
9571
|
+
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
9572
|
children: [
|
|
9531
9573
|
"Crop Box (",
|
|
9532
9574
|
state.crop ? "Selected" : "Full",
|
|
@@ -9542,9 +9584,9 @@ var ImageEditor = ({
|
|
|
9542
9584
|
type: "button",
|
|
9543
9585
|
onClick: handleInpaint,
|
|
9544
9586
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
9545
|
-
className: "mt-1 px-3 py-2 rounded-lg bg-
|
|
9587
|
+
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
9588
|
children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
9547
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className:
|
|
9589
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: imageSpinnerClass }),
|
|
9548
9590
|
"Generating Inpaint..."
|
|
9549
9591
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
9550
9592
|
/* @__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 +9595,8 @@ var ImageEditor = ({
|
|
|
9553
9595
|
}
|
|
9554
9596
|
)
|
|
9555
9597
|
] }),
|
|
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-
|
|
9598
|
+
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 }),
|
|
9599
|
+
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
9600
|
] })
|
|
9559
9601
|
] })
|
|
9560
9602
|
] })
|
|
@@ -10556,18 +10598,18 @@ var AssetMentionChips = ({
|
|
|
10556
10598
|
document.addEventListener("mousedown", onPointer);
|
|
10557
10599
|
return () => document.removeEventListener("mousedown", onPointer);
|
|
10558
10600
|
}, [open]);
|
|
10559
|
-
const pick = (
|
|
10601
|
+
const pick = (chip2, role) => {
|
|
10560
10602
|
setOpen(null);
|
|
10561
|
-
if (
|
|
10562
|
-
onChange((0, import_generation3.setMentionRoleInText)(content,
|
|
10603
|
+
if (chip2.start === void 0) return;
|
|
10604
|
+
onChange((0, import_generation3.setMentionRoleInText)(content, chip2.start, role));
|
|
10563
10605
|
};
|
|
10564
10606
|
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 =
|
|
10607
|
+
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) => {
|
|
10608
|
+
const error = chip2.issues.find((issue) => issue.severity === "error");
|
|
10609
|
+
const warning = chip2.issues.find((issue) => issue.severity === "warning");
|
|
10568
10610
|
const problem = error ?? warning;
|
|
10569
|
-
const isOpen = open ===
|
|
10570
|
-
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "relative inline-flex", "data-asset-chip":
|
|
10611
|
+
const isOpen = open === chip2.index;
|
|
10612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "relative inline-flex", "data-asset-chip": chip2.asset.id, children: [
|
|
10571
10613
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
10572
10614
|
"button",
|
|
10573
10615
|
{
|
|
@@ -10576,19 +10618,19 @@ var AssetMentionChips = ({
|
|
|
10576
10618
|
"aria-expanded": isOpen,
|
|
10577
10619
|
title: problem?.message,
|
|
10578
10620
|
"data-issue": problem?.code,
|
|
10579
|
-
onClick: () => setOpen(isOpen ? null :
|
|
10621
|
+
onClick: () => setOpen(isOpen ? null : chip2.index),
|
|
10580
10622
|
onKeyDown: (e) => {
|
|
10581
10623
|
if (e.key === "Escape") setOpen(null);
|
|
10582
10624
|
},
|
|
10583
10625
|
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
10626
|
children: [
|
|
10585
|
-
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { children: renderAsset ? renderAsset(
|
|
10627
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { children: renderAsset ? renderAsset(chip2) : `@${chip2.asset.label ?? chip2.handle}` }),
|
|
10586
10628
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
10587
10629
|
"span",
|
|
10588
10630
|
{
|
|
10589
|
-
className: `rounded px-1 text-[10px] uppercase tracking-wide ${
|
|
10590
|
-
"data-role-badge":
|
|
10591
|
-
children:
|
|
10631
|
+
className: `rounded px-1 text-[10px] uppercase tracking-wide ${chip2.role ? "bg-primary/15" : "opacity-60"}`,
|
|
10632
|
+
"data-role-badge": chip2.role ?? "",
|
|
10633
|
+
children: chip2.roleLabel ?? "No role"
|
|
10592
10634
|
}
|
|
10593
10635
|
)
|
|
10594
10636
|
]
|
|
@@ -10598,7 +10640,7 @@ var AssetMentionChips = ({
|
|
|
10598
10640
|
"div",
|
|
10599
10641
|
{
|
|
10600
10642
|
role: "listbox",
|
|
10601
|
-
"aria-label": `Role for ${
|
|
10643
|
+
"aria-label": `Role for ${chip2.asset.label ?? chip2.handle}`,
|
|
10602
10644
|
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
10645
|
"data-role-picker": "",
|
|
10604
10646
|
onKeyDown: (e) => {
|
|
@@ -10610,10 +10652,10 @@ var AssetMentionChips = ({
|
|
|
10610
10652
|
{
|
|
10611
10653
|
type: "button",
|
|
10612
10654
|
role: "option",
|
|
10613
|
-
"aria-selected":
|
|
10655
|
+
"aria-selected": chip2.role === option.role,
|
|
10614
10656
|
"data-role-option": option.role,
|
|
10615
10657
|
title: option.description,
|
|
10616
|
-
onClick: () => pick(
|
|
10658
|
+
onClick: () => pick(chip2, option.role),
|
|
10617
10659
|
className: "flex items-center justify-between gap-2 rounded px-2 py-1 text-left hover:bg-muted",
|
|
10618
10660
|
children: [
|
|
10619
10661
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { children: option.label }),
|
|
@@ -10627,18 +10669,18 @@ var AssetMentionChips = ({
|
|
|
10627
10669
|
{
|
|
10628
10670
|
type: "button",
|
|
10629
10671
|
role: "option",
|
|
10630
|
-
"aria-selected": !
|
|
10672
|
+
"aria-selected": !chip2.role,
|
|
10631
10673
|
"data-role-option": "",
|
|
10632
|
-
onClick: () => pick(
|
|
10674
|
+
onClick: () => pick(chip2, null),
|
|
10633
10675
|
className: "rounded px-2 py-1 text-left opacity-70 hover:bg-muted",
|
|
10634
10676
|
children: "No role"
|
|
10635
10677
|
}
|
|
10636
10678
|
),
|
|
10637
|
-
|
|
10679
|
+
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
10680
|
]
|
|
10639
10681
|
}
|
|
10640
10682
|
)
|
|
10641
|
-
] }, `${
|
|
10683
|
+
] }, `${chip2.start}-${chip2.index}`);
|
|
10642
10684
|
}) });
|
|
10643
10685
|
};
|
|
10644
10686
|
|