@pixerate/editor-react 0.122.0 → 0.124.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-VR3JON4V.js → chunk-Y7AFHOHY.js} +44 -3
- package/dist/image-editor/ChannelsPanel.d.cts +3 -2
- package/dist/image-editor/ChannelsPanel.d.ts +3 -2
- package/dist/image-editor/LayersPanel.d.cts +1 -1
- package/dist/image-editor/LayersPanel.d.ts +1 -1
- package/dist/image-editor/index.cjs +42 -2
- package/dist/image-editor/index.js +1 -1
- package/dist/index.cjs +42 -2
- package/dist/index.js +1 -1
- package/package.json +3 -3
|
@@ -225,6 +225,7 @@ import {
|
|
|
225
225
|
startMarchingAnts,
|
|
226
226
|
handleSelectionShortcut,
|
|
227
227
|
handleQuickMaskKey,
|
|
228
|
+
handleMaskViewKey,
|
|
228
229
|
ShapeDrawGesture,
|
|
229
230
|
TypeToolGesture,
|
|
230
231
|
DEFAULT_SHAPE_TOOL_OPTIONS,
|
|
@@ -602,7 +603,7 @@ var ImageEditorCanvas = ({
|
|
|
602
603
|
if (target?.closest?.('input, textarea, select, [contenteditable="true"]')) return;
|
|
603
604
|
if (window.getSelection?.()?.toString()) return;
|
|
604
605
|
const gesture = selectionGestureRef.current;
|
|
605
|
-
if (handleQuickMaskKey(controller, e)) {
|
|
606
|
+
if (handleQuickMaskKey(controller, e) || handleMaskViewKey(controller, e)) {
|
|
606
607
|
e.preventDefault();
|
|
607
608
|
return;
|
|
608
609
|
}
|
|
@@ -1670,6 +1671,7 @@ var Thumbnail = ({
|
|
|
1670
1671
|
pixels,
|
|
1671
1672
|
size,
|
|
1672
1673
|
label,
|
|
1674
|
+
title,
|
|
1673
1675
|
onClick,
|
|
1674
1676
|
selected,
|
|
1675
1677
|
testId
|
|
@@ -1691,6 +1693,7 @@ var Thumbnail = ({
|
|
|
1691
1693
|
ref,
|
|
1692
1694
|
role: onClick ? "button" : "img",
|
|
1693
1695
|
"aria-label": label,
|
|
1696
|
+
title,
|
|
1694
1697
|
"data-testid": testId,
|
|
1695
1698
|
onClick,
|
|
1696
1699
|
style: { width: size, height: size },
|
|
@@ -1717,6 +1720,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1717
1720
|
};
|
|
1718
1721
|
const commitNext = useRef5(true);
|
|
1719
1722
|
const state = controller.getState();
|
|
1723
|
+
const maskView = controller.getMaskView();
|
|
1720
1724
|
const rows = layerPanelRows(state.layers, state.activeLayerId);
|
|
1721
1725
|
const active = controller.getActiveLayer();
|
|
1722
1726
|
const attempt = (fn) => {
|
|
@@ -2008,7 +2012,8 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2008
2012
|
{
|
|
2009
2013
|
pixels: maskThumb(layer),
|
|
2010
2014
|
size: thumbnailSize,
|
|
2011
|
-
label: `${row.label} mask${layer.mask.enabled === false ? " (disabled)" : ""}`,
|
|
2015
|
+
label: `${row.label} mask${layer.mask.enabled === false ? " (disabled)" : ""}${maskView?.layerId === layer.id ? " (shown)" : ""}`,
|
|
2016
|
+
title: "Alt-click: show the mask alone \xB7 Alt+Shift-click: as an overlay",
|
|
2012
2017
|
testId: "layer-mask-thumbnail",
|
|
2013
2018
|
selected: row.active && state.activeTarget === "mask",
|
|
2014
2019
|
onClick: (e) => {
|
|
@@ -3114,7 +3119,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3114
3119
|
|
|
3115
3120
|
// src/image-editor/ChannelsPanel.tsx
|
|
3116
3121
|
import { useEffect as useEffect10, useRef as useRef7, useState as useState13 } from "react";
|
|
3117
|
-
import { channelThumbnail, selectionModeFromModifiers } from "@pixerate/editor/image-editor";
|
|
3122
|
+
import { MASK_FILE_ACCEPT, channelThumbnail, downloadMaskImage, openMaskFile, selectionModeFromModifiers } from "@pixerate/editor/image-editor";
|
|
3118
3123
|
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3119
3124
|
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"}`;
|
|
3120
3125
|
var ChannelThumb = ({ channel, size }) => {
|
|
@@ -3138,6 +3143,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
3138
3143
|
const [activeId, setActiveId] = useState13(null);
|
|
3139
3144
|
const [renaming, setRenaming] = useState13(null);
|
|
3140
3145
|
const [error, setError] = useState13(null);
|
|
3146
|
+
const fileInput = useRef7(null);
|
|
3141
3147
|
const channels = controller.getChannels();
|
|
3142
3148
|
const active = channels.find((c) => c.id === activeId) ?? null;
|
|
3143
3149
|
const hasSelection = Boolean(controller.getSelection());
|
|
@@ -3150,6 +3156,15 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
3150
3156
|
setError(err instanceof Error ? err.message : String(err));
|
|
3151
3157
|
}
|
|
3152
3158
|
};
|
|
3159
|
+
const importFile = async (file) => {
|
|
3160
|
+
if (!file) return;
|
|
3161
|
+
setError(null);
|
|
3162
|
+
try {
|
|
3163
|
+
setActiveId((await openMaskFile(controller, file)).id);
|
|
3164
|
+
} catch (err) {
|
|
3165
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
3166
|
+
}
|
|
3167
|
+
};
|
|
3153
3168
|
return /* @__PURE__ */ jsxs15("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
|
|
3154
3169
|
/* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between", children: [
|
|
3155
3170
|
/* @__PURE__ */ jsx17("span", { className: imageSectionTitleClass, children: "Channels" }),
|
|
@@ -3221,6 +3236,32 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
3221
3236
|
}),
|
|
3222
3237
|
children: "Delete"
|
|
3223
3238
|
}
|
|
3239
|
+
),
|
|
3240
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
|
|
3241
|
+
/* @__PURE__ */ jsx17(
|
|
3242
|
+
"button",
|
|
3243
|
+
{
|
|
3244
|
+
type: "button",
|
|
3245
|
+
className: btn2(),
|
|
3246
|
+
disabled: !active && !hasSelection,
|
|
3247
|
+
title: active ? "Save the channel as a greyscale PNG" : "Save the selection as a greyscale PNG",
|
|
3248
|
+
onClick: () => attempt(() => downloadMaskImage(controller, active ? { channelId: active.id } : "selection", active?.name ?? "selection")),
|
|
3249
|
+
children: "Export PNG"
|
|
3250
|
+
}
|
|
3251
|
+
),
|
|
3252
|
+
/* @__PURE__ */ jsx17(
|
|
3253
|
+
"input",
|
|
3254
|
+
{
|
|
3255
|
+
ref: fileInput,
|
|
3256
|
+
type: "file",
|
|
3257
|
+
accept: MASK_FILE_ACCEPT,
|
|
3258
|
+
hidden: true,
|
|
3259
|
+
"data-testid": "channel-import-input",
|
|
3260
|
+
onChange: (e) => {
|
|
3261
|
+
void importFile(e.currentTarget.files?.[0]);
|
|
3262
|
+
e.currentTarget.value = "";
|
|
3263
|
+
}
|
|
3264
|
+
}
|
|
3224
3265
|
)
|
|
3225
3266
|
] }),
|
|
3226
3267
|
error && /* @__PURE__ */ jsx17("p", { role: "alert", className: "text-destructive", children: error })
|
|
@@ -9,7 +9,8 @@ export interface ChannelsPanelProps {
|
|
|
9
9
|
/**
|
|
10
10
|
* The Channels panel: the alpha channels (saved selections) with thumbnails, an eye to show
|
|
11
11
|
* each as a tint, click to load it as the selection (Shift adds, Alt subtracts, both
|
|
12
|
-
* intersect), double-click to rename; Save Selection, Duplicate and Delete;
|
|
13
|
-
*
|
|
12
|
+
* intersect), double-click to rename; Save Selection, Duplicate and Delete; Import (a mask
|
|
13
|
+
* image into a new channel) and Export PNG (the active channel, else the selection); and the
|
|
14
|
+
* Quick Mask mode switch (Q on the canvas). Every change is one undo step on the controller.
|
|
14
15
|
*/
|
|
15
16
|
export declare const ChannelsPanel: React.FC<ChannelsPanelProps>;
|
|
@@ -9,7 +9,8 @@ export interface ChannelsPanelProps {
|
|
|
9
9
|
/**
|
|
10
10
|
* The Channels panel: the alpha channels (saved selections) with thumbnails, an eye to show
|
|
11
11
|
* each as a tint, click to load it as the selection (Shift adds, Alt subtracts, both
|
|
12
|
-
* intersect), double-click to rename; Save Selection, Duplicate and Delete;
|
|
13
|
-
*
|
|
12
|
+
* intersect), double-click to rename; Save Selection, Duplicate and Delete; Import (a mask
|
|
13
|
+
* image into a new channel) and Export PNG (the active channel, else the selection); and the
|
|
14
|
+
* Quick Mask mode switch (Q on the canvas). Every change is one undo step on the controller.
|
|
14
15
|
*/
|
|
15
16
|
export declare const ChannelsPanel: React.FC<ChannelsPanelProps>;
|
|
@@ -15,7 +15,7 @@ export interface LayersPanelProps {
|
|
|
15
15
|
/**
|
|
16
16
|
* The layer stack, top first: visibility, thumbnails, names (double-click to rename), locks,
|
|
17
17
|
* mask thumbnails (click to paint the mask, Shift-click to disable it, Ctrl/⌘-click to load it
|
|
18
|
-
* as the selection; Ctrl/⌘-click a layer thumbnail to select its pixels), drag to reorder or drop
|
|
18
|
+
* as the selection, Alt-click to show it alone in grey, Alt+Shift-click as a red overlay; Ctrl/⌘-click a layer thumbnail to select its pixels), drag to reorder or drop
|
|
19
19
|
* into a group, opacity / fill / blend / clipping for the active layer, and the layer menu
|
|
20
20
|
* (right-click a row, or the ⋯ button), an fx badge on rows with effects (click to switch them
|
|
21
21
|
* on or off) and the active layer's effects. Every action is one undo step on the controller.
|
|
@@ -15,7 +15,7 @@ export interface LayersPanelProps {
|
|
|
15
15
|
/**
|
|
16
16
|
* The layer stack, top first: visibility, thumbnails, names (double-click to rename), locks,
|
|
17
17
|
* mask thumbnails (click to paint the mask, Shift-click to disable it, Ctrl/⌘-click to load it
|
|
18
|
-
* as the selection; Ctrl/⌘-click a layer thumbnail to select its pixels), drag to reorder or drop
|
|
18
|
+
* as the selection, Alt-click to show it alone in grey, Alt+Shift-click as a red overlay; Ctrl/⌘-click a layer thumbnail to select its pixels), drag to reorder or drop
|
|
19
19
|
* into a group, opacity / fill / blend / clipping for the active layer, and the layer menu
|
|
20
20
|
* (right-click a row, or the ⋯ button), an fx badge on rows with effects (click to switch them
|
|
21
21
|
* on or off) and the active layer's effects. Every action is one undo step on the controller.
|
|
@@ -704,7 +704,7 @@ var ImageEditorCanvas = ({
|
|
|
704
704
|
if (target?.closest?.('input, textarea, select, [contenteditable="true"]')) return;
|
|
705
705
|
if (window.getSelection?.()?.toString()) return;
|
|
706
706
|
const gesture = selectionGestureRef.current;
|
|
707
|
-
if ((0, import_image_editor2.handleQuickMaskKey)(controller, e)) {
|
|
707
|
+
if ((0, import_image_editor2.handleQuickMaskKey)(controller, e) || (0, import_image_editor2.handleMaskViewKey)(controller, e)) {
|
|
708
708
|
e.preventDefault();
|
|
709
709
|
return;
|
|
710
710
|
}
|
|
@@ -1736,6 +1736,7 @@ var Thumbnail = ({
|
|
|
1736
1736
|
pixels,
|
|
1737
1737
|
size,
|
|
1738
1738
|
label,
|
|
1739
|
+
title,
|
|
1739
1740
|
onClick,
|
|
1740
1741
|
selected,
|
|
1741
1742
|
testId
|
|
@@ -1757,6 +1758,7 @@ var Thumbnail = ({
|
|
|
1757
1758
|
ref,
|
|
1758
1759
|
role: onClick ? "button" : "img",
|
|
1759
1760
|
"aria-label": label,
|
|
1761
|
+
title,
|
|
1760
1762
|
"data-testid": testId,
|
|
1761
1763
|
onClick,
|
|
1762
1764
|
style: { width: size, height: size },
|
|
@@ -1783,6 +1785,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1783
1785
|
};
|
|
1784
1786
|
const commitNext = (0, import_react11.useRef)(true);
|
|
1785
1787
|
const state = controller.getState();
|
|
1788
|
+
const maskView = controller.getMaskView();
|
|
1786
1789
|
const rows = (0, import_image_editor8.layerPanelRows)(state.layers, state.activeLayerId);
|
|
1787
1790
|
const active = controller.getActiveLayer();
|
|
1788
1791
|
const attempt = (fn) => {
|
|
@@ -2074,7 +2077,8 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2074
2077
|
{
|
|
2075
2078
|
pixels: maskThumb(layer),
|
|
2076
2079
|
size: thumbnailSize,
|
|
2077
|
-
label: `${row.label} mask${layer.mask.enabled === false ? " (disabled)" : ""}`,
|
|
2080
|
+
label: `${row.label} mask${layer.mask.enabled === false ? " (disabled)" : ""}${maskView?.layerId === layer.id ? " (shown)" : ""}`,
|
|
2081
|
+
title: "Alt-click: show the mask alone \xB7 Alt+Shift-click: as an overlay",
|
|
2078
2082
|
testId: "layer-mask-thumbnail",
|
|
2079
2083
|
selected: row.active && state.activeTarget === "mask",
|
|
2080
2084
|
onClick: (e) => {
|
|
@@ -5067,6 +5071,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5067
5071
|
const [activeId, setActiveId] = (0, import_react27.useState)(null);
|
|
5068
5072
|
const [renaming, setRenaming] = (0, import_react27.useState)(null);
|
|
5069
5073
|
const [error, setError] = (0, import_react27.useState)(null);
|
|
5074
|
+
const fileInput = (0, import_react27.useRef)(null);
|
|
5070
5075
|
const channels = controller.getChannels();
|
|
5071
5076
|
const active = channels.find((c) => c.id === activeId) ?? null;
|
|
5072
5077
|
const hasSelection = Boolean(controller.getSelection());
|
|
@@ -5079,6 +5084,15 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5079
5084
|
setError(err instanceof Error ? err.message : String(err));
|
|
5080
5085
|
}
|
|
5081
5086
|
};
|
|
5087
|
+
const importFile = async (file) => {
|
|
5088
|
+
if (!file) return;
|
|
5089
|
+
setError(null);
|
|
5090
|
+
try {
|
|
5091
|
+
setActiveId((await (0, import_image_editor16.openMaskFile)(controller, file)).id);
|
|
5092
|
+
} catch (err) {
|
|
5093
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
5094
|
+
}
|
|
5095
|
+
};
|
|
5082
5096
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
|
|
5083
5097
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5084
5098
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
|
|
@@ -5150,6 +5164,32 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5150
5164
|
}),
|
|
5151
5165
|
children: "Delete"
|
|
5152
5166
|
}
|
|
5167
|
+
),
|
|
5168
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
|
|
5169
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5170
|
+
"button",
|
|
5171
|
+
{
|
|
5172
|
+
type: "button",
|
|
5173
|
+
className: btn2(),
|
|
5174
|
+
disabled: !active && !hasSelection,
|
|
5175
|
+
title: active ? "Save the channel as a greyscale PNG" : "Save the selection as a greyscale PNG",
|
|
5176
|
+
onClick: () => attempt(() => (0, import_image_editor16.downloadMaskImage)(controller, active ? { channelId: active.id } : "selection", active?.name ?? "selection")),
|
|
5177
|
+
children: "Export PNG"
|
|
5178
|
+
}
|
|
5179
|
+
),
|
|
5180
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5181
|
+
"input",
|
|
5182
|
+
{
|
|
5183
|
+
ref: fileInput,
|
|
5184
|
+
type: "file",
|
|
5185
|
+
accept: import_image_editor16.MASK_FILE_ACCEPT,
|
|
5186
|
+
hidden: true,
|
|
5187
|
+
"data-testid": "channel-import-input",
|
|
5188
|
+
onChange: (e) => {
|
|
5189
|
+
void importFile(e.currentTarget.files?.[0]);
|
|
5190
|
+
e.currentTarget.value = "";
|
|
5191
|
+
}
|
|
5192
|
+
}
|
|
5153
5193
|
)
|
|
5154
5194
|
] }),
|
|
5155
5195
|
error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
package/dist/index.cjs
CHANGED
|
@@ -4418,7 +4418,7 @@ var ImageEditorCanvas = ({
|
|
|
4418
4418
|
if (target?.closest?.('input, textarea, select, [contenteditable="true"]')) return;
|
|
4419
4419
|
if (window.getSelection?.()?.toString()) return;
|
|
4420
4420
|
const gesture = selectionGestureRef.current;
|
|
4421
|
-
if ((0, import_image_editor2.handleQuickMaskKey)(controller, e)) {
|
|
4421
|
+
if ((0, import_image_editor2.handleQuickMaskKey)(controller, e) || (0, import_image_editor2.handleMaskViewKey)(controller, e)) {
|
|
4422
4422
|
e.preventDefault();
|
|
4423
4423
|
return;
|
|
4424
4424
|
}
|
|
@@ -5450,6 +5450,7 @@ var Thumbnail = ({
|
|
|
5450
5450
|
pixels,
|
|
5451
5451
|
size,
|
|
5452
5452
|
label,
|
|
5453
|
+
title,
|
|
5453
5454
|
onClick,
|
|
5454
5455
|
selected,
|
|
5455
5456
|
testId
|
|
@@ -5471,6 +5472,7 @@ var Thumbnail = ({
|
|
|
5471
5472
|
ref,
|
|
5472
5473
|
role: onClick ? "button" : "img",
|
|
5473
5474
|
"aria-label": label,
|
|
5475
|
+
title,
|
|
5474
5476
|
"data-testid": testId,
|
|
5475
5477
|
onClick,
|
|
5476
5478
|
style: { width: size, height: size },
|
|
@@ -5497,6 +5499,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5497
5499
|
};
|
|
5498
5500
|
const commitNext = (0, import_react47.useRef)(true);
|
|
5499
5501
|
const state = controller.getState();
|
|
5502
|
+
const maskView = controller.getMaskView();
|
|
5500
5503
|
const rows = (0, import_image_editor8.layerPanelRows)(state.layers, state.activeLayerId);
|
|
5501
5504
|
const active = controller.getActiveLayer();
|
|
5502
5505
|
const attempt = (fn) => {
|
|
@@ -5788,7 +5791,8 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5788
5791
|
{
|
|
5789
5792
|
pixels: maskThumb(layer),
|
|
5790
5793
|
size: thumbnailSize,
|
|
5791
|
-
label: `${row.label} mask${layer.mask.enabled === false ? " (disabled)" : ""}`,
|
|
5794
|
+
label: `${row.label} mask${layer.mask.enabled === false ? " (disabled)" : ""}${maskView?.layerId === layer.id ? " (shown)" : ""}`,
|
|
5795
|
+
title: "Alt-click: show the mask alone \xB7 Alt+Shift-click: as an overlay",
|
|
5792
5796
|
testId: "layer-mask-thumbnail",
|
|
5793
5797
|
selected: row.active && state.activeTarget === "mask",
|
|
5794
5798
|
onClick: (e) => {
|
|
@@ -8781,6 +8785,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
8781
8785
|
const [activeId, setActiveId] = (0, import_react63.useState)(null);
|
|
8782
8786
|
const [renaming, setRenaming] = (0, import_react63.useState)(null);
|
|
8783
8787
|
const [error, setError] = (0, import_react63.useState)(null);
|
|
8788
|
+
const fileInput = (0, import_react63.useRef)(null);
|
|
8784
8789
|
const channels = controller.getChannels();
|
|
8785
8790
|
const active = channels.find((c) => c.id === activeId) ?? null;
|
|
8786
8791
|
const hasSelection = Boolean(controller.getSelection());
|
|
@@ -8793,6 +8798,15 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
8793
8798
|
setError(err instanceof Error ? err.message : String(err));
|
|
8794
8799
|
}
|
|
8795
8800
|
};
|
|
8801
|
+
const importFile = async (file) => {
|
|
8802
|
+
if (!file) return;
|
|
8803
|
+
setError(null);
|
|
8804
|
+
try {
|
|
8805
|
+
setActiveId((await (0, import_image_editor16.openMaskFile)(controller, file)).id);
|
|
8806
|
+
} catch (err) {
|
|
8807
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
8808
|
+
}
|
|
8809
|
+
};
|
|
8796
8810
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
|
|
8797
8811
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
8798
8812
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
|
|
@@ -8864,6 +8878,32 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
8864
8878
|
}),
|
|
8865
8879
|
children: "Delete"
|
|
8866
8880
|
}
|
|
8881
|
+
),
|
|
8882
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
|
|
8883
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
8884
|
+
"button",
|
|
8885
|
+
{
|
|
8886
|
+
type: "button",
|
|
8887
|
+
className: btn2(),
|
|
8888
|
+
disabled: !active && !hasSelection,
|
|
8889
|
+
title: active ? "Save the channel as a greyscale PNG" : "Save the selection as a greyscale PNG",
|
|
8890
|
+
onClick: () => attempt(() => (0, import_image_editor16.downloadMaskImage)(controller, active ? { channelId: active.id } : "selection", active?.name ?? "selection")),
|
|
8891
|
+
children: "Export PNG"
|
|
8892
|
+
}
|
|
8893
|
+
),
|
|
8894
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
8895
|
+
"input",
|
|
8896
|
+
{
|
|
8897
|
+
ref: fileInput,
|
|
8898
|
+
type: "file",
|
|
8899
|
+
accept: import_image_editor16.MASK_FILE_ACCEPT,
|
|
8900
|
+
hidden: true,
|
|
8901
|
+
"data-testid": "channel-import-input",
|
|
8902
|
+
onChange: (e) => {
|
|
8903
|
+
void importFile(e.currentTarget.files?.[0]);
|
|
8904
|
+
e.currentTarget.value = "";
|
|
8905
|
+
}
|
|
8906
|
+
}
|
|
8867
8907
|
)
|
|
8868
8908
|
] }),
|
|
8869
8909
|
error && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixerate/editor-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.124.0",
|
|
4
4
|
"description": "React bindings and prompt/rich-text components for @pixerate/editor",
|
|
5
5
|
"author": "Pixerate",
|
|
6
6
|
"license": "MIT",
|
|
@@ -254,7 +254,7 @@
|
|
|
254
254
|
"dependencies": {},
|
|
255
255
|
"peerDependencies": {
|
|
256
256
|
"@dagrejs/dagre": "^1.1.8",
|
|
257
|
-
"@pixerate/editor": ">=0.
|
|
257
|
+
"@pixerate/editor": ">=0.189.0 <1.0.0-0",
|
|
258
258
|
"@tiptap/core": "^2.27.3",
|
|
259
259
|
"@tiptap/extension-bubble-menu": "^2.27.3",
|
|
260
260
|
"@tiptap/extension-placeholder": "^2.27.3",
|
|
@@ -305,7 +305,7 @@
|
|
|
305
305
|
"tsup": "^9.0.0",
|
|
306
306
|
"typescript": "^5.7.3",
|
|
307
307
|
"vitest": "^5.0.5",
|
|
308
|
-
"@pixerate/editor": "0.
|
|
308
|
+
"@pixerate/editor": "0.189.0"
|
|
309
309
|
},
|
|
310
310
|
"scripts": {
|
|
311
311
|
"build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",
|