@pixerate/editor-react 0.123.0 → 0.125.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-UNKMMYPZ.js → chunk-FS5J4CY3.js} +24 -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 +21 -2
- package/dist/image-editor/index.js +1 -1
- package/dist/index.cjs +21 -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
|
}
|
|
@@ -1654,6 +1655,8 @@ import {
|
|
|
1654
1655
|
dropPlacement,
|
|
1655
1656
|
dropZone,
|
|
1656
1657
|
maskThumbnailClick,
|
|
1658
|
+
vectorMaskThumbnail,
|
|
1659
|
+
vectorMaskThumbnailClick,
|
|
1657
1660
|
layerThumbnailClick,
|
|
1658
1661
|
openPsdFile,
|
|
1659
1662
|
layerBadge,
|
|
@@ -1670,6 +1673,7 @@ var Thumbnail = ({
|
|
|
1670
1673
|
pixels,
|
|
1671
1674
|
size,
|
|
1672
1675
|
label,
|
|
1676
|
+
title,
|
|
1673
1677
|
onClick,
|
|
1674
1678
|
selected,
|
|
1675
1679
|
testId
|
|
@@ -1691,6 +1695,7 @@ var Thumbnail = ({
|
|
|
1691
1695
|
ref,
|
|
1692
1696
|
role: onClick ? "button" : "img",
|
|
1693
1697
|
"aria-label": label,
|
|
1698
|
+
title,
|
|
1694
1699
|
"data-testid": testId,
|
|
1695
1700
|
onClick,
|
|
1696
1701
|
style: { width: size, height: size },
|
|
@@ -1717,6 +1722,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1717
1722
|
};
|
|
1718
1723
|
const commitNext = useRef5(true);
|
|
1719
1724
|
const state = controller.getState();
|
|
1725
|
+
const maskView = controller.getMaskView();
|
|
1720
1726
|
const rows = layerPanelRows(state.layers, state.activeLayerId);
|
|
1721
1727
|
const active = controller.getActiveLayer();
|
|
1722
1728
|
const attempt = (fn) => {
|
|
@@ -1752,6 +1758,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1752
1758
|
};
|
|
1753
1759
|
const thumb = (layer) => layerHasThumbnail(layer) ? controller.getLayerThumbnail(layer.id, { maxSide: 64 }) : null;
|
|
1754
1760
|
const maskThumb = (layer) => layer.mask && !layer.mask.source ? controller.getLayerThumbnail(layer.id, { maxSide: 64, mask: true }) : null;
|
|
1761
|
+
const vectorThumb = (layer) => layer.vectorMask ? vectorMaskThumbnail(layer.vectorMask, state.imageDimensions.width, state.imageDimensions.height, 64) : null;
|
|
1755
1762
|
const locked = (layer) => Boolean(layer.locks?.all || layer.locks?.pixels || layer.locks?.position || layer.locks?.transparency);
|
|
1756
1763
|
return /* @__PURE__ */ jsxs8("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "layers-panel", onClick: () => menu && setMenu(null), children: [
|
|
1757
1764
|
/* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap items-center gap-1", role: "toolbar", "aria-label": "Layer actions", children: [
|
|
@@ -2008,7 +2015,8 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2008
2015
|
{
|
|
2009
2016
|
pixels: maskThumb(layer),
|
|
2010
2017
|
size: thumbnailSize,
|
|
2011
|
-
label: `${row.label} mask${layer.mask.enabled === false ? " (disabled)" : ""}`,
|
|
2018
|
+
label: `${row.label} mask${layer.mask.enabled === false ? " (disabled)" : ""}${maskView?.layerId === layer.id ? " (shown)" : ""}`,
|
|
2019
|
+
title: "Alt-click: show the mask alone \xB7 Alt+Shift-click: as an overlay",
|
|
2012
2020
|
testId: "layer-mask-thumbnail",
|
|
2013
2021
|
selected: row.active && state.activeTarget === "mask",
|
|
2014
2022
|
onClick: (e) => {
|
|
@@ -2017,6 +2025,20 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2017
2025
|
}
|
|
2018
2026
|
}
|
|
2019
2027
|
),
|
|
2028
|
+
layer.vectorMask && /* @__PURE__ */ jsx8(
|
|
2029
|
+
Thumbnail,
|
|
2030
|
+
{
|
|
2031
|
+
pixels: vectorThumb(layer),
|
|
2032
|
+
size: thumbnailSize,
|
|
2033
|
+
label: `${row.label} vector mask${layer.vectorMask.enabled === false ? " (disabled)" : ""}`,
|
|
2034
|
+
title: "Ctrl/\u2318-click: load the path as the selection \xB7 Shift-click: turn it off or on",
|
|
2035
|
+
testId: "layer-vector-mask-thumbnail",
|
|
2036
|
+
onClick: (e) => {
|
|
2037
|
+
e.stopPropagation();
|
|
2038
|
+
attempt(() => vectorMaskThumbnailClick(controller, layer, e));
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
),
|
|
2020
2042
|
renaming === layer.id ? /* @__PURE__ */ jsx8(
|
|
2021
2043
|
"input",
|
|
2022
2044
|
{
|
|
@@ -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) => {
|
|
@@ -1818,6 +1821,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1818
1821
|
};
|
|
1819
1822
|
const thumb = (layer) => (0, import_image_editor8.layerHasThumbnail)(layer) ? controller.getLayerThumbnail(layer.id, { maxSide: 64 }) : null;
|
|
1820
1823
|
const maskThumb = (layer) => layer.mask && !layer.mask.source ? controller.getLayerThumbnail(layer.id, { maxSide: 64, mask: true }) : null;
|
|
1824
|
+
const vectorThumb = (layer) => layer.vectorMask ? (0, import_image_editor8.vectorMaskThumbnail)(layer.vectorMask, state.imageDimensions.width, state.imageDimensions.height, 64) : null;
|
|
1821
1825
|
const locked = (layer) => Boolean(layer.locks?.all || layer.locks?.pixels || layer.locks?.position || layer.locks?.transparency);
|
|
1822
1826
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "layers-panel", onClick: () => menu && setMenu(null), children: [
|
|
1823
1827
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "toolbar", "aria-label": "Layer actions", children: [
|
|
@@ -2074,7 +2078,8 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2074
2078
|
{
|
|
2075
2079
|
pixels: maskThumb(layer),
|
|
2076
2080
|
size: thumbnailSize,
|
|
2077
|
-
label: `${row.label} mask${layer.mask.enabled === false ? " (disabled)" : ""}`,
|
|
2081
|
+
label: `${row.label} mask${layer.mask.enabled === false ? " (disabled)" : ""}${maskView?.layerId === layer.id ? " (shown)" : ""}`,
|
|
2082
|
+
title: "Alt-click: show the mask alone \xB7 Alt+Shift-click: as an overlay",
|
|
2078
2083
|
testId: "layer-mask-thumbnail",
|
|
2079
2084
|
selected: row.active && state.activeTarget === "mask",
|
|
2080
2085
|
onClick: (e) => {
|
|
@@ -2083,6 +2088,20 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2083
2088
|
}
|
|
2084
2089
|
}
|
|
2085
2090
|
),
|
|
2091
|
+
layer.vectorMask && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2092
|
+
Thumbnail,
|
|
2093
|
+
{
|
|
2094
|
+
pixels: vectorThumb(layer),
|
|
2095
|
+
size: thumbnailSize,
|
|
2096
|
+
label: `${row.label} vector mask${layer.vectorMask.enabled === false ? " (disabled)" : ""}`,
|
|
2097
|
+
title: "Ctrl/\u2318-click: load the path as the selection \xB7 Shift-click: turn it off or on",
|
|
2098
|
+
testId: "layer-vector-mask-thumbnail",
|
|
2099
|
+
onClick: (e) => {
|
|
2100
|
+
e.stopPropagation();
|
|
2101
|
+
attempt(() => (0, import_image_editor8.vectorMaskThumbnailClick)(controller, layer, e));
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2104
|
+
),
|
|
2086
2105
|
renaming === layer.id ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2087
2106
|
"input",
|
|
2088
2107
|
{
|
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) => {
|
|
@@ -5532,6 +5535,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5532
5535
|
};
|
|
5533
5536
|
const thumb = (layer) => (0, import_image_editor8.layerHasThumbnail)(layer) ? controller.getLayerThumbnail(layer.id, { maxSide: 64 }) : null;
|
|
5534
5537
|
const maskThumb = (layer) => layer.mask && !layer.mask.source ? controller.getLayerThumbnail(layer.id, { maxSide: 64, mask: true }) : null;
|
|
5538
|
+
const vectorThumb = (layer) => layer.vectorMask ? (0, import_image_editor8.vectorMaskThumbnail)(layer.vectorMask, state.imageDimensions.width, state.imageDimensions.height, 64) : null;
|
|
5535
5539
|
const locked = (layer) => Boolean(layer.locks?.all || layer.locks?.pixels || layer.locks?.position || layer.locks?.transparency);
|
|
5536
5540
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "layers-panel", onClick: () => menu && setMenu(null), children: [
|
|
5537
5541
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "toolbar", "aria-label": "Layer actions", children: [
|
|
@@ -5788,7 +5792,8 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5788
5792
|
{
|
|
5789
5793
|
pixels: maskThumb(layer),
|
|
5790
5794
|
size: thumbnailSize,
|
|
5791
|
-
label: `${row.label} mask${layer.mask.enabled === false ? " (disabled)" : ""}`,
|
|
5795
|
+
label: `${row.label} mask${layer.mask.enabled === false ? " (disabled)" : ""}${maskView?.layerId === layer.id ? " (shown)" : ""}`,
|
|
5796
|
+
title: "Alt-click: show the mask alone \xB7 Alt+Shift-click: as an overlay",
|
|
5792
5797
|
testId: "layer-mask-thumbnail",
|
|
5793
5798
|
selected: row.active && state.activeTarget === "mask",
|
|
5794
5799
|
onClick: (e) => {
|
|
@@ -5797,6 +5802,20 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5797
5802
|
}
|
|
5798
5803
|
}
|
|
5799
5804
|
),
|
|
5805
|
+
layer.vectorMask && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5806
|
+
Thumbnail,
|
|
5807
|
+
{
|
|
5808
|
+
pixels: vectorThumb(layer),
|
|
5809
|
+
size: thumbnailSize,
|
|
5810
|
+
label: `${row.label} vector mask${layer.vectorMask.enabled === false ? " (disabled)" : ""}`,
|
|
5811
|
+
title: "Ctrl/\u2318-click: load the path as the selection \xB7 Shift-click: turn it off or on",
|
|
5812
|
+
testId: "layer-vector-mask-thumbnail",
|
|
5813
|
+
onClick: (e) => {
|
|
5814
|
+
e.stopPropagation();
|
|
5815
|
+
attempt(() => (0, import_image_editor8.vectorMaskThumbnailClick)(controller, layer, e));
|
|
5816
|
+
}
|
|
5817
|
+
}
|
|
5818
|
+
),
|
|
5800
5819
|
renaming === layer.id ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5801
5820
|
"input",
|
|
5802
5821
|
{
|
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.125.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.190.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.190.0"
|
|
309
309
|
},
|
|
310
310
|
"scripts": {
|
|
311
311
|
"build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",
|