@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
package/dist/index.cjs
CHANGED
|
@@ -4100,7 +4100,7 @@ function useImageEffectsTools(registry, controller, options = {}) {
|
|
|
4100
4100
|
|
|
4101
4101
|
// src/image-editor/ImageEditor.tsx
|
|
4102
4102
|
var import_react76 = __toESM(require("react"), 1);
|
|
4103
|
-
var
|
|
4103
|
+
var import_image_editor24 = require("@pixerate/editor/image-editor");
|
|
4104
4104
|
|
|
4105
4105
|
// src/image-editor/ImageEditorCanvas.tsx
|
|
4106
4106
|
var import_react41 = require("react");
|
|
@@ -5402,7 +5402,7 @@ var import_react49 = require("react");
|
|
|
5402
5402
|
|
|
5403
5403
|
// src/image-editor/LayerEffectsPanel.tsx
|
|
5404
5404
|
var import_react46 = require("react");
|
|
5405
|
-
var
|
|
5405
|
+
var import_raster = require("@pixerate/editor/raster");
|
|
5406
5406
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
5407
5407
|
var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) => {
|
|
5408
5408
|
const [, setTick] = (0, import_react46.useState)(0);
|
|
@@ -5411,7 +5411,7 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
|
|
|
5411
5411
|
const [error, setError] = (0, import_react46.useState)(null);
|
|
5412
5412
|
const commitNext = (0, import_react46.useRef)(true);
|
|
5413
5413
|
const layer = layerId ? controller.getLayer(layerId) : controller.getActiveLayer();
|
|
5414
|
-
const model = (0,
|
|
5414
|
+
const model = (0, import_raster.layerEffectsPanel)(layer);
|
|
5415
5415
|
const id = layer?.id;
|
|
5416
5416
|
const attempt = (fn) => {
|
|
5417
5417
|
try {
|
|
@@ -5428,7 +5428,7 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
|
|
|
5428
5428
|
const patterns = controller.getDocumentPatterns();
|
|
5429
5429
|
const change = (effectId, control, value, drag = false) => attempt(() => {
|
|
5430
5430
|
const effect = controller.getLayerEffects(id).items.find((e) => e.id === effectId);
|
|
5431
|
-
controller.updateLayerEffect(id, effectId, (0,
|
|
5431
|
+
controller.updateLayerEffect(id, effectId, (0, import_raster.effectControlChange)(effect, control.key, value, patterns), drag ? commitNext.current : true);
|
|
5432
5432
|
if (drag) commitNext.current = false;
|
|
5433
5433
|
});
|
|
5434
5434
|
const renderControl = (effectId, c) => {
|
|
@@ -5521,7 +5521,7 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
|
|
|
5521
5521
|
value: "",
|
|
5522
5522
|
placeholder: "Add style\u2026",
|
|
5523
5523
|
disabled: model.readOnly,
|
|
5524
|
-
options:
|
|
5524
|
+
options: import_raster.LAYER_EFFECT_MENU.map((m) => ({ value: m.kind, label: m.label })),
|
|
5525
5525
|
onChange: (v) => {
|
|
5526
5526
|
const kind = v;
|
|
5527
5527
|
if (!kind) return;
|
|
@@ -5549,7 +5549,7 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
|
|
|
5549
5549
|
),
|
|
5550
5550
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: imageIconButtonClass, "aria-label": `Remove ${row.label}`, disabled: model.readOnly, onClick: () => attempt(() => controller.removeLayerEffect(id, row.id)), children: "\u2715" })
|
|
5551
5551
|
] }),
|
|
5552
|
-
expanded && /* @__PURE__ */ (0, import_jsx_runtime26.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,
|
|
5552
|
+
expanded && /* @__PURE__ */ (0, import_jsx_runtime26.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)) })
|
|
5553
5553
|
] }, row.id);
|
|
5554
5554
|
}) }),
|
|
5555
5555
|
error && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
@@ -5693,7 +5693,7 @@ var VectorMaskEdgesPanel = ({ controller, layer, className = "" }) => {
|
|
|
5693
5693
|
};
|
|
5694
5694
|
|
|
5695
5695
|
// src/image-editor/LayersPanel.tsx
|
|
5696
|
-
var
|
|
5696
|
+
var import_image_editor7 = require("@pixerate/editor/image-editor");
|
|
5697
5697
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5698
5698
|
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"}`;
|
|
5699
5699
|
var Thumbnail = ({
|
|
@@ -5750,7 +5750,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5750
5750
|
const commitNext = (0, import_react49.useRef)(true);
|
|
5751
5751
|
const state = controller.getState();
|
|
5752
5752
|
const maskView = controller.getMaskView();
|
|
5753
|
-
const rows = (0,
|
|
5753
|
+
const rows = (0, import_image_editor7.layerPanelRows)(state.layers, state.activeLayerId);
|
|
5754
5754
|
const active = controller.getActiveLayer();
|
|
5755
5755
|
const attempt = (fn) => {
|
|
5756
5756
|
try {
|
|
@@ -5762,7 +5762,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5762
5762
|
};
|
|
5763
5763
|
const run = async (action) => {
|
|
5764
5764
|
setMenu(null);
|
|
5765
|
-
setError(await (0,
|
|
5765
|
+
setError(await (0, import_image_editor7.runLayerMenuAction)(controller, action));
|
|
5766
5766
|
};
|
|
5767
5767
|
const prop = (key, value) => attempt(() => {
|
|
5768
5768
|
controller.setLayerProperties(active.id, { [key]: value }, commitNext.current);
|
|
@@ -5780,12 +5780,12 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5780
5780
|
if (!id) return;
|
|
5781
5781
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
5782
5782
|
const fraction = rect.height ? (e.clientY - rect.top) / rect.height : 0.5;
|
|
5783
|
-
const placement = (0,
|
|
5783
|
+
const placement = (0, import_image_editor7.dropPlacement)(state.layers, id, row.layer.id, (0, import_image_editor7.dropZone)(fraction, row.layer.type === "group"));
|
|
5784
5784
|
if (placement) attempt(() => controller.moveLayer(id, placement));
|
|
5785
5785
|
};
|
|
5786
|
-
const thumb = (layer) => (0,
|
|
5786
|
+
const thumb = (layer) => (0, import_image_editor7.layerHasThumbnail)(layer) ? controller.getLayerThumbnail(layer.id, { maxSide: 64 }) : null;
|
|
5787
5787
|
const maskThumb = (layer) => layer.mask && !layer.mask.source ? controller.getLayerThumbnail(layer.id, { maxSide: 64, mask: true }) : null;
|
|
5788
|
-
const vectorThumb = (layer) => layer.vectorMask ? (0,
|
|
5788
|
+
const vectorThumb = (layer) => layer.vectorMask ? (0, import_image_editor7.vectorMaskThumbnail)(layer.vectorMask, state.imageDimensions.width, state.imageDimensions.height, 64) : null;
|
|
5789
5789
|
const locked = (layer) => Boolean(layer.locks?.all || layer.locks?.pixels || layer.locks?.position || layer.locks?.transparency);
|
|
5790
5790
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "layers-panel", onClick: () => menu && setMenu(null), children: [
|
|
5791
5791
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "toolbar", "aria-label": "Layer actions", children: [
|
|
@@ -5817,25 +5817,25 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5817
5817
|
className: "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground",
|
|
5818
5818
|
value: controller.bitDepth,
|
|
5819
5819
|
onChange: (e) => attempt(() => controller.setBitDepth(Number(e.target.value))),
|
|
5820
|
-
children:
|
|
5820
|
+
children: import_image_editor7.BIT_DEPTH_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: o.depth, title: o.title, children: o.label }, o.depth))
|
|
5821
5821
|
}
|
|
5822
5822
|
),
|
|
5823
5823
|
psd && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
5824
5824
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => fileInput.current?.click(), children: "Open PSD\u2026" }),
|
|
5825
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => psdTask(async () => (await (0,
|
|
5825
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => psdTask(async () => (await (0, import_image_editor7.downloadPsd)(controller, psdFileName)).warnings), children: "Export PSD" }),
|
|
5826
5826
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5827
5827
|
"input",
|
|
5828
5828
|
{
|
|
5829
5829
|
ref: fileInput,
|
|
5830
5830
|
type: "file",
|
|
5831
|
-
accept:
|
|
5831
|
+
accept: import_image_editor7.PSD_FILE_ACCEPT,
|
|
5832
5832
|
className: "hidden",
|
|
5833
5833
|
"data-testid": "psd-file-input",
|
|
5834
5834
|
"aria-label": "Open a PSD file",
|
|
5835
5835
|
onChange: (e) => {
|
|
5836
5836
|
const file = e.currentTarget.files?.[0];
|
|
5837
5837
|
e.currentTarget.value = "";
|
|
5838
|
-
if (file) psdTask(() => (0,
|
|
5838
|
+
if (file) psdTask(() => (0, import_image_editor7.openPsdFile)(controller, file));
|
|
5839
5839
|
}
|
|
5840
5840
|
}
|
|
5841
5841
|
)
|
|
@@ -5896,7 +5896,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5896
5896
|
onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { blend: e.target.value })),
|
|
5897
5897
|
children: [
|
|
5898
5898
|
active.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: "pass-through", children: "Pass Through" }),
|
|
5899
|
-
|
|
5899
|
+
import_image_editor7.BLEND_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: m.id, children: m.label }, m.id))
|
|
5900
5900
|
]
|
|
5901
5901
|
}
|
|
5902
5902
|
),
|
|
@@ -5990,7 +5990,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5990
5990
|
}
|
|
5991
5991
|
),
|
|
5992
5992
|
row.clipped && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", "aria-label": "Clipped", children: "\u21B3" }),
|
|
5993
|
-
(0,
|
|
5993
|
+
(0, import_image_editor7.layerHasThumbnail)(layer) ? /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "relative shrink-0", children: [
|
|
5994
5994
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5995
5995
|
Thumbnail,
|
|
5996
5996
|
{
|
|
@@ -6002,7 +6002,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
6002
6002
|
onClick: (e) => {
|
|
6003
6003
|
if (e.ctrlKey || e.metaKey) {
|
|
6004
6004
|
e.stopPropagation();
|
|
6005
|
-
attempt(() => (0,
|
|
6005
|
+
attempt(() => (0, import_image_editor7.layerThumbnailClick)(controller, layer, e));
|
|
6006
6006
|
}
|
|
6007
6007
|
}
|
|
6008
6008
|
}
|
|
@@ -6012,7 +6012,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
6012
6012
|
{
|
|
6013
6013
|
"data-testid": "layer-kind-badge",
|
|
6014
6014
|
className: "absolute -bottom-1 -right-1 rounded bg-accent px-0.5 text-[8px] font-bold leading-tight text-foreground ring-1 ring-background",
|
|
6015
|
-
children: (0,
|
|
6015
|
+
children: (0, import_image_editor7.layerBadge)(layer)
|
|
6016
6016
|
}
|
|
6017
6017
|
)
|
|
6018
6018
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
@@ -6020,7 +6020,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
6020
6020
|
{
|
|
6021
6021
|
className: "shrink-0 grid place-items-center rounded bg-muted text-[9px] text-muted-foreground ring-1 ring-border",
|
|
6022
6022
|
style: { width: thumbnailSize, height: thumbnailSize },
|
|
6023
|
-
children: (0,
|
|
6023
|
+
children: (0, import_image_editor7.layerBadge)(layer)
|
|
6024
6024
|
}
|
|
6025
6025
|
),
|
|
6026
6026
|
layer.mask && !layer.mask.source && layer.type === "pixel" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
@@ -6050,7 +6050,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
6050
6050
|
selected: row.active && state.activeTarget === "mask",
|
|
6051
6051
|
onClick: (e) => {
|
|
6052
6052
|
e.stopPropagation();
|
|
6053
|
-
attempt(() => (0,
|
|
6053
|
+
attempt(() => (0, import_image_editor7.maskThumbnailClick)(controller, layer, e));
|
|
6054
6054
|
}
|
|
6055
6055
|
}
|
|
6056
6056
|
),
|
|
@@ -6064,7 +6064,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
6064
6064
|
testId: "layer-vector-mask-thumbnail",
|
|
6065
6065
|
onClick: (e) => {
|
|
6066
6066
|
e.stopPropagation();
|
|
6067
|
-
attempt(() => (0,
|
|
6067
|
+
attempt(() => (0, import_image_editor7.vectorMaskThumbnailClick)(controller, layer, e));
|
|
6068
6068
|
}
|
|
6069
6069
|
}
|
|
6070
6070
|
),
|
|
@@ -6096,18 +6096,18 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
6096
6096
|
children: row.label
|
|
6097
6097
|
}
|
|
6098
6098
|
),
|
|
6099
|
-
(0,
|
|
6100
|
-
(0,
|
|
6099
|
+
(0, import_image_editor7.layerWarning)(layer) && /* @__PURE__ */ (0, import_jsx_runtime29.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" }),
|
|
6100
|
+
(0, import_image_editor7.layerEffectsBadge)(layer) && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
6101
6101
|
"button",
|
|
6102
6102
|
{
|
|
6103
6103
|
type: "button",
|
|
6104
6104
|
"data-testid": "layer-fx-badge",
|
|
6105
|
-
"aria-label": (0,
|
|
6106
|
-
"aria-pressed": (0,
|
|
6107
|
-
className: `text-[9px] italic font-semibold ${(0,
|
|
6105
|
+
"aria-label": (0, import_image_editor7.layerEffectsBadge)(layer) === "on" ? `Turn effects off for ${row.label}` : `Turn effects on for ${row.label}`,
|
|
6106
|
+
"aria-pressed": (0, import_image_editor7.layerEffectsBadge)(layer) === "on",
|
|
6107
|
+
className: `text-[9px] italic font-semibold ${(0, import_image_editor7.layerEffectsBadge)(layer) === "on" ? "text-primary" : "text-muted-foreground/70 line-through"}`,
|
|
6108
6108
|
onClick: (e) => {
|
|
6109
6109
|
e.stopPropagation();
|
|
6110
|
-
attempt(() => controller.setLayerEffectsEnabled(layer.id, (0,
|
|
6110
|
+
attempt(() => controller.setLayerEffectsEnabled(layer.id, (0, import_image_editor7.layerEffectsBadge)(layer) !== "on"));
|
|
6111
6111
|
},
|
|
6112
6112
|
children: "fx"
|
|
6113
6113
|
}
|
|
@@ -6129,7 +6129,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
6129
6129
|
style: { left: menu.x, top: menu.y },
|
|
6130
6130
|
onClick: (e) => e.stopPropagation(),
|
|
6131
6131
|
onKeyDown: (e) => e.key === "Escape" && setMenu(null),
|
|
6132
|
-
children: (0,
|
|
6132
|
+
children: (0, import_image_editor7.layerMenu)(controller).map((item) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
6133
6133
|
"button",
|
|
6134
6134
|
{
|
|
6135
6135
|
type: "button",
|
|
@@ -6148,7 +6148,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
6148
6148
|
|
|
6149
6149
|
// src/image-editor/ImageProviderEffectsPanel.tsx
|
|
6150
6150
|
var import_react59 = require("react");
|
|
6151
|
-
var
|
|
6151
|
+
var import_image_editor8 = require("@pixerate/editor/image-editor");
|
|
6152
6152
|
|
|
6153
6153
|
// src/effects/useEffects.ts
|
|
6154
6154
|
var import_react50 = require("react");
|
|
@@ -8004,7 +8004,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
8004
8004
|
const [scrubbed, setScrubbed] = (0, import_react59.useState)(null);
|
|
8005
8005
|
const provider = controller.effectsProvider;
|
|
8006
8006
|
const state = controller.getState();
|
|
8007
|
-
const layer = state.activeLayerId ? (0,
|
|
8007
|
+
const layer = state.activeLayerId ? (0, import_image_editor8.findLayer)(state.layers, state.activeLayerId)?.layer ?? null : null;
|
|
8008
8008
|
const run = (work) => {
|
|
8009
8009
|
setMessage(null);
|
|
8010
8010
|
Promise.resolve().then(work).catch((e) => setMessage(e instanceof Error ? e.message : String(e)));
|
|
@@ -8024,7 +8024,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
8024
8024
|
const generator = layer?.type === "pixel" ? layer.generator : void 0;
|
|
8025
8025
|
const canFilter = !!provider && !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
|
|
8026
8026
|
const { description } = useEffectDescription(provider, generator?.effect);
|
|
8027
|
-
const timing = generator ? (0,
|
|
8027
|
+
const timing = generator ? (0, import_image_editor8.effectLayerTiming)(generator, description) : null;
|
|
8028
8028
|
const scrub = (0, import_react59.useRef)({ next: null, busy: false, gesture: null });
|
|
8029
8029
|
const scrubTo = (layerId, time) => {
|
|
8030
8030
|
const s = scrub.current;
|
|
@@ -8052,7 +8052,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
8052
8052
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider, "aria-pressed": browse === "change", onClick: () => setBrowse(browse === "change" ? null : "change"), children: "Change\u2026" }),
|
|
8053
8053
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { type: "button", className: imageOutlineButtonClass, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
|
|
8054
8054
|
] }),
|
|
8055
|
-
browse === "change" && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(EffectsBrowser, { provider, uses:
|
|
8055
|
+
browse === "change" && /* @__PURE__ */ (0, import_jsx_runtime39.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 }))) }),
|
|
8056
8056
|
timing && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "space-y-1.5 rounded border border-border p-1.5", "data-effect-part": "timing", role: "group", "aria-label": "Frames", children: [
|
|
8057
8057
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex gap-1", role: "radiogroup", "aria-label": "Output", children: [
|
|
8058
8058
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
@@ -8211,7 +8211,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
8211
8211
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ImageCheckbox, { checked: clip, label: "Clip to layer below", onChange: setClip }),
|
|
8212
8212
|
"Clip to layer below"
|
|
8213
8213
|
] }),
|
|
8214
|
-
browse === "layer" && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(EffectsBrowser, { provider, uses:
|
|
8214
|
+
browse === "layer" && /* @__PURE__ */ (0, import_jsx_runtime39.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 }))) })
|
|
8215
8215
|
] }),
|
|
8216
8216
|
!layer && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
|
|
8217
8217
|
message2 && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message2 })
|
|
@@ -8220,11 +8220,11 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
8220
8220
|
|
|
8221
8221
|
// src/image-editor/BrushOptionsBar.tsx
|
|
8222
8222
|
var import_react61 = require("react");
|
|
8223
|
+
var import_image_editor10 = require("@pixerate/editor/image-editor");
|
|
8223
8224
|
var import_image_editor11 = require("@pixerate/editor/image-editor");
|
|
8224
|
-
var import_image_editor12 = require("@pixerate/editor/image-editor");
|
|
8225
8225
|
|
|
8226
8226
|
// src/image-editor/PaintGradientEditor.tsx
|
|
8227
|
-
var
|
|
8227
|
+
var import_image_editor9 = require("@pixerate/editor/image-editor");
|
|
8228
8228
|
|
|
8229
8229
|
// src/paint-editor/PaintGradientEditorView.tsx
|
|
8230
8230
|
var import_react60 = require("react");
|
|
@@ -8350,7 +8350,7 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
|
|
|
8350
8350
|
|
|
8351
8351
|
// src/image-editor/PaintGradientEditor.tsx
|
|
8352
8352
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
8353
|
-
var PaintGradientEditor = (props) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PaintGradientEditorView, { ...props, kit:
|
|
8353
|
+
var PaintGradientEditor = (props) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PaintGradientEditorView, { ...props, kit: import_image_editor9.PAINT_GRADIENT_KIT });
|
|
8354
8354
|
|
|
8355
8355
|
// src/image-editor/BrushOptionsBar.tsx
|
|
8356
8356
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
@@ -8366,11 +8366,11 @@ var BrushOptionsBar = ({ controller, showTools = true, className }) => {
|
|
|
8366
8366
|
setError(null);
|
|
8367
8367
|
fn();
|
|
8368
8368
|
} catch (err) {
|
|
8369
|
-
setError((0,
|
|
8369
|
+
setError((0, import_image_editor11.userErrorMessage)(err));
|
|
8370
8370
|
}
|
|
8371
8371
|
};
|
|
8372
8372
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "brush-options", children: [
|
|
8373
|
-
showTools && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children:
|
|
8373
|
+
showTools && /* @__PURE__ */ (0, import_jsx_runtime42.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_runtime42.jsx)(
|
|
8374
8374
|
"button",
|
|
8375
8375
|
{
|
|
8376
8376
|
type: "button",
|
|
@@ -8400,13 +8400,13 @@ var BrushOptionsBar = ({ controller, showTools = true, className }) => {
|
|
|
8400
8400
|
"aria-pressed": paint.type === "gradient",
|
|
8401
8401
|
title: "Gradient paint: the brush changes colour as the stroke goes",
|
|
8402
8402
|
className: imageChipClass(paint.type === "gradient"),
|
|
8403
|
-
onClick: () => attempt(() => controller.setPaintOptions(paint.type === "gradient" ? { foreground } : { paint:
|
|
8403
|
+
onClick: () => attempt(() => controller.setPaintOptions(paint.type === "gradient" ? { foreground } : { paint: import_image_editor11.DEFAULT_PAINT_GRADIENT })),
|
|
8404
8404
|
children: "Gradient"
|
|
8405
8405
|
}
|
|
8406
8406
|
)
|
|
8407
8407
|
] }),
|
|
8408
8408
|
state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PaintGradientEditor, { value: paint, colors: { paint: foreground, secondary: background }, onChange: (g) => attempt(() => controller.setPaintOptions({ paint: g })) }),
|
|
8409
|
-
|
|
8409
|
+
import_image_editor10.BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
8410
8410
|
ControlSlider,
|
|
8411
8411
|
{
|
|
8412
8412
|
spec,
|
|
@@ -8421,15 +8421,15 @@ var BrushOptionsBar = ({ controller, showTools = true, className }) => {
|
|
|
8421
8421
|
"span",
|
|
8422
8422
|
{
|
|
8423
8423
|
"aria-label": "Brush load",
|
|
8424
|
-
title: mixerLoad.reservoir ? `Loaded ${(0,
|
|
8424
|
+
title: mixerLoad.reservoir ? `Loaded ${(0, import_image_editor10.rgbUnitToHex)(mixerLoad.reservoir)}, ${Math.round(mixerLoad.amount * 100)}% left` : "Unloaded",
|
|
8425
8425
|
className: "h-6 w-6 rounded border border-border",
|
|
8426
|
-
style: { background: mixerLoad.reservoir ? (0,
|
|
8426
|
+
style: { background: mixerLoad.reservoir ? (0, import_image_editor10.rgbUnitToHex)(mixerLoad.reservoir) : "transparent" }
|
|
8427
8427
|
}
|
|
8428
8428
|
),
|
|
8429
8429
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("button", { type: "button", title: "Fill the reservoir with the foreground colour", className: imageChipClass(false), onClick: () => controller.loadMixerBrush(), children: "Load brush" }),
|
|
8430
8430
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("button", { type: "button", title: "Empty the picked-up colour", className: imageChipClass(false), onClick: () => controller.cleanMixerBrush(), children: "Clean brush" })
|
|
8431
8431
|
] }),
|
|
8432
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children:
|
|
8432
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children: import_image_editor10.MIXER_MIXING_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
8433
8433
|
"button",
|
|
8434
8434
|
{
|
|
8435
8435
|
type: "button",
|
|
@@ -8441,7 +8441,7 @@ var BrushOptionsBar = ({ controller, showTools = true, className }) => {
|
|
|
8441
8441
|
},
|
|
8442
8442
|
m.id
|
|
8443
8443
|
)) }),
|
|
8444
|
-
|
|
8444
|
+
import_image_editor10.MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ControlSlider, { spec, value: mixer[spec.id], onChange: (v) => controller.setPaintOptions({ mixer: { [spec.id]: v } }) }, spec.id)),
|
|
8445
8445
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex flex-wrap gap-3 text-foreground", children: [
|
|
8446
8446
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
8447
8447
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ImageCheckbox, { label: "Load the brush after each stroke", checked: mixer.loadEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { loadEachStroke: on } }) }),
|
|
@@ -8453,20 +8453,20 @@ var BrushOptionsBar = ({ controller, showTools = true, className }) => {
|
|
|
8453
8453
|
] })
|
|
8454
8454
|
] })
|
|
8455
8455
|
] }),
|
|
8456
|
-
(0,
|
|
8456
|
+
(0, import_image_editor10.isRetouchPaintTool)(tool) && /* @__PURE__ */ (0, import_jsx_runtime42.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: [
|
|
8457
8457
|
(tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
8458
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "text-muted-foreground", "data-testid": "clone-source", children: (0,
|
|
8458
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "text-muted-foreground", "data-testid": "clone-source", children: (0, import_image_editor10.cloneSourceLabel)(controller) }),
|
|
8459
8459
|
cloneSource && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("button", { type: "button", title: "Forget the source point", className: imageChipClass(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
|
|
8460
8460
|
] }),
|
|
8461
8461
|
(tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex flex-col gap-1", role: "group", "aria-label": "Clone source transform", "data-testid": "clone-transform", children: [
|
|
8462
|
-
|
|
8462
|
+
import_image_editor10.CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime42.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)),
|
|
8463
8463
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
8464
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("button", { type: "button", "aria-pressed": (0,
|
|
8465
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("button", { type: "button", "aria-pressed": (0,
|
|
8466
|
-
!(0,
|
|
8464
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.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" }),
|
|
8465
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.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" }),
|
|
8466
|
+
!(0, import_image_editor10.cloneTransformView)(controller).identity && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className: imageChipClass(false), onClick: () => controller.setCloneTransform(null), children: "Reset transform" })
|
|
8467
8467
|
] })
|
|
8468
8468
|
] }),
|
|
8469
|
-
|
|
8469
|
+
import_image_editor10.RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": choice.label, children: [
|
|
8470
8470
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "text-muted-foreground", children: choice.label }),
|
|
8471
8471
|
choice.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
8472
8472
|
"button",
|
|
@@ -8475,14 +8475,14 @@ var BrushOptionsBar = ({ controller, showTools = true, className }) => {
|
|
|
8475
8475
|
"aria-pressed": retouch[choice.id] === o.id,
|
|
8476
8476
|
title: o.title,
|
|
8477
8477
|
className: imageChipClass(retouch[choice.id] === o.id),
|
|
8478
|
-
onClick: () => (0,
|
|
8478
|
+
onClick: () => (0, import_image_editor10.setRetouchChoice)(controller, choice.id, o.id),
|
|
8479
8479
|
children: o.label
|
|
8480
8480
|
},
|
|
8481
8481
|
o.id
|
|
8482
8482
|
))
|
|
8483
8483
|
] }, choice.id)),
|
|
8484
|
-
|
|
8485
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex flex-wrap gap-3 text-foreground", children:
|
|
8484
|
+
import_image_editor10.RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ControlSlider, { spec, value: retouch[spec.id], onChange: (v) => controller.setPaintOptions({ retouch: { [spec.id]: v } }) }, spec.id)),
|
|
8485
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.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_runtime42.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
8486
8486
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ImageCheckbox, { label: t.label, checked: retouch[t.id], onChange: (on) => controller.setPaintOptions({ retouch: { [t.id]: on } }) }),
|
|
8487
8487
|
t.label
|
|
8488
8488
|
] }, t.id)) })
|
|
@@ -8507,7 +8507,7 @@ var BrushOptionsBar = ({ controller, showTools = true, className }) => {
|
|
|
8507
8507
|
|
|
8508
8508
|
// src/image-editor/ColorProfilePanel.tsx
|
|
8509
8509
|
var import_react62 = require("react");
|
|
8510
|
-
var
|
|
8510
|
+
var import_image_editor12 = require("@pixerate/editor/image-editor");
|
|
8511
8511
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
8512
8512
|
var chip = imageChipClass(false);
|
|
8513
8513
|
var select2 = "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground";
|
|
@@ -8518,7 +8518,7 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
8518
8518
|
const [intent, setIntent] = (0, import_react62.useState)("relative");
|
|
8519
8519
|
const [bpc, setBpc] = (0, import_react62.useState)(true);
|
|
8520
8520
|
const [error, setError] = (0, import_react62.useState)(null);
|
|
8521
|
-
const view = (0,
|
|
8521
|
+
const view = (0, import_image_editor12.colorPanelView)(controller);
|
|
8522
8522
|
const attempt = (fn) => {
|
|
8523
8523
|
try {
|
|
8524
8524
|
setError(null);
|
|
@@ -8546,12 +8546,12 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
8546
8546
|
] }),
|
|
8547
8547
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Colour mode", children: [
|
|
8548
8548
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "text-muted-foreground", children: "Mode" }),
|
|
8549
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("select", { "aria-label": "Colour mode", className: select2, value: view.mode, onChange: (e) => attempt(() => controller.setColorMode(e.target.value)), children:
|
|
8549
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.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_runtime43.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
|
|
8550
8550
|
view.cmykProfileName && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "text-muted-foreground", children: view.cmykProfileName })
|
|
8551
8551
|
] }),
|
|
8552
8552
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
|
|
8553
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("select", { "aria-label": "Target profile", className: select2, value: target, onChange: (e) => setTarget(e.target.value), children:
|
|
8554
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("select", { "aria-label": "Rendering intent", className: select2, value: intent, onChange: (e) => setIntent(e.target.value), children:
|
|
8553
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.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_runtime43.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
|
|
8554
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.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_runtime43.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
|
|
8555
8555
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8556
8556
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-primary" }),
|
|
8557
8557
|
"BPC"
|
|
@@ -8570,12 +8570,12 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
8570
8570
|
onChange: (e) => e.target.value ? proofWith({ id: e.target.value }) : attempt(() => controller.setProofSetup(null)),
|
|
8571
8571
|
children: [
|
|
8572
8572
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("option", { value: "", children: "Off" }),
|
|
8573
|
-
|
|
8573
|
+
import_image_editor12.PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("option", { value: o.id, children: o.label }, o.id))
|
|
8574
8574
|
]
|
|
8575
8575
|
}
|
|
8576
8576
|
),
|
|
8577
8577
|
view.proof && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
8578
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("select", { "aria-label": "Proof intent", className: select2, value: view.proof.intent, onChange: (e) => proofWith({ intent: e.target.value }), children:
|
|
8578
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.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_runtime43.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
|
|
8579
8579
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8580
8580
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-primary" }),
|
|
8581
8581
|
"Paper"
|
|
@@ -8595,7 +8595,7 @@ var import_react66 = require("react");
|
|
|
8595
8595
|
|
|
8596
8596
|
// src/image-editor/SelectionRecipePanel.tsx
|
|
8597
8597
|
var import_react63 = require("react");
|
|
8598
|
-
var
|
|
8598
|
+
var import_image_editor13 = require("@pixerate/editor/image-editor");
|
|
8599
8599
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
8600
8600
|
var MODES2 = ["replace", "add", "subtract", "intersect"];
|
|
8601
8601
|
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";
|
|
@@ -8613,10 +8613,10 @@ var SelectionRecipePanel = ({ controller, className = "" }) => {
|
|
|
8613
8613
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("button", { type: "button", className: button2, title: "Keep the selection, drop its steps", onClick: () => run(controller.freezeSelection()), children: "Freeze" })
|
|
8614
8614
|
] }),
|
|
8615
8615
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("ol", { className: "flex flex-col gap-1", children: recipe.steps.map((step) => {
|
|
8616
|
-
const setting = (0,
|
|
8616
|
+
const setting = (0, import_image_editor13.recipeStepSetting)(step);
|
|
8617
8617
|
const shape = "mode" in step || ["rect", "ellipse", "polygon", "magic-wand", "color-range", "color-range-preset"].includes(step.op);
|
|
8618
8618
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("li", { "data-testid": "selection-step", className: "flex flex-wrap items-center gap-1", children: [
|
|
8619
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "flex-1 min-w-0 truncate text-foreground", children: (0,
|
|
8619
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "flex-1 min-w-0 truncate text-foreground", children: (0, import_image_editor13.describeRecipeStep)(step) }),
|
|
8620
8620
|
shape && step.index > 0 && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
8621
8621
|
"select",
|
|
8622
8622
|
{
|
|
@@ -8651,16 +8651,16 @@ var SelectionRecipePanel = ({ controller, className = "" }) => {
|
|
|
8651
8651
|
};
|
|
8652
8652
|
|
|
8653
8653
|
// src/image-editor/SelectionOptionsBar.tsx
|
|
8654
|
-
var
|
|
8654
|
+
var import_image_editor16 = require("@pixerate/editor/image-editor");
|
|
8655
8655
|
|
|
8656
8656
|
// src/image-editor/SelectAndMaskWorkspace.tsx
|
|
8657
8657
|
var import_react64 = require("react");
|
|
8658
|
-
var
|
|
8658
|
+
var import_image_editor14 = require("@pixerate/editor/image-editor");
|
|
8659
8659
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
8660
8660
|
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";
|
|
8661
8661
|
var toggle = (on) => `${button3} ${on ? "bg-primary text-primary-foreground border-primary" : ""}`;
|
|
8662
8662
|
var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
8663
|
-
const session = (0, import_react64.useMemo)(() => new
|
|
8663
|
+
const session = (0, import_react64.useMemo)(() => new import_image_editor14.SelectAndMaskSession(controller), [controller]);
|
|
8664
8664
|
const [, setRevision] = (0, import_react64.useState)(0);
|
|
8665
8665
|
const [zoom, setZoom] = (0, import_react64.useState)(1);
|
|
8666
8666
|
const [pan, setPan] = (0, import_react64.useState)({ x: 0, y: 0 });
|
|
@@ -8749,7 +8749,7 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
8749
8749
|
"aria-label": "Select and Mask",
|
|
8750
8750
|
className: `fixed inset-0 z-50 flex bg-background text-xs text-foreground ${className}`,
|
|
8751
8751
|
children: [
|
|
8752
|
-
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { role: "group", "aria-label": "Select and Mask tool", className: "flex flex-col gap-1 p-2 border-r border-border", children:
|
|
8752
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.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_runtime45.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)) }),
|
|
8753
8753
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex-1 flex flex-col min-w-0", children: [
|
|
8754
8754
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
|
|
8755
8755
|
brushTool && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
@@ -8810,7 +8810,7 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
8810
8810
|
{
|
|
8811
8811
|
label: "View",
|
|
8812
8812
|
value: settings.view,
|
|
8813
|
-
options:
|
|
8813
|
+
options: import_image_editor14.SELECT_AND_MASK_VIEWS.map((v) => ({ value: v.id, label: `${v.label} (${v.key.toUpperCase()})` })),
|
|
8814
8814
|
onChange: (v) => set({ view: v })
|
|
8815
8815
|
}
|
|
8816
8816
|
)
|
|
@@ -8857,7 +8857,7 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
8857
8857
|
}
|
|
8858
8858
|
)
|
|
8859
8859
|
] }),
|
|
8860
|
-
|
|
8860
|
+
import_image_editor14.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
8861
8861
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
8862
8862
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { children: c.label }),
|
|
8863
8863
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "font-mono", children: [
|
|
@@ -8892,7 +8892,7 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
8892
8892
|
{
|
|
8893
8893
|
label: "Output to",
|
|
8894
8894
|
value: settings.output,
|
|
8895
|
-
options:
|
|
8895
|
+
options: import_image_editor14.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => ({ value: o.id, label: o.label })),
|
|
8896
8896
|
onChange: (v) => set({ output: v })
|
|
8897
8897
|
}
|
|
8898
8898
|
)
|
|
@@ -8916,12 +8916,12 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
8916
8916
|
|
|
8917
8917
|
// src/image-editor/ContentAwareFillWorkspace.tsx
|
|
8918
8918
|
var import_react65 = require("react");
|
|
8919
|
-
var
|
|
8919
|
+
var import_image_editor15 = require("@pixerate/editor/image-editor");
|
|
8920
8920
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
8921
8921
|
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";
|
|
8922
8922
|
var toggle2 = (on) => `${button4} ${on ? "bg-primary text-primary-foreground border-primary" : ""}`;
|
|
8923
8923
|
var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
8924
|
-
const session = (0, import_react65.useMemo)(() => new
|
|
8924
|
+
const session = (0, import_react65.useMemo)(() => new import_image_editor15.ContentAwareFillSession(controller), [controller]);
|
|
8925
8925
|
const [, setRevision] = (0, import_react65.useState)(0);
|
|
8926
8926
|
const [zoom, setZoom] = (0, import_react65.useState)(1);
|
|
8927
8927
|
const [pan, setPan] = (0, import_react65.useState)({ x: 0, y: 0 });
|
|
@@ -9006,7 +9006,7 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
9006
9006
|
};
|
|
9007
9007
|
const view = { maxWidth: "100%", maxHeight: "100%", transform: `translate(${pan.x}px, ${pan.y}px) scale(${zoom})`, imageRendering: zoom > 2 ? "pixelated" : void 0 };
|
|
9008
9008
|
return /* @__PURE__ */ (0, import_jsx_runtime46.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: [
|
|
9009
|
-
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { role: "group", "aria-label": "Content-Aware Fill tool", className: "flex flex-col gap-1 p-2 border-r border-border", children:
|
|
9009
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.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_runtime46.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)) }),
|
|
9010
9010
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex-1 flex flex-col min-w-0", children: [
|
|
9011
9011
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
|
|
9012
9012
|
settings.tool === "sampling-brush" && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
@@ -9060,7 +9060,7 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
9060
9060
|
] }),
|
|
9061
9061
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "w-64 flex flex-col gap-3 p-3 border-l border-border overflow-y-auto", children: [
|
|
9062
9062
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: imageSectionTitleClass, children: "Sampling Area Options" }),
|
|
9063
|
-
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { role: "group", "aria-label": "Sampling area", className: "flex gap-1", children:
|
|
9063
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.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_runtime46.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)) }),
|
|
9064
9064
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
9065
9065
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ImageCheckbox, { label: "Show Sampling Area", checked: settings.showSampling, onChange: (on) => set({ showSampling: on }) }),
|
|
9066
9066
|
"Show Sampling Area"
|
|
@@ -9263,8 +9263,8 @@ var SelectionOptionsBar = ({
|
|
|
9263
9263
|
}
|
|
9264
9264
|
};
|
|
9265
9265
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
9266
|
-
showTools && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children:
|
|
9267
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children:
|
|
9266
|
+
showTools && /* @__PURE__ */ (0, import_jsx_runtime47.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_runtime47.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)) }),
|
|
9267
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.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_runtime47.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)) }),
|
|
9268
9268
|
options.tool === "wand" && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
9269
9269
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
9270
9270
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
@@ -9458,7 +9458,7 @@ var SelectionOptionsBar = ({
|
|
|
9458
9458
|
{
|
|
9459
9459
|
label: "Color Range preset",
|
|
9460
9460
|
value: preset,
|
|
9461
|
-
options:
|
|
9461
|
+
options: import_image_editor16.COLOR_RANGE_PRESETS.map((p) => ({ value: p, label: import_image_editor16.COLOR_RANGE_PRESET_LABELS[p] })),
|
|
9462
9462
|
onChange: (v) => setPreset(v)
|
|
9463
9463
|
}
|
|
9464
9464
|
),
|
|
@@ -9657,18 +9657,18 @@ var SelectionOptionsBar = ({
|
|
|
9657
9657
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("outside")), children: "Paste Outside" })
|
|
9658
9658
|
] }),
|
|
9659
9659
|
colorStatus && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { role: "status", className: "text-muted-foreground", children: colorStatus }),
|
|
9660
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: (0,
|
|
9660
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: (0, import_image_editor16.describeSelection)(sel) }),
|
|
9661
9661
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SelectionRecipePanel, { controller, selection: sel })
|
|
9662
9662
|
] });
|
|
9663
9663
|
};
|
|
9664
9664
|
|
|
9665
9665
|
// src/image-editor/RefineEdgePanel.tsx
|
|
9666
9666
|
var import_react70 = require("react");
|
|
9667
|
-
var
|
|
9667
|
+
var import_image_editor18 = require("@pixerate/editor/image-editor");
|
|
9668
9668
|
|
|
9669
9669
|
// src/image-editor/MaskEdgeCheck.tsx
|
|
9670
9670
|
var import_react67 = __toESM(require("react"), 1);
|
|
9671
|
-
var
|
|
9671
|
+
var import_image_editor17 = require("@pixerate/editor/image-editor");
|
|
9672
9672
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
9673
9673
|
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";
|
|
9674
9674
|
var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, className = "" }) => {
|
|
@@ -9685,7 +9685,7 @@ var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, cla
|
|
|
9685
9685
|
setError(err instanceof Error ? err.message : String(err));
|
|
9686
9686
|
}
|
|
9687
9687
|
};
|
|
9688
|
-
const T =
|
|
9688
|
+
const T = import_image_editor17.MASK_EDGE_THRESHOLDS;
|
|
9689
9689
|
const rows = report ? [
|
|
9690
9690
|
{ label: "Halo", value: report.haloScore, bad: report.haloScore >= T.halo },
|
|
9691
9691
|
{ label: "Edge alignment", value: report.edgeAlignment, bad: report.edgeAlignment < T.alignment },
|
|
@@ -9854,7 +9854,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
9854
9854
|
};
|
|
9855
9855
|
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
9856
9856
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
|
|
9857
|
-
|
|
9857
|
+
import_image_editor18.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
9858
9858
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
9859
9859
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: c.label }),
|
|
9860
9860
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { className: "font-mono", children: [
|
|
@@ -9897,7 +9897,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
9897
9897
|
value: output,
|
|
9898
9898
|
onChange: (e) => setOutput(e.target.value),
|
|
9899
9899
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
9900
|
-
children:
|
|
9900
|
+
children: import_image_editor18.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("option", { value: o.id, children: o.label }, o.id))
|
|
9901
9901
|
}
|
|
9902
9902
|
)
|
|
9903
9903
|
] }),
|
|
@@ -9944,7 +9944,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
9944
9944
|
value: newKind,
|
|
9945
9945
|
onChange: (e) => setNewKind(e.target.value),
|
|
9946
9946
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
9947
|
-
children:
|
|
9947
|
+
children: import_image_editor18.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("option", { value: k.kind, children: k.label }, k.kind))
|
|
9948
9948
|
}
|
|
9949
9949
|
),
|
|
9950
9950
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
@@ -9953,7 +9953,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
9953
9953
|
type: "button",
|
|
9954
9954
|
className: button8,
|
|
9955
9955
|
disabled: !sel,
|
|
9956
|
-
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0,
|
|
9956
|
+
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0, import_image_editor18.layerMaskFromSelection)(sel) })),
|
|
9957
9957
|
children: "New Masked Layer"
|
|
9958
9958
|
}
|
|
9959
9959
|
)
|
|
@@ -9967,7 +9967,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
9967
9967
|
onChange: (e) => setLayerId(e.target.value),
|
|
9968
9968
|
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
9969
9969
|
children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("option", { value: l.id, children: [
|
|
9970
|
-
l.name || (0,
|
|
9970
|
+
l.name || (0, import_image_editor18.adjustmentKindLabel)(l.kind),
|
|
9971
9971
|
l.mask ? " (masked)" : ""
|
|
9972
9972
|
] }, l.id))
|
|
9973
9973
|
}
|
|
@@ -10029,7 +10029,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
10029
10029
|
|
|
10030
10030
|
// src/image-editor/ChannelsPanel.tsx
|
|
10031
10031
|
var import_react71 = require("react");
|
|
10032
|
-
var
|
|
10032
|
+
var import_image_editor19 = require("@pixerate/editor/image-editor");
|
|
10033
10033
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
10034
10034
|
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"}`;
|
|
10035
10035
|
var ChannelThumb = ({ channel, size }) => {
|
|
@@ -10038,7 +10038,7 @@ var ChannelThumb = ({ channel, size }) => {
|
|
|
10038
10038
|
const canvas = ref.current;
|
|
10039
10039
|
const ctx = canvas?.getContext("2d");
|
|
10040
10040
|
if (!canvas || !ctx || typeof ctx.createImageData !== "function") return;
|
|
10041
|
-
const px = (0,
|
|
10041
|
+
const px = (0, import_image_editor19.channelThumbnail)(channel, 64);
|
|
10042
10042
|
canvas.width = px.width;
|
|
10043
10043
|
canvas.height = px.height;
|
|
10044
10044
|
const img = ctx.createImageData(px.width, px.height);
|
|
@@ -10070,7 +10070,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
10070
10070
|
if (!file) return;
|
|
10071
10071
|
setError(null);
|
|
10072
10072
|
try {
|
|
10073
|
-
setActiveId((await (0,
|
|
10073
|
+
setActiveId((await (0, import_image_editor19.openMaskFile)(controller, file)).id);
|
|
10074
10074
|
} catch (err) {
|
|
10075
10075
|
setError(err instanceof Error ? err.message : String(err));
|
|
10076
10076
|
}
|
|
@@ -10089,7 +10089,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
10089
10089
|
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"}`,
|
|
10090
10090
|
onClick: (e) => {
|
|
10091
10091
|
setActiveId(c.id);
|
|
10092
|
-
attempt(() => controller.loadSelectionFromChannel(c.id, { mode: (0,
|
|
10092
|
+
attempt(() => controller.loadSelectionFromChannel(c.id, { mode: (0, import_image_editor19.selectionModeFromModifiers)(e, "replace") }));
|
|
10093
10093
|
},
|
|
10094
10094
|
onDoubleClick: () => setRenaming(c.id),
|
|
10095
10095
|
children: [
|
|
@@ -10155,7 +10155,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
10155
10155
|
className: btn2(),
|
|
10156
10156
|
disabled: !active && !hasSelection,
|
|
10157
10157
|
title: active ? "Save the channel as a greyscale PNG" : "Save the selection as a greyscale PNG",
|
|
10158
|
-
onClick: () => attempt(() => (0,
|
|
10158
|
+
onClick: () => attempt(() => (0, import_image_editor19.downloadMaskImage)(controller, active ? { channelId: active.id } : "selection", active?.name ?? "selection")),
|
|
10159
10159
|
children: "Export PNG"
|
|
10160
10160
|
}
|
|
10161
10161
|
),
|
|
@@ -10164,7 +10164,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
10164
10164
|
{
|
|
10165
10165
|
ref: fileInput,
|
|
10166
10166
|
type: "file",
|
|
10167
|
-
accept:
|
|
10167
|
+
accept: import_image_editor19.MASK_FILE_ACCEPT,
|
|
10168
10168
|
hidden: true,
|
|
10169
10169
|
"data-testid": "channel-import-input",
|
|
10170
10170
|
onChange: (e) => {
|
|
@@ -10180,7 +10180,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
10180
10180
|
|
|
10181
10181
|
// src/image-editor/PathsPanel.tsx
|
|
10182
10182
|
var import_react72 = require("react");
|
|
10183
|
-
var
|
|
10183
|
+
var import_image_editor20 = require("@pixerate/editor/image-editor");
|
|
10184
10184
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
10185
10185
|
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"}`;
|
|
10186
10186
|
var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
@@ -10217,7 +10217,7 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
10217
10217
|
onClick: () => attempt(() => controller.setActivePath(p.id)),
|
|
10218
10218
|
onDoubleClick: () => setRenaming(p.id),
|
|
10219
10219
|
children: [
|
|
10220
|
-
/* @__PURE__ */ (0, import_jsx_runtime53.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_runtime53.jsx)("path", { d: (0,
|
|
10220
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.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_runtime53.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" }) }),
|
|
10221
10221
|
renaming === p.id ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10222
10222
|
"input",
|
|
10223
10223
|
{
|
|
@@ -10250,7 +10250,7 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
10250
10250
|
className: btn3(),
|
|
10251
10251
|
disabled: !active,
|
|
10252
10252
|
title: "Load the path as the selection (Shift adds, Alt subtracts)",
|
|
10253
|
-
onClick: (e) => attempt(() => controller.loadPathAsSelection(active.id, { mode: (0,
|
|
10253
|
+
onClick: (e) => attempt(() => controller.loadPathAsSelection(active.id, { mode: (0, import_image_editor20.selectionModeFromModifiers)(e, "replace") })),
|
|
10254
10254
|
children: "Load as Selection"
|
|
10255
10255
|
}
|
|
10256
10256
|
),
|
|
@@ -10290,7 +10290,7 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
10290
10290
|
|
|
10291
10291
|
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
10292
10292
|
var import_react73 = require("react");
|
|
10293
|
-
var
|
|
10293
|
+
var import_image_editor21 = require("@pixerate/editor/image-editor");
|
|
10294
10294
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
10295
10295
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
10296
10296
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
@@ -10308,12 +10308,12 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
10308
10308
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
10309
10309
|
};
|
|
10310
10310
|
return /* @__PURE__ */ (0, import_jsx_runtime54.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: [
|
|
10311
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children:
|
|
10312
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children:
|
|
10311
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.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_runtime54.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)) }),
|
|
10312
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.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_runtime54.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)) }),
|
|
10313
10313
|
tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
10314
10314
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10315
10315
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
10316
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children:
|
|
10316
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.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_runtime54.jsx)("option", { value: o.id, children: o.label }, o.id)) })
|
|
10317
10317
|
] }),
|
|
10318
10318
|
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10319
10319
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
@@ -10358,18 +10358,18 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
10358
10358
|
"select",
|
|
10359
10359
|
{
|
|
10360
10360
|
"aria-label": "Warp grid",
|
|
10361
|
-
value:
|
|
10361
|
+
value: import_image_editor21.WARP_GRID_OPTIONS.find((g) => g.columns === warp.columns && g.rows === warp.rows)?.id ?? "1x1",
|
|
10362
10362
|
onChange: (e) => {
|
|
10363
|
-
const g =
|
|
10363
|
+
const g = import_image_editor21.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
|
|
10364
10364
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
10365
10365
|
},
|
|
10366
10366
|
className: imageFieldClass,
|
|
10367
|
-
children:
|
|
10367
|
+
children: import_image_editor21.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("option", { value: g.id, children: g.label }, g.id))
|
|
10368
10368
|
}
|
|
10369
10369
|
)
|
|
10370
10370
|
] })
|
|
10371
10371
|
] }),
|
|
10372
|
-
tool.mode !== "warp" &&
|
|
10372
|
+
tool.mode !== "warp" && import_image_editor21.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
10373
10373
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-muted-foreground", children: f.label }),
|
|
10374
10374
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10375
10375
|
"input",
|
|
@@ -10416,7 +10416,7 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
10416
10416
|
value: tool.interpolation,
|
|
10417
10417
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
10418
10418
|
className: imageFieldClass,
|
|
10419
|
-
children:
|
|
10419
|
+
children: import_image_editor21.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
10420
10420
|
}
|
|
10421
10421
|
)
|
|
10422
10422
|
] }),
|
|
@@ -10428,7 +10428,7 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
10428
10428
|
|
|
10429
10429
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
10430
10430
|
var import_react74 = require("react");
|
|
10431
|
-
var
|
|
10431
|
+
var import_image_editor22 = require("@pixerate/editor/image-editor");
|
|
10432
10432
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
10433
10433
|
var ShapeOptionsBar = ({ controller, options, onChange, showTools = true, className }) => {
|
|
10434
10434
|
const [, setTick] = (0, import_react74.useState)(0);
|
|
@@ -10441,14 +10441,14 @@ var ShapeOptionsBar = ({ controller, options, onChange, showTools = true, classN
|
|
|
10441
10441
|
if (!shapeId) return;
|
|
10442
10442
|
try {
|
|
10443
10443
|
setError(null);
|
|
10444
|
-
(0,
|
|
10444
|
+
(0, import_image_editor22.applyShapeOptions)(controller, shapeId, change);
|
|
10445
10445
|
} catch (e) {
|
|
10446
10446
|
setError(e instanceof Error ? e.message : String(e));
|
|
10447
10447
|
}
|
|
10448
10448
|
};
|
|
10449
10449
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
10450
10450
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
10451
|
-
showTools && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children:
|
|
10451
|
+
showTools && /* @__PURE__ */ (0, import_jsx_runtime55.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_runtime55.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)) }),
|
|
10452
10452
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
10453
10453
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10454
10454
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
|
|
@@ -10513,7 +10513,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, showTools = true, classN
|
|
|
10513
10513
|
|
|
10514
10514
|
// src/image-editor/TypeOptionsBar.tsx
|
|
10515
10515
|
var import_react75 = require("react");
|
|
10516
|
-
var
|
|
10516
|
+
var import_image_editor23 = require("@pixerate/editor/image-editor");
|
|
10517
10517
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
10518
10518
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
10519
10519
|
var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
|
|
@@ -10609,9 +10609,9 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
10609
10609
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
10610
10610
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
|
|
10611
10611
|
] }),
|
|
10612
|
-
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children:
|
|
10612
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor23.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
10613
10613
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
|
|
10614
|
-
|
|
10614
|
+
import_image_editor23.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
|
|
10615
10615
|
orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
10616
10616
|
"button",
|
|
10617
10617
|
{
|
|
@@ -10660,7 +10660,7 @@ var ImageEditor = ({
|
|
|
10660
10660
|
const effectsShown = !!controller.effectsProvider || state.layers.some(function has(l) {
|
|
10661
10661
|
return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
|
|
10662
10662
|
});
|
|
10663
|
-
const legacyProcess = (0,
|
|
10663
|
+
const legacyProcess = (0, import_image_editor24.normalizeProcessVersion)(state.adjustments.process) < import_image_editor24.LATEST_PROCESS_VERSION;
|
|
10664
10664
|
const [activeTab, setActiveTab] = (0, import_react76.useState)("crop");
|
|
10665
10665
|
const rootRef = (0, import_react76.useRef)(null);
|
|
10666
10666
|
const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
|
|
@@ -10672,9 +10672,9 @@ var ImageEditor = ({
|
|
|
10672
10672
|
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
10673
10673
|
};
|
|
10674
10674
|
const [activeCropRatio, setActiveCropRatio] = (0, import_react76.useState)(null);
|
|
10675
|
-
const [selectionOptions, setSelectionOptions] = (0, import_react76.useState)(
|
|
10676
|
-
const [shapeOptions, setShapeOptions] = (0, import_react76.useState)(
|
|
10677
|
-
const [typeOptions, setTypeOptions] = (0, import_react76.useState)(
|
|
10675
|
+
const [selectionOptions, setSelectionOptions] = (0, import_react76.useState)(import_image_editor24.DEFAULT_SELECTION_TOOL_OPTIONS);
|
|
10676
|
+
const [shapeOptions, setShapeOptions] = (0, import_react76.useState)(import_image_editor24.DEFAULT_SHAPE_TOOL_OPTIONS);
|
|
10677
|
+
const [typeOptions, setTypeOptions] = (0, import_react76.useState)(import_image_editor24.DEFAULT_TYPE_TOOL_OPTIONS);
|
|
10678
10678
|
const [typeSession, setTypeSession] = (0, import_react76.useState)(null);
|
|
10679
10679
|
const [selectionError, setSelectionError] = (0, import_react76.useState)(null);
|
|
10680
10680
|
const [paintError, setPaintError] = (0, import_react76.useState)(null);
|
|
@@ -10689,7 +10689,7 @@ var ImageEditor = ({
|
|
|
10689
10689
|
const transformControllerRef = (0, import_react76.useRef)(controller);
|
|
10690
10690
|
if (!transformToolRef.current || transformControllerRef.current !== controller) {
|
|
10691
10691
|
transformToolRef.current?.cancel();
|
|
10692
|
-
transformToolRef.current = new
|
|
10692
|
+
transformToolRef.current = new import_image_editor24.FreeTransformTool(controller, {
|
|
10693
10693
|
schedule: (run) => typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame(run) : run()
|
|
10694
10694
|
});
|
|
10695
10695
|
transformControllerRef.current = controller;
|
|
@@ -11171,12 +11171,12 @@ var ImageEditor = ({
|
|
|
11171
11171
|
)
|
|
11172
11172
|
] }),
|
|
11173
11173
|
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Histogram, { histogram: editor.histogram }),
|
|
11174
|
-
|
|
11174
|
+
import_image_editor24.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_react76.default.Fragment, { children: [
|
|
11175
11175
|
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
11176
11176
|
ControlSlider,
|
|
11177
11177
|
{
|
|
11178
11178
|
spec,
|
|
11179
|
-
value: (0,
|
|
11179
|
+
value: (0, import_image_editor24.readAdjustmentControls)(state.adjustments)[spec.id],
|
|
11180
11180
|
disabled: spec.requiresProcess !== void 0 && legacyProcess,
|
|
11181
11181
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
11182
11182
|
}
|
|
@@ -11254,7 +11254,7 @@ var ImageEditor = ({
|
|
|
11254
11254
|
"aria-pressed": state.activeTool === t,
|
|
11255
11255
|
onClick: () => editor.setTool(t),
|
|
11256
11256
|
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"}`,
|
|
11257
|
-
children: (0,
|
|
11257
|
+
children: (0, import_image_editor24.imageToolLabel)(t)
|
|
11258
11258
|
},
|
|
11259
11259
|
t
|
|
11260
11260
|
)) }),
|