@pixerate/editor-react 0.114.2 → 0.115.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 +361 -216
- package/dist/animation-editor/index.js +2 -2
- package/dist/canvas/index.cjs +539 -394
- package/dist/canvas/index.js +2 -2
- package/dist/{chunk-2INOKIJN.js → chunk-2KXZLZAS.js} +381 -364
- package/dist/{chunk-5LFQ2UQZ.js → chunk-5RPB4WGT.js} +240 -102
- package/dist/{chunk-BWEARAWR.js → chunk-6BWTJ3EE.js} +40 -18
- package/dist/effects/EffectParameters.d.cts +4 -1
- package/dist/effects/EffectParameters.d.ts +4 -1
- package/dist/effects/index.cjs +367 -222
- package/dist/effects/index.js +2 -2
- package/dist/image-editor/ImageEffectControls.d.cts +4 -1
- package/dist/image-editor/ImageEffectControls.d.ts +4 -1
- package/dist/image-editor/ImageProviderEffectsPanel.d.cts +4 -1
- package/dist/image-editor/ImageProviderEffectsPanel.d.ts +4 -1
- package/dist/image-editor/controls/controls.d.cts +19 -0
- package/dist/image-editor/controls/controls.d.ts +19 -0
- package/dist/image-editor/controls/parameterControls.d.cts +4 -0
- package/dist/image-editor/controls/parameterControls.d.ts +4 -0
- package/dist/image-editor/index.cjs +924 -765
- package/dist/image-editor/index.d.cts +1 -1
- package/dist/image-editor/index.d.ts +1 -1
- package/dist/image-editor/index.js +5 -3
- package/dist/index.cjs +1444 -1285
- package/dist/index.js +5 -3
- package/dist/paint-editor/index.cjs +354 -209
- package/dist/paint-editor/index.js +2 -2
- package/dist/parameters/ParametersPanel.d.cts +4 -1
- package/dist/parameters/ParametersPanel.d.ts +4 -1
- package/dist/parameters/controls.d.cts +92 -0
- package/dist/parameters/controls.d.ts +92 -0
- package/dist/parameters/fields.d.cts +20 -7
- package/dist/parameters/fields.d.ts +20 -7
- package/dist/parameters/index.cjs +369 -184
- package/dist/parameters/index.d.cts +1 -0
- package/dist/parameters/index.d.ts +1 -0
- package/dist/parameters/index.js +70 -14
- package/dist/vector/index.cjs +340 -195
- package/dist/vector/index.js +2 -2
- package/dist/video-editor/index.cjs +437 -292
- package/dist/video-editor/index.js +2 -2
- package/package.json +3 -3
|
@@ -6,7 +6,11 @@ import {
|
|
|
6
6
|
EffectsBrowser,
|
|
7
7
|
useEffectDescription,
|
|
8
8
|
useEffects
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-6BWTJ3EE.js";
|
|
10
|
+
import {
|
|
11
|
+
resolveParameterComponents,
|
|
12
|
+
useParameterComponents
|
|
13
|
+
} from "./chunk-5RPB4WGT.js";
|
|
10
14
|
import {
|
|
11
15
|
PresenceLayer,
|
|
12
16
|
useAgentPlayback,
|
|
@@ -1033,6 +1037,22 @@ function ImageSelect(props) {
|
|
|
1033
1037
|
options.map((o) => /* @__PURE__ */ jsx2("option", { value: o.value, children: o.label }, o.value))
|
|
1034
1038
|
] });
|
|
1035
1039
|
}
|
|
1040
|
+
function ImageColor(props) {
|
|
1041
|
+
const Host = useImageEditorControls().Color;
|
|
1042
|
+
if (Host) return /* @__PURE__ */ jsx2(Host, { ...props });
|
|
1043
|
+
const { value, label, alpha, disabled, onChange, className = "" } = props;
|
|
1044
|
+
return /* @__PURE__ */ jsx2(
|
|
1045
|
+
"input",
|
|
1046
|
+
{
|
|
1047
|
+
type: "color",
|
|
1048
|
+
"aria-label": label,
|
|
1049
|
+
value: value.slice(0, 7),
|
|
1050
|
+
disabled,
|
|
1051
|
+
onChange: (e) => onChange(e.target.value + (alpha ? value.slice(7, 9) : "")),
|
|
1052
|
+
className: `${imageColorInputClass} ${className}`
|
|
1053
|
+
}
|
|
1054
|
+
);
|
|
1055
|
+
}
|
|
1036
1056
|
|
|
1037
1057
|
// src/image-editor/ControlSlider.tsx
|
|
1038
1058
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
@@ -1292,32 +1312,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
|
|
|
1292
1312
|
/* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
1293
1313
|
/* @__PURE__ */ jsx6(ImageCheckbox, { label: "Tint", checked: layer.params.tint !== null, onChange: (on) => setParam(layer, "tint", on ? "#e1d3b3" : null) }),
|
|
1294
1314
|
"Tint",
|
|
1295
|
-
layer.params.tint && /* @__PURE__ */ jsx6(
|
|
1296
|
-
"input",
|
|
1297
|
-
{
|
|
1298
|
-
type: "color",
|
|
1299
|
-
"aria-label": "Tint colour",
|
|
1300
|
-
value: layer.params.tint,
|
|
1301
|
-
onChange: (e) => setParam(layer, "tint", e.target.value),
|
|
1302
|
-
className: "h-5 w-8 bg-transparent"
|
|
1303
|
-
}
|
|
1304
|
-
)
|
|
1315
|
+
layer.params.tint && /* @__PURE__ */ jsx6(ImageColor, { label: "Tint colour", value: layer.params.tint, onChange: (v) => setParam(layer, "tint", v) })
|
|
1305
1316
|
] })
|
|
1306
1317
|
] });
|
|
1307
1318
|
case "photoFilter":
|
|
1308
1319
|
return /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-2", children: [
|
|
1309
1320
|
/* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
1310
1321
|
"Filter colour",
|
|
1311
|
-
/* @__PURE__ */ jsx6(
|
|
1312
|
-
"input",
|
|
1313
|
-
{
|
|
1314
|
-
type: "color",
|
|
1315
|
-
"aria-label": "Filter colour",
|
|
1316
|
-
value: layer.params.color,
|
|
1317
|
-
onChange: (e) => setParam(layer, "color", e.target.value),
|
|
1318
|
-
className: "h-5 w-8 bg-transparent"
|
|
1319
|
-
}
|
|
1320
|
-
)
|
|
1322
|
+
/* @__PURE__ */ jsx6(ImageColor, { label: "Filter colour", value: layer.params.color, onChange: (v) => setParam(layer, "color", v) })
|
|
1321
1323
|
] }),
|
|
1322
1324
|
controlsOf(layer).map((s) => slider(layer, s)),
|
|
1323
1325
|
checkbox(layer, "preserveLuminosity", "Preserve luminosity")
|
|
@@ -1507,7 +1509,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1507
1509
|
}
|
|
1508
1510
|
case "color":
|
|
1509
1511
|
return /* @__PURE__ */ jsxs7("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
1510
|
-
/* @__PURE__ */ jsx7(
|
|
1512
|
+
/* @__PURE__ */ jsx7(ImageColor, { label, value: c.value, disabled: model.readOnly, onChange: (v) => change(effectId, c, v) }),
|
|
1511
1513
|
label
|
|
1512
1514
|
] }, c.key);
|
|
1513
1515
|
case "checkbox":
|
|
@@ -2047,25 +2049,83 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2047
2049
|
import React7, { useEffect as useEffect7, useState as useState8 } from "react";
|
|
2048
2050
|
import { EFFECT_LAYER_USES, findLayer } from "@pixerate/editor/image-editor";
|
|
2049
2051
|
|
|
2052
|
+
// src/image-editor/controls/parameterControls.tsx
|
|
2053
|
+
import { matchParameterOptionValue } from "@pixerate/editor/parameters";
|
|
2054
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
2055
|
+
function ImageParameterSlider({ value, min, max, step, label, disabled, className, onChange, onGestureStart, onGestureEnd }) {
|
|
2056
|
+
return /* @__PURE__ */ jsx9(
|
|
2057
|
+
ImageRange,
|
|
2058
|
+
{
|
|
2059
|
+
value,
|
|
2060
|
+
min,
|
|
2061
|
+
max,
|
|
2062
|
+
step,
|
|
2063
|
+
label,
|
|
2064
|
+
disabled,
|
|
2065
|
+
className,
|
|
2066
|
+
onChange,
|
|
2067
|
+
onStart: onGestureStart,
|
|
2068
|
+
onEnd: onGestureEnd
|
|
2069
|
+
}
|
|
2070
|
+
);
|
|
2071
|
+
}
|
|
2072
|
+
function ImageParameterSelect({ value, options, label, disabled, className, onChange }) {
|
|
2073
|
+
return /* @__PURE__ */ jsx9(
|
|
2074
|
+
ImageSelect,
|
|
2075
|
+
{
|
|
2076
|
+
value: String(value),
|
|
2077
|
+
options: options.map((o) => ({ value: String(o.value), label: o.label })),
|
|
2078
|
+
label,
|
|
2079
|
+
disabled,
|
|
2080
|
+
className,
|
|
2081
|
+
onChange: (v) => onChange(matchParameterOptionValue(options, v))
|
|
2082
|
+
}
|
|
2083
|
+
);
|
|
2084
|
+
}
|
|
2085
|
+
function ImageParameterColor({ value, alpha, label, disabled, className, onChange, onGestureStart, onGestureEnd }) {
|
|
2086
|
+
return /* @__PURE__ */ jsx9(
|
|
2087
|
+
ImageColor,
|
|
2088
|
+
{
|
|
2089
|
+
value,
|
|
2090
|
+
alpha,
|
|
2091
|
+
label,
|
|
2092
|
+
disabled,
|
|
2093
|
+
className,
|
|
2094
|
+
onChange,
|
|
2095
|
+
onStart: onGestureStart,
|
|
2096
|
+
onEnd: onGestureEnd
|
|
2097
|
+
}
|
|
2098
|
+
);
|
|
2099
|
+
}
|
|
2100
|
+
function imageEditorParameterComponents(controls) {
|
|
2101
|
+
return {
|
|
2102
|
+
slider: controls.Range ? ImageParameterSlider : void 0,
|
|
2103
|
+
select: controls.Select ? ImageParameterSelect : void 0,
|
|
2104
|
+
color: controls.Color ? ImageParameterColor : void 0
|
|
2105
|
+
};
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2050
2108
|
// src/image-editor/ImageEffectControls.tsx
|
|
2051
|
-
import { jsx as
|
|
2052
|
-
function ImageEffectControls({ provider, effect, name, values, onChange, onPreset, className }) {
|
|
2109
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2110
|
+
function ImageEffectControls({ provider, effect, name, values, onChange, onPreset, className, components }) {
|
|
2053
2111
|
const { description, error } = useEffectDescription(provider, effect);
|
|
2112
|
+
const fallback = resolveParameterComponents(useParameterComponents(), imageEditorParameterComponents(useImageEditorControls()));
|
|
2113
|
+
const effectiveComponents = resolveParameterComponents(components, fallback);
|
|
2054
2114
|
let body;
|
|
2055
2115
|
if (!provider) body = /* @__PURE__ */ jsxs9("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
2056
2116
|
'No effects provider: "',
|
|
2057
2117
|
name ?? effect,
|
|
2058
2118
|
'" is kept but not drawn.'
|
|
2059
2119
|
] });
|
|
2060
|
-
else if (error) body = /* @__PURE__ */
|
|
2061
|
-
else if (!description) body = /* @__PURE__ */
|
|
2062
|
-
else body = /* @__PURE__ */
|
|
2063
|
-
return /* @__PURE__ */
|
|
2120
|
+
else if (error) body = /* @__PURE__ */ jsx10("p", { className: "text-[11px] text-amber-600", children: error });
|
|
2121
|
+
else if (!description) body = /* @__PURE__ */ jsx10("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
|
|
2122
|
+
else body = /* @__PURE__ */ jsx10(EffectParameters, { description, values, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset, components: effectiveComponents });
|
|
2123
|
+
return /* @__PURE__ */ jsx10("div", { className, "data-testid": "image-effect-controls", children: body });
|
|
2064
2124
|
}
|
|
2065
2125
|
|
|
2066
2126
|
// src/image-editor/ImageProviderEffectsPanel.tsx
|
|
2067
|
-
import { jsx as
|
|
2068
|
-
function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
2127
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2128
|
+
function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
2069
2129
|
const [, setTick] = useState8(0);
|
|
2070
2130
|
useEffect7(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
2071
2131
|
const [browse, setBrowse] = useState8(null);
|
|
@@ -2094,73 +2154,75 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
2094
2154
|
const canFilter = !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
|
|
2095
2155
|
return /* @__PURE__ */ jsxs10("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Provider effects", "data-image-provider-effects": "", children: [
|
|
2096
2156
|
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
|
|
2097
|
-
/* @__PURE__ */
|
|
2098
|
-
/* @__PURE__ */
|
|
2099
|
-
/* @__PURE__ */
|
|
2157
|
+
/* @__PURE__ */ jsx11("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Effects" }),
|
|
2158
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider || !canFilter, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Apply effect\u2026" }),
|
|
2159
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => setBrowse(browse === "layer" ? null : "layer"), children: "Effect layer\u2026" })
|
|
2100
2160
|
] }),
|
|
2101
|
-
!provider && /* @__PURE__ */
|
|
2102
|
-
browse === "filter" && layer && /* @__PURE__ */
|
|
2103
|
-
browse === "layer" && /* @__PURE__ */
|
|
2161
|
+
!provider && /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the document are kept." }),
|
|
2162
|
+
browse === "filter" && layer && /* @__PURE__ */ jsx11(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id))) }),
|
|
2163
|
+
browse === "layer" && /* @__PURE__ */ jsx11(EffectsBrowser, { provider, uses: EFFECT_LAYER_USES, title: "Generators and overlays", onPick: (e) => (setBrowse(null), run(() => controller.addEffectLayer(e.id))) }),
|
|
2104
2164
|
generator && layer && /* @__PURE__ */ jsxs10("div", { className: "space-y-1", "data-effect-part": "generator", children: [
|
|
2105
2165
|
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
|
|
2106
|
-
/* @__PURE__ */
|
|
2107
|
-
/* @__PURE__ */
|
|
2166
|
+
/* @__PURE__ */ jsx11("span", { className: "flex-1 font-medium text-foreground", children: generator.name ?? generator.effect }),
|
|
2167
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: imageOutlineButtonClass, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
|
|
2108
2168
|
] }),
|
|
2109
|
-
/* @__PURE__ */
|
|
2169
|
+
/* @__PURE__ */ jsx11(
|
|
2110
2170
|
ImageEffectControls,
|
|
2111
2171
|
{
|
|
2112
2172
|
provider,
|
|
2113
2173
|
effect: generator.effect,
|
|
2114
2174
|
name: generator.name,
|
|
2115
2175
|
values: generator.values,
|
|
2176
|
+
components,
|
|
2116
2177
|
onChange: (k, v, gesture) => run(() => controller.updateEffectLayer(layer.id, { values: { [k]: v } }, commit(gesture))),
|
|
2117
2178
|
onPreset: (values) => run(() => controller.updateEffectLayer(layer.id, { values }))
|
|
2118
2179
|
}
|
|
2119
2180
|
)
|
|
2120
2181
|
] }),
|
|
2121
|
-
filters.length > 0 && layer && /* @__PURE__ */
|
|
2182
|
+
filters.length > 0 && layer && /* @__PURE__ */ jsx11("ol", { className: "space-y-1", "data-effect-part": "filters", children: filters.map((f) => {
|
|
2122
2183
|
const label = f.kind === "effect" ? f.name ?? f.effect : f.kind;
|
|
2123
2184
|
const all = layer.smartFilters.filters;
|
|
2124
2185
|
const index = all.indexOf(f);
|
|
2125
2186
|
if (f.kind !== "effect") return null;
|
|
2126
2187
|
return /* @__PURE__ */ jsxs10("li", { className: "rounded border border-border p-1", "data-smart-effect": f.id, children: [
|
|
2127
2188
|
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
|
|
2128
|
-
/* @__PURE__ */
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2189
|
+
/* @__PURE__ */ jsx11(
|
|
2190
|
+
ImageCheckbox,
|
|
2191
|
+
{
|
|
2192
|
+
checked: f.enabled,
|
|
2193
|
+
label: `${label} on`,
|
|
2194
|
+
onChange: (enabled) => run(() => controller.updateEffectFilter(layer.id, f.id, { enabled }))
|
|
2195
|
+
}
|
|
2196
|
+
),
|
|
2197
|
+
/* @__PURE__ */ jsx11("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 }),
|
|
2198
|
+
/* @__PURE__ */ jsx11("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" }),
|
|
2199
|
+
/* @__PURE__ */ jsx11("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" }),
|
|
2200
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: imageOutlineButtonClass, "aria-label": `Remove ${label}`, onClick: () => run(() => controller.removeSmartFilter(layer.id, f.id)), children: "\u2715" })
|
|
2136
2201
|
] }),
|
|
2137
2202
|
open === f.id && /* @__PURE__ */ jsxs10("div", { className: "mt-1 space-y-2", children: [
|
|
2138
2203
|
/* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-1", children: [
|
|
2139
|
-
/* @__PURE__ */
|
|
2140
|
-
/* @__PURE__ */
|
|
2141
|
-
|
|
2204
|
+
/* @__PURE__ */ jsx11("span", { className: "w-14 text-[11px] text-foreground", children: "Opacity" }),
|
|
2205
|
+
/* @__PURE__ */ jsx11(
|
|
2206
|
+
ImageRange,
|
|
2142
2207
|
{
|
|
2143
|
-
type: "range",
|
|
2144
2208
|
min: 0,
|
|
2145
2209
|
max: 1,
|
|
2146
2210
|
step: 0.01,
|
|
2147
2211
|
className: "flex-1",
|
|
2148
2212
|
value: f.opacity,
|
|
2149
|
-
|
|
2150
|
-
onChange: (
|
|
2151
|
-
const opacity = Number(e.currentTarget.value);
|
|
2152
|
-
run(() => controller.updateEffectFilter(layer.id, f.id, { opacity }));
|
|
2153
|
-
}
|
|
2213
|
+
label: `${label} opacity`,
|
|
2214
|
+
onChange: (opacity) => run(() => controller.updateEffectFilter(layer.id, f.id, { opacity }))
|
|
2154
2215
|
}
|
|
2155
2216
|
)
|
|
2156
2217
|
] }),
|
|
2157
|
-
/* @__PURE__ */
|
|
2218
|
+
/* @__PURE__ */ jsx11(
|
|
2158
2219
|
ImageEffectControls,
|
|
2159
2220
|
{
|
|
2160
2221
|
provider,
|
|
2161
2222
|
effect: f.effect,
|
|
2162
2223
|
name: f.name,
|
|
2163
2224
|
values: f.values,
|
|
2225
|
+
components,
|
|
2164
2226
|
onChange: (k, v, gesture) => run(() => controller.updateEffectFilter(layer.id, f.id, { values: { [k]: v } }, commit(gesture))),
|
|
2165
2227
|
onPreset: (values) => run(() => controller.updateEffectFilter(layer.id, f.id, { values }))
|
|
2166
2228
|
}
|
|
@@ -2168,8 +2230,8 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
2168
2230
|
] })
|
|
2169
2231
|
] }, f.id);
|
|
2170
2232
|
}) }),
|
|
2171
|
-
!layer && /* @__PURE__ */
|
|
2172
|
-
message && /* @__PURE__ */
|
|
2233
|
+
!layer && /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
|
|
2234
|
+
message && /* @__PURE__ */ jsx11("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
2173
2235
|
] });
|
|
2174
2236
|
}
|
|
2175
2237
|
|
|
@@ -2195,11 +2257,11 @@ import { DEFAULT_PAINT_GRADIENT, userErrorMessage } from "@pixerate/editor/image
|
|
|
2195
2257
|
|
|
2196
2258
|
// src/image-editor/PaintGradientEditor.tsx
|
|
2197
2259
|
import { PAINT_GRADIENT_KIT } from "@pixerate/editor/image-editor";
|
|
2198
|
-
import { jsx as
|
|
2199
|
-
var PaintGradientEditor = (props) => /* @__PURE__ */
|
|
2260
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
2261
|
+
var PaintGradientEditor = (props) => /* @__PURE__ */ jsx12(PaintGradientEditorView, { ...props, kit: PAINT_GRADIENT_KIT });
|
|
2200
2262
|
|
|
2201
2263
|
// src/image-editor/BrushOptionsBar.tsx
|
|
2202
|
-
import { jsx as
|
|
2264
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2203
2265
|
var BrushOptionsBar = ({ controller, className }) => {
|
|
2204
2266
|
const [, setTick] = useState9(0);
|
|
2205
2267
|
useEffect8(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -2216,7 +2278,7 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2216
2278
|
}
|
|
2217
2279
|
};
|
|
2218
2280
|
return /* @__PURE__ */ jsxs11("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "brush-options", children: [
|
|
2219
|
-
/* @__PURE__ */
|
|
2281
|
+
/* @__PURE__ */ jsx13("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: PAINT_TOOLS.map((t) => /* @__PURE__ */ jsx13(
|
|
2220
2282
|
"button",
|
|
2221
2283
|
{
|
|
2222
2284
|
type: "button",
|
|
@@ -2230,34 +2292,16 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2230
2292
|
)) }),
|
|
2231
2293
|
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", role: "group", "aria-label": "Colours", children: [
|
|
2232
2294
|
/* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1", children: [
|
|
2233
|
-
/* @__PURE__ */
|
|
2234
|
-
|
|
2235
|
-
{
|
|
2236
|
-
type: "color",
|
|
2237
|
-
"aria-label": "Foreground colour",
|
|
2238
|
-
value: foreground,
|
|
2239
|
-
onChange: (e) => controller.setPaintOptions({ foreground: e.target.value }),
|
|
2240
|
-
className: imageColorInputClass
|
|
2241
|
-
}
|
|
2242
|
-
),
|
|
2243
|
-
/* @__PURE__ */ jsx12("span", { className: "text-muted-foreground", children: "FG" })
|
|
2295
|
+
/* @__PURE__ */ jsx13(ImageColor, { label: "Foreground colour", value: foreground, onChange: (fg) => controller.setPaintOptions({ foreground: fg }) }),
|
|
2296
|
+
/* @__PURE__ */ jsx13("span", { className: "text-muted-foreground", children: "FG" })
|
|
2244
2297
|
] }),
|
|
2245
2298
|
/* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1", children: [
|
|
2246
|
-
/* @__PURE__ */
|
|
2247
|
-
|
|
2248
|
-
{
|
|
2249
|
-
type: "color",
|
|
2250
|
-
"aria-label": "Background colour",
|
|
2251
|
-
value: background,
|
|
2252
|
-
onChange: (e) => controller.setPaintOptions({ background: e.target.value }),
|
|
2253
|
-
className: imageColorInputClass
|
|
2254
|
-
}
|
|
2255
|
-
),
|
|
2256
|
-
/* @__PURE__ */ jsx12("span", { className: "text-muted-foreground", children: "BG" })
|
|
2299
|
+
/* @__PURE__ */ jsx13(ImageColor, { label: "Background colour", value: background, onChange: (bg) => controller.setPaintOptions({ background: bg }) }),
|
|
2300
|
+
/* @__PURE__ */ jsx13("span", { className: "text-muted-foreground", children: "BG" })
|
|
2257
2301
|
] }),
|
|
2258
|
-
/* @__PURE__ */
|
|
2259
|
-
/* @__PURE__ */
|
|
2260
|
-
state.activeTool === "brush" && /* @__PURE__ */
|
|
2302
|
+
/* @__PURE__ */ jsx13("button", { type: "button", title: "Swap colours (X)", className: imageChipClass(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
|
|
2303
|
+
/* @__PURE__ */ jsx13("button", { type: "button", title: "Default colours (D)", className: imageChipClass(false), onClick: () => controller.resetPaintColors(), children: "Default" }),
|
|
2304
|
+
state.activeTool === "brush" && /* @__PURE__ */ jsx13(
|
|
2261
2305
|
"button",
|
|
2262
2306
|
{
|
|
2263
2307
|
type: "button",
|
|
@@ -2269,8 +2313,8 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2269
2313
|
}
|
|
2270
2314
|
)
|
|
2271
2315
|
] }),
|
|
2272
|
-
state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */
|
|
2273
|
-
BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */
|
|
2316
|
+
state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */ jsx13(PaintGradientEditor, { value: paint, colors: { paint: foreground, secondary: background }, onChange: (g) => attempt(() => controller.setPaintOptions({ paint: g })) }),
|
|
2317
|
+
BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ jsx13(
|
|
2274
2318
|
ControlSlider,
|
|
2275
2319
|
{
|
|
2276
2320
|
spec,
|
|
@@ -2281,7 +2325,7 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2281
2325
|
)),
|
|
2282
2326
|
state.activeTool === "mixer" && /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Mixer Brush", "data-testid": "mixer-options", children: [
|
|
2283
2327
|
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
2284
|
-
/* @__PURE__ */
|
|
2328
|
+
/* @__PURE__ */ jsx13(
|
|
2285
2329
|
"span",
|
|
2286
2330
|
{
|
|
2287
2331
|
"aria-label": "Brush load",
|
|
@@ -2290,10 +2334,10 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2290
2334
|
style: { background: mixerLoad.reservoir ? rgbUnitToHex(mixerLoad.reservoir) : "transparent" }
|
|
2291
2335
|
}
|
|
2292
2336
|
),
|
|
2293
|
-
/* @__PURE__ */
|
|
2294
|
-
/* @__PURE__ */
|
|
2337
|
+
/* @__PURE__ */ jsx13("button", { type: "button", title: "Fill the reservoir with the foreground colour", className: imageChipClass(false), onClick: () => controller.loadMixerBrush(), children: "Load brush" }),
|
|
2338
|
+
/* @__PURE__ */ jsx13("button", { type: "button", title: "Empty the picked-up colour", className: imageChipClass(false), onClick: () => controller.cleanMixerBrush(), children: "Clean brush" })
|
|
2295
2339
|
] }),
|
|
2296
|
-
/* @__PURE__ */
|
|
2340
|
+
/* @__PURE__ */ jsx13("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children: MIXER_MIXING_OPTIONS.map((m) => /* @__PURE__ */ jsx13(
|
|
2297
2341
|
"button",
|
|
2298
2342
|
{
|
|
2299
2343
|
type: "button",
|
|
@@ -2305,34 +2349,34 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2305
2349
|
},
|
|
2306
2350
|
m.id
|
|
2307
2351
|
)) }),
|
|
2308
|
-
MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */
|
|
2352
|
+
MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ jsx13(ControlSlider, { spec, value: mixer[spec.id], onChange: (v) => controller.setPaintOptions({ mixer: { [spec.id]: v } }) }, spec.id)),
|
|
2309
2353
|
/* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap gap-3 text-foreground", children: [
|
|
2310
2354
|
/* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1.5", children: [
|
|
2311
|
-
/* @__PURE__ */
|
|
2355
|
+
/* @__PURE__ */ jsx13(ImageCheckbox, { label: "Load the brush after each stroke", checked: mixer.loadEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { loadEachStroke: on } }) }),
|
|
2312
2356
|
"Load each stroke"
|
|
2313
2357
|
] }),
|
|
2314
2358
|
/* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1.5", children: [
|
|
2315
|
-
/* @__PURE__ */
|
|
2359
|
+
/* @__PURE__ */ jsx13(ImageCheckbox, { label: "Clean the brush after each stroke", checked: mixer.cleanEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { cleanEachStroke: on } }) }),
|
|
2316
2360
|
"Clean each stroke"
|
|
2317
2361
|
] })
|
|
2318
2362
|
] })
|
|
2319
2363
|
] }),
|
|
2320
2364
|
isRetouchPaintTool(tool) && /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Retouch options", "data-testid": "retouch-options", children: [
|
|
2321
2365
|
(tool === "clone" || tool === "heal") && /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
2322
|
-
/* @__PURE__ */
|
|
2323
|
-
cloneSource && /* @__PURE__ */
|
|
2366
|
+
/* @__PURE__ */ jsx13("span", { className: "text-muted-foreground", "data-testid": "clone-source", children: cloneSourceLabel(controller) }),
|
|
2367
|
+
cloneSource && /* @__PURE__ */ jsx13("button", { type: "button", title: "Forget the source point", className: imageChipClass(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
|
|
2324
2368
|
] }),
|
|
2325
2369
|
(tool === "clone" || tool === "heal") && /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-1", role: "group", "aria-label": "Clone source transform", "data-testid": "clone-transform", children: [
|
|
2326
|
-
CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */
|
|
2370
|
+
CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ jsx13(ControlSlider, { spec, value: cloneTransformView(controller)[spec.id], onChange: (v) => setCloneTransformValue(controller, spec.id, v) }, spec.id)),
|
|
2327
2371
|
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", children: [
|
|
2328
|
-
/* @__PURE__ */
|
|
2329
|
-
/* @__PURE__ */
|
|
2330
|
-
!cloneTransformView(controller).identity && /* @__PURE__ */
|
|
2372
|
+
/* @__PURE__ */ jsx13("button", { type: "button", "aria-pressed": cloneTransformView(controller).flipH, title: "Mirror the source left to right", className: imageChipClass(cloneTransformView(controller).flipH), onClick: () => setCloneTransformValue(controller, "flipH"), children: "Flip H" }),
|
|
2373
|
+
/* @__PURE__ */ jsx13("button", { type: "button", "aria-pressed": cloneTransformView(controller).flipV, title: "Mirror the source top to bottom", className: imageChipClass(cloneTransformView(controller).flipV), onClick: () => setCloneTransformValue(controller, "flipV"), children: "Flip V" }),
|
|
2374
|
+
!cloneTransformView(controller).identity && /* @__PURE__ */ jsx13("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className: imageChipClass(false), onClick: () => controller.setCloneTransform(null), children: "Reset transform" })
|
|
2331
2375
|
] })
|
|
2332
2376
|
] }),
|
|
2333
2377
|
RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": choice.label, children: [
|
|
2334
|
-
/* @__PURE__ */
|
|
2335
|
-
choice.options.map((o) => /* @__PURE__ */
|
|
2378
|
+
/* @__PURE__ */ jsx13("span", { className: "text-muted-foreground", children: choice.label }),
|
|
2379
|
+
choice.options.map((o) => /* @__PURE__ */ jsx13(
|
|
2336
2380
|
"button",
|
|
2337
2381
|
{
|
|
2338
2382
|
type: "button",
|
|
@@ -2345,34 +2389,34 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2345
2389
|
o.id
|
|
2346
2390
|
))
|
|
2347
2391
|
] }, choice.id)),
|
|
2348
|
-
RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */
|
|
2349
|
-
/* @__PURE__ */
|
|
2350
|
-
/* @__PURE__ */
|
|
2392
|
+
RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ jsx13(ControlSlider, { spec, value: retouch[spec.id], onChange: (v) => controller.setPaintOptions({ retouch: { [spec.id]: v } }) }, spec.id)),
|
|
2393
|
+
/* @__PURE__ */ jsx13("div", { className: "flex flex-wrap gap-3 text-foreground", children: RETOUCH_TOGGLES.filter((t) => t.tools.includes(tool)).map((t) => /* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1.5", children: [
|
|
2394
|
+
/* @__PURE__ */ jsx13(ImageCheckbox, { label: t.label, checked: retouch[t.id], onChange: (on) => controller.setPaintOptions({ retouch: { [t.id]: on } }) }),
|
|
2351
2395
|
t.label
|
|
2352
2396
|
] }, t.id)) })
|
|
2353
2397
|
] }),
|
|
2354
2398
|
/* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap gap-3 text-foreground", role: "group", "aria-label": "Pressure", children: [
|
|
2355
2399
|
/* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1.5", children: [
|
|
2356
|
-
/* @__PURE__ */
|
|
2400
|
+
/* @__PURE__ */ jsx13(ImageCheckbox, { label: "Pressure controls size", checked: brush.pressureSize, onChange: (on) => controller.setPaintOptions({ brush: { pressureSize: on } }) }),
|
|
2357
2401
|
"Pressure size"
|
|
2358
2402
|
] }),
|
|
2359
2403
|
/* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1.5", children: [
|
|
2360
|
-
/* @__PURE__ */
|
|
2404
|
+
/* @__PURE__ */ jsx13(ImageCheckbox, { label: "Pressure controls opacity", checked: brush.pressureOpacity, onChange: (on) => controller.setPaintOptions({ brush: { pressureOpacity: on } }) }),
|
|
2361
2405
|
"Pressure opacity"
|
|
2362
2406
|
] })
|
|
2363
2407
|
] }),
|
|
2364
2408
|
/* @__PURE__ */ jsxs11("div", { className: "flex gap-1", children: [
|
|
2365
|
-
/* @__PURE__ */
|
|
2366
|
-
/* @__PURE__ */
|
|
2409
|
+
/* @__PURE__ */ jsx13("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.fillPixels()), children: "Fill" }),
|
|
2410
|
+
/* @__PURE__ */ jsx13("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.clearPixels()), children: "Clear" })
|
|
2367
2411
|
] }),
|
|
2368
|
-
error && /* @__PURE__ */
|
|
2412
|
+
error && /* @__PURE__ */ jsx13("p", { role: "alert", className: "text-destructive", children: error })
|
|
2369
2413
|
] });
|
|
2370
2414
|
};
|
|
2371
2415
|
|
|
2372
2416
|
// src/image-editor/ColorProfilePanel.tsx
|
|
2373
2417
|
import { useEffect as useEffect9, useState as useState10 } from "react";
|
|
2374
2418
|
import { COLOR_MODE_OPTIONS, INTENT_OPTIONS, PROOF_PROFILE_OPTIONS, WORKING_SPACE_OPTIONS, colorPanelView } from "@pixerate/editor/image-editor";
|
|
2375
|
-
import { Fragment as Fragment2, jsx as
|
|
2419
|
+
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2376
2420
|
var chip = imageChipClass(false);
|
|
2377
2421
|
var select = "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground";
|
|
2378
2422
|
var ColorProfilePanel = ({ controller, className }) => {
|
|
@@ -2405,26 +2449,26 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
2405
2449
|
};
|
|
2406
2450
|
return /* @__PURE__ */ jsxs12("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "color-profile-panel", children: [
|
|
2407
2451
|
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
2408
|
-
/* @__PURE__ */
|
|
2409
|
-
/* @__PURE__ */
|
|
2452
|
+
/* @__PURE__ */ jsx14("span", { className: "text-muted-foreground", children: "Profile" }),
|
|
2453
|
+
/* @__PURE__ */ jsx14("span", { "data-testid": "color-profile-name", children: view.profileName })
|
|
2410
2454
|
] }),
|
|
2411
2455
|
/* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Colour mode", children: [
|
|
2412
|
-
/* @__PURE__ */
|
|
2413
|
-
/* @__PURE__ */
|
|
2414
|
-
view.cmykProfileName && /* @__PURE__ */
|
|
2456
|
+
/* @__PURE__ */ jsx14("span", { className: "text-muted-foreground", children: "Mode" }),
|
|
2457
|
+
/* @__PURE__ */ jsx14("select", { "aria-label": "Colour mode", className: select, value: view.mode, onChange: (e) => attempt(() => controller.setColorMode(e.target.value)), children: COLOR_MODE_OPTIONS.map((o) => /* @__PURE__ */ jsx14("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
|
|
2458
|
+
view.cmykProfileName && /* @__PURE__ */ jsx14("span", { className: "text-muted-foreground", children: view.cmykProfileName })
|
|
2415
2459
|
] }),
|
|
2416
2460
|
/* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
|
|
2417
|
-
/* @__PURE__ */
|
|
2418
|
-
/* @__PURE__ */
|
|
2461
|
+
/* @__PURE__ */ jsx14("select", { "aria-label": "Target profile", className: select, value: target, onChange: (e) => setTarget(e.target.value), children: WORKING_SPACE_OPTIONS.map((o) => /* @__PURE__ */ jsx14("option", { value: o.id, children: o.label }, o.id)) }),
|
|
2462
|
+
/* @__PURE__ */ jsx14("select", { "aria-label": "Rendering intent", className: select, value: intent, onChange: (e) => setIntent(e.target.value), children: INTENT_OPTIONS.map((o) => /* @__PURE__ */ jsx14("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
|
|
2419
2463
|
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", children: [
|
|
2420
|
-
/* @__PURE__ */
|
|
2464
|
+
/* @__PURE__ */ jsx14("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-primary" }),
|
|
2421
2465
|
"BPC"
|
|
2422
2466
|
] }),
|
|
2423
|
-
/* @__PURE__ */
|
|
2424
|
-
/* @__PURE__ */
|
|
2467
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: chip, title: "Edit \u203A Assign Profile: keep the numbers", onClick: () => attempt(() => controller.assignProfile(target)), children: "Assign" }),
|
|
2468
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: chip, title: "Edit \u203A Convert to Profile: keep the look", onClick: () => attempt(() => controller.convertToProfile(target, { intent, bpc })), children: "Convert" })
|
|
2425
2469
|
] }),
|
|
2426
2470
|
/* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Proof setup", children: [
|
|
2427
|
-
/* @__PURE__ */
|
|
2471
|
+
/* @__PURE__ */ jsx14("span", { className: "text-muted-foreground", children: "Proof" }),
|
|
2428
2472
|
/* @__PURE__ */ jsxs12(
|
|
2429
2473
|
"select",
|
|
2430
2474
|
{
|
|
@@ -2433,24 +2477,24 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
2433
2477
|
value: view.proof?.id ?? "",
|
|
2434
2478
|
onChange: (e) => e.target.value ? proofWith({ id: e.target.value }) : attempt(() => controller.setProofSetup(null)),
|
|
2435
2479
|
children: [
|
|
2436
|
-
/* @__PURE__ */
|
|
2437
|
-
PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */
|
|
2480
|
+
/* @__PURE__ */ jsx14("option", { value: "", children: "Off" }),
|
|
2481
|
+
PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */ jsx14("option", { value: o.id, children: o.label }, o.id))
|
|
2438
2482
|
]
|
|
2439
2483
|
}
|
|
2440
2484
|
),
|
|
2441
2485
|
view.proof && /* @__PURE__ */ jsxs12(Fragment2, { children: [
|
|
2442
|
-
/* @__PURE__ */
|
|
2486
|
+
/* @__PURE__ */ jsx14("select", { "aria-label": "Proof intent", className: select, value: view.proof.intent, onChange: (e) => proofWith({ intent: e.target.value }), children: INTENT_OPTIONS.map((o) => /* @__PURE__ */ jsx14("option", { value: o.id, children: o.label }, o.id)) }),
|
|
2443
2487
|
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", children: [
|
|
2444
|
-
/* @__PURE__ */
|
|
2488
|
+
/* @__PURE__ */ jsx14("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-primary" }),
|
|
2445
2489
|
"Paper"
|
|
2446
2490
|
] }),
|
|
2447
2491
|
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", children: [
|
|
2448
|
-
/* @__PURE__ */
|
|
2492
|
+
/* @__PURE__ */ jsx14("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-primary" }),
|
|
2449
2493
|
"Gamut warning"
|
|
2450
2494
|
] })
|
|
2451
2495
|
] })
|
|
2452
2496
|
] }),
|
|
2453
|
-
error && /* @__PURE__ */
|
|
2497
|
+
error && /* @__PURE__ */ jsx14("p", { role: "alert", className: "text-destructive", children: error })
|
|
2454
2498
|
] });
|
|
2455
2499
|
};
|
|
2456
2500
|
|
|
@@ -2462,7 +2506,7 @@ import {
|
|
|
2462
2506
|
SELECTION_TOOLS,
|
|
2463
2507
|
describeSelection
|
|
2464
2508
|
} from "@pixerate/editor/image-editor";
|
|
2465
|
-
import { jsx as
|
|
2509
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2466
2510
|
var MODIFY_OPS = [
|
|
2467
2511
|
{ op: "grow", label: "Grow" },
|
|
2468
2512
|
{ op: "shrink", label: "Shrink" },
|
|
@@ -2484,27 +2528,27 @@ var SelectionOptionsBar = ({
|
|
|
2484
2528
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
2485
2529
|
const qm = quickMask ?? Boolean(controller.getState().quickMask);
|
|
2486
2530
|
return /* @__PURE__ */ jsxs13("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
2487
|
-
/* @__PURE__ */
|
|
2488
|
-
/* @__PURE__ */
|
|
2531
|
+
/* @__PURE__ */ jsx15("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: SELECTION_TOOLS.map((t) => /* @__PURE__ */ jsx15("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)) }),
|
|
2532
|
+
/* @__PURE__ */ jsx15("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: SELECTION_MODES.map((m) => /* @__PURE__ */ jsx15("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: SELECTION_MODE_LABELS[m] }, m)) }),
|
|
2489
2533
|
options.tool === "wand" && /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-2", children: [
|
|
2490
2534
|
/* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
|
|
2491
2535
|
/* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
2492
|
-
/* @__PURE__ */
|
|
2493
|
-
/* @__PURE__ */
|
|
2536
|
+
/* @__PURE__ */ jsx15("span", { children: "Tolerance" }),
|
|
2537
|
+
/* @__PURE__ */ jsx15("span", { className: "font-mono", children: options.tolerance })
|
|
2494
2538
|
] }),
|
|
2495
|
-
/* @__PURE__ */
|
|
2539
|
+
/* @__PURE__ */ jsx15(ImageRange, { label: "Tolerance", min: 0, max: 255, step: 1, value: options.tolerance, onChange: (v) => set({ tolerance: v }) })
|
|
2496
2540
|
] }),
|
|
2497
2541
|
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
2498
|
-
/* @__PURE__ */
|
|
2542
|
+
/* @__PURE__ */ jsx15(ImageCheckbox, { label: "Contiguous", checked: options.contiguous, onChange: (on) => set({ contiguous: on }) }),
|
|
2499
2543
|
"Contiguous"
|
|
2500
2544
|
] }),
|
|
2501
2545
|
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
2502
|
-
/* @__PURE__ */
|
|
2546
|
+
/* @__PURE__ */ jsx15(ImageCheckbox, { label: "Sample adjusted image", checked: options.sampleMerged, onChange: (on) => set({ sampleMerged: on }) }),
|
|
2503
2547
|
"Sample adjusted image"
|
|
2504
2548
|
] }),
|
|
2505
2549
|
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
2506
2550
|
"Sample",
|
|
2507
|
-
/* @__PURE__ */
|
|
2551
|
+
/* @__PURE__ */ jsx15(
|
|
2508
2552
|
ImageSelect,
|
|
2509
2553
|
{
|
|
2510
2554
|
label: "Sample from",
|
|
@@ -2519,19 +2563,19 @@ var SelectionOptionsBar = ({
|
|
|
2519
2563
|
] })
|
|
2520
2564
|
] }),
|
|
2521
2565
|
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
2522
|
-
/* @__PURE__ */
|
|
2566
|
+
/* @__PURE__ */ jsx15(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
|
|
2523
2567
|
"Anti-alias"
|
|
2524
2568
|
] }),
|
|
2525
2569
|
/* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap gap-1", children: [
|
|
2526
|
-
/* @__PURE__ */
|
|
2527
|
-
/* @__PURE__ */
|
|
2528
|
-
/* @__PURE__ */
|
|
2529
|
-
/* @__PURE__ */
|
|
2570
|
+
/* @__PURE__ */ jsx15("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
|
|
2571
|
+
/* @__PURE__ */ jsx15("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
|
|
2572
|
+
/* @__PURE__ */ jsx15("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
|
|
2573
|
+
/* @__PURE__ */ jsx15("button", { type: "button", "aria-pressed": qm, className: btn(qm), onClick: () => controller.setQuickMask(!qm), children: "Quick Mask" })
|
|
2530
2574
|
] }),
|
|
2531
2575
|
/* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2532
2576
|
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
2533
2577
|
"Radius",
|
|
2534
|
-
/* @__PURE__ */
|
|
2578
|
+
/* @__PURE__ */ jsx15(
|
|
2535
2579
|
"input",
|
|
2536
2580
|
{
|
|
2537
2581
|
type: "number",
|
|
@@ -2545,9 +2589,9 @@ var SelectionOptionsBar = ({
|
|
|
2545
2589
|
}
|
|
2546
2590
|
)
|
|
2547
2591
|
] }),
|
|
2548
|
-
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */
|
|
2592
|
+
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ jsx15("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
|
|
2549
2593
|
] }),
|
|
2550
|
-
/* @__PURE__ */
|
|
2594
|
+
/* @__PURE__ */ jsx15("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: describeSelection(sel) })
|
|
2551
2595
|
] });
|
|
2552
2596
|
};
|
|
2553
2597
|
|
|
@@ -2559,7 +2603,7 @@ import {
|
|
|
2559
2603
|
adjustmentKindLabel as adjustmentKindLabel2,
|
|
2560
2604
|
layerMaskFromSelection
|
|
2561
2605
|
} from "@pixerate/editor/image-editor";
|
|
2562
|
-
import { Fragment as Fragment3, jsx as
|
|
2606
|
+
import { Fragment as Fragment3, jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2563
2607
|
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
2564
2608
|
var button = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
|
|
2565
2609
|
var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
@@ -2583,16 +2627,16 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2583
2627
|
}
|
|
2584
2628
|
};
|
|
2585
2629
|
return /* @__PURE__ */ jsxs14("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
2586
|
-
/* @__PURE__ */
|
|
2630
|
+
/* @__PURE__ */ jsx16("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
|
|
2587
2631
|
REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
|
|
2588
2632
|
/* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
2589
|
-
/* @__PURE__ */
|
|
2633
|
+
/* @__PURE__ */ jsx16("span", { children: c.label }),
|
|
2590
2634
|
/* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
|
|
2591
2635
|
params[c.id],
|
|
2592
2636
|
c.unit
|
|
2593
2637
|
] })
|
|
2594
2638
|
] }),
|
|
2595
|
-
/* @__PURE__ */
|
|
2639
|
+
/* @__PURE__ */ jsx16(
|
|
2596
2640
|
"input",
|
|
2597
2641
|
{
|
|
2598
2642
|
type: "range",
|
|
@@ -2607,27 +2651,27 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2607
2651
|
)
|
|
2608
2652
|
] }, c.id)),
|
|
2609
2653
|
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
2610
|
-
/* @__PURE__ */
|
|
2654
|
+
/* @__PURE__ */ jsx16("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
2611
2655
|
"Smart Radius"
|
|
2612
2656
|
] }),
|
|
2613
2657
|
/* @__PURE__ */ jsxs14("div", { className: "flex gap-1", children: [
|
|
2614
|
-
/* @__PURE__ */
|
|
2615
|
-
/* @__PURE__ */
|
|
2658
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: button, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
2659
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: button, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
|
2616
2660
|
] }),
|
|
2617
|
-
error && /* @__PURE__ */
|
|
2618
|
-
/* @__PURE__ */
|
|
2661
|
+
error && /* @__PURE__ */ jsx16("p", { role: "alert", className: "text-destructive", children: error }),
|
|
2662
|
+
/* @__PURE__ */ jsx16("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
|
|
2619
2663
|
/* @__PURE__ */ jsxs14("div", { className: "flex gap-1 items-center", children: [
|
|
2620
|
-
/* @__PURE__ */
|
|
2664
|
+
/* @__PURE__ */ jsx16(
|
|
2621
2665
|
"select",
|
|
2622
2666
|
{
|
|
2623
2667
|
"aria-label": "New masked layer kind",
|
|
2624
2668
|
value: newKind,
|
|
2625
2669
|
onChange: (e) => setNewKind(e.target.value),
|
|
2626
2670
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
2627
|
-
children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */
|
|
2671
|
+
children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */ jsx16("option", { value: k.kind, children: k.label }, k.kind))
|
|
2628
2672
|
}
|
|
2629
2673
|
),
|
|
2630
|
-
/* @__PURE__ */
|
|
2674
|
+
/* @__PURE__ */ jsx16(
|
|
2631
2675
|
"button",
|
|
2632
2676
|
{
|
|
2633
2677
|
type: "button",
|
|
@@ -2639,7 +2683,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2639
2683
|
)
|
|
2640
2684
|
] }),
|
|
2641
2685
|
list.length > 0 && target && /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-2", children: [
|
|
2642
|
-
/* @__PURE__ */
|
|
2686
|
+
/* @__PURE__ */ jsx16(
|
|
2643
2687
|
"select",
|
|
2644
2688
|
{
|
|
2645
2689
|
"aria-label": "Mask layer",
|
|
@@ -2653,20 +2697,20 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2653
2697
|
}
|
|
2654
2698
|
),
|
|
2655
2699
|
/* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap gap-1", children: [
|
|
2656
|
-
/* @__PURE__ */
|
|
2657
|
-
/* @__PURE__ */
|
|
2658
|
-
/* @__PURE__ */
|
|
2700
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: button, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
|
|
2701
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: button, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
|
|
2702
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: button, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
|
|
2659
2703
|
] }),
|
|
2660
2704
|
target.mask && /* @__PURE__ */ jsxs14(Fragment3, { children: [
|
|
2661
2705
|
/* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
|
|
2662
2706
|
/* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
2663
|
-
/* @__PURE__ */
|
|
2707
|
+
/* @__PURE__ */ jsx16("span", { children: "Density" }),
|
|
2664
2708
|
/* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
|
|
2665
2709
|
Math.round((target.mask.density ?? 1) * 100),
|
|
2666
2710
|
"%"
|
|
2667
2711
|
] })
|
|
2668
2712
|
] }),
|
|
2669
|
-
/* @__PURE__ */
|
|
2713
|
+
/* @__PURE__ */ jsx16(
|
|
2670
2714
|
"input",
|
|
2671
2715
|
{
|
|
2672
2716
|
type: "range",
|
|
@@ -2682,13 +2726,13 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2682
2726
|
] }),
|
|
2683
2727
|
/* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
|
|
2684
2728
|
/* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
2685
|
-
/* @__PURE__ */
|
|
2729
|
+
/* @__PURE__ */ jsx16("span", { children: "Mask Feather" }),
|
|
2686
2730
|
/* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
|
|
2687
2731
|
target.mask.feather ?? 0,
|
|
2688
2732
|
"px"
|
|
2689
2733
|
] })
|
|
2690
2734
|
] }),
|
|
2691
|
-
/* @__PURE__ */
|
|
2735
|
+
/* @__PURE__ */ jsx16(
|
|
2692
2736
|
"input",
|
|
2693
2737
|
{
|
|
2694
2738
|
type: "range",
|
|
@@ -2710,7 +2754,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
2710
2754
|
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
2711
2755
|
import { useEffect as useEffect10, useState as useState13 } from "react";
|
|
2712
2756
|
import { FREE_TRANSFORM_FIELDS, FREE_TRANSFORM_MODE_OPTIONS, INTERPOLATIONS, TRANSFORM_ANCHORS, WARP_GRID_OPTIONS, WARP_STYLE_OPTIONS } from "@pixerate/editor/image-editor";
|
|
2713
|
-
import { jsx as
|
|
2757
|
+
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2714
2758
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
2715
2759
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
2716
2760
|
const [, setTick] = useState13(0);
|
|
@@ -2727,16 +2771,16 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2727
2771
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
2728
2772
|
};
|
|
2729
2773
|
return /* @__PURE__ */ jsxs15("div", { className: `flex flex-wrap items-center gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
|
|
2730
|
-
/* @__PURE__ */
|
|
2731
|
-
/* @__PURE__ */
|
|
2774
|
+
/* @__PURE__ */ jsx17("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ jsx17("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)) }),
|
|
2775
|
+
/* @__PURE__ */ jsx17("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ jsx17("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)) }),
|
|
2732
2776
|
tool.mode === "warp" && /* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
2733
2777
|
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", children: [
|
|
2734
|
-
/* @__PURE__ */
|
|
2735
|
-
/* @__PURE__ */
|
|
2778
|
+
/* @__PURE__ */ jsx17("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
2779
|
+
/* @__PURE__ */ jsx17("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ jsx17("option", { value: o.id, children: o.label }, o.id)) })
|
|
2736
2780
|
] }),
|
|
2737
2781
|
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", children: [
|
|
2738
|
-
/* @__PURE__ */
|
|
2739
|
-
/* @__PURE__ */
|
|
2782
|
+
/* @__PURE__ */ jsx17("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
2783
|
+
/* @__PURE__ */ jsx17(
|
|
2740
2784
|
"input",
|
|
2741
2785
|
{
|
|
2742
2786
|
type: "number",
|
|
@@ -2757,9 +2801,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2757
2801
|
},
|
|
2758
2802
|
`${k}:${warp[k]}`
|
|
2759
2803
|
),
|
|
2760
|
-
/* @__PURE__ */
|
|
2804
|
+
/* @__PURE__ */ jsx17("span", { className: "text-muted-foreground", children: "%" })
|
|
2761
2805
|
] }, k)),
|
|
2762
|
-
/* @__PURE__ */
|
|
2806
|
+
/* @__PURE__ */ jsx17(
|
|
2763
2807
|
"button",
|
|
2764
2808
|
{
|
|
2765
2809
|
type: "button",
|
|
@@ -2772,8 +2816,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2772
2816
|
}
|
|
2773
2817
|
),
|
|
2774
2818
|
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", children: [
|
|
2775
|
-
/* @__PURE__ */
|
|
2776
|
-
/* @__PURE__ */
|
|
2819
|
+
/* @__PURE__ */ jsx17("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
2820
|
+
/* @__PURE__ */ jsx17(
|
|
2777
2821
|
"select",
|
|
2778
2822
|
{
|
|
2779
2823
|
"aria-label": "Warp grid",
|
|
@@ -2783,14 +2827,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2783
2827
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
2784
2828
|
},
|
|
2785
2829
|
className: imageFieldClass,
|
|
2786
|
-
children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */
|
|
2830
|
+
children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ jsx17("option", { value: g.id, children: g.label }, g.id))
|
|
2787
2831
|
}
|
|
2788
2832
|
)
|
|
2789
2833
|
] })
|
|
2790
2834
|
] }),
|
|
2791
2835
|
tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
2792
|
-
/* @__PURE__ */
|
|
2793
|
-
/* @__PURE__ */
|
|
2836
|
+
/* @__PURE__ */ jsx17("span", { className: "text-muted-foreground", children: f.label }),
|
|
2837
|
+
/* @__PURE__ */ jsx17(
|
|
2794
2838
|
"input",
|
|
2795
2839
|
{
|
|
2796
2840
|
type: "number",
|
|
@@ -2810,8 +2854,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2810
2854
|
},
|
|
2811
2855
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
2812
2856
|
),
|
|
2813
|
-
/* @__PURE__ */
|
|
2814
|
-
f.id === "scaleX" && /* @__PURE__ */
|
|
2857
|
+
/* @__PURE__ */ jsx17("span", { className: "text-muted-foreground", children: f.unit }),
|
|
2858
|
+
f.id === "scaleX" && /* @__PURE__ */ jsx17(
|
|
2815
2859
|
"button",
|
|
2816
2860
|
{
|
|
2817
2861
|
type: "button",
|
|
@@ -2827,28 +2871,28 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
2827
2871
|
)
|
|
2828
2872
|
] }, f.id)),
|
|
2829
2873
|
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", children: [
|
|
2830
|
-
/* @__PURE__ */
|
|
2831
|
-
/* @__PURE__ */
|
|
2874
|
+
/* @__PURE__ */ jsx17("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
2875
|
+
/* @__PURE__ */ jsx17(
|
|
2832
2876
|
"select",
|
|
2833
2877
|
{
|
|
2834
2878
|
"aria-label": "Interpolation",
|
|
2835
2879
|
value: tool.interpolation,
|
|
2836
2880
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
2837
2881
|
className: imageFieldClass,
|
|
2838
|
-
children: INTERPOLATIONS.map((i) => /* @__PURE__ */
|
|
2882
|
+
children: INTERPOLATIONS.map((i) => /* @__PURE__ */ jsx17("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
2839
2883
|
}
|
|
2840
2884
|
)
|
|
2841
2885
|
] }),
|
|
2842
|
-
/* @__PURE__ */
|
|
2843
|
-
/* @__PURE__ */
|
|
2844
|
-
tool.error && /* @__PURE__ */
|
|
2886
|
+
/* @__PURE__ */ jsx17("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" }),
|
|
2887
|
+
/* @__PURE__ */ jsx17("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
2888
|
+
tool.error && /* @__PURE__ */ jsx17("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
2845
2889
|
] });
|
|
2846
2890
|
};
|
|
2847
2891
|
|
|
2848
2892
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
2849
2893
|
import { useEffect as useEffect11, useState as useState14 } from "react";
|
|
2850
2894
|
import { LIVE_SHAPE_KINDS, SHAPE_KIND_LABELS, applyShapeOptions } from "@pixerate/editor/image-editor";
|
|
2851
|
-
import { Fragment as Fragment4, jsx as
|
|
2895
|
+
import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2852
2896
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
2853
2897
|
const [, setTick] = useState14(0);
|
|
2854
2898
|
useEffect11(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -2867,41 +2911,21 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2867
2911
|
};
|
|
2868
2912
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
2869
2913
|
return /* @__PURE__ */ jsxs16("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
2870
|
-
/* @__PURE__ */
|
|
2914
|
+
/* @__PURE__ */ jsx18("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ jsx18("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: SHAPE_KIND_LABELS[k] }, k)) }),
|
|
2871
2915
|
/* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
2872
2916
|
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
|
|
2873
|
-
/* @__PURE__ */
|
|
2917
|
+
/* @__PURE__ */ jsx18(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
|
|
2874
2918
|
"Fill",
|
|
2875
|
-
/* @__PURE__ */
|
|
2876
|
-
"input",
|
|
2877
|
-
{
|
|
2878
|
-
type: "color",
|
|
2879
|
-
"aria-label": "Fill colour",
|
|
2880
|
-
disabled: options.fill === null,
|
|
2881
|
-
value: options.fill ?? "#4f46e5",
|
|
2882
|
-
onChange: (e) => set({ fill: e.target.value }),
|
|
2883
|
-
className: imageColorInputClass
|
|
2884
|
-
}
|
|
2885
|
-
)
|
|
2919
|
+
/* @__PURE__ */ jsx18(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
|
|
2886
2920
|
] }),
|
|
2887
2921
|
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
|
|
2888
|
-
/* @__PURE__ */
|
|
2922
|
+
/* @__PURE__ */ jsx18(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
|
|
2889
2923
|
"Stroke",
|
|
2890
|
-
/* @__PURE__ */
|
|
2891
|
-
"input",
|
|
2892
|
-
{
|
|
2893
|
-
type: "color",
|
|
2894
|
-
"aria-label": "Stroke colour",
|
|
2895
|
-
disabled: options.stroke === null,
|
|
2896
|
-
value: options.stroke ?? "#000000",
|
|
2897
|
-
onChange: (e) => set({ stroke: e.target.value }),
|
|
2898
|
-
className: imageColorInputClass
|
|
2899
|
-
}
|
|
2900
|
-
)
|
|
2924
|
+
/* @__PURE__ */ jsx18(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
|
|
2901
2925
|
] }),
|
|
2902
2926
|
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
|
|
2903
2927
|
"Width",
|
|
2904
|
-
/* @__PURE__ */
|
|
2928
|
+
/* @__PURE__ */ jsx18(
|
|
2905
2929
|
"input",
|
|
2906
2930
|
{
|
|
2907
2931
|
type: "number",
|
|
@@ -2918,42 +2942,42 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
2918
2942
|
/* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
2919
2943
|
options.kind === "rect" && /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
|
|
2920
2944
|
"Radius",
|
|
2921
|
-
/* @__PURE__ */
|
|
2945
|
+
/* @__PURE__ */ jsx18("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}` })
|
|
2922
2946
|
] }),
|
|
2923
2947
|
options.kind === "polygon" && /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
|
|
2924
2948
|
"Sides",
|
|
2925
|
-
/* @__PURE__ */
|
|
2949
|
+
/* @__PURE__ */ jsx18("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}` })
|
|
2926
2950
|
] }),
|
|
2927
2951
|
options.kind === "star" && /* @__PURE__ */ jsxs16(Fragment4, { children: [
|
|
2928
2952
|
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
|
|
2929
2953
|
"Points",
|
|
2930
|
-
/* @__PURE__ */
|
|
2954
|
+
/* @__PURE__ */ jsx18("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}` })
|
|
2931
2955
|
] }),
|
|
2932
2956
|
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
|
|
2933
2957
|
"Inner",
|
|
2934
|
-
/* @__PURE__ */
|
|
2958
|
+
/* @__PURE__ */ jsx18(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
|
|
2935
2959
|
] })
|
|
2936
2960
|
] }),
|
|
2937
2961
|
options.kind === "line" && /* @__PURE__ */ jsxs16(Fragment4, { children: [
|
|
2938
2962
|
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
|
|
2939
2963
|
"Weight",
|
|
2940
|
-
/* @__PURE__ */
|
|
2964
|
+
/* @__PURE__ */ jsx18("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}` })
|
|
2941
2965
|
] }),
|
|
2942
2966
|
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
|
|
2943
|
-
/* @__PURE__ */
|
|
2967
|
+
/* @__PURE__ */ jsx18(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
|
|
2944
2968
|
"Arrowhead"
|
|
2945
2969
|
] })
|
|
2946
2970
|
] })
|
|
2947
2971
|
] }),
|
|
2948
|
-
/* @__PURE__ */
|
|
2949
|
-
error && /* @__PURE__ */
|
|
2972
|
+
/* @__PURE__ */ jsx18("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." }),
|
|
2973
|
+
error && /* @__PURE__ */ jsx18("p", { role: "alert", className: "text-destructive", children: error })
|
|
2950
2974
|
] });
|
|
2951
2975
|
};
|
|
2952
2976
|
|
|
2953
2977
|
// src/image-editor/TypeOptionsBar.tsx
|
|
2954
2978
|
import { useEffect as useEffect12, useState as useState15 } from "react";
|
|
2955
2979
|
import { TEXT_ALIGNS } from "@pixerate/editor/image-editor";
|
|
2956
|
-
import { jsx as
|
|
2980
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2957
2981
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
2958
2982
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
2959
2983
|
const [, setTick] = useState15(0);
|
|
@@ -2995,7 +3019,7 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
2995
3019
|
/* @__PURE__ */ jsxs17("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
2996
3020
|
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1", children: [
|
|
2997
3021
|
"Font",
|
|
2998
|
-
/* @__PURE__ */
|
|
3022
|
+
/* @__PURE__ */ jsx19(
|
|
2999
3023
|
"input",
|
|
3000
3024
|
{
|
|
3001
3025
|
list: "pixerate-type-fonts",
|
|
@@ -3005,11 +3029,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
3005
3029
|
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
3006
3030
|
}
|
|
3007
3031
|
),
|
|
3008
|
-
/* @__PURE__ */
|
|
3032
|
+
/* @__PURE__ */ jsx19("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ jsx19("option", { value: f }, f)) })
|
|
3009
3033
|
] }),
|
|
3010
3034
|
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1", children: [
|
|
3011
3035
|
"Size",
|
|
3012
|
-
/* @__PURE__ */
|
|
3036
|
+
/* @__PURE__ */ jsx19(
|
|
3013
3037
|
"input",
|
|
3014
3038
|
{
|
|
3015
3039
|
type: "number",
|
|
@@ -3022,24 +3046,24 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
3022
3046
|
}
|
|
3023
3047
|
)
|
|
3024
3048
|
] }),
|
|
3025
|
-
/* @__PURE__ */
|
|
3026
|
-
/* @__PURE__ */
|
|
3027
|
-
/* @__PURE__ */
|
|
3049
|
+
/* @__PURE__ */ jsx19("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" }),
|
|
3050
|
+
/* @__PURE__ */ jsx19("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
3051
|
+
/* @__PURE__ */ jsx19(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
|
|
3028
3052
|
] }),
|
|
3029
|
-
/* @__PURE__ */
|
|
3030
|
-
/* @__PURE__ */
|
|
3053
|
+
/* @__PURE__ */ jsx19("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: TEXT_ALIGNS.map((a) => /* @__PURE__ */ jsx19("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
3054
|
+
/* @__PURE__ */ jsx19("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." }),
|
|
3031
3055
|
missing.length > 0 && /* @__PURE__ */ jsxs17("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
3032
3056
|
"Missing ",
|
|
3033
3057
|
missing.length === 1 ? "font" : "fonts",
|
|
3034
3058
|
": ",
|
|
3035
3059
|
missing.join(", ")
|
|
3036
3060
|
] }),
|
|
3037
|
-
error && /* @__PURE__ */
|
|
3061
|
+
error && /* @__PURE__ */ jsx19("p", { role: "alert", className: "text-destructive", children: error })
|
|
3038
3062
|
] });
|
|
3039
3063
|
};
|
|
3040
3064
|
|
|
3041
3065
|
// src/image-editor/ImageEditor.tsx
|
|
3042
|
-
import { Fragment as Fragment5, jsx as
|
|
3066
|
+
import { Fragment as Fragment5, jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3043
3067
|
var ImageEditor = ({
|
|
3044
3068
|
editor: externalEditor,
|
|
3045
3069
|
src,
|
|
@@ -3211,7 +3235,7 @@ var ImageEditor = ({
|
|
|
3211
3235
|
children: [
|
|
3212
3236
|
/* @__PURE__ */ jsxs18("div", { className: imageEditorHeaderClass, children: [
|
|
3213
3237
|
/* @__PURE__ */ jsxs18("div", { role: "tablist", className: imageTabListClass, children: [
|
|
3214
|
-
/* @__PURE__ */
|
|
3238
|
+
/* @__PURE__ */ jsx20(
|
|
3215
3239
|
"button",
|
|
3216
3240
|
{
|
|
3217
3241
|
type: "button",
|
|
@@ -3226,7 +3250,7 @@ var ImageEditor = ({
|
|
|
3226
3250
|
children: "Transform & Crop"
|
|
3227
3251
|
}
|
|
3228
3252
|
),
|
|
3229
|
-
/* @__PURE__ */
|
|
3253
|
+
/* @__PURE__ */ jsx20(
|
|
3230
3254
|
"button",
|
|
3231
3255
|
{
|
|
3232
3256
|
type: "button",
|
|
@@ -3241,7 +3265,7 @@ var ImageEditor = ({
|
|
|
3241
3265
|
children: "Adjustments"
|
|
3242
3266
|
}
|
|
3243
3267
|
),
|
|
3244
|
-
/* @__PURE__ */
|
|
3268
|
+
/* @__PURE__ */ jsx20(
|
|
3245
3269
|
"button",
|
|
3246
3270
|
{
|
|
3247
3271
|
type: "button",
|
|
@@ -3256,7 +3280,7 @@ var ImageEditor = ({
|
|
|
3256
3280
|
children: "Layers"
|
|
3257
3281
|
}
|
|
3258
3282
|
),
|
|
3259
|
-
/* @__PURE__ */
|
|
3283
|
+
/* @__PURE__ */ jsx20(
|
|
3260
3284
|
"button",
|
|
3261
3285
|
{
|
|
3262
3286
|
type: "button",
|
|
@@ -3271,7 +3295,7 @@ var ImageEditor = ({
|
|
|
3271
3295
|
children: "Paint"
|
|
3272
3296
|
}
|
|
3273
3297
|
),
|
|
3274
|
-
/* @__PURE__ */
|
|
3298
|
+
/* @__PURE__ */ jsx20(
|
|
3275
3299
|
"button",
|
|
3276
3300
|
{
|
|
3277
3301
|
type: "button",
|
|
@@ -3286,7 +3310,7 @@ var ImageEditor = ({
|
|
|
3286
3310
|
children: "Select & Mask"
|
|
3287
3311
|
}
|
|
3288
3312
|
),
|
|
3289
|
-
/* @__PURE__ */
|
|
3313
|
+
/* @__PURE__ */ jsx20(
|
|
3290
3314
|
"button",
|
|
3291
3315
|
{
|
|
3292
3316
|
type: "button",
|
|
@@ -3301,7 +3325,7 @@ var ImageEditor = ({
|
|
|
3301
3325
|
children: "Annotations"
|
|
3302
3326
|
}
|
|
3303
3327
|
),
|
|
3304
|
-
/* @__PURE__ */
|
|
3328
|
+
/* @__PURE__ */ jsx20(
|
|
3305
3329
|
"button",
|
|
3306
3330
|
{
|
|
3307
3331
|
type: "button",
|
|
@@ -3329,14 +3353,14 @@ var ImageEditor = ({
|
|
|
3329
3353
|
"aria-selected": activeTab === "ai",
|
|
3330
3354
|
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
3331
3355
|
children: [
|
|
3332
|
-
/* @__PURE__ */
|
|
3356
|
+
/* @__PURE__ */ jsx20("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx20("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" }) }),
|
|
3333
3357
|
"AI Tools"
|
|
3334
3358
|
]
|
|
3335
3359
|
}
|
|
3336
3360
|
)
|
|
3337
3361
|
] }),
|
|
3338
3362
|
/* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
3339
|
-
/* @__PURE__ */
|
|
3363
|
+
/* @__PURE__ */ jsx20(
|
|
3340
3364
|
"button",
|
|
3341
3365
|
{
|
|
3342
3366
|
type: "button",
|
|
@@ -3347,7 +3371,7 @@ var ImageEditor = ({
|
|
|
3347
3371
|
children: "\u21A9"
|
|
3348
3372
|
}
|
|
3349
3373
|
),
|
|
3350
|
-
/* @__PURE__ */
|
|
3374
|
+
/* @__PURE__ */ jsx20(
|
|
3351
3375
|
"button",
|
|
3352
3376
|
{
|
|
3353
3377
|
type: "button",
|
|
@@ -3358,7 +3382,7 @@ var ImageEditor = ({
|
|
|
3358
3382
|
children: "\u21AA"
|
|
3359
3383
|
}
|
|
3360
3384
|
),
|
|
3361
|
-
/* @__PURE__ */
|
|
3385
|
+
/* @__PURE__ */ jsx20(
|
|
3362
3386
|
"button",
|
|
3363
3387
|
{
|
|
3364
3388
|
type: "button",
|
|
@@ -3367,8 +3391,8 @@ var ImageEditor = ({
|
|
|
3367
3391
|
children: "Reset"
|
|
3368
3392
|
}
|
|
3369
3393
|
),
|
|
3370
|
-
/* @__PURE__ */
|
|
3371
|
-
/* @__PURE__ */
|
|
3394
|
+
/* @__PURE__ */ jsx20("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
3395
|
+
/* @__PURE__ */ jsx20(
|
|
3372
3396
|
"button",
|
|
3373
3397
|
{
|
|
3374
3398
|
type: "button",
|
|
@@ -3382,7 +3406,7 @@ var ImageEditor = ({
|
|
|
3382
3406
|
Math.round(state.zoom * 100),
|
|
3383
3407
|
"%"
|
|
3384
3408
|
] }),
|
|
3385
|
-
/* @__PURE__ */
|
|
3409
|
+
/* @__PURE__ */ jsx20(
|
|
3386
3410
|
"button",
|
|
3387
3411
|
{
|
|
3388
3412
|
type: "button",
|
|
@@ -3392,8 +3416,8 @@ var ImageEditor = ({
|
|
|
3392
3416
|
children: "+"
|
|
3393
3417
|
}
|
|
3394
3418
|
),
|
|
3395
|
-
/* @__PURE__ */
|
|
3396
|
-
/* @__PURE__ */
|
|
3419
|
+
/* @__PURE__ */ jsx20("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
3420
|
+
/* @__PURE__ */ jsx20(
|
|
3397
3421
|
"button",
|
|
3398
3422
|
{
|
|
3399
3423
|
type: "button",
|
|
@@ -3404,7 +3428,7 @@ var ImageEditor = ({
|
|
|
3404
3428
|
children: "Hold Compare"
|
|
3405
3429
|
}
|
|
3406
3430
|
),
|
|
3407
|
-
/* @__PURE__ */
|
|
3431
|
+
/* @__PURE__ */ jsx20(
|
|
3408
3432
|
"button",
|
|
3409
3433
|
{
|
|
3410
3434
|
type: "button",
|
|
@@ -3415,10 +3439,10 @@ var ImageEditor = ({
|
|
|
3415
3439
|
)
|
|
3416
3440
|
] })
|
|
3417
3441
|
] }),
|
|
3418
|
-
transformTool.active && /* @__PURE__ */
|
|
3419
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */
|
|
3442
|
+
transformTool.active && /* @__PURE__ */ jsx20(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
3443
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ jsx20("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
3420
3444
|
/* @__PURE__ */ jsxs18("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
3421
|
-
/* @__PURE__ */
|
|
3445
|
+
/* @__PURE__ */ jsx20(
|
|
3422
3446
|
ImageEditorCanvas,
|
|
3423
3447
|
{
|
|
3424
3448
|
editor,
|
|
@@ -3444,9 +3468,9 @@ var ImageEditor = ({
|
|
|
3444
3468
|
),
|
|
3445
3469
|
/* @__PURE__ */ jsxs18("div", { className: imageSidebarClass, children: [
|
|
3446
3470
|
activeTab === "crop" && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
3447
|
-
/* @__PURE__ */
|
|
3471
|
+
/* @__PURE__ */ jsx20("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
3448
3472
|
/* @__PURE__ */ jsxs18("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
3449
|
-
/* @__PURE__ */
|
|
3473
|
+
/* @__PURE__ */ jsx20(
|
|
3450
3474
|
"button",
|
|
3451
3475
|
{
|
|
3452
3476
|
type: "button",
|
|
@@ -3458,7 +3482,7 @@ var ImageEditor = ({
|
|
|
3458
3482
|
children: "Freeform"
|
|
3459
3483
|
}
|
|
3460
3484
|
),
|
|
3461
|
-
/* @__PURE__ */
|
|
3485
|
+
/* @__PURE__ */ jsx20(
|
|
3462
3486
|
"button",
|
|
3463
3487
|
{
|
|
3464
3488
|
type: "button",
|
|
@@ -3470,7 +3494,7 @@ var ImageEditor = ({
|
|
|
3470
3494
|
children: "1:1 Square"
|
|
3471
3495
|
}
|
|
3472
3496
|
),
|
|
3473
|
-
/* @__PURE__ */
|
|
3497
|
+
/* @__PURE__ */ jsx20(
|
|
3474
3498
|
"button",
|
|
3475
3499
|
{
|
|
3476
3500
|
type: "button",
|
|
@@ -3482,7 +3506,7 @@ var ImageEditor = ({
|
|
|
3482
3506
|
children: "4:3 Standard"
|
|
3483
3507
|
}
|
|
3484
3508
|
),
|
|
3485
|
-
/* @__PURE__ */
|
|
3509
|
+
/* @__PURE__ */ jsx20(
|
|
3486
3510
|
"button",
|
|
3487
3511
|
{
|
|
3488
3512
|
type: "button",
|
|
@@ -3494,7 +3518,7 @@ var ImageEditor = ({
|
|
|
3494
3518
|
children: "16:9 Wide"
|
|
3495
3519
|
}
|
|
3496
3520
|
),
|
|
3497
|
-
/* @__PURE__ */
|
|
3521
|
+
/* @__PURE__ */ jsx20(
|
|
3498
3522
|
"button",
|
|
3499
3523
|
{
|
|
3500
3524
|
type: "button",
|
|
@@ -3506,7 +3530,7 @@ var ImageEditor = ({
|
|
|
3506
3530
|
children: "3:2 Photo"
|
|
3507
3531
|
}
|
|
3508
3532
|
),
|
|
3509
|
-
/* @__PURE__ */
|
|
3533
|
+
/* @__PURE__ */ jsx20(
|
|
3510
3534
|
"button",
|
|
3511
3535
|
{
|
|
3512
3536
|
type: "button",
|
|
@@ -3519,10 +3543,10 @@ var ImageEditor = ({
|
|
|
3519
3543
|
}
|
|
3520
3544
|
)
|
|
3521
3545
|
] }),
|
|
3522
|
-
/* @__PURE__ */
|
|
3523
|
-
/* @__PURE__ */
|
|
3546
|
+
/* @__PURE__ */ jsx20("div", { className: imageDividerClass }),
|
|
3547
|
+
/* @__PURE__ */ jsx20("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
3524
3548
|
/* @__PURE__ */ jsxs18("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
3525
|
-
/* @__PURE__ */
|
|
3549
|
+
/* @__PURE__ */ jsx20(
|
|
3526
3550
|
"button",
|
|
3527
3551
|
{
|
|
3528
3552
|
type: "button",
|
|
@@ -3531,7 +3555,7 @@ var ImageEditor = ({
|
|
|
3531
3555
|
children: "Rotate -90\xB0"
|
|
3532
3556
|
}
|
|
3533
3557
|
),
|
|
3534
|
-
/* @__PURE__ */
|
|
3558
|
+
/* @__PURE__ */ jsx20(
|
|
3535
3559
|
"button",
|
|
3536
3560
|
{
|
|
3537
3561
|
type: "button",
|
|
@@ -3540,7 +3564,7 @@ var ImageEditor = ({
|
|
|
3540
3564
|
children: "Rotate +90\xB0"
|
|
3541
3565
|
}
|
|
3542
3566
|
),
|
|
3543
|
-
/* @__PURE__ */
|
|
3567
|
+
/* @__PURE__ */ jsx20(
|
|
3544
3568
|
"button",
|
|
3545
3569
|
{
|
|
3546
3570
|
type: "button",
|
|
@@ -3549,7 +3573,7 @@ var ImageEditor = ({
|
|
|
3549
3573
|
children: "Flip Horizontal"
|
|
3550
3574
|
}
|
|
3551
3575
|
),
|
|
3552
|
-
/* @__PURE__ */
|
|
3576
|
+
/* @__PURE__ */ jsx20(
|
|
3553
3577
|
"button",
|
|
3554
3578
|
{
|
|
3555
3579
|
type: "button",
|
|
@@ -3562,8 +3586,8 @@ var ImageEditor = ({
|
|
|
3562
3586
|
] }),
|
|
3563
3587
|
activeTab === "adjust" && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
3564
3588
|
/* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between", children: [
|
|
3565
|
-
/* @__PURE__ */
|
|
3566
|
-
/* @__PURE__ */
|
|
3589
|
+
/* @__PURE__ */ jsx20("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
3590
|
+
/* @__PURE__ */ jsx20(
|
|
3567
3591
|
"button",
|
|
3568
3592
|
{
|
|
3569
3593
|
type: "button",
|
|
@@ -3573,9 +3597,9 @@ var ImageEditor = ({
|
|
|
3573
3597
|
}
|
|
3574
3598
|
)
|
|
3575
3599
|
] }),
|
|
3576
|
-
/* @__PURE__ */
|
|
3600
|
+
/* @__PURE__ */ jsx20(Histogram, { histogram: editor.histogram }),
|
|
3577
3601
|
IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs18(React15.Fragment, { children: [
|
|
3578
|
-
/* @__PURE__ */
|
|
3602
|
+
/* @__PURE__ */ jsx20(
|
|
3579
3603
|
ControlSlider,
|
|
3580
3604
|
{
|
|
3581
3605
|
spec,
|
|
@@ -3590,8 +3614,8 @@ var ImageEditor = ({
|
|
|
3590
3614
|
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",
|
|
3591
3615
|
"data-testid": "image-editor-process-notice",
|
|
3592
3616
|
children: [
|
|
3593
|
-
/* @__PURE__ */
|
|
3594
|
-
/* @__PURE__ */
|
|
3617
|
+
/* @__PURE__ */ jsx20("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
3618
|
+
/* @__PURE__ */ jsx20(
|
|
3595
3619
|
"button",
|
|
3596
3620
|
{
|
|
3597
3621
|
type: "button",
|
|
@@ -3604,7 +3628,7 @@ var ImageEditor = ({
|
|
|
3604
3628
|
}
|
|
3605
3629
|
)
|
|
3606
3630
|
] }, spec.id)),
|
|
3607
|
-
/* @__PURE__ */
|
|
3631
|
+
/* @__PURE__ */ jsx20("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx20(
|
|
3608
3632
|
AdjustmentLayersPanel,
|
|
3609
3633
|
{
|
|
3610
3634
|
controller,
|
|
@@ -3614,8 +3638,8 @@ var ImageEditor = ({
|
|
|
3614
3638
|
) })
|
|
3615
3639
|
] }),
|
|
3616
3640
|
activeTab === "layers" && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
3617
|
-
/* @__PURE__ */
|
|
3618
|
-
/* @__PURE__ */
|
|
3641
|
+
/* @__PURE__ */ jsx20("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
3642
|
+
/* @__PURE__ */ jsx20(
|
|
3619
3643
|
"button",
|
|
3620
3644
|
{
|
|
3621
3645
|
type: "button",
|
|
@@ -3626,15 +3650,15 @@ var ImageEditor = ({
|
|
|
3626
3650
|
children: "Free Transform"
|
|
3627
3651
|
}
|
|
3628
3652
|
),
|
|
3629
|
-
/* @__PURE__ */
|
|
3630
|
-
effectsShown && /* @__PURE__ */
|
|
3631
|
-
/* @__PURE__ */
|
|
3632
|
-
/* @__PURE__ */
|
|
3653
|
+
/* @__PURE__ */ jsx20(LayersPanel, { controller }),
|
|
3654
|
+
effectsShown && /* @__PURE__ */ jsx20(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
3655
|
+
/* @__PURE__ */ jsx20("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
3656
|
+
/* @__PURE__ */ jsx20(ColorProfilePanel, { controller })
|
|
3633
3657
|
] }),
|
|
3634
3658
|
activeTab === "paint" && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
3635
|
-
/* @__PURE__ */
|
|
3636
|
-
/* @__PURE__ */
|
|
3637
|
-
/* @__PURE__ */
|
|
3659
|
+
/* @__PURE__ */ jsx20("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
3660
|
+
/* @__PURE__ */ jsx20(BrushOptionsBar, { controller }),
|
|
3661
|
+
/* @__PURE__ */ jsx20(
|
|
3638
3662
|
"button",
|
|
3639
3663
|
{
|
|
3640
3664
|
type: "button",
|
|
@@ -3645,12 +3669,12 @@ var ImageEditor = ({
|
|
|
3645
3669
|
children: "Free Transform"
|
|
3646
3670
|
}
|
|
3647
3671
|
),
|
|
3648
|
-
paintError && /* @__PURE__ */
|
|
3649
|
-
/* @__PURE__ */
|
|
3672
|
+
paintError && /* @__PURE__ */ jsx20("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
3673
|
+
/* @__PURE__ */ jsx20("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx20(LayersPanel, { controller }) })
|
|
3650
3674
|
] }),
|
|
3651
3675
|
activeTab === "annotate" && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
3652
|
-
/* @__PURE__ */
|
|
3653
|
-
/* @__PURE__ */
|
|
3676
|
+
/* @__PURE__ */ jsx20("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
|
|
3677
|
+
/* @__PURE__ */ jsx20("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ jsx20(
|
|
3654
3678
|
"button",
|
|
3655
3679
|
{
|
|
3656
3680
|
type: "button",
|
|
@@ -3661,13 +3685,13 @@ var ImageEditor = ({
|
|
|
3661
3685
|
},
|
|
3662
3686
|
t
|
|
3663
3687
|
)) }),
|
|
3664
|
-
state.activeTool === "shape" && /* @__PURE__ */
|
|
3665
|
-
state.activeTool === "type" && /* @__PURE__ */
|
|
3666
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */
|
|
3667
|
-
shapeTypeError && /* @__PURE__ */
|
|
3668
|
-
/* @__PURE__ */
|
|
3669
|
-
/* @__PURE__ */
|
|
3670
|
-
/* @__PURE__ */
|
|
3688
|
+
state.activeTool === "shape" && /* @__PURE__ */ jsx20(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
3689
|
+
state.activeTool === "type" && /* @__PURE__ */ jsx20(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
|
|
3690
|
+
state.activeTool === "type" && typeSession && /* @__PURE__ */ jsx20("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" }),
|
|
3691
|
+
shapeTypeError && /* @__PURE__ */ jsx20("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
3692
|
+
/* @__PURE__ */ jsx20("div", { className: imageDividerClass }),
|
|
3693
|
+
/* @__PURE__ */ jsx20("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
3694
|
+
/* @__PURE__ */ jsx20("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ jsx20(
|
|
3671
3695
|
"button",
|
|
3672
3696
|
{
|
|
3673
3697
|
type: "button",
|
|
@@ -3678,25 +3702,17 @@ var ImageEditor = ({
|
|
|
3678
3702
|
t
|
|
3679
3703
|
)) }),
|
|
3680
3704
|
/* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
3681
|
-
/* @__PURE__ */
|
|
3682
|
-
/* @__PURE__ */
|
|
3683
|
-
"input",
|
|
3684
|
-
{
|
|
3685
|
-
type: "color",
|
|
3686
|
-
value: activeColor,
|
|
3687
|
-
onChange: (e) => setActiveColor(e.target.value),
|
|
3688
|
-
className: "w-8 h-8 rounded border border-border cursor-pointer bg-transparent"
|
|
3689
|
-
}
|
|
3690
|
-
),
|
|
3705
|
+
/* @__PURE__ */ jsx20("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
3706
|
+
/* @__PURE__ */ jsx20(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
|
|
3691
3707
|
/* @__PURE__ */ jsxs18("div", { className: "flex-1 ml-2", children: [
|
|
3692
3708
|
/* @__PURE__ */ jsxs18("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
3693
|
-
/* @__PURE__ */
|
|
3709
|
+
/* @__PURE__ */ jsx20("span", { children: "Width:" }),
|
|
3694
3710
|
/* @__PURE__ */ jsxs18("span", { className: "font-mono", children: [
|
|
3695
3711
|
strokeWidth,
|
|
3696
3712
|
"px"
|
|
3697
3713
|
] })
|
|
3698
3714
|
] }),
|
|
3699
|
-
/* @__PURE__ */
|
|
3715
|
+
/* @__PURE__ */ jsx20(
|
|
3700
3716
|
"input",
|
|
3701
3717
|
{
|
|
3702
3718
|
type: "range",
|
|
@@ -3709,10 +3725,10 @@ var ImageEditor = ({
|
|
|
3709
3725
|
)
|
|
3710
3726
|
] })
|
|
3711
3727
|
] }),
|
|
3712
|
-
/* @__PURE__ */
|
|
3713
|
-
/* @__PURE__ */
|
|
3728
|
+
/* @__PURE__ */ jsx20("div", { className: imageDividerClass }),
|
|
3729
|
+
/* @__PURE__ */ jsx20("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
3714
3730
|
/* @__PURE__ */ jsxs18("div", { className: "flex gap-2", children: [
|
|
3715
|
-
/* @__PURE__ */
|
|
3731
|
+
/* @__PURE__ */ jsx20(
|
|
3716
3732
|
"input",
|
|
3717
3733
|
{
|
|
3718
3734
|
type: "text",
|
|
@@ -3723,7 +3739,7 @@ var ImageEditor = ({
|
|
|
3723
3739
|
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"
|
|
3724
3740
|
}
|
|
3725
3741
|
),
|
|
3726
|
-
/* @__PURE__ */
|
|
3742
|
+
/* @__PURE__ */ jsx20(
|
|
3727
3743
|
"button",
|
|
3728
3744
|
{
|
|
3729
3745
|
type: "button",
|
|
@@ -3734,13 +3750,13 @@ var ImageEditor = ({
|
|
|
3734
3750
|
)
|
|
3735
3751
|
] }),
|
|
3736
3752
|
/* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
3737
|
-
/* @__PURE__ */
|
|
3753
|
+
/* @__PURE__ */ jsx20("span", { children: "Font Size:" }),
|
|
3738
3754
|
/* @__PURE__ */ jsxs18("span", { className: "font-mono", children: [
|
|
3739
3755
|
fontSize,
|
|
3740
3756
|
"px"
|
|
3741
3757
|
] })
|
|
3742
3758
|
] }),
|
|
3743
|
-
/* @__PURE__ */
|
|
3759
|
+
/* @__PURE__ */ jsx20(
|
|
3744
3760
|
"input",
|
|
3745
3761
|
{
|
|
3746
3762
|
type: "range",
|
|
@@ -3751,14 +3767,14 @@ var ImageEditor = ({
|
|
|
3751
3767
|
className: imageRangeClass
|
|
3752
3768
|
}
|
|
3753
3769
|
),
|
|
3754
|
-
/* @__PURE__ */
|
|
3770
|
+
/* @__PURE__ */ jsx20("div", { className: imageDividerClass }),
|
|
3755
3771
|
/* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between", children: [
|
|
3756
3772
|
/* @__PURE__ */ jsxs18("span", { className: "text-muted-foreground", children: [
|
|
3757
3773
|
"Layers (",
|
|
3758
3774
|
state.annotations.length,
|
|
3759
3775
|
")"
|
|
3760
3776
|
] }),
|
|
3761
|
-
state.selectedAnnotationId && /* @__PURE__ */
|
|
3777
|
+
state.selectedAnnotationId && /* @__PURE__ */ jsx20(
|
|
3762
3778
|
"button",
|
|
3763
3779
|
{
|
|
3764
3780
|
type: "button",
|
|
@@ -3767,7 +3783,7 @@ var ImageEditor = ({
|
|
|
3767
3783
|
children: "Delete Selected"
|
|
3768
3784
|
}
|
|
3769
3785
|
),
|
|
3770
|
-
state.annotations.length > 0 && /* @__PURE__ */
|
|
3786
|
+
state.annotations.length > 0 && /* @__PURE__ */ jsx20(
|
|
3771
3787
|
"button",
|
|
3772
3788
|
{
|
|
3773
3789
|
type: "button",
|
|
@@ -3780,8 +3796,8 @@ var ImageEditor = ({
|
|
|
3780
3796
|
] }),
|
|
3781
3797
|
activeTab === "depth" && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
3782
3798
|
/* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between", children: [
|
|
3783
|
-
/* @__PURE__ */
|
|
3784
|
-
/* @__PURE__ */
|
|
3799
|
+
/* @__PURE__ */ jsx20("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
3800
|
+
/* @__PURE__ */ jsx20(
|
|
3785
3801
|
"button",
|
|
3786
3802
|
{
|
|
3787
3803
|
type: "button",
|
|
@@ -3792,7 +3808,7 @@ var ImageEditor = ({
|
|
|
3792
3808
|
)
|
|
3793
3809
|
] }),
|
|
3794
3810
|
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
3795
|
-
/* @__PURE__ */
|
|
3811
|
+
/* @__PURE__ */ jsx20(
|
|
3796
3812
|
"input",
|
|
3797
3813
|
{
|
|
3798
3814
|
type: "checkbox",
|
|
@@ -3801,12 +3817,12 @@ var ImageEditor = ({
|
|
|
3801
3817
|
className: "rounded accent-primary"
|
|
3802
3818
|
}
|
|
3803
3819
|
),
|
|
3804
|
-
/* @__PURE__ */
|
|
3820
|
+
/* @__PURE__ */ jsx20("span", { children: "Enable Depth / Alpha Mask" })
|
|
3805
3821
|
] }),
|
|
3806
3822
|
state.depthMask.enabled && /* @__PURE__ */ jsxs18(Fragment5, { children: [
|
|
3807
3823
|
/* @__PURE__ */ jsxs18("div", { children: [
|
|
3808
|
-
/* @__PURE__ */
|
|
3809
|
-
/* @__PURE__ */
|
|
3824
|
+
/* @__PURE__ */ jsx20("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
3825
|
+
/* @__PURE__ */ jsx20(
|
|
3810
3826
|
"input",
|
|
3811
3827
|
{
|
|
3812
3828
|
type: "text",
|
|
@@ -3818,7 +3834,7 @@ var ImageEditor = ({
|
|
|
3818
3834
|
)
|
|
3819
3835
|
] }),
|
|
3820
3836
|
/* @__PURE__ */ jsxs18("div", { className: "flex gap-2", children: [
|
|
3821
|
-
/* @__PURE__ */
|
|
3837
|
+
/* @__PURE__ */ jsx20(
|
|
3822
3838
|
"button",
|
|
3823
3839
|
{
|
|
3824
3840
|
type: "button",
|
|
@@ -3827,7 +3843,7 @@ var ImageEditor = ({
|
|
|
3827
3843
|
children: "Threshold Mode"
|
|
3828
3844
|
}
|
|
3829
3845
|
),
|
|
3830
|
-
/* @__PURE__ */
|
|
3846
|
+
/* @__PURE__ */ jsx20(
|
|
3831
3847
|
"button",
|
|
3832
3848
|
{
|
|
3833
3849
|
type: "button",
|
|
@@ -3839,10 +3855,10 @@ var ImageEditor = ({
|
|
|
3839
3855
|
] }),
|
|
3840
3856
|
/* @__PURE__ */ jsxs18("div", { children: [
|
|
3841
3857
|
/* @__PURE__ */ jsxs18("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
3842
|
-
/* @__PURE__ */
|
|
3843
|
-
/* @__PURE__ */
|
|
3858
|
+
/* @__PURE__ */ jsx20("span", { children: "Depth Start (Lower):" }),
|
|
3859
|
+
/* @__PURE__ */ jsx20("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
3844
3860
|
] }),
|
|
3845
|
-
/* @__PURE__ */
|
|
3861
|
+
/* @__PURE__ */ jsx20(
|
|
3846
3862
|
"input",
|
|
3847
3863
|
{
|
|
3848
3864
|
type: "range",
|
|
@@ -3858,10 +3874,10 @@ var ImageEditor = ({
|
|
|
3858
3874
|
] }),
|
|
3859
3875
|
/* @__PURE__ */ jsxs18("div", { children: [
|
|
3860
3876
|
/* @__PURE__ */ jsxs18("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
3861
|
-
/* @__PURE__ */
|
|
3862
|
-
/* @__PURE__ */
|
|
3877
|
+
/* @__PURE__ */ jsx20("span", { children: "Depth Stop (Upper):" }),
|
|
3878
|
+
/* @__PURE__ */ jsx20("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
3863
3879
|
] }),
|
|
3864
|
-
/* @__PURE__ */
|
|
3880
|
+
/* @__PURE__ */ jsx20(
|
|
3865
3881
|
"input",
|
|
3866
3882
|
{
|
|
3867
3883
|
type: "range",
|
|
@@ -3877,10 +3893,10 @@ var ImageEditor = ({
|
|
|
3877
3893
|
] }),
|
|
3878
3894
|
/* @__PURE__ */ jsxs18("div", { children: [
|
|
3879
3895
|
/* @__PURE__ */ jsxs18("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
3880
|
-
/* @__PURE__ */
|
|
3881
|
-
/* @__PURE__ */
|
|
3896
|
+
/* @__PURE__ */ jsx20("span", { children: "Softness:" }),
|
|
3897
|
+
/* @__PURE__ */ jsx20("span", { className: "font-mono", children: state.depthMask.softness })
|
|
3882
3898
|
] }),
|
|
3883
|
-
/* @__PURE__ */
|
|
3899
|
+
/* @__PURE__ */ jsx20(
|
|
3884
3900
|
"input",
|
|
3885
3901
|
{
|
|
3886
3902
|
type: "range",
|
|
@@ -3893,7 +3909,7 @@ var ImageEditor = ({
|
|
|
3893
3909
|
)
|
|
3894
3910
|
] }),
|
|
3895
3911
|
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
3896
|
-
/* @__PURE__ */
|
|
3912
|
+
/* @__PURE__ */ jsx20(
|
|
3897
3913
|
"input",
|
|
3898
3914
|
{
|
|
3899
3915
|
type: "checkbox",
|
|
@@ -3902,12 +3918,12 @@ var ImageEditor = ({
|
|
|
3902
3918
|
className: "rounded accent-primary"
|
|
3903
3919
|
}
|
|
3904
3920
|
),
|
|
3905
|
-
/* @__PURE__ */
|
|
3921
|
+
/* @__PURE__ */ jsx20("span", { children: "Invert Mask" })
|
|
3906
3922
|
] })
|
|
3907
3923
|
] })
|
|
3908
3924
|
] }),
|
|
3909
3925
|
activeTab === "select" && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
3910
|
-
/* @__PURE__ */
|
|
3926
|
+
/* @__PURE__ */ jsx20(
|
|
3911
3927
|
SelectionOptionsBar,
|
|
3912
3928
|
{
|
|
3913
3929
|
controller,
|
|
@@ -3917,9 +3933,9 @@ var ImageEditor = ({
|
|
|
3917
3933
|
quickMask: Boolean(state.quickMask)
|
|
3918
3934
|
}
|
|
3919
3935
|
),
|
|
3920
|
-
selectionError && /* @__PURE__ */
|
|
3936
|
+
selectionError && /* @__PURE__ */ jsx20("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
3921
3937
|
/* @__PURE__ */ jsxs18("div", { className: "flex gap-1", children: [
|
|
3922
|
-
/* @__PURE__ */
|
|
3938
|
+
/* @__PURE__ */ jsx20(
|
|
3923
3939
|
"button",
|
|
3924
3940
|
{
|
|
3925
3941
|
type: "button",
|
|
@@ -3930,7 +3946,7 @@ var ImageEditor = ({
|
|
|
3930
3946
|
children: "Transform Selection"
|
|
3931
3947
|
}
|
|
3932
3948
|
),
|
|
3933
|
-
/* @__PURE__ */
|
|
3949
|
+
/* @__PURE__ */ jsx20(
|
|
3934
3950
|
"button",
|
|
3935
3951
|
{
|
|
3936
3952
|
type: "button",
|
|
@@ -3942,11 +3958,11 @@ var ImageEditor = ({
|
|
|
3942
3958
|
}
|
|
3943
3959
|
)
|
|
3944
3960
|
] }),
|
|
3945
|
-
/* @__PURE__ */
|
|
3961
|
+
/* @__PURE__ */ jsx20(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers })
|
|
3946
3962
|
] }),
|
|
3947
3963
|
activeTab === "ai" && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
3948
3964
|
/* @__PURE__ */ jsxs18("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
3949
|
-
/* @__PURE__ */
|
|
3965
|
+
/* @__PURE__ */ jsx20("span", { children: "Results go to" }),
|
|
3950
3966
|
/* @__PURE__ */ jsxs18(
|
|
3951
3967
|
"select",
|
|
3952
3968
|
{
|
|
@@ -3955,9 +3971,9 @@ var ImageEditor = ({
|
|
|
3955
3971
|
onChange: (e) => setAiTarget(e.target.value),
|
|
3956
3972
|
className: imageSelectClass,
|
|
3957
3973
|
children: [
|
|
3958
|
-
/* @__PURE__ */
|
|
3959
|
-
/* @__PURE__ */
|
|
3960
|
-
/* @__PURE__ */
|
|
3974
|
+
/* @__PURE__ */ jsx20("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
3975
|
+
/* @__PURE__ */ jsx20("option", { value: "new-layer", children: "New layer / mask" }),
|
|
3976
|
+
/* @__PURE__ */ jsx20("option", { value: "replace", children: "Replace image" })
|
|
3961
3977
|
]
|
|
3962
3978
|
}
|
|
3963
3979
|
)
|
|
@@ -3965,13 +3981,13 @@ var ImageEditor = ({
|
|
|
3965
3981
|
/* @__PURE__ */ jsxs18("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
3966
3982
|
/* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between", children: [
|
|
3967
3983
|
/* @__PURE__ */ jsxs18("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
3968
|
-
/* @__PURE__ */
|
|
3984
|
+
/* @__PURE__ */ jsx20("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx20("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" }) }),
|
|
3969
3985
|
"Background Removal"
|
|
3970
3986
|
] }),
|
|
3971
|
-
isRemovingBg && /* @__PURE__ */
|
|
3987
|
+
isRemovingBg && /* @__PURE__ */ jsx20("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..." })
|
|
3972
3988
|
] }),
|
|
3973
|
-
/* @__PURE__ */
|
|
3974
|
-
/* @__PURE__ */
|
|
3989
|
+
/* @__PURE__ */ jsx20("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
3990
|
+
/* @__PURE__ */ jsx20(
|
|
3975
3991
|
"button",
|
|
3976
3992
|
{
|
|
3977
3993
|
type: "button",
|
|
@@ -3979,10 +3995,10 @@ var ImageEditor = ({
|
|
|
3979
3995
|
disabled: isRemovingBg || isInpainting,
|
|
3980
3996
|
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",
|
|
3981
3997
|
children: isRemovingBg ? /* @__PURE__ */ jsxs18(Fragment5, { children: [
|
|
3982
|
-
/* @__PURE__ */
|
|
3998
|
+
/* @__PURE__ */ jsx20("div", { className: imageSpinnerClass }),
|
|
3983
3999
|
"Removing Background..."
|
|
3984
4000
|
] }) : /* @__PURE__ */ jsxs18(Fragment5, { children: [
|
|
3985
|
-
/* @__PURE__ */
|
|
4001
|
+
/* @__PURE__ */ jsx20("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx20("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" }) }),
|
|
3986
4002
|
"Remove Background"
|
|
3987
4003
|
] })
|
|
3988
4004
|
}
|
|
@@ -3992,17 +4008,17 @@ var ImageEditor = ({
|
|
|
3992
4008
|
/* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between", children: [
|
|
3993
4009
|
/* @__PURE__ */ jsxs18("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
3994
4010
|
/* @__PURE__ */ jsxs18("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
3995
|
-
/* @__PURE__ */
|
|
3996
|
-
/* @__PURE__ */
|
|
4011
|
+
/* @__PURE__ */ jsx20("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" }),
|
|
4012
|
+
/* @__PURE__ */ jsx20("path", { d: "m14 7 3 3" })
|
|
3997
4013
|
] }),
|
|
3998
4014
|
"Generative Inpainting"
|
|
3999
4015
|
] }),
|
|
4000
|
-
isInpainting && /* @__PURE__ */
|
|
4016
|
+
isInpainting && /* @__PURE__ */ jsx20("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..." })
|
|
4001
4017
|
] }),
|
|
4002
|
-
/* @__PURE__ */
|
|
4018
|
+
/* @__PURE__ */ jsx20("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
|
|
4003
4019
|
/* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-1", children: [
|
|
4004
|
-
/* @__PURE__ */
|
|
4005
|
-
/* @__PURE__ */
|
|
4020
|
+
/* @__PURE__ */ jsx20("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
4021
|
+
/* @__PURE__ */ jsx20(
|
|
4006
4022
|
"textarea",
|
|
4007
4023
|
{
|
|
4008
4024
|
id: "ai-inpaint-prompt-react",
|
|
@@ -4015,7 +4031,7 @@ var ImageEditor = ({
|
|
|
4015
4031
|
)
|
|
4016
4032
|
] }),
|
|
4017
4033
|
/* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-1", children: [
|
|
4018
|
-
/* @__PURE__ */
|
|
4034
|
+
/* @__PURE__ */ jsx20("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
4019
4035
|
/* @__PURE__ */ jsxs18("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
4020
4036
|
/* @__PURE__ */ jsxs18(
|
|
4021
4037
|
"button",
|
|
@@ -4045,7 +4061,7 @@ var ImageEditor = ({
|
|
|
4045
4061
|
)
|
|
4046
4062
|
] })
|
|
4047
4063
|
] }),
|
|
4048
|
-
/* @__PURE__ */
|
|
4064
|
+
/* @__PURE__ */ jsx20(
|
|
4049
4065
|
"button",
|
|
4050
4066
|
{
|
|
4051
4067
|
type: "button",
|
|
@@ -4053,17 +4069,17 @@ var ImageEditor = ({
|
|
|
4053
4069
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
4054
4070
|
className: "mt-1 px-3 py-2 rounded-lg bg-primary hover:bg-primary/90 disabled:opacity-50 text-primary-foreground font-medium shadow transition-colors flex items-center justify-center gap-2",
|
|
4055
4071
|
children: isInpainting ? /* @__PURE__ */ jsxs18(Fragment5, { children: [
|
|
4056
|
-
/* @__PURE__ */
|
|
4072
|
+
/* @__PURE__ */ jsx20("div", { className: imageSpinnerClass }),
|
|
4057
4073
|
"Generating Inpaint..."
|
|
4058
4074
|
] }) : /* @__PURE__ */ jsxs18(Fragment5, { children: [
|
|
4059
|
-
/* @__PURE__ */
|
|
4075
|
+
/* @__PURE__ */ jsx20("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx20("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
|
|
4060
4076
|
"Apply Inpainting"
|
|
4061
4077
|
] })
|
|
4062
4078
|
}
|
|
4063
4079
|
)
|
|
4064
4080
|
] }),
|
|
4065
|
-
aiError && /* @__PURE__ */
|
|
4066
|
-
aiSuccess && /* @__PURE__ */
|
|
4081
|
+
aiError && /* @__PURE__ */ jsx20("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
|
|
4082
|
+
aiSuccess && /* @__PURE__ */ jsx20("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
|
|
4067
4083
|
] })
|
|
4068
4084
|
] })
|
|
4069
4085
|
] })
|
|
@@ -4081,6 +4097,7 @@ export {
|
|
|
4081
4097
|
ImageCheckbox,
|
|
4082
4098
|
ImageRange,
|
|
4083
4099
|
ImageSelect,
|
|
4100
|
+
ImageColor,
|
|
4084
4101
|
ControlSlider,
|
|
4085
4102
|
Histogram,
|
|
4086
4103
|
useImageHistogram,
|