@elementor/editor-canvas 4.2.0-927 → 4.2.0-928
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/index.js +269 -71
- package/dist/index.mjs +243 -45
- package/package.json +18 -18
- package/src/components/grid-outline/__tests__/grid-outline.test.tsx +62 -2
- package/src/components/grid-outline/first-empty-cell.tsx +38 -0
- package/src/components/grid-outline/grid-outline-overlay.tsx +1 -1
- package/src/components/grid-outline/grid-outline.tsx +29 -13
- package/src/hooks/use-toolbar-rect.ts +30 -0
- package/src/utils/__tests__/find-first-empty-cell.test.ts +132 -0
- package/src/utils/clip-path-cutout.ts +11 -0
- package/src/utils/find-first-empty-cell.ts +226 -0
package/dist/index.mjs
CHANGED
|
@@ -356,7 +356,7 @@ var renameClass = (oldClassName, newClassName) => {
|
|
|
356
356
|
};
|
|
357
357
|
|
|
358
358
|
// src/components/elements-overlays.tsx
|
|
359
|
-
import * as
|
|
359
|
+
import * as React7 from "react";
|
|
360
360
|
import { getElements, useSelectedElement } from "@elementor/editor-elements";
|
|
361
361
|
import {
|
|
362
362
|
__privateUseIsRouteActive as useIsRouteActive,
|
|
@@ -366,7 +366,7 @@ import {
|
|
|
366
366
|
} from "@elementor/editor-v1-adapters";
|
|
367
367
|
|
|
368
368
|
// src/components/grid-outline/grid-outline-overlay.tsx
|
|
369
|
-
import * as
|
|
369
|
+
import * as React6 from "react";
|
|
370
370
|
import { useSelectedElementSettings } from "@elementor/editor-elements";
|
|
371
371
|
import { booleanPropTypeUtil } from "@elementor/editor-props";
|
|
372
372
|
import { Box as Box2 } from "@elementor/ui";
|
|
@@ -725,7 +725,170 @@ var OutlineOverlay = ({ element, isSelected, id, isGlobal = false }) => {
|
|
|
725
725
|
};
|
|
726
726
|
|
|
727
727
|
// src/components/grid-outline/grid-outline.tsx
|
|
728
|
-
import * as
|
|
728
|
+
import * as React5 from "react";
|
|
729
|
+
import { useMemo } from "react";
|
|
730
|
+
|
|
731
|
+
// src/utils/find-first-empty-cell.ts
|
|
732
|
+
function findFirstEmptyCell(element, columnCount, rowCount) {
|
|
733
|
+
if (!element || columnCount === 0 || rowCount === 0) {
|
|
734
|
+
return null;
|
|
735
|
+
}
|
|
736
|
+
const previewWindow = element.ownerDocument?.defaultView;
|
|
737
|
+
if (!previewWindow) {
|
|
738
|
+
return null;
|
|
739
|
+
}
|
|
740
|
+
const containerStyle = previewWindow.getComputedStyle(element);
|
|
741
|
+
const flowsByColumn = containerStyle.gridAutoFlow.trim().startsWith("column");
|
|
742
|
+
const matrix = Array.from({ length: rowCount }, () => new Array(columnCount).fill(false));
|
|
743
|
+
const explicit = [];
|
|
744
|
+
const autoPlaced = [];
|
|
745
|
+
for (const child of Array.from(element.children)) {
|
|
746
|
+
if (!child.classList.contains("elementor-element")) {
|
|
747
|
+
continue;
|
|
748
|
+
}
|
|
749
|
+
const style = previewWindow.getComputedStyle(child);
|
|
750
|
+
if (style.display === "none") {
|
|
751
|
+
continue;
|
|
752
|
+
}
|
|
753
|
+
const col = resolvePlacement(style.gridColumnStart, style.gridColumnEnd);
|
|
754
|
+
const row = resolvePlacement(style.gridRowStart, style.gridRowEnd);
|
|
755
|
+
if (col.start !== null || row.start !== null) {
|
|
756
|
+
explicit.push({ col: col.start, colSpan: col.span, row: row.start, rowSpan: row.span });
|
|
757
|
+
} else {
|
|
758
|
+
autoPlaced.push({ colSpan: col.span, rowSpan: row.span });
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
for (const child of explicit) {
|
|
762
|
+
fillMatrix(matrix, child.col ?? 0, child.row ?? 0, child.colSpan, child.rowSpan);
|
|
763
|
+
}
|
|
764
|
+
for (const child of autoPlaced) {
|
|
765
|
+
const slot = findNextFreeSlot(matrix, child.colSpan, child.rowSpan, flowsByColumn);
|
|
766
|
+
if (slot) {
|
|
767
|
+
fillMatrix(matrix, slot.col, slot.row, child.colSpan, child.rowSpan);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
return scanFirstEmpty(matrix, flowsByColumn);
|
|
771
|
+
}
|
|
772
|
+
function resolvePlacement(startRaw, endRaw) {
|
|
773
|
+
const start = parseLineValue(startRaw);
|
|
774
|
+
const end = parseLineValue(endRaw);
|
|
775
|
+
if (typeof start === "number") {
|
|
776
|
+
const zeroIndexedStart = start - 1;
|
|
777
|
+
if (typeof end === "number") {
|
|
778
|
+
return { start: zeroIndexedStart, span: Math.max(1, end - start) };
|
|
779
|
+
}
|
|
780
|
+
if (isSpan(end)) {
|
|
781
|
+
return { start: zeroIndexedStart, span: end.n };
|
|
782
|
+
}
|
|
783
|
+
return { start: zeroIndexedStart, span: 1 };
|
|
784
|
+
}
|
|
785
|
+
if (isSpan(start)) {
|
|
786
|
+
if (typeof end === "number") {
|
|
787
|
+
const zeroIndexedStart = end - 1 - start.n;
|
|
788
|
+
return { start: zeroIndexedStart >= 0 ? zeroIndexedStart : null, span: start.n };
|
|
789
|
+
}
|
|
790
|
+
return { start: null, span: start.n };
|
|
791
|
+
}
|
|
792
|
+
if (typeof end === "number") {
|
|
793
|
+
const zeroIndexedStart = end - 2;
|
|
794
|
+
return { start: zeroIndexedStart >= 0 ? zeroIndexedStart : null, span: 1 };
|
|
795
|
+
}
|
|
796
|
+
if (isSpan(end)) {
|
|
797
|
+
return { start: null, span: end.n };
|
|
798
|
+
}
|
|
799
|
+
return { start: null, span: 1 };
|
|
800
|
+
}
|
|
801
|
+
function parseLineValue(raw) {
|
|
802
|
+
const trimmed = raw.trim();
|
|
803
|
+
if (trimmed === "" || trimmed === "auto") {
|
|
804
|
+
return "auto";
|
|
805
|
+
}
|
|
806
|
+
const spanMatch = trimmed.match(/^span\s+(\d+)$/);
|
|
807
|
+
if (spanMatch) {
|
|
808
|
+
const n = parseInt(spanMatch[1], 10);
|
|
809
|
+
return { kind: "span", n: Math.max(1, n) };
|
|
810
|
+
}
|
|
811
|
+
const parsed = parseInt(trimmed, 10);
|
|
812
|
+
if (Number.isFinite(parsed) && parsed > 0) {
|
|
813
|
+
return parsed;
|
|
814
|
+
}
|
|
815
|
+
return "auto";
|
|
816
|
+
}
|
|
817
|
+
function isSpan(value) {
|
|
818
|
+
return typeof value === "object" && value !== null && "kind" in value && value.kind === "span";
|
|
819
|
+
}
|
|
820
|
+
function fillMatrix(matrix, col, row, colSpan, rowSpan) {
|
|
821
|
+
const rows = matrix.length;
|
|
822
|
+
const cols = rows > 0 ? matrix[0].length : 0;
|
|
823
|
+
const startRow = Math.max(0, row);
|
|
824
|
+
const startCol = Math.max(0, col);
|
|
825
|
+
const endRow = Math.min(rows, row + rowSpan);
|
|
826
|
+
const endCol = Math.min(cols, col + colSpan);
|
|
827
|
+
for (let r = startRow; r < endRow; r++) {
|
|
828
|
+
for (let c = startCol; c < endCol; c++) {
|
|
829
|
+
matrix[r][c] = true;
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
function findNextFreeSlot(matrix, colSpan, rowSpan, flowsByColumn) {
|
|
834
|
+
const rows = matrix.length;
|
|
835
|
+
const cols = rows > 0 ? matrix[0].length : 0;
|
|
836
|
+
const maxCol = cols - colSpan;
|
|
837
|
+
const maxRow = rows - rowSpan;
|
|
838
|
+
if (maxCol < 0 || maxRow < 0) {
|
|
839
|
+
return null;
|
|
840
|
+
}
|
|
841
|
+
if (flowsByColumn) {
|
|
842
|
+
for (let col = 0; col <= maxCol; col++) {
|
|
843
|
+
for (let row = 0; row <= maxRow; row++) {
|
|
844
|
+
if (canFit(matrix, col, row, colSpan, rowSpan)) {
|
|
845
|
+
return { row, col };
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
} else {
|
|
850
|
+
for (let row = 0; row <= maxRow; row++) {
|
|
851
|
+
for (let col = 0; col <= maxCol; col++) {
|
|
852
|
+
if (canFit(matrix, col, row, colSpan, rowSpan)) {
|
|
853
|
+
return { row, col };
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
return null;
|
|
859
|
+
}
|
|
860
|
+
function canFit(matrix, col, row, colSpan, rowSpan) {
|
|
861
|
+
for (let r = row; r < row + rowSpan; r++) {
|
|
862
|
+
for (let c = col; c < col + colSpan; c++) {
|
|
863
|
+
if (matrix[r][c]) {
|
|
864
|
+
return false;
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
return true;
|
|
869
|
+
}
|
|
870
|
+
function scanFirstEmpty(matrix, flowsByColumn) {
|
|
871
|
+
const rows = matrix.length;
|
|
872
|
+
const cols = rows > 0 ? matrix[0].length : 0;
|
|
873
|
+
if (flowsByColumn) {
|
|
874
|
+
for (let col = 0; col < cols; col++) {
|
|
875
|
+
for (let row = 0; row < rows; row++) {
|
|
876
|
+
if (!matrix[row][col]) {
|
|
877
|
+
return { row, col };
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
} else {
|
|
882
|
+
for (let row = 0; row < rows; row++) {
|
|
883
|
+
for (let col = 0; col < cols; col++) {
|
|
884
|
+
if (!matrix[row][col]) {
|
|
885
|
+
return { row, col };
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
return null;
|
|
891
|
+
}
|
|
729
892
|
|
|
730
893
|
// src/components/grid-outline/cell.tsx
|
|
731
894
|
import * as React2 from "react";
|
|
@@ -747,11 +910,40 @@ function Cell({ x, y, width, height, color }) {
|
|
|
747
910
|
);
|
|
748
911
|
}
|
|
749
912
|
|
|
750
|
-
// src/components/grid-outline/
|
|
913
|
+
// src/components/grid-outline/first-empty-cell.tsx
|
|
751
914
|
import * as React3 from "react";
|
|
915
|
+
var GLYPH_SIZE = 19;
|
|
916
|
+
function FirstEmptyCell({ rect, color }) {
|
|
917
|
+
const size2 = Math.min(GLYPH_SIZE, rect.width, rect.height);
|
|
918
|
+
if (size2 <= 0) {
|
|
919
|
+
return null;
|
|
920
|
+
}
|
|
921
|
+
const centerX = rect.x + rect.width / 2;
|
|
922
|
+
const centerY = rect.y + rect.height / 2;
|
|
923
|
+
return /* @__PURE__ */ React3.createElement(
|
|
924
|
+
"i",
|
|
925
|
+
{
|
|
926
|
+
className: "eicon-plus",
|
|
927
|
+
"aria-hidden": "true",
|
|
928
|
+
style: {
|
|
929
|
+
position: "absolute",
|
|
930
|
+
left: centerX,
|
|
931
|
+
top: centerY,
|
|
932
|
+
transform: "translate(-50%, -50%)",
|
|
933
|
+
fontSize: size2,
|
|
934
|
+
color,
|
|
935
|
+
lineHeight: 1,
|
|
936
|
+
pointerEvents: "none"
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
);
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
// src/components/grid-outline/line.tsx
|
|
943
|
+
import * as React4 from "react";
|
|
752
944
|
var FALLBACK_COLOR2 = "rgba(0, 0, 0, 0.12)";
|
|
753
945
|
function Line({ x1, y1, x2, y2, color }) {
|
|
754
|
-
return /* @__PURE__ */
|
|
946
|
+
return /* @__PURE__ */ React4.createElement(
|
|
755
947
|
"line",
|
|
756
948
|
{
|
|
757
949
|
x1,
|
|
@@ -767,7 +959,7 @@ function Line({ x1, y1, x2, y2, color }) {
|
|
|
767
959
|
}
|
|
768
960
|
|
|
769
961
|
// src/components/grid-outline/grid-outline.tsx
|
|
770
|
-
var renderCells = (
|
|
962
|
+
var renderCells = (cells, color) => cells.map((cell, i) => /* @__PURE__ */ React5.createElement(
|
|
771
963
|
Cell,
|
|
772
964
|
{
|
|
773
965
|
key: i,
|
|
@@ -775,13 +967,13 @@ var renderCells = (tracks, width, height) => computeCellRects(tracks, width, hei
|
|
|
775
967
|
y: snapToHalfPixel(cell.y),
|
|
776
968
|
width: Math.round(cell.width),
|
|
777
969
|
height: Math.round(cell.height),
|
|
778
|
-
color
|
|
970
|
+
color
|
|
779
971
|
}
|
|
780
972
|
));
|
|
781
973
|
var renderLines = (tracks, width, height) => {
|
|
782
974
|
const { vertical, horizontal } = computeGridLines(tracks, width, height);
|
|
783
975
|
return [
|
|
784
|
-
...vertical.map((line, i) => /* @__PURE__ */
|
|
976
|
+
...vertical.map((line, i) => /* @__PURE__ */ React5.createElement(
|
|
785
977
|
Line,
|
|
786
978
|
{
|
|
787
979
|
key: `v${i}`,
|
|
@@ -792,7 +984,7 @@ var renderLines = (tracks, width, height) => {
|
|
|
792
984
|
color: tracks.borderColor
|
|
793
985
|
}
|
|
794
986
|
)),
|
|
795
|
-
...horizontal.map((line, i) => /* @__PURE__ */
|
|
987
|
+
...horizontal.map((line, i) => /* @__PURE__ */ React5.createElement(
|
|
796
988
|
Line,
|
|
797
989
|
{
|
|
798
990
|
key: `h${i}`,
|
|
@@ -805,9 +997,15 @@ var renderLines = (tracks, width, height) => {
|
|
|
805
997
|
))
|
|
806
998
|
];
|
|
807
999
|
};
|
|
808
|
-
function GridOutline({ tracks, width, height }) {
|
|
1000
|
+
function GridOutline({ element, tracks, width, height }) {
|
|
1001
|
+
const cells = useMemo(() => computeCellRects(tracks, width, height), [tracks, width, height]);
|
|
809
1002
|
const hasGap = tracks.columnGap > 0 || tracks.rowGap > 0;
|
|
810
|
-
|
|
1003
|
+
const firstEmpty = useMemo(
|
|
1004
|
+
() => findFirstEmptyCell(element, tracks.columns.length, tracks.rows.length),
|
|
1005
|
+
[element, tracks]
|
|
1006
|
+
);
|
|
1007
|
+
const emptyCellRect = firstEmpty && tracks.columns.length > 0 ? cells[firstEmpty.row * tracks.columns.length + firstEmpty.col] : null;
|
|
1008
|
+
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(
|
|
811
1009
|
"svg",
|
|
812
1010
|
{
|
|
813
1011
|
width,
|
|
@@ -815,8 +1013,8 @@ function GridOutline({ tracks, width, height }) {
|
|
|
815
1013
|
style: { position: "absolute", inset: 0, overflow: "visible" },
|
|
816
1014
|
xmlns: "http://www.w3.org/2000/svg"
|
|
817
1015
|
},
|
|
818
|
-
hasGap ? renderCells(
|
|
819
|
-
);
|
|
1016
|
+
hasGap ? renderCells(cells, tracks.borderColor) : renderLines(tracks, width, height)
|
|
1017
|
+
), emptyCellRect && /* @__PURE__ */ React5.createElement(FirstEmptyCell, { rect: emptyCellRect, color: tracks.borderColor }));
|
|
820
1018
|
}
|
|
821
1019
|
|
|
822
1020
|
// src/components/grid-outline/grid-outline-overlay.tsx
|
|
@@ -832,7 +1030,7 @@ var GridOutlineOverlay = ({ element, id, isSelected }) => {
|
|
|
832
1030
|
if (tracks.columns.length === 0 && tracks.rows.length === 0) {
|
|
833
1031
|
return null;
|
|
834
1032
|
}
|
|
835
|
-
return /* @__PURE__ */
|
|
1033
|
+
return /* @__PURE__ */ React6.createElement(FloatingPortal2, { id: CANVAS_WRAPPER_ID }, /* @__PURE__ */ React6.createElement(
|
|
836
1034
|
Box2,
|
|
837
1035
|
{
|
|
838
1036
|
ref: floating.setRef,
|
|
@@ -840,7 +1038,7 @@ var GridOutlineOverlay = ({ element, id, isSelected }) => {
|
|
|
840
1038
|
"data-grid-outline": id,
|
|
841
1039
|
role: "presentation"
|
|
842
1040
|
},
|
|
843
|
-
/* @__PURE__ */
|
|
1041
|
+
/* @__PURE__ */ React6.createElement(GridOutline, { element, tracks, width: rect.width, height: rect.height })
|
|
844
1042
|
));
|
|
845
1043
|
};
|
|
846
1044
|
|
|
@@ -869,7 +1067,7 @@ function ElementsOverlays() {
|
|
|
869
1067
|
return elements.map(({ id, domElement, isGlobal }) => {
|
|
870
1068
|
const isSelected = selected.element?.id === id;
|
|
871
1069
|
return overlayRegistry.map(
|
|
872
|
-
({ shouldRender, component: Overlay }, index) => shouldRender({ id, element: domElement, isSelected }) && /* @__PURE__ */
|
|
1070
|
+
({ shouldRender, component: Overlay }, index) => shouldRender({ id, element: domElement, isSelected }) && /* @__PURE__ */ React7.createElement(
|
|
873
1071
|
Overlay,
|
|
874
1072
|
{
|
|
875
1073
|
key: `${id}-${index}`,
|
|
@@ -902,7 +1100,7 @@ function isV4Element(dataset) {
|
|
|
902
1100
|
}
|
|
903
1101
|
|
|
904
1102
|
// src/components/interactions-renderer.tsx
|
|
905
|
-
import * as
|
|
1103
|
+
import * as React8 from "react";
|
|
906
1104
|
import {
|
|
907
1105
|
__privateUseListenTo as useListenTo3,
|
|
908
1106
|
commandEndEvent,
|
|
@@ -911,7 +1109,7 @@ import {
|
|
|
911
1109
|
import { Portal } from "@elementor/ui";
|
|
912
1110
|
|
|
913
1111
|
// src/hooks/use-interactions-items.ts
|
|
914
|
-
import { useEffect as useEffect8, useMemo, useState as useState5 } from "react";
|
|
1112
|
+
import { useEffect as useEffect8, useMemo as useMemo2, useState as useState5 } from "react";
|
|
915
1113
|
import { interactionsRepository } from "@elementor/editor-interactions";
|
|
916
1114
|
import { registerDataHook } from "@elementor/editor-v1-adapters";
|
|
917
1115
|
|
|
@@ -930,7 +1128,7 @@ function useOnMount(cb) {
|
|
|
930
1128
|
// src/hooks/use-interactions-items.ts
|
|
931
1129
|
function useInteractionsItems() {
|
|
932
1130
|
const [interactionItems, setInteractionItems] = useState5({});
|
|
933
|
-
const providerAndSubscribers =
|
|
1131
|
+
const providerAndSubscribers = useMemo2(() => {
|
|
934
1132
|
try {
|
|
935
1133
|
const providers = interactionsRepository.getProviders();
|
|
936
1134
|
const mapped = providers.map((provider) => {
|
|
@@ -978,7 +1176,7 @@ function useInteractionsItems() {
|
|
|
978
1176
|
});
|
|
979
1177
|
});
|
|
980
1178
|
});
|
|
981
|
-
return
|
|
1179
|
+
return useMemo2(() => {
|
|
982
1180
|
const result = Object.values(interactionItems).sort(sortByProviderPriority).flatMap(({ items }) => items);
|
|
983
1181
|
return result;
|
|
984
1182
|
}, [interactionItems]);
|
|
@@ -1008,7 +1206,7 @@ function InteractionsRenderer() {
|
|
|
1008
1206
|
return null;
|
|
1009
1207
|
}
|
|
1010
1208
|
const interactionsData = JSON.stringify(Array.isArray(interactionItems) ? interactionItems : []);
|
|
1011
|
-
return /* @__PURE__ */
|
|
1209
|
+
return /* @__PURE__ */ React8.createElement(Portal, { container }, /* @__PURE__ */ React8.createElement(
|
|
1012
1210
|
"script",
|
|
1013
1211
|
{
|
|
1014
1212
|
type: "application/json",
|
|
@@ -1024,7 +1222,7 @@ function usePortalContainer() {
|
|
|
1024
1222
|
}
|
|
1025
1223
|
|
|
1026
1224
|
// src/components/style-renderer.tsx
|
|
1027
|
-
import * as
|
|
1225
|
+
import * as React9 from "react";
|
|
1028
1226
|
import {
|
|
1029
1227
|
__privateUseListenTo as useListenTo5,
|
|
1030
1228
|
commandEndEvent as commandEndEvent3,
|
|
@@ -1084,7 +1282,7 @@ function getLinkAttrs(el) {
|
|
|
1084
1282
|
}
|
|
1085
1283
|
|
|
1086
1284
|
// src/hooks/use-style-items.ts
|
|
1087
|
-
import { useEffect as useEffect9, useMemo as
|
|
1285
|
+
import { useEffect as useEffect9, useMemo as useMemo5, useRef as useRef2, useState as useState6 } from "react";
|
|
1088
1286
|
import { useBreakpoints } from "@elementor/editor-responsive";
|
|
1089
1287
|
import { isClassState } from "@elementor/editor-styles";
|
|
1090
1288
|
import { stylesRepository as stylesRepository2 } from "@elementor/editor-styles-repository";
|
|
@@ -1146,7 +1344,7 @@ function signalizedProcess(signal, steps = []) {
|
|
|
1146
1344
|
}
|
|
1147
1345
|
|
|
1148
1346
|
// src/hooks/use-style-prop-resolver.ts
|
|
1149
|
-
import { useMemo as
|
|
1347
|
+
import { useMemo as useMemo3 } from "react";
|
|
1150
1348
|
import { getStylesSchema as getStylesSchema2 } from "@elementor/editor-styles";
|
|
1151
1349
|
import { enqueueFont } from "@elementor/editor-v1-adapters";
|
|
1152
1350
|
|
|
@@ -1276,7 +1474,7 @@ var styleTransformersRegistry = createTransformersRegistry();
|
|
|
1276
1474
|
|
|
1277
1475
|
// src/hooks/use-style-prop-resolver.ts
|
|
1278
1476
|
function useStylePropResolver() {
|
|
1279
|
-
return
|
|
1477
|
+
return useMemo3(() => {
|
|
1280
1478
|
return createPropsResolver({
|
|
1281
1479
|
transformers: styleTransformersRegistry,
|
|
1282
1480
|
schema: getStylesSchema2(),
|
|
@@ -1291,7 +1489,7 @@ function useStylePropResolver() {
|
|
|
1291
1489
|
}
|
|
1292
1490
|
|
|
1293
1491
|
// src/hooks/use-style-renderer.ts
|
|
1294
|
-
import { useMemo as
|
|
1492
|
+
import { useMemo as useMemo4 } from "react";
|
|
1295
1493
|
import { useBreakpointsMap } from "@elementor/editor-responsive";
|
|
1296
1494
|
|
|
1297
1495
|
// src/renderers/create-styles-renderer.ts
|
|
@@ -1402,7 +1600,7 @@ function customCssToString(customCss) {
|
|
|
1402
1600
|
var SELECTOR_PREFIX = ".elementor";
|
|
1403
1601
|
function useStyleRenderer(resolve) {
|
|
1404
1602
|
const breakpoints = useBreakpointsMap();
|
|
1405
|
-
return
|
|
1603
|
+
return useMemo4(() => {
|
|
1406
1604
|
return createStylesRenderer({
|
|
1407
1605
|
selectorPrefix: SELECTOR_PREFIX,
|
|
1408
1606
|
breakpoints,
|
|
@@ -1418,7 +1616,7 @@ function useStyleItems() {
|
|
|
1418
1616
|
const breakpoints = useBreakpoints();
|
|
1419
1617
|
const [styleItems, setStyleItems] = useState6({});
|
|
1420
1618
|
const styleItemsCacheRef = useRef2(/* @__PURE__ */ new Map());
|
|
1421
|
-
const providerAndSubscribers =
|
|
1619
|
+
const providerAndSubscribers = useMemo5(() => {
|
|
1422
1620
|
const createEmptyCache = () => {
|
|
1423
1621
|
return { orderedIds: [], itemsById: /* @__PURE__ */ new Map() };
|
|
1424
1622
|
};
|
|
@@ -1459,11 +1657,11 @@ function useStyleItems() {
|
|
|
1459
1657
|
await Promise.all(promises);
|
|
1460
1658
|
});
|
|
1461
1659
|
});
|
|
1462
|
-
const breakpointSorter =
|
|
1660
|
+
const breakpointSorter = useMemo5(
|
|
1463
1661
|
() => createBreakpointSorter(breakpoints.map((breakpoint) => breakpoint.id)),
|
|
1464
1662
|
[breakpoints]
|
|
1465
1663
|
);
|
|
1466
|
-
return
|
|
1664
|
+
return useMemo5(
|
|
1467
1665
|
() => Object.values(styleItems).sort(prioritySorter).flatMap(({ items }) => items).sort(stateSorter).sort(breakpointSorter),
|
|
1468
1666
|
[styleItems, breakpointSorter]
|
|
1469
1667
|
);
|
|
@@ -1605,7 +1803,7 @@ function StyleRenderer() {
|
|
|
1605
1803
|
if (!container) {
|
|
1606
1804
|
return null;
|
|
1607
1805
|
}
|
|
1608
|
-
return /* @__PURE__ */
|
|
1806
|
+
return /* @__PURE__ */ React9.createElement(Portal2, { container }, filterUniqueStyleDefinitions(styleItems).map((item) => /* @__PURE__ */ React9.createElement("style", { key: `${item.id}-${item.breakpoint}-${item.state ?? "normal"}` }, item.value)), linksAttrs.map((attrs) => /* @__PURE__ */ React9.createElement("link", { ...attrs, key: attrs.id })));
|
|
1609
1807
|
}
|
|
1610
1808
|
function usePortalContainer2() {
|
|
1611
1809
|
return useListenTo5(commandEndEvent3("editor/documents/attach-preview"), () => getCanvasIframeDocument4()?.head);
|
|
@@ -3082,7 +3280,7 @@ function createPromotionView(BaseView) {
|
|
|
3082
3280
|
import { createRoot } from "react-dom/client";
|
|
3083
3281
|
|
|
3084
3282
|
// src/legacy/replacements/inline-editing/inline-editing-elements.tsx
|
|
3085
|
-
import * as
|
|
3283
|
+
import * as React11 from "react";
|
|
3086
3284
|
import { getContainer as getContainer2, getElementLabel, getElementType as getElementType2 } from "@elementor/editor-elements";
|
|
3087
3285
|
import {
|
|
3088
3286
|
htmlV3PropTypeUtil as htmlV3PropTypeUtil2,
|
|
@@ -3135,7 +3333,7 @@ var ReplacementBase = class {
|
|
|
3135
3333
|
};
|
|
3136
3334
|
|
|
3137
3335
|
// src/legacy/replacements/inline-editing/canvas-inline-editor.tsx
|
|
3138
|
-
import * as
|
|
3336
|
+
import * as React10 from "react";
|
|
3139
3337
|
import { useCallback as useCallback2, useEffect as useEffect11, useLayoutEffect, useState as useState8 } from "react";
|
|
3140
3338
|
import { InlineEditor, InlineEditorToolbar } from "@elementor/editor-controls";
|
|
3141
3339
|
import { Box as Box3, ThemeProvider } from "@elementor/ui";
|
|
@@ -3307,7 +3505,7 @@ var CanvasInlineEditor = ({
|
|
|
3307
3505
|
if (!active) {
|
|
3308
3506
|
return null;
|
|
3309
3507
|
}
|
|
3310
|
-
return /* @__PURE__ */
|
|
3508
|
+
return /* @__PURE__ */ React10.createElement(ThemeProvider, null, /* @__PURE__ */ React10.createElement(InlineEditingOverlay, { expectedTag, rootElement, id }), /* @__PURE__ */ React10.createElement(
|
|
3311
3509
|
InlineEditor,
|
|
3312
3510
|
{
|
|
3313
3511
|
onEditorCreate: setEditor,
|
|
@@ -3324,7 +3522,7 @@ var CanvasInlineEditor = ({
|
|
|
3324
3522
|
autofocus: true,
|
|
3325
3523
|
onSelectionEnd
|
|
3326
3524
|
}
|
|
3327
|
-
), toolbarAnchor && editor && /* @__PURE__ */
|
|
3525
|
+
), toolbarAnchor && editor && /* @__PURE__ */ React10.createElement(InlineEditingToolbar, { anchor: toolbarAnchor, editor, id }));
|
|
3328
3526
|
};
|
|
3329
3527
|
var InlineEditingOverlay = ({
|
|
3330
3528
|
expectedTag,
|
|
@@ -3336,7 +3534,7 @@ var InlineEditingOverlay = ({
|
|
|
3336
3534
|
useEffect11(() => {
|
|
3337
3535
|
setOverlayElement(getInlineEditorElement(rootElement, expectedTag));
|
|
3338
3536
|
}, [expectedTag, rootElement]);
|
|
3339
|
-
return overlayRefElement ? /* @__PURE__ */
|
|
3537
|
+
return overlayRefElement ? /* @__PURE__ */ React10.createElement(OutlineOverlay, { element: overlayRefElement, id, isSelected: true }) : null;
|
|
3340
3538
|
};
|
|
3341
3539
|
var InlineEditingToolbar = ({ anchor, editor, id }) => {
|
|
3342
3540
|
const { refs, floatingStyles } = useFloating2({
|
|
@@ -3350,7 +3548,7 @@ var InlineEditingToolbar = ({ anchor, editor, id }) => {
|
|
|
3350
3548
|
refs.setReference(anchor);
|
|
3351
3549
|
return () => refs.setReference(null);
|
|
3352
3550
|
}, [anchor, refs]);
|
|
3353
|
-
return /* @__PURE__ */
|
|
3551
|
+
return /* @__PURE__ */ React10.createElement(FloatingPortal3, { id: CANVAS_WRAPPER_ID }, /* @__PURE__ */ React10.createElement(
|
|
3354
3552
|
Box3,
|
|
3355
3553
|
{
|
|
3356
3554
|
ref: refs.setFloating,
|
|
@@ -3360,7 +3558,7 @@ var InlineEditingToolbar = ({ anchor, editor, id }) => {
|
|
|
3360
3558
|
pointerEvents: "none"
|
|
3361
3559
|
}
|
|
3362
3560
|
},
|
|
3363
|
-
/* @__PURE__ */
|
|
3561
|
+
/* @__PURE__ */ React10.createElement(InlineEditorToolbar, { editor, elementId: id })
|
|
3364
3562
|
));
|
|
3365
3563
|
};
|
|
3366
3564
|
|
|
@@ -3569,7 +3767,7 @@ var InlineEditingReplacement = class extends ReplacementBase {
|
|
|
3569
3767
|
contentElement.innerHTML = "";
|
|
3570
3768
|
this.editing = true;
|
|
3571
3769
|
this.reactRoot.render(
|
|
3572
|
-
/* @__PURE__ */
|
|
3770
|
+
/* @__PURE__ */ React11.createElement(
|
|
3573
3771
|
CanvasInlineEditor,
|
|
3574
3772
|
{
|
|
3575
3773
|
elementClasses,
|
|
@@ -4374,7 +4572,7 @@ function getElementDisplayName(container) {
|
|
|
4374
4572
|
// src/mcp/tools/build-composition/tool.ts
|
|
4375
4573
|
import { getCurrentDocument } from "@elementor/editor-documents";
|
|
4376
4574
|
import {
|
|
4377
|
-
createElement as
|
|
4575
|
+
createElement as createElement13,
|
|
4378
4576
|
deleteElement as deleteElement2,
|
|
4379
4577
|
getContainer as getContainer5,
|
|
4380
4578
|
getWidgetsCache as getWidgetsCache9
|
|
@@ -4382,7 +4580,7 @@ import {
|
|
|
4382
4580
|
|
|
4383
4581
|
// src/composition-builder/composition-builder.ts
|
|
4384
4582
|
import {
|
|
4385
|
-
createElement as
|
|
4583
|
+
createElement as createElement12,
|
|
4386
4584
|
deleteElement,
|
|
4387
4585
|
generateElementId as generateElementId2,
|
|
4388
4586
|
getContainer as getContainer4,
|
|
@@ -4682,7 +4880,7 @@ var CompositionBuilder = class _CompositionBuilder {
|
|
|
4682
4880
|
elementCustomCSS = {};
|
|
4683
4881
|
rootContainers = [];
|
|
4684
4882
|
api = {
|
|
4685
|
-
createElement:
|
|
4883
|
+
createElement: createElement12,
|
|
4686
4884
|
deleteElement,
|
|
4687
4885
|
getWidgetsCache: getWidgetsCache8,
|
|
4688
4886
|
generateElementId: generateElementId2,
|
|
@@ -5218,7 +5416,7 @@ var initBuildCompositionsTool = (reg) => {
|
|
|
5218
5416
|
const targetContainer = getCompositionTargetContainer(documentContainer, currentDocument?.type.value);
|
|
5219
5417
|
try {
|
|
5220
5418
|
const compositionBuilder = CompositionBuilder.fromXMLString(xmlStructure, {
|
|
5221
|
-
createElement:
|
|
5419
|
+
createElement: createElement13,
|
|
5222
5420
|
deleteElement: deleteElement2,
|
|
5223
5421
|
getWidgetsCache: getWidgetsCache9
|
|
5224
5422
|
});
|
|
@@ -6252,7 +6450,7 @@ var getLegacyPanelElementView = ({ settings, ...rest }) => {
|
|
|
6252
6450
|
var GLOBAL_STYLES_IMPORTED_EVENT = "elementor/global-styles/imported";
|
|
6253
6451
|
|
|
6254
6452
|
// src/components/spotlight-backdrop.tsx
|
|
6255
|
-
import * as
|
|
6453
|
+
import * as React12 from "react";
|
|
6256
6454
|
function SpotlightBackdrop({ canvas, element, onExit, ariaLabel }) {
|
|
6257
6455
|
const rect = useElementRect(element);
|
|
6258
6456
|
const clipPath = element ? getRectClipPath(rect, canvas.defaultView) : void 0;
|
|
@@ -6274,7 +6472,7 @@ function SpotlightBackdrop({ canvas, element, onExit, ariaLabel }) {
|
|
|
6274
6472
|
onExit();
|
|
6275
6473
|
}
|
|
6276
6474
|
};
|
|
6277
|
-
return /* @__PURE__ */
|
|
6475
|
+
return /* @__PURE__ */ React12.createElement(
|
|
6278
6476
|
"div",
|
|
6279
6477
|
{
|
|
6280
6478
|
style: backdropStyle,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-canvas",
|
|
3
3
|
"description": "Elementor Editor Canvas",
|
|
4
|
-
"version": "4.2.0-
|
|
4
|
+
"version": "4.2.0-928",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -37,25 +37,25 @@
|
|
|
37
37
|
"react-dom": "^18.3.1"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@elementor/editor": "4.2.0-
|
|
40
|
+
"@elementor/editor": "4.2.0-928",
|
|
41
41
|
"dompurify": "^3.2.6",
|
|
42
|
-
"@elementor/editor-controls": "4.2.0-
|
|
43
|
-
"@elementor/editor-documents": "4.2.0-
|
|
44
|
-
"@elementor/editor-elements": "4.2.0-
|
|
45
|
-
"@elementor/editor-interactions": "4.2.0-
|
|
46
|
-
"@elementor/editor-mcp": "4.2.0-
|
|
47
|
-
"@elementor/editor-notifications": "4.2.0-
|
|
48
|
-
"@elementor/editor-props": "4.2.0-
|
|
49
|
-
"@elementor/editor-responsive": "4.2.0-
|
|
50
|
-
"@elementor/editor-styles": "4.2.0-
|
|
51
|
-
"@elementor/editor-styles-repository": "4.2.0-
|
|
52
|
-
"@elementor/editor-ui": "4.2.0-
|
|
53
|
-
"@elementor/editor-v1-adapters": "4.2.0-
|
|
54
|
-
"@elementor/schema": "4.2.0-
|
|
55
|
-
"@elementor/twing": "4.2.0-
|
|
42
|
+
"@elementor/editor-controls": "4.2.0-928",
|
|
43
|
+
"@elementor/editor-documents": "4.2.0-928",
|
|
44
|
+
"@elementor/editor-elements": "4.2.0-928",
|
|
45
|
+
"@elementor/editor-interactions": "4.2.0-928",
|
|
46
|
+
"@elementor/editor-mcp": "4.2.0-928",
|
|
47
|
+
"@elementor/editor-notifications": "4.2.0-928",
|
|
48
|
+
"@elementor/editor-props": "4.2.0-928",
|
|
49
|
+
"@elementor/editor-responsive": "4.2.0-928",
|
|
50
|
+
"@elementor/editor-styles": "4.2.0-928",
|
|
51
|
+
"@elementor/editor-styles-repository": "4.2.0-928",
|
|
52
|
+
"@elementor/editor-ui": "4.2.0-928",
|
|
53
|
+
"@elementor/editor-v1-adapters": "4.2.0-928",
|
|
54
|
+
"@elementor/schema": "4.2.0-928",
|
|
55
|
+
"@elementor/twing": "4.2.0-928",
|
|
56
56
|
"@elementor/ui": "1.37.5",
|
|
57
|
-
"@elementor/utils": "4.2.0-
|
|
58
|
-
"@elementor/wp-media": "4.2.0-
|
|
57
|
+
"@elementor/utils": "4.2.0-928",
|
|
58
|
+
"@elementor/wp-media": "4.2.0-928",
|
|
59
59
|
"@floating-ui/react": "^0.27.5",
|
|
60
60
|
"@wordpress/i18n": "^5.13.0"
|
|
61
61
|
},
|