@pixerate/editor-react 0.167.0 → 0.169.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/{chunk-65EL63YS.js → chunk-2UD3JH4W.js} +1137 -1376
- package/dist/chunk-EP6C5N54.js +406 -0
- package/dist/image-editor/LayerEffectsPanel.d.cts +3 -2
- package/dist/image-editor/LayerEffectsPanel.d.ts +3 -2
- package/dist/image-editor/index.cjs +121 -121
- package/dist/image-editor/index.js +10 -9
- package/dist/index.cjs +121 -121
- package/dist/index.js +10 -9
- package/dist/paint-editor/PaintLayersPanel.d.cts +2 -1
- package/dist/paint-editor/PaintLayersPanel.d.ts +2 -1
- package/dist/paint-editor/index.cjs +688 -423
- package/dist/paint-editor/index.js +38 -2
- package/package.json +3 -3
- package/dist/chunk-AJCWF6SN.js +0 -125
|
@@ -241,7 +241,7 @@ function useImageEffectsTools(registry, controller, options = {}) {
|
|
|
241
241
|
|
|
242
242
|
// src/image-editor/ImageEditor.tsx
|
|
243
243
|
var import_react40 = __toESM(require("react"), 1);
|
|
244
|
-
var
|
|
244
|
+
var import_image_editor24 = require("@pixerate/editor/image-editor");
|
|
245
245
|
|
|
246
246
|
// src/image-editor/ImageEditorCanvas.tsx
|
|
247
247
|
var import_react5 = require("react");
|
|
@@ -1638,7 +1638,7 @@ var import_react13 = require("react");
|
|
|
1638
1638
|
|
|
1639
1639
|
// src/image-editor/LayerEffectsPanel.tsx
|
|
1640
1640
|
var import_react10 = require("react");
|
|
1641
|
-
var
|
|
1641
|
+
var import_raster = require("@pixerate/editor/raster");
|
|
1642
1642
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1643
1643
|
var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) => {
|
|
1644
1644
|
const [, setTick] = (0, import_react10.useState)(0);
|
|
@@ -1647,7 +1647,7 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
|
|
|
1647
1647
|
const [error, setError] = (0, import_react10.useState)(null);
|
|
1648
1648
|
const commitNext = (0, import_react10.useRef)(true);
|
|
1649
1649
|
const layer = layerId ? controller.getLayer(layerId) : controller.getActiveLayer();
|
|
1650
|
-
const model = (0,
|
|
1650
|
+
const model = (0, import_raster.layerEffectsPanel)(layer);
|
|
1651
1651
|
const id = layer?.id;
|
|
1652
1652
|
const attempt = (fn) => {
|
|
1653
1653
|
try {
|
|
@@ -1664,7 +1664,7 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
|
|
|
1664
1664
|
const patterns = controller.getDocumentPatterns();
|
|
1665
1665
|
const change = (effectId, control, value, drag = false) => attempt(() => {
|
|
1666
1666
|
const effect = controller.getLayerEffects(id).items.find((e) => e.id === effectId);
|
|
1667
|
-
controller.updateLayerEffect(id, effectId, (0,
|
|
1667
|
+
controller.updateLayerEffect(id, effectId, (0, import_raster.effectControlChange)(effect, control.key, value, patterns), drag ? commitNext.current : true);
|
|
1668
1668
|
if (drag) commitNext.current = false;
|
|
1669
1669
|
});
|
|
1670
1670
|
const renderControl = (effectId, c) => {
|
|
@@ -1757,7 +1757,7 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
|
|
|
1757
1757
|
value: "",
|
|
1758
1758
|
placeholder: "Add style\u2026",
|
|
1759
1759
|
disabled: model.readOnly,
|
|
1760
|
-
options:
|
|
1760
|
+
options: import_raster.LAYER_EFFECT_MENU.map((m) => ({ value: m.kind, label: m.label })),
|
|
1761
1761
|
onChange: (v) => {
|
|
1762
1762
|
const kind = v;
|
|
1763
1763
|
if (!kind) return;
|
|
@@ -1785,7 +1785,7 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
|
|
|
1785
1785
|
),
|
|
1786
1786
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: imageIconButtonClass, "aria-label": `Remove ${row.label}`, disabled: model.readOnly, onClick: () => attempt(() => controller.removeLayerEffect(id, row.id)), children: "\u2715" })
|
|
1787
1787
|
] }),
|
|
1788
|
-
expanded && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 px-1.5 pb-1.5", "data-testid": "effect-settings", children: (0,
|
|
1788
|
+
expanded && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 px-1.5 pb-1.5", "data-testid": "effect-settings", children: (0, import_raster.layerEffectControls)(effect, patterns).map((c) => renderControl(row.id, c)) })
|
|
1789
1789
|
] }, row.id);
|
|
1790
1790
|
}) }),
|
|
1791
1791
|
error && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
@@ -1929,7 +1929,7 @@ var VectorMaskEdgesPanel = ({ controller, layer, className = "" }) => {
|
|
|
1929
1929
|
};
|
|
1930
1930
|
|
|
1931
1931
|
// src/image-editor/LayersPanel.tsx
|
|
1932
|
-
var
|
|
1932
|
+
var import_image_editor7 = require("@pixerate/editor/image-editor");
|
|
1933
1933
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1934
1934
|
var rowClass = (active) => `flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer select-none ${active ? "bg-primary/30 ring-1 ring-primary" : "hover:bg-muted"}`;
|
|
1935
1935
|
var Thumbnail = ({
|
|
@@ -1986,7 +1986,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1986
1986
|
const commitNext = (0, import_react13.useRef)(true);
|
|
1987
1987
|
const state = controller.getState();
|
|
1988
1988
|
const maskView = controller.getMaskView();
|
|
1989
|
-
const rows = (0,
|
|
1989
|
+
const rows = (0, import_image_editor7.layerPanelRows)(state.layers, state.activeLayerId);
|
|
1990
1990
|
const active = controller.getActiveLayer();
|
|
1991
1991
|
const attempt = (fn) => {
|
|
1992
1992
|
try {
|
|
@@ -1998,7 +1998,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1998
1998
|
};
|
|
1999
1999
|
const run = async (action) => {
|
|
2000
2000
|
setMenu(null);
|
|
2001
|
-
setError(await (0,
|
|
2001
|
+
setError(await (0, import_image_editor7.runLayerMenuAction)(controller, action));
|
|
2002
2002
|
};
|
|
2003
2003
|
const prop = (key, value) => attempt(() => {
|
|
2004
2004
|
controller.setLayerProperties(active.id, { [key]: value }, commitNext.current);
|
|
@@ -2016,12 +2016,12 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2016
2016
|
if (!id) return;
|
|
2017
2017
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
2018
2018
|
const fraction = rect.height ? (e.clientY - rect.top) / rect.height : 0.5;
|
|
2019
|
-
const placement = (0,
|
|
2019
|
+
const placement = (0, import_image_editor7.dropPlacement)(state.layers, id, row.layer.id, (0, import_image_editor7.dropZone)(fraction, row.layer.type === "group"));
|
|
2020
2020
|
if (placement) attempt(() => controller.moveLayer(id, placement));
|
|
2021
2021
|
};
|
|
2022
|
-
const thumb = (layer) => (0,
|
|
2022
|
+
const thumb = (layer) => (0, import_image_editor7.layerHasThumbnail)(layer) ? controller.getLayerThumbnail(layer.id, { maxSide: 64 }) : null;
|
|
2023
2023
|
const maskThumb = (layer) => layer.mask && !layer.mask.source ? controller.getLayerThumbnail(layer.id, { maxSide: 64, mask: true }) : null;
|
|
2024
|
-
const vectorThumb = (layer) => layer.vectorMask ? (0,
|
|
2024
|
+
const vectorThumb = (layer) => layer.vectorMask ? (0, import_image_editor7.vectorMaskThumbnail)(layer.vectorMask, state.imageDimensions.width, state.imageDimensions.height, 64) : null;
|
|
2025
2025
|
const locked = (layer) => Boolean(layer.locks?.all || layer.locks?.pixels || layer.locks?.position || layer.locks?.transparency);
|
|
2026
2026
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "layers-panel", onClick: () => menu && setMenu(null), children: [
|
|
2027
2027
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "toolbar", "aria-label": "Layer actions", children: [
|
|
@@ -2053,25 +2053,25 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2053
2053
|
className: "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground",
|
|
2054
2054
|
value: controller.bitDepth,
|
|
2055
2055
|
onChange: (e) => attempt(() => controller.setBitDepth(Number(e.target.value))),
|
|
2056
|
-
children:
|
|
2056
|
+
children: import_image_editor7.BIT_DEPTH_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: o.depth, title: o.title, children: o.label }, o.depth))
|
|
2057
2057
|
}
|
|
2058
2058
|
),
|
|
2059
2059
|
psd && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
2060
2060
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => fileInput.current?.click(), children: "Open PSD\u2026" }),
|
|
2061
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => psdTask(async () => (await (0,
|
|
2061
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => psdTask(async () => (await (0, import_image_editor7.downloadPsd)(controller, psdFileName)).warnings), children: "Export PSD" }),
|
|
2062
2062
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2063
2063
|
"input",
|
|
2064
2064
|
{
|
|
2065
2065
|
ref: fileInput,
|
|
2066
2066
|
type: "file",
|
|
2067
|
-
accept:
|
|
2067
|
+
accept: import_image_editor7.PSD_FILE_ACCEPT,
|
|
2068
2068
|
className: "hidden",
|
|
2069
2069
|
"data-testid": "psd-file-input",
|
|
2070
2070
|
"aria-label": "Open a PSD file",
|
|
2071
2071
|
onChange: (e) => {
|
|
2072
2072
|
const file = e.currentTarget.files?.[0];
|
|
2073
2073
|
e.currentTarget.value = "";
|
|
2074
|
-
if (file) psdTask(() => (0,
|
|
2074
|
+
if (file) psdTask(() => (0, import_image_editor7.openPsdFile)(controller, file));
|
|
2075
2075
|
}
|
|
2076
2076
|
}
|
|
2077
2077
|
)
|
|
@@ -2132,7 +2132,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2132
2132
|
onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { blend: e.target.value })),
|
|
2133
2133
|
children: [
|
|
2134
2134
|
active.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "pass-through", children: "Pass Through" }),
|
|
2135
|
-
|
|
2135
|
+
import_image_editor7.BLEND_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: m.id, children: m.label }, m.id))
|
|
2136
2136
|
]
|
|
2137
2137
|
}
|
|
2138
2138
|
),
|
|
@@ -2226,7 +2226,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2226
2226
|
}
|
|
2227
2227
|
),
|
|
2228
2228
|
row.clipped && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-muted-foreground", "aria-label": "Clipped", children: "\u21B3" }),
|
|
2229
|
-
(0,
|
|
2229
|
+
(0, import_image_editor7.layerHasThumbnail)(layer) ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "relative shrink-0", children: [
|
|
2230
2230
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2231
2231
|
Thumbnail,
|
|
2232
2232
|
{
|
|
@@ -2238,7 +2238,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2238
2238
|
onClick: (e) => {
|
|
2239
2239
|
if (e.ctrlKey || e.metaKey) {
|
|
2240
2240
|
e.stopPropagation();
|
|
2241
|
-
attempt(() => (0,
|
|
2241
|
+
attempt(() => (0, import_image_editor7.layerThumbnailClick)(controller, layer, e));
|
|
2242
2242
|
}
|
|
2243
2243
|
}
|
|
2244
2244
|
}
|
|
@@ -2248,7 +2248,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2248
2248
|
{
|
|
2249
2249
|
"data-testid": "layer-kind-badge",
|
|
2250
2250
|
className: "absolute -bottom-1 -right-1 rounded bg-accent px-0.5 text-[8px] font-bold leading-tight text-foreground ring-1 ring-background",
|
|
2251
|
-
children: (0,
|
|
2251
|
+
children: (0, import_image_editor7.layerBadge)(layer)
|
|
2252
2252
|
}
|
|
2253
2253
|
)
|
|
2254
2254
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
@@ -2256,7 +2256,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2256
2256
|
{
|
|
2257
2257
|
className: "shrink-0 grid place-items-center rounded bg-muted text-[9px] text-muted-foreground ring-1 ring-border",
|
|
2258
2258
|
style: { width: thumbnailSize, height: thumbnailSize },
|
|
2259
|
-
children: (0,
|
|
2259
|
+
children: (0, import_image_editor7.layerBadge)(layer)
|
|
2260
2260
|
}
|
|
2261
2261
|
),
|
|
2262
2262
|
layer.mask && !layer.mask.source && layer.type === "pixel" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
@@ -2286,7 +2286,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2286
2286
|
selected: row.active && state.activeTarget === "mask",
|
|
2287
2287
|
onClick: (e) => {
|
|
2288
2288
|
e.stopPropagation();
|
|
2289
|
-
attempt(() => (0,
|
|
2289
|
+
attempt(() => (0, import_image_editor7.maskThumbnailClick)(controller, layer, e));
|
|
2290
2290
|
}
|
|
2291
2291
|
}
|
|
2292
2292
|
),
|
|
@@ -2300,7 +2300,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2300
2300
|
testId: "layer-vector-mask-thumbnail",
|
|
2301
2301
|
onClick: (e) => {
|
|
2302
2302
|
e.stopPropagation();
|
|
2303
|
-
attempt(() => (0,
|
|
2303
|
+
attempt(() => (0, import_image_editor7.vectorMaskThumbnailClick)(controller, layer, e));
|
|
2304
2304
|
}
|
|
2305
2305
|
}
|
|
2306
2306
|
),
|
|
@@ -2332,18 +2332,18 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2332
2332
|
children: row.label
|
|
2333
2333
|
}
|
|
2334
2334
|
),
|
|
2335
|
-
(0,
|
|
2336
|
-
(0,
|
|
2335
|
+
(0, import_image_editor7.layerWarning)(layer) && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { role: "img", "data-testid": "layer-warning", "aria-label": (0, import_image_editor7.layerWarning)(layer), title: (0, import_image_editor7.layerWarning)(layer), className: "text-[10px] text-amber-600", children: "\u26A0" }),
|
|
2336
|
+
(0, import_image_editor7.layerEffectsBadge)(layer) && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2337
2337
|
"button",
|
|
2338
2338
|
{
|
|
2339
2339
|
type: "button",
|
|
2340
2340
|
"data-testid": "layer-fx-badge",
|
|
2341
|
-
"aria-label": (0,
|
|
2342
|
-
"aria-pressed": (0,
|
|
2343
|
-
className: `text-[9px] italic font-semibold ${(0,
|
|
2341
|
+
"aria-label": (0, import_image_editor7.layerEffectsBadge)(layer) === "on" ? `Turn effects off for ${row.label}` : `Turn effects on for ${row.label}`,
|
|
2342
|
+
"aria-pressed": (0, import_image_editor7.layerEffectsBadge)(layer) === "on",
|
|
2343
|
+
className: `text-[9px] italic font-semibold ${(0, import_image_editor7.layerEffectsBadge)(layer) === "on" ? "text-primary" : "text-muted-foreground/70 line-through"}`,
|
|
2344
2344
|
onClick: (e) => {
|
|
2345
2345
|
e.stopPropagation();
|
|
2346
|
-
attempt(() => controller.setLayerEffectsEnabled(layer.id, (0,
|
|
2346
|
+
attempt(() => controller.setLayerEffectsEnabled(layer.id, (0, import_image_editor7.layerEffectsBadge)(layer) !== "on"));
|
|
2347
2347
|
},
|
|
2348
2348
|
children: "fx"
|
|
2349
2349
|
}
|
|
@@ -2365,7 +2365,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2365
2365
|
style: { left: menu.x, top: menu.y },
|
|
2366
2366
|
onClick: (e) => e.stopPropagation(),
|
|
2367
2367
|
onKeyDown: (e) => e.key === "Escape" && setMenu(null),
|
|
2368
|
-
children: (0,
|
|
2368
|
+
children: (0, import_image_editor7.layerMenu)(controller).map((item) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2369
2369
|
"button",
|
|
2370
2370
|
{
|
|
2371
2371
|
type: "button",
|
|
@@ -2384,7 +2384,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2384
2384
|
|
|
2385
2385
|
// src/image-editor/ImageProviderEffectsPanel.tsx
|
|
2386
2386
|
var import_react23 = require("react");
|
|
2387
|
-
var
|
|
2387
|
+
var import_image_editor8 = require("@pixerate/editor/image-editor");
|
|
2388
2388
|
|
|
2389
2389
|
// src/effects/useEffects.ts
|
|
2390
2390
|
var import_react14 = require("react");
|
|
@@ -4240,7 +4240,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
4240
4240
|
const [scrubbed, setScrubbed] = (0, import_react23.useState)(null);
|
|
4241
4241
|
const provider = controller.effectsProvider;
|
|
4242
4242
|
const state = controller.getState();
|
|
4243
|
-
const layer = state.activeLayerId ? (0,
|
|
4243
|
+
const layer = state.activeLayerId ? (0, import_image_editor8.findLayer)(state.layers, state.activeLayerId)?.layer ?? null : null;
|
|
4244
4244
|
const run = (work) => {
|
|
4245
4245
|
setMessage(null);
|
|
4246
4246
|
Promise.resolve().then(work).catch((e) => setMessage(e instanceof Error ? e.message : String(e)));
|
|
@@ -4260,7 +4260,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
4260
4260
|
const generator = layer?.type === "pixel" ? layer.generator : void 0;
|
|
4261
4261
|
const canFilter = !!provider && !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
|
|
4262
4262
|
const { description } = useEffectDescription(provider, generator?.effect);
|
|
4263
|
-
const timing = generator ? (0,
|
|
4263
|
+
const timing = generator ? (0, import_image_editor8.effectLayerTiming)(generator, description) : null;
|
|
4264
4264
|
const scrub = (0, import_react23.useRef)({ next: null, busy: false, gesture: null });
|
|
4265
4265
|
const scrubTo = (layerId, time) => {
|
|
4266
4266
|
const s = scrub.current;
|
|
@@ -4288,7 +4288,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
4288
4288
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider, "aria-pressed": browse === "change", onClick: () => setBrowse(browse === "change" ? null : "change"), children: "Change\u2026" }),
|
|
4289
4289
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: imageOutlineButtonClass, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
|
|
4290
4290
|
] }),
|
|
4291
|
-
browse === "change" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EffectsBrowser, { provider, uses:
|
|
4291
|
+
browse === "change" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EffectsBrowser, { provider, uses: import_image_editor8.EFFECT_LAYER_USES, title: "Change the effect to", onPick: (e) => (setBrowse(null), run(() => controller.updateEffectLayer(layer.id, { effect: e.id }))) }),
|
|
4292
4292
|
timing && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "space-y-1.5 rounded border border-border p-1.5", "data-effect-part": "timing", role: "group", "aria-label": "Frames", children: [
|
|
4293
4293
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex gap-1", role: "radiogroup", "aria-label": "Output", children: [
|
|
4294
4294
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
@@ -4447,7 +4447,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
4447
4447
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ImageCheckbox, { checked: clip, label: "Clip to layer below", onChange: setClip }),
|
|
4448
4448
|
"Clip to layer below"
|
|
4449
4449
|
] }),
|
|
4450
|
-
browse === "layer" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EffectsBrowser, { provider, uses:
|
|
4450
|
+
browse === "layer" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EffectsBrowser, { provider, uses: import_image_editor8.EFFECT_LAYER_USES, title: "Add an effect layer", onPick: (e) => (setBrowse(null), run(() => controller.addEffectLayer(e.id, { clipped: clip }))) })
|
|
4451
4451
|
] }),
|
|
4452
4452
|
!layer && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
|
|
4453
4453
|
message && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
@@ -4456,11 +4456,11 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
4456
4456
|
|
|
4457
4457
|
// src/image-editor/BrushOptionsBar.tsx
|
|
4458
4458
|
var import_react25 = require("react");
|
|
4459
|
+
var import_image_editor10 = require("@pixerate/editor/image-editor");
|
|
4459
4460
|
var import_image_editor11 = require("@pixerate/editor/image-editor");
|
|
4460
|
-
var import_image_editor12 = require("@pixerate/editor/image-editor");
|
|
4461
4461
|
|
|
4462
4462
|
// src/image-editor/PaintGradientEditor.tsx
|
|
4463
|
-
var
|
|
4463
|
+
var import_image_editor9 = require("@pixerate/editor/image-editor");
|
|
4464
4464
|
|
|
4465
4465
|
// src/paint-editor/PaintGradientEditorView.tsx
|
|
4466
4466
|
var import_react24 = require("react");
|
|
@@ -4586,7 +4586,7 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
|
|
|
4586
4586
|
|
|
4587
4587
|
// src/image-editor/PaintGradientEditor.tsx
|
|
4588
4588
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4589
|
-
var PaintGradientEditor = (props) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PaintGradientEditorView, { ...props, kit:
|
|
4589
|
+
var PaintGradientEditor = (props) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PaintGradientEditorView, { ...props, kit: import_image_editor9.PAINT_GRADIENT_KIT });
|
|
4590
4590
|
|
|
4591
4591
|
// src/image-editor/BrushOptionsBar.tsx
|
|
4592
4592
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
@@ -4602,11 +4602,11 @@ var BrushOptionsBar = ({ controller, showTools = true, className }) => {
|
|
|
4602
4602
|
setError(null);
|
|
4603
4603
|
fn();
|
|
4604
4604
|
} catch (err) {
|
|
4605
|
-
setError((0,
|
|
4605
|
+
setError((0, import_image_editor11.userErrorMessage)(err));
|
|
4606
4606
|
}
|
|
4607
4607
|
};
|
|
4608
4608
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "brush-options", children: [
|
|
4609
|
-
showTools && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children:
|
|
4609
|
+
showTools && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: import_image_editor10.PAINT_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4610
4610
|
"button",
|
|
4611
4611
|
{
|
|
4612
4612
|
type: "button",
|
|
@@ -4636,13 +4636,13 @@ var BrushOptionsBar = ({ controller, showTools = true, className }) => {
|
|
|
4636
4636
|
"aria-pressed": paint.type === "gradient",
|
|
4637
4637
|
title: "Gradient paint: the brush changes colour as the stroke goes",
|
|
4638
4638
|
className: imageChipClass(paint.type === "gradient"),
|
|
4639
|
-
onClick: () => attempt(() => controller.setPaintOptions(paint.type === "gradient" ? { foreground } : { paint:
|
|
4639
|
+
onClick: () => attempt(() => controller.setPaintOptions(paint.type === "gradient" ? { foreground } : { paint: import_image_editor11.DEFAULT_PAINT_GRADIENT })),
|
|
4640
4640
|
children: "Gradient"
|
|
4641
4641
|
}
|
|
4642
4642
|
)
|
|
4643
4643
|
] }),
|
|
4644
4644
|
state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(PaintGradientEditor, { value: paint, colors: { paint: foreground, secondary: background }, onChange: (g) => attempt(() => controller.setPaintOptions({ paint: g })) }),
|
|
4645
|
-
|
|
4645
|
+
import_image_editor10.BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4646
4646
|
ControlSlider,
|
|
4647
4647
|
{
|
|
4648
4648
|
spec,
|
|
@@ -4657,15 +4657,15 @@ var BrushOptionsBar = ({ controller, showTools = true, className }) => {
|
|
|
4657
4657
|
"span",
|
|
4658
4658
|
{
|
|
4659
4659
|
"aria-label": "Brush load",
|
|
4660
|
-
title: mixerLoad.reservoir ? `Loaded ${(0,
|
|
4660
|
+
title: mixerLoad.reservoir ? `Loaded ${(0, import_image_editor10.rgbUnitToHex)(mixerLoad.reservoir)}, ${Math.round(mixerLoad.amount * 100)}% left` : "Unloaded",
|
|
4661
4661
|
className: "h-6 w-6 rounded border border-border",
|
|
4662
|
-
style: { background: mixerLoad.reservoir ? (0,
|
|
4662
|
+
style: { background: mixerLoad.reservoir ? (0, import_image_editor10.rgbUnitToHex)(mixerLoad.reservoir) : "transparent" }
|
|
4663
4663
|
}
|
|
4664
4664
|
),
|
|
4665
4665
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", title: "Fill the reservoir with the foreground colour", className: imageChipClass(false), onClick: () => controller.loadMixerBrush(), children: "Load brush" }),
|
|
4666
4666
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", title: "Empty the picked-up colour", className: imageChipClass(false), onClick: () => controller.cleanMixerBrush(), children: "Clean brush" })
|
|
4667
4667
|
] }),
|
|
4668
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children:
|
|
4668
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children: import_image_editor10.MIXER_MIXING_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4669
4669
|
"button",
|
|
4670
4670
|
{
|
|
4671
4671
|
type: "button",
|
|
@@ -4677,7 +4677,7 @@ var BrushOptionsBar = ({ controller, showTools = true, className }) => {
|
|
|
4677
4677
|
},
|
|
4678
4678
|
m.id
|
|
4679
4679
|
)) }),
|
|
4680
|
-
|
|
4680
|
+
import_image_editor10.MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ControlSlider, { spec, value: mixer[spec.id], onChange: (v) => controller.setPaintOptions({ mixer: { [spec.id]: v } }) }, spec.id)),
|
|
4681
4681
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap gap-3 text-foreground", children: [
|
|
4682
4682
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
4683
4683
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "Load the brush after each stroke", checked: mixer.loadEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { loadEachStroke: on } }) }),
|
|
@@ -4689,20 +4689,20 @@ var BrushOptionsBar = ({ controller, showTools = true, className }) => {
|
|
|
4689
4689
|
] })
|
|
4690
4690
|
] })
|
|
4691
4691
|
] }),
|
|
4692
|
-
(0,
|
|
4692
|
+
(0, import_image_editor10.isRetouchPaintTool)(tool) && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Retouch options", "data-testid": "retouch-options", children: [
|
|
4693
4693
|
(tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4694
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", "data-testid": "clone-source", children: (0,
|
|
4694
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", "data-testid": "clone-source", children: (0, import_image_editor10.cloneSourceLabel)(controller) }),
|
|
4695
4695
|
cloneSource && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", title: "Forget the source point", className: imageChipClass(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
|
|
4696
4696
|
] }),
|
|
4697
4697
|
(tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col gap-1", role: "group", "aria-label": "Clone source transform", "data-testid": "clone-transform", children: [
|
|
4698
|
-
|
|
4698
|
+
import_image_editor10.CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ControlSlider, { spec, value: (0, import_image_editor10.cloneTransformView)(controller)[spec.id], onChange: (v) => (0, import_image_editor10.setCloneTransformValue)(controller, spec.id, v) }, spec.id)),
|
|
4699
4699
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
4700
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", "aria-pressed": (0,
|
|
4701
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", "aria-pressed": (0,
|
|
4702
|
-
!(0,
|
|
4700
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor10.cloneTransformView)(controller).flipH, title: "Mirror the source left to right", className: imageChipClass((0, import_image_editor10.cloneTransformView)(controller).flipH), onClick: () => (0, import_image_editor10.setCloneTransformValue)(controller, "flipH"), children: "Flip H" }),
|
|
4701
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor10.cloneTransformView)(controller).flipV, title: "Mirror the source top to bottom", className: imageChipClass((0, import_image_editor10.cloneTransformView)(controller).flipV), onClick: () => (0, import_image_editor10.setCloneTransformValue)(controller, "flipV"), children: "Flip V" }),
|
|
4702
|
+
!(0, import_image_editor10.cloneTransformView)(controller).identity && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className: imageChipClass(false), onClick: () => controller.setCloneTransform(null), children: "Reset transform" })
|
|
4703
4703
|
] })
|
|
4704
4704
|
] }),
|
|
4705
|
-
|
|
4705
|
+
import_image_editor10.RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": choice.label, children: [
|
|
4706
4706
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", children: choice.label }),
|
|
4707
4707
|
choice.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4708
4708
|
"button",
|
|
@@ -4711,14 +4711,14 @@ var BrushOptionsBar = ({ controller, showTools = true, className }) => {
|
|
|
4711
4711
|
"aria-pressed": retouch[choice.id] === o.id,
|
|
4712
4712
|
title: o.title,
|
|
4713
4713
|
className: imageChipClass(retouch[choice.id] === o.id),
|
|
4714
|
-
onClick: () => (0,
|
|
4714
|
+
onClick: () => (0, import_image_editor10.setRetouchChoice)(controller, choice.id, o.id),
|
|
4715
4715
|
children: o.label
|
|
4716
4716
|
},
|
|
4717
4717
|
o.id
|
|
4718
4718
|
))
|
|
4719
4719
|
] }, choice.id)),
|
|
4720
|
-
|
|
4721
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex flex-wrap gap-3 text-foreground", children:
|
|
4720
|
+
import_image_editor10.RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ControlSlider, { spec, value: retouch[spec.id], onChange: (v) => controller.setPaintOptions({ retouch: { [spec.id]: v } }) }, spec.id)),
|
|
4721
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex flex-wrap gap-3 text-foreground", children: import_image_editor10.RETOUCH_TOGGLES.filter((t) => t.tools.includes(tool)).map((t) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
4722
4722
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: t.label, checked: retouch[t.id], onChange: (on) => controller.setPaintOptions({ retouch: { [t.id]: on } }) }),
|
|
4723
4723
|
t.label
|
|
4724
4724
|
] }, t.id)) })
|
|
@@ -4743,7 +4743,7 @@ var BrushOptionsBar = ({ controller, showTools = true, className }) => {
|
|
|
4743
4743
|
|
|
4744
4744
|
// src/image-editor/ColorProfilePanel.tsx
|
|
4745
4745
|
var import_react26 = require("react");
|
|
4746
|
-
var
|
|
4746
|
+
var import_image_editor12 = require("@pixerate/editor/image-editor");
|
|
4747
4747
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4748
4748
|
var chip = imageChipClass(false);
|
|
4749
4749
|
var select2 = "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground";
|
|
@@ -4754,7 +4754,7 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
4754
4754
|
const [intent, setIntent] = (0, import_react26.useState)("relative");
|
|
4755
4755
|
const [bpc, setBpc] = (0, import_react26.useState)(true);
|
|
4756
4756
|
const [error, setError] = (0, import_react26.useState)(null);
|
|
4757
|
-
const view = (0,
|
|
4757
|
+
const view = (0, import_image_editor12.colorPanelView)(controller);
|
|
4758
4758
|
const attempt = (fn) => {
|
|
4759
4759
|
try {
|
|
4760
4760
|
setError(null);
|
|
@@ -4782,12 +4782,12 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
4782
4782
|
] }),
|
|
4783
4783
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Colour mode", children: [
|
|
4784
4784
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-muted-foreground", children: "Mode" }),
|
|
4785
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("select", { "aria-label": "Colour mode", className: select2, value: view.mode, onChange: (e) => attempt(() => controller.setColorMode(e.target.value)), children:
|
|
4785
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("select", { "aria-label": "Colour mode", className: select2, value: view.mode, onChange: (e) => attempt(() => controller.setColorMode(e.target.value)), children: import_image_editor12.COLOR_MODE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
|
|
4786
4786
|
view.cmykProfileName && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-muted-foreground", children: view.cmykProfileName })
|
|
4787
4787
|
] }),
|
|
4788
4788
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
|
|
4789
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("select", { "aria-label": "Target profile", className: select2, value: target, onChange: (e) => setTarget(e.target.value), children:
|
|
4790
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("select", { "aria-label": "Rendering intent", className: select2, value: intent, onChange: (e) => setIntent(e.target.value), children:
|
|
4789
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("select", { "aria-label": "Target profile", className: select2, value: target, onChange: (e) => setTarget(e.target.value), children: import_image_editor12.WORKING_SPACE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
|
|
4790
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("select", { "aria-label": "Rendering intent", className: select2, value: intent, onChange: (e) => setIntent(e.target.value), children: import_image_editor12.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
|
|
4791
4791
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4792
4792
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-primary" }),
|
|
4793
4793
|
"BPC"
|
|
@@ -4806,12 +4806,12 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
4806
4806
|
onChange: (e) => e.target.value ? proofWith({ id: e.target.value }) : attempt(() => controller.setProofSetup(null)),
|
|
4807
4807
|
children: [
|
|
4808
4808
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: "", children: "Off" }),
|
|
4809
|
-
|
|
4809
|
+
import_image_editor12.PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: o.id, children: o.label }, o.id))
|
|
4810
4810
|
]
|
|
4811
4811
|
}
|
|
4812
4812
|
),
|
|
4813
4813
|
view.proof && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
4814
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("select", { "aria-label": "Proof intent", className: select2, value: view.proof.intent, onChange: (e) => proofWith({ intent: e.target.value }), children:
|
|
4814
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("select", { "aria-label": "Proof intent", className: select2, value: view.proof.intent, onChange: (e) => proofWith({ intent: e.target.value }), children: import_image_editor12.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
|
|
4815
4815
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4816
4816
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-primary" }),
|
|
4817
4817
|
"Paper"
|
|
@@ -4831,7 +4831,7 @@ var import_react30 = require("react");
|
|
|
4831
4831
|
|
|
4832
4832
|
// src/image-editor/SelectionRecipePanel.tsx
|
|
4833
4833
|
var import_react27 = require("react");
|
|
4834
|
-
var
|
|
4834
|
+
var import_image_editor13 = require("@pixerate/editor/image-editor");
|
|
4835
4835
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4836
4836
|
var MODES2 = ["replace", "add", "subtract", "intersect"];
|
|
4837
4837
|
var button2 = "px-1.5 py-0.5 rounded border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
|
|
@@ -4849,10 +4849,10 @@ var SelectionRecipePanel = ({ controller, className = "" }) => {
|
|
|
4849
4849
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: button2, title: "Keep the selection, drop its steps", onClick: () => run(controller.freezeSelection()), children: "Freeze" })
|
|
4850
4850
|
] }),
|
|
4851
4851
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("ol", { className: "flex flex-col gap-1", children: recipe.steps.map((step) => {
|
|
4852
|
-
const setting = (0,
|
|
4852
|
+
const setting = (0, import_image_editor13.recipeStepSetting)(step);
|
|
4853
4853
|
const shape = "mode" in step || ["rect", "ellipse", "polygon", "magic-wand", "color-range", "color-range-preset"].includes(step.op);
|
|
4854
4854
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("li", { "data-testid": "selection-step", className: "flex flex-wrap items-center gap-1", children: [
|
|
4855
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "flex-1 min-w-0 truncate text-foreground", children: (0,
|
|
4855
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "flex-1 min-w-0 truncate text-foreground", children: (0, import_image_editor13.describeRecipeStep)(step) }),
|
|
4856
4856
|
shape && step.index > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4857
4857
|
"select",
|
|
4858
4858
|
{
|
|
@@ -4887,16 +4887,16 @@ var SelectionRecipePanel = ({ controller, className = "" }) => {
|
|
|
4887
4887
|
};
|
|
4888
4888
|
|
|
4889
4889
|
// src/image-editor/SelectionOptionsBar.tsx
|
|
4890
|
-
var
|
|
4890
|
+
var import_image_editor16 = require("@pixerate/editor/image-editor");
|
|
4891
4891
|
|
|
4892
4892
|
// src/image-editor/SelectAndMaskWorkspace.tsx
|
|
4893
4893
|
var import_react28 = require("react");
|
|
4894
|
-
var
|
|
4894
|
+
var import_image_editor14 = require("@pixerate/editor/image-editor");
|
|
4895
4895
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4896
4896
|
var button3 = "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";
|
|
4897
4897
|
var toggle = (on) => `${button3} ${on ? "bg-primary text-primary-foreground border-primary" : ""}`;
|
|
4898
4898
|
var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
4899
|
-
const session = (0, import_react28.useMemo)(() => new
|
|
4899
|
+
const session = (0, import_react28.useMemo)(() => new import_image_editor14.SelectAndMaskSession(controller), [controller]);
|
|
4900
4900
|
const [, setRevision] = (0, import_react28.useState)(0);
|
|
4901
4901
|
const [zoom, setZoom] = (0, import_react28.useState)(1);
|
|
4902
4902
|
const [pan, setPan] = (0, import_react28.useState)({ x: 0, y: 0 });
|
|
@@ -4985,7 +4985,7 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
4985
4985
|
"aria-label": "Select and Mask",
|
|
4986
4986
|
className: `fixed inset-0 z-50 flex bg-background text-xs text-foreground ${className}`,
|
|
4987
4987
|
children: [
|
|
4988
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { role: "group", "aria-label": "Select and Mask tool", className: "flex flex-col gap-1 p-2 border-r border-border", children:
|
|
4988
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { role: "group", "aria-label": "Select and Mask tool", className: "flex flex-col gap-1 p-2 border-r border-border", children: import_image_editor14.SELECT_AND_MASK_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", title: `${t.label} (${t.key.toUpperCase()})`, "aria-pressed": settings.tool === t.id, className: toggle(settings.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
|
|
4989
4989
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex-1 flex flex-col min-w-0", children: [
|
|
4990
4990
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
|
|
4991
4991
|
brushTool && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
@@ -5046,7 +5046,7 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5046
5046
|
{
|
|
5047
5047
|
label: "View",
|
|
5048
5048
|
value: settings.view,
|
|
5049
|
-
options:
|
|
5049
|
+
options: import_image_editor14.SELECT_AND_MASK_VIEWS.map((v) => ({ value: v.id, label: `${v.label} (${v.key.toUpperCase()})` })),
|
|
5050
5050
|
onChange: (v) => set({ view: v })
|
|
5051
5051
|
}
|
|
5052
5052
|
)
|
|
@@ -5093,7 +5093,7 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5093
5093
|
}
|
|
5094
5094
|
)
|
|
5095
5095
|
] }),
|
|
5096
|
-
|
|
5096
|
+
import_image_editor14.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5097
5097
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5098
5098
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: c.label }),
|
|
5099
5099
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-mono", children: [
|
|
@@ -5128,7 +5128,7 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5128
5128
|
{
|
|
5129
5129
|
label: "Output to",
|
|
5130
5130
|
value: settings.output,
|
|
5131
|
-
options:
|
|
5131
|
+
options: import_image_editor14.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => ({ value: o.id, label: o.label })),
|
|
5132
5132
|
onChange: (v) => set({ output: v })
|
|
5133
5133
|
}
|
|
5134
5134
|
)
|
|
@@ -5152,12 +5152,12 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5152
5152
|
|
|
5153
5153
|
// src/image-editor/ContentAwareFillWorkspace.tsx
|
|
5154
5154
|
var import_react29 = require("react");
|
|
5155
|
-
var
|
|
5155
|
+
var import_image_editor15 = require("@pixerate/editor/image-editor");
|
|
5156
5156
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5157
5157
|
var button4 = "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";
|
|
5158
5158
|
var toggle2 = (on) => `${button4} ${on ? "bg-primary text-primary-foreground border-primary" : ""}`;
|
|
5159
5159
|
var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
5160
|
-
const session = (0, import_react29.useMemo)(() => new
|
|
5160
|
+
const session = (0, import_react29.useMemo)(() => new import_image_editor15.ContentAwareFillSession(controller), [controller]);
|
|
5161
5161
|
const [, setRevision] = (0, import_react29.useState)(0);
|
|
5162
5162
|
const [zoom, setZoom] = (0, import_react29.useState)(1);
|
|
5163
5163
|
const [pan, setPan] = (0, import_react29.useState)({ x: 0, y: 0 });
|
|
@@ -5242,7 +5242,7 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5242
5242
|
};
|
|
5243
5243
|
const view = { maxWidth: "100%", maxHeight: "100%", transform: `translate(${pan.x}px, ${pan.y}px) scale(${zoom})`, imageRendering: zoom > 2 ? "pixelated" : void 0 };
|
|
5244
5244
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { "data-testid": "content-aware-fill-workspace", role: "dialog", "aria-label": "Content-Aware Fill", className: `fixed inset-0 z-50 flex bg-background text-xs text-foreground ${className}`, children: [
|
|
5245
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { role: "group", "aria-label": "Content-Aware Fill tool", className: "flex flex-col gap-1 p-2 border-r border-border", children:
|
|
5245
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { role: "group", "aria-label": "Content-Aware Fill tool", className: "flex flex-col gap-1 p-2 border-r border-border", children: import_image_editor15.CONTENT_AWARE_FILL_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", title: `${t.label} (${t.key.toUpperCase()})`, "aria-pressed": settings.tool === t.id, className: toggle2(settings.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
|
|
5246
5246
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex-1 flex flex-col min-w-0", children: [
|
|
5247
5247
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
|
|
5248
5248
|
settings.tool === "sampling-brush" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
@@ -5296,7 +5296,7 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5296
5296
|
] }),
|
|
5297
5297
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "w-64 flex flex-col gap-3 p-3 border-l border-border overflow-y-auto", children: [
|
|
5298
5298
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: imageSectionTitleClass, children: "Sampling Area Options" }),
|
|
5299
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { role: "group", "aria-label": "Sampling area", className: "flex gap-1", children:
|
|
5299
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { role: "group", "aria-label": "Sampling area", className: "flex gap-1", children: import_image_editor15.CONTENT_AWARE_FILL_SAMPLING.map((m) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", "aria-pressed": settings.sampling === m.id, className: toggle2(settings.sampling === m.id), onClick: () => set({ sampling: m.id }), children: m.label }, m.id)) }),
|
|
5300
5300
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
5301
5301
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageCheckbox, { label: "Show Sampling Area", checked: settings.showSampling, onChange: (on) => set({ showSampling: on }) }),
|
|
5302
5302
|
"Show Sampling Area"
|
|
@@ -5499,8 +5499,8 @@ var SelectionOptionsBar = ({
|
|
|
5499
5499
|
}
|
|
5500
5500
|
};
|
|
5501
5501
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
5502
|
-
showTools && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children:
|
|
5503
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children:
|
|
5502
|
+
showTools && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor16.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
|
|
5503
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: import_image_editor16.SELECTION_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: import_image_editor16.SELECTION_MODE_LABELS[m] }, m)) }),
|
|
5504
5504
|
options.tool === "wand" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
5505
5505
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5506
5506
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
@@ -5694,7 +5694,7 @@ var SelectionOptionsBar = ({
|
|
|
5694
5694
|
{
|
|
5695
5695
|
label: "Color Range preset",
|
|
5696
5696
|
value: preset,
|
|
5697
|
-
options:
|
|
5697
|
+
options: import_image_editor16.COLOR_RANGE_PRESETS.map((p) => ({ value: p, label: import_image_editor16.COLOR_RANGE_PRESET_LABELS[p] })),
|
|
5698
5698
|
onChange: (v) => setPreset(v)
|
|
5699
5699
|
}
|
|
5700
5700
|
),
|
|
@@ -5893,18 +5893,18 @@ var SelectionOptionsBar = ({
|
|
|
5893
5893
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("outside")), children: "Paste Outside" })
|
|
5894
5894
|
] }),
|
|
5895
5895
|
colorStatus && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "status", className: "text-muted-foreground", children: colorStatus }),
|
|
5896
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: (0,
|
|
5896
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: (0, import_image_editor16.describeSelection)(sel) }),
|
|
5897
5897
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(SelectionRecipePanel, { controller, selection: sel })
|
|
5898
5898
|
] });
|
|
5899
5899
|
};
|
|
5900
5900
|
|
|
5901
5901
|
// src/image-editor/RefineEdgePanel.tsx
|
|
5902
5902
|
var import_react34 = require("react");
|
|
5903
|
-
var
|
|
5903
|
+
var import_image_editor18 = require("@pixerate/editor/image-editor");
|
|
5904
5904
|
|
|
5905
5905
|
// src/image-editor/MaskEdgeCheck.tsx
|
|
5906
5906
|
var import_react31 = __toESM(require("react"), 1);
|
|
5907
|
-
var
|
|
5907
|
+
var import_image_editor17 = require("@pixerate/editor/image-editor");
|
|
5908
5908
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5909
5909
|
var button5 = "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";
|
|
5910
5910
|
var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, className = "" }) => {
|
|
@@ -5921,7 +5921,7 @@ var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, cla
|
|
|
5921
5921
|
setError(err instanceof Error ? err.message : String(err));
|
|
5922
5922
|
}
|
|
5923
5923
|
};
|
|
5924
|
-
const T =
|
|
5924
|
+
const T = import_image_editor17.MASK_EDGE_THRESHOLDS;
|
|
5925
5925
|
const rows = report ? [
|
|
5926
5926
|
{ label: "Halo", value: report.haloScore, bad: report.haloScore >= T.halo },
|
|
5927
5927
|
{ label: "Edge alignment", value: report.edgeAlignment, bad: report.edgeAlignment < T.alignment },
|
|
@@ -6090,7 +6090,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
6090
6090
|
};
|
|
6091
6091
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
6092
6092
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
|
|
6093
|
-
|
|
6093
|
+
import_image_editor18.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
6094
6094
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
6095
6095
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: c.label }),
|
|
6096
6096
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "font-mono", children: [
|
|
@@ -6133,7 +6133,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
6133
6133
|
value: output,
|
|
6134
6134
|
onChange: (e) => setOutput(e.target.value),
|
|
6135
6135
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
6136
|
-
children:
|
|
6136
|
+
children: import_image_editor18.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: o.id, children: o.label }, o.id))
|
|
6137
6137
|
}
|
|
6138
6138
|
)
|
|
6139
6139
|
] }),
|
|
@@ -6180,7 +6180,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
6180
6180
|
value: newKind,
|
|
6181
6181
|
onChange: (e) => setNewKind(e.target.value),
|
|
6182
6182
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
6183
|
-
children:
|
|
6183
|
+
children: import_image_editor18.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: k.kind, children: k.label }, k.kind))
|
|
6184
6184
|
}
|
|
6185
6185
|
),
|
|
6186
6186
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
@@ -6189,7 +6189,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
6189
6189
|
type: "button",
|
|
6190
6190
|
className: button8,
|
|
6191
6191
|
disabled: !sel,
|
|
6192
|
-
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0,
|
|
6192
|
+
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0, import_image_editor18.layerMaskFromSelection)(sel) })),
|
|
6193
6193
|
children: "New Masked Layer"
|
|
6194
6194
|
}
|
|
6195
6195
|
)
|
|
@@ -6203,7 +6203,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
6203
6203
|
onChange: (e) => setLayerId(e.target.value),
|
|
6204
6204
|
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
6205
6205
|
children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("option", { value: l.id, children: [
|
|
6206
|
-
l.name || (0,
|
|
6206
|
+
l.name || (0, import_image_editor18.adjustmentKindLabel)(l.kind),
|
|
6207
6207
|
l.mask ? " (masked)" : ""
|
|
6208
6208
|
] }, l.id))
|
|
6209
6209
|
}
|
|
@@ -6265,7 +6265,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
6265
6265
|
|
|
6266
6266
|
// src/image-editor/ChannelsPanel.tsx
|
|
6267
6267
|
var import_react35 = require("react");
|
|
6268
|
-
var
|
|
6268
|
+
var import_image_editor19 = require("@pixerate/editor/image-editor");
|
|
6269
6269
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
6270
6270
|
var btn2 = (on = false) => `px-2 py-1 rounded-md border text-[11px] transition-colors disabled:opacity-40 ${on ? "bg-primary border-primary text-primary-foreground" : "bg-background border-border text-foreground hover:bg-accent hover:text-accent-foreground"}`;
|
|
6271
6271
|
var ChannelThumb = ({ channel, size }) => {
|
|
@@ -6274,7 +6274,7 @@ var ChannelThumb = ({ channel, size }) => {
|
|
|
6274
6274
|
const canvas = ref.current;
|
|
6275
6275
|
const ctx = canvas?.getContext("2d");
|
|
6276
6276
|
if (!canvas || !ctx || typeof ctx.createImageData !== "function") return;
|
|
6277
|
-
const px = (0,
|
|
6277
|
+
const px = (0, import_image_editor19.channelThumbnail)(channel, 64);
|
|
6278
6278
|
canvas.width = px.width;
|
|
6279
6279
|
canvas.height = px.height;
|
|
6280
6280
|
const img = ctx.createImageData(px.width, px.height);
|
|
@@ -6306,7 +6306,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6306
6306
|
if (!file) return;
|
|
6307
6307
|
setError(null);
|
|
6308
6308
|
try {
|
|
6309
|
-
setActiveId((await (0,
|
|
6309
|
+
setActiveId((await (0, import_image_editor19.openMaskFile)(controller, file)).id);
|
|
6310
6310
|
} catch (err) {
|
|
6311
6311
|
setError(err instanceof Error ? err.message : String(err));
|
|
6312
6312
|
}
|
|
@@ -6325,7 +6325,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6325
6325
|
className: `flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer select-none ${c.id === activeId ? "bg-primary/30 ring-1 ring-primary" : "hover:bg-muted"}`,
|
|
6326
6326
|
onClick: (e) => {
|
|
6327
6327
|
setActiveId(c.id);
|
|
6328
|
-
attempt(() => controller.loadSelectionFromChannel(c.id, { mode: (0,
|
|
6328
|
+
attempt(() => controller.loadSelectionFromChannel(c.id, { mode: (0, import_image_editor19.selectionModeFromModifiers)(e, "replace") }));
|
|
6329
6329
|
},
|
|
6330
6330
|
onDoubleClick: () => setRenaming(c.id),
|
|
6331
6331
|
children: [
|
|
@@ -6391,7 +6391,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6391
6391
|
className: btn2(),
|
|
6392
6392
|
disabled: !active && !hasSelection,
|
|
6393
6393
|
title: active ? "Save the channel as a greyscale PNG" : "Save the selection as a greyscale PNG",
|
|
6394
|
-
onClick: () => attempt(() => (0,
|
|
6394
|
+
onClick: () => attempt(() => (0, import_image_editor19.downloadMaskImage)(controller, active ? { channelId: active.id } : "selection", active?.name ?? "selection")),
|
|
6395
6395
|
children: "Export PNG"
|
|
6396
6396
|
}
|
|
6397
6397
|
),
|
|
@@ -6400,7 +6400,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6400
6400
|
{
|
|
6401
6401
|
ref: fileInput,
|
|
6402
6402
|
type: "file",
|
|
6403
|
-
accept:
|
|
6403
|
+
accept: import_image_editor19.MASK_FILE_ACCEPT,
|
|
6404
6404
|
hidden: true,
|
|
6405
6405
|
"data-testid": "channel-import-input",
|
|
6406
6406
|
onChange: (e) => {
|
|
@@ -6416,7 +6416,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6416
6416
|
|
|
6417
6417
|
// src/image-editor/PathsPanel.tsx
|
|
6418
6418
|
var import_react36 = require("react");
|
|
6419
|
-
var
|
|
6419
|
+
var import_image_editor20 = require("@pixerate/editor/image-editor");
|
|
6420
6420
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
6421
6421
|
var btn3 = (on = false) => `px-2 py-1 rounded-md border text-[11px] transition-colors disabled:opacity-40 ${on ? "bg-primary border-primary text-primary-foreground" : "bg-background border-border text-foreground hover:bg-accent hover:text-accent-foreground"}`;
|
|
6422
6422
|
var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
@@ -6453,7 +6453,7 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6453
6453
|
onClick: () => attempt(() => controller.setActivePath(p.id)),
|
|
6454
6454
|
onDoubleClick: () => setRenaming(p.id),
|
|
6455
6455
|
children: [
|
|
6456
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("svg", { "aria-hidden": "true", viewBox: `0 0 ${w || 1} ${h || 1}`, style: { width: thumbnailSize, height: thumbnailSize }, className: "shrink-0 rounded ring-1 ring-border bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("path", { d: (0,
|
|
6456
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("svg", { "aria-hidden": "true", viewBox: `0 0 ${w || 1} ${h || 1}`, style: { width: thumbnailSize, height: thumbnailSize }, className: "shrink-0 rounded ring-1 ring-border bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("path", { d: (0, import_image_editor20.pathSvgData)(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
|
|
6457
6457
|
renaming === p.id ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6458
6458
|
"input",
|
|
6459
6459
|
{
|
|
@@ -6486,7 +6486,7 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6486
6486
|
className: btn3(),
|
|
6487
6487
|
disabled: !active,
|
|
6488
6488
|
title: "Load the path as the selection (Shift adds, Alt subtracts)",
|
|
6489
|
-
onClick: (e) => attempt(() => controller.loadPathAsSelection(active.id, { mode: (0,
|
|
6489
|
+
onClick: (e) => attempt(() => controller.loadPathAsSelection(active.id, { mode: (0, import_image_editor20.selectionModeFromModifiers)(e, "replace") })),
|
|
6490
6490
|
children: "Load as Selection"
|
|
6491
6491
|
}
|
|
6492
6492
|
),
|
|
@@ -6526,7 +6526,7 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6526
6526
|
|
|
6527
6527
|
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
6528
6528
|
var import_react37 = require("react");
|
|
6529
|
-
var
|
|
6529
|
+
var import_image_editor21 = require("@pixerate/editor/image-editor");
|
|
6530
6530
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
6531
6531
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
6532
6532
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
@@ -6544,12 +6544,12 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6544
6544
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
6545
6545
|
};
|
|
6546
6546
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: `flex flex-wrap items-center gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
|
|
6547
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children:
|
|
6548
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children:
|
|
6547
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor21.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: imageChipClass(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
|
|
6548
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor21.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-accent hover:bg-primary/90", onClick: () => tool.setReference(a) }, a)) }),
|
|
6549
6549
|
tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
6550
6550
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6551
6551
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
6552
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children:
|
|
6552
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor21.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("option", { value: o.id, children: o.label }, o.id)) })
|
|
6553
6553
|
] }),
|
|
6554
6554
|
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6555
6555
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
@@ -6594,18 +6594,18 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6594
6594
|
"select",
|
|
6595
6595
|
{
|
|
6596
6596
|
"aria-label": "Warp grid",
|
|
6597
|
-
value:
|
|
6597
|
+
value: import_image_editor21.WARP_GRID_OPTIONS.find((g) => g.columns === warp.columns && g.rows === warp.rows)?.id ?? "1x1",
|
|
6598
6598
|
onChange: (e) => {
|
|
6599
|
-
const g =
|
|
6599
|
+
const g = import_image_editor21.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
|
|
6600
6600
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
6601
6601
|
},
|
|
6602
6602
|
className: imageFieldClass,
|
|
6603
|
-
children:
|
|
6603
|
+
children: import_image_editor21.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("option", { value: g.id, children: g.label }, g.id))
|
|
6604
6604
|
}
|
|
6605
6605
|
)
|
|
6606
6606
|
] })
|
|
6607
6607
|
] }),
|
|
6608
|
-
tool.mode !== "warp" &&
|
|
6608
|
+
tool.mode !== "warp" && import_image_editor21.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
6609
6609
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-muted-foreground", children: f.label }),
|
|
6610
6610
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6611
6611
|
"input",
|
|
@@ -6652,7 +6652,7 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6652
6652
|
value: tool.interpolation,
|
|
6653
6653
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
6654
6654
|
className: imageFieldClass,
|
|
6655
|
-
children:
|
|
6655
|
+
children: import_image_editor21.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
6656
6656
|
}
|
|
6657
6657
|
)
|
|
6658
6658
|
] }),
|
|
@@ -6664,7 +6664,7 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6664
6664
|
|
|
6665
6665
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
6666
6666
|
var import_react38 = require("react");
|
|
6667
|
-
var
|
|
6667
|
+
var import_image_editor22 = require("@pixerate/editor/image-editor");
|
|
6668
6668
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
6669
6669
|
var ShapeOptionsBar = ({ controller, options, onChange, showTools = true, className }) => {
|
|
6670
6670
|
const [, setTick] = (0, import_react38.useState)(0);
|
|
@@ -6677,14 +6677,14 @@ var ShapeOptionsBar = ({ controller, options, onChange, showTools = true, classN
|
|
|
6677
6677
|
if (!shapeId) return;
|
|
6678
6678
|
try {
|
|
6679
6679
|
setError(null);
|
|
6680
|
-
(0,
|
|
6680
|
+
(0, import_image_editor22.applyShapeOptions)(controller, shapeId, change);
|
|
6681
6681
|
} catch (e) {
|
|
6682
6682
|
setError(e instanceof Error ? e.message : String(e));
|
|
6683
6683
|
}
|
|
6684
6684
|
};
|
|
6685
6685
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
6686
6686
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
6687
|
-
showTools && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children:
|
|
6687
|
+
showTools && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor22.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor22.SHAPE_KIND_LABELS[k] }, k)) }),
|
|
6688
6688
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
6689
6689
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6690
6690
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
|
|
@@ -6749,7 +6749,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, showTools = true, classN
|
|
|
6749
6749
|
|
|
6750
6750
|
// src/image-editor/TypeOptionsBar.tsx
|
|
6751
6751
|
var import_react39 = require("react");
|
|
6752
|
-
var
|
|
6752
|
+
var import_image_editor23 = require("@pixerate/editor/image-editor");
|
|
6753
6753
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
6754
6754
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
6755
6755
|
var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
|
|
@@ -6845,9 +6845,9 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
6845
6845
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
6846
6846
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
|
|
6847
6847
|
] }),
|
|
6848
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children:
|
|
6848
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor23.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
6849
6849
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
|
|
6850
|
-
|
|
6850
|
+
import_image_editor23.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
|
|
6851
6851
|
orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6852
6852
|
"button",
|
|
6853
6853
|
{
|
|
@@ -6896,7 +6896,7 @@ var ImageEditor = ({
|
|
|
6896
6896
|
const effectsShown = !!controller.effectsProvider || state.layers.some(function has(l) {
|
|
6897
6897
|
return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
|
|
6898
6898
|
});
|
|
6899
|
-
const legacyProcess = (0,
|
|
6899
|
+
const legacyProcess = (0, import_image_editor24.normalizeProcessVersion)(state.adjustments.process) < import_image_editor24.LATEST_PROCESS_VERSION;
|
|
6900
6900
|
const [activeTab, setActiveTab] = (0, import_react40.useState)("crop");
|
|
6901
6901
|
const rootRef = (0, import_react40.useRef)(null);
|
|
6902
6902
|
const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
|
|
@@ -6908,9 +6908,9 @@ var ImageEditor = ({
|
|
|
6908
6908
|
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
6909
6909
|
};
|
|
6910
6910
|
const [activeCropRatio, setActiveCropRatio] = (0, import_react40.useState)(null);
|
|
6911
|
-
const [selectionOptions, setSelectionOptions] = (0, import_react40.useState)(
|
|
6912
|
-
const [shapeOptions, setShapeOptions] = (0, import_react40.useState)(
|
|
6913
|
-
const [typeOptions, setTypeOptions] = (0, import_react40.useState)(
|
|
6911
|
+
const [selectionOptions, setSelectionOptions] = (0, import_react40.useState)(import_image_editor24.DEFAULT_SELECTION_TOOL_OPTIONS);
|
|
6912
|
+
const [shapeOptions, setShapeOptions] = (0, import_react40.useState)(import_image_editor24.DEFAULT_SHAPE_TOOL_OPTIONS);
|
|
6913
|
+
const [typeOptions, setTypeOptions] = (0, import_react40.useState)(import_image_editor24.DEFAULT_TYPE_TOOL_OPTIONS);
|
|
6914
6914
|
const [typeSession, setTypeSession] = (0, import_react40.useState)(null);
|
|
6915
6915
|
const [selectionError, setSelectionError] = (0, import_react40.useState)(null);
|
|
6916
6916
|
const [paintError, setPaintError] = (0, import_react40.useState)(null);
|
|
@@ -6925,7 +6925,7 @@ var ImageEditor = ({
|
|
|
6925
6925
|
const transformControllerRef = (0, import_react40.useRef)(controller);
|
|
6926
6926
|
if (!transformToolRef.current || transformControllerRef.current !== controller) {
|
|
6927
6927
|
transformToolRef.current?.cancel();
|
|
6928
|
-
transformToolRef.current = new
|
|
6928
|
+
transformToolRef.current = new import_image_editor24.FreeTransformTool(controller, {
|
|
6929
6929
|
schedule: (run) => typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame(run) : run()
|
|
6930
6930
|
});
|
|
6931
6931
|
transformControllerRef.current = controller;
|
|
@@ -7407,12 +7407,12 @@ var ImageEditor = ({
|
|
|
7407
7407
|
)
|
|
7408
7408
|
] }),
|
|
7409
7409
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Histogram, { histogram: editor.histogram }),
|
|
7410
|
-
|
|
7410
|
+
import_image_editor24.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react40.default.Fragment, { children: [
|
|
7411
7411
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7412
7412
|
ControlSlider,
|
|
7413
7413
|
{
|
|
7414
7414
|
spec,
|
|
7415
|
-
value: (0,
|
|
7415
|
+
value: (0, import_image_editor24.readAdjustmentControls)(state.adjustments)[spec.id],
|
|
7416
7416
|
disabled: spec.requiresProcess !== void 0 && legacyProcess,
|
|
7417
7417
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
7418
7418
|
}
|
|
@@ -7490,7 +7490,7 @@ var ImageEditor = ({
|
|
|
7490
7490
|
"aria-pressed": state.activeTool === t,
|
|
7491
7491
|
onClick: () => editor.setTool(t),
|
|
7492
7492
|
className: `py-1.5 px-2 rounded-lg font-medium border transition-colors ${state.activeTool === t ? "bg-primary border-primary text-primary-foreground" : "bg-muted border-border text-foreground hover:bg-accent"}`,
|
|
7493
|
-
children: (0,
|
|
7493
|
+
children: (0, import_image_editor24.imageToolLabel)(t)
|
|
7494
7494
|
},
|
|
7495
7495
|
t
|
|
7496
7496
|
)) }),
|