@elementor/editor-components 4.0.0-681 → 4.0.0-683
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 +79 -29
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +62 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +23 -23
- package/src/components/components-tab/components.tsx +45 -1
- package/src/components/components-upgrade-alert.tsx +1 -1
- package/src/components/instance-editing-panel/empty-state.tsx +9 -2
package/dist/index.js
CHANGED
|
@@ -491,6 +491,7 @@ var componentOverrideTransformer = (0, import_editor_canvas3.createTransformer)(
|
|
|
491
491
|
|
|
492
492
|
// src/components/components-tab/components.tsx
|
|
493
493
|
var React8 = __toESM(require("react"));
|
|
494
|
+
var import_react3 = require("react");
|
|
494
495
|
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
495
496
|
var import_ui6 = require("@elementor/ui");
|
|
496
497
|
var import_utils3 = require("@elementor/utils");
|
|
@@ -860,7 +861,7 @@ var import_icons4 = require("@elementor/icons");
|
|
|
860
861
|
var import_ui5 = require("@elementor/ui");
|
|
861
862
|
var import_i18n3 = require("@wordpress/i18n");
|
|
862
863
|
function ComponentsUpgradeAlert({ title, description, upgradeUrl }) {
|
|
863
|
-
return /* @__PURE__ */ React6.createElement(import_ui5.Box, { sx: { mt: "auto" } }, /* @__PURE__ */ React6.createElement(
|
|
864
|
+
return /* @__PURE__ */ React6.createElement(import_ui5.Box, { sx: { mt: "auto", position: "sticky", bottom: 0 } }, /* @__PURE__ */ React6.createElement(
|
|
864
865
|
import_ui5.Alert,
|
|
865
866
|
{
|
|
866
867
|
variant: "standard",
|
|
@@ -900,12 +901,49 @@ function ComponentsProNotification() {
|
|
|
900
901
|
}
|
|
901
902
|
|
|
902
903
|
// src/components/components-tab/components.tsx
|
|
904
|
+
var FULL_HEIGHT_STYLE_ID = "components-full-height-panel";
|
|
905
|
+
var FULL_HEIGHT_CSS = `
|
|
906
|
+
#elementor-panel-page-elements {
|
|
907
|
+
display: flex;
|
|
908
|
+
flex-direction: column;
|
|
909
|
+
height: 100%;
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
#elementor-panel-elements {
|
|
913
|
+
display: flex;
|
|
914
|
+
flex-direction: column;
|
|
915
|
+
flex: 1;
|
|
916
|
+
min-height: 0;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
#elementor-panel-elements-wrapper {
|
|
920
|
+
display: flex;
|
|
921
|
+
flex-direction: column;
|
|
922
|
+
flex: 1;
|
|
923
|
+
min-height: 0;
|
|
924
|
+
}
|
|
925
|
+
`;
|
|
926
|
+
var useFullHeightPanel = () => {
|
|
927
|
+
(0, import_react3.useLayoutEffect)(() => {
|
|
928
|
+
let style = document.getElementById(FULL_HEIGHT_STYLE_ID);
|
|
929
|
+
if (!style) {
|
|
930
|
+
style = document.createElement("style");
|
|
931
|
+
style.id = FULL_HEIGHT_STYLE_ID;
|
|
932
|
+
style.textContent = FULL_HEIGHT_CSS;
|
|
933
|
+
document.head.appendChild(style);
|
|
934
|
+
}
|
|
935
|
+
return () => {
|
|
936
|
+
document.getElementById(FULL_HEIGHT_STYLE_ID)?.remove();
|
|
937
|
+
};
|
|
938
|
+
}, []);
|
|
939
|
+
};
|
|
903
940
|
var ComponentsContent = () => {
|
|
904
941
|
const { components, isLoading } = useComponents();
|
|
905
942
|
const hasComponents = !isLoading && components.length > 0;
|
|
906
943
|
const hasPro = (0, import_utils3.hasProInstalled)();
|
|
907
944
|
const showProNotification = !hasPro && hasComponents;
|
|
908
|
-
|
|
945
|
+
useFullHeightPanel();
|
|
946
|
+
return /* @__PURE__ */ React8.createElement(import_ui6.Stack, { justifyContent: "space-between", sx: { flex: 1, minHeight: 0 } }, hasComponents && /* @__PURE__ */ React8.createElement(ComponentSearch, null), /* @__PURE__ */ React8.createElement(ComponentsList, null), showProNotification && /* @__PURE__ */ React8.createElement(ComponentsProNotification, null));
|
|
909
947
|
};
|
|
910
948
|
var Components = () => {
|
|
911
949
|
return /* @__PURE__ */ React8.createElement(import_editor_ui2.ThemeProvider, null, /* @__PURE__ */ React8.createElement(SearchProvider, { localStorageKey: "elementor-components-search" }, /* @__PURE__ */ React8.createElement(ComponentsContent, null)));
|
|
@@ -972,18 +1010,18 @@ var import_i18n10 = require("@wordpress/i18n");
|
|
|
972
1010
|
|
|
973
1011
|
// src/provider/component-instance-context.tsx
|
|
974
1012
|
var React11 = __toESM(require("react"));
|
|
975
|
-
var
|
|
976
|
-
var ComponentInstanceContext = (0,
|
|
1013
|
+
var import_react4 = require("react");
|
|
1014
|
+
var ComponentInstanceContext = (0, import_react4.createContext)(null);
|
|
977
1015
|
function ComponentInstanceProvider({ children, ...props }) {
|
|
978
1016
|
return /* @__PURE__ */ React11.createElement(ComponentInstanceContext.Provider, { value: props }, children);
|
|
979
1017
|
}
|
|
980
|
-
var useComponentId = () => (0,
|
|
981
|
-
var useComponentInstanceOverrides = () => (0,
|
|
982
|
-
var useComponentOverridableProps = () => (0,
|
|
1018
|
+
var useComponentId = () => (0, import_react4.useContext)(ComponentInstanceContext)?.componentId;
|
|
1019
|
+
var useComponentInstanceOverrides = () => (0, import_react4.useContext)(ComponentInstanceContext)?.overrides;
|
|
1020
|
+
var useComponentOverridableProps = () => (0, import_react4.useContext)(ComponentInstanceContext)?.overridableProps;
|
|
983
1021
|
|
|
984
1022
|
// src/components/instance-editing-panel/detach-action.tsx
|
|
985
1023
|
var React13 = __toESM(require("react"));
|
|
986
|
-
var
|
|
1024
|
+
var import_react5 = require("react");
|
|
987
1025
|
var import_editor_notifications = require("@elementor/editor-notifications");
|
|
988
1026
|
var import_icons8 = require("@elementor/icons");
|
|
989
1027
|
var import_i18n8 = require("@wordpress/i18n");
|
|
@@ -1374,7 +1412,7 @@ var DetachAction = ({
|
|
|
1374
1412
|
componentInstanceId,
|
|
1375
1413
|
componentId
|
|
1376
1414
|
}) => {
|
|
1377
|
-
const [isDetachDialogOpen, setIsDetachDialogOpen] = (0,
|
|
1415
|
+
const [isDetachDialogOpen, setIsDetachDialogOpen] = (0, import_react5.useState)(false);
|
|
1378
1416
|
const handleDetachConfirm = async () => {
|
|
1379
1417
|
setIsDetachDialogOpen(false);
|
|
1380
1418
|
try {
|
|
@@ -1449,7 +1487,19 @@ var EmptyState2 = ({ onEditComponent }) => {
|
|
|
1449
1487
|
/* @__PURE__ */ React14.createElement(import_icons9.ComponentPropListIcon, { fontSize: "large" }),
|
|
1450
1488
|
/* @__PURE__ */ React14.createElement(import_ui9.Typography, { align: "center", variant: "subtitle2" }, (0, import_i18n9.__)("No properties yet", "elementor")),
|
|
1451
1489
|
/* @__PURE__ */ React14.createElement(import_ui9.Typography, { align: "center", variant: "caption", maxWidth: "170px" }, message),
|
|
1452
|
-
canEdit &&
|
|
1490
|
+
canEdit && /* @__PURE__ */ React14.createElement(
|
|
1491
|
+
import_ui9.Button,
|
|
1492
|
+
{
|
|
1493
|
+
variant: "outlined",
|
|
1494
|
+
color: "secondary",
|
|
1495
|
+
size: "small",
|
|
1496
|
+
sx: { mt: 1 },
|
|
1497
|
+
disabled: !onEditComponent,
|
|
1498
|
+
onClick: onEditComponent
|
|
1499
|
+
},
|
|
1500
|
+
/* @__PURE__ */ React14.createElement(import_icons9.PencilIcon, { fontSize: "small" }),
|
|
1501
|
+
(0, import_i18n9.__)("Edit component", "elementor")
|
|
1502
|
+
)
|
|
1453
1503
|
);
|
|
1454
1504
|
};
|
|
1455
1505
|
|
|
@@ -1462,7 +1512,7 @@ var import_ui13 = require("@elementor/ui");
|
|
|
1462
1512
|
|
|
1463
1513
|
// src/components/instance-editing-panel/override-props-group.tsx
|
|
1464
1514
|
var React18 = __toESM(require("react"));
|
|
1465
|
-
var
|
|
1515
|
+
var import_react7 = require("react");
|
|
1466
1516
|
var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
|
|
1467
1517
|
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
1468
1518
|
var import_ui12 = require("@elementor/ui");
|
|
@@ -1507,13 +1557,13 @@ function getControlsByBind(controls) {
|
|
|
1507
1557
|
|
|
1508
1558
|
// src/provider/overridable-prop-context.tsx
|
|
1509
1559
|
var React15 = __toESM(require("react"));
|
|
1510
|
-
var
|
|
1511
|
-
var OverridablePropContext = (0,
|
|
1560
|
+
var import_react6 = require("react");
|
|
1561
|
+
var OverridablePropContext = (0, import_react6.createContext)(null);
|
|
1512
1562
|
function OverridablePropProvider({ children, ...props }) {
|
|
1513
1563
|
return /* @__PURE__ */ React15.createElement(OverridablePropContext.Provider, { value: props }, children);
|
|
1514
1564
|
}
|
|
1515
|
-
var useOverridablePropValue = () => (0,
|
|
1516
|
-
var useComponentInstanceElement = () => (0,
|
|
1565
|
+
var useOverridablePropValue = () => (0, import_react6.useContext)(OverridablePropContext)?.value;
|
|
1566
|
+
var useComponentInstanceElement = () => (0, import_react6.useContext)(OverridablePropContext)?.componentInstanceElement;
|
|
1517
1567
|
|
|
1518
1568
|
// src/utils/resolve-override-prop-value.ts
|
|
1519
1569
|
var resolveOverridePropValue = (originalPropValue) => {
|
|
@@ -2055,7 +2105,7 @@ function OverridePropsGroup({ group }) {
|
|
|
2055
2105
|
const handleClick = () => {
|
|
2056
2106
|
setIsOpen(!isOpen);
|
|
2057
2107
|
};
|
|
2058
|
-
const id = (0,
|
|
2108
|
+
const id = (0, import_react7.useId)();
|
|
2059
2109
|
const labelId = `label-${id}`;
|
|
2060
2110
|
const contentId = `content-${id}`;
|
|
2061
2111
|
const title = group.label;
|
|
@@ -2222,7 +2272,7 @@ function InstanceEditingPanel() {
|
|
|
2222
2272
|
}
|
|
2223
2273
|
|
|
2224
2274
|
// src/components/load-template-components.tsx
|
|
2225
|
-
var
|
|
2275
|
+
var import_react8 = require("react");
|
|
2226
2276
|
var import_editor_templates = require("@elementor/editor-templates");
|
|
2227
2277
|
|
|
2228
2278
|
// src/store/actions/load-components-assets.ts
|
|
@@ -2261,14 +2311,14 @@ async function getComponentIds(elements, cache) {
|
|
|
2261
2311
|
async function getDocumentsMap(ids, cache) {
|
|
2262
2312
|
const documents = await Promise.all(
|
|
2263
2313
|
ids.map(async (id) => {
|
|
2264
|
-
const
|
|
2265
|
-
if (!
|
|
2314
|
+
const document2 = await cache.get(id);
|
|
2315
|
+
if (!document2) {
|
|
2266
2316
|
return null;
|
|
2267
2317
|
}
|
|
2268
|
-
return [id,
|
|
2318
|
+
return [id, document2];
|
|
2269
2319
|
})
|
|
2270
2320
|
);
|
|
2271
|
-
return new Map(documents.filter((
|
|
2321
|
+
return new Map(documents.filter((document2) => document2 !== null));
|
|
2272
2322
|
}
|
|
2273
2323
|
|
|
2274
2324
|
// src/store/actions/load-components-overridable-props.ts
|
|
@@ -2311,15 +2361,15 @@ function loadComponentsStyles(documents) {
|
|
|
2311
2361
|
}
|
|
2312
2362
|
function addStyles(documents) {
|
|
2313
2363
|
const styles = Object.fromEntries(
|
|
2314
|
-
[...documents.entries()].map(([id,
|
|
2364
|
+
[...documents.entries()].map(([id, document2]) => [id, extractStylesFromDocument(document2)])
|
|
2315
2365
|
);
|
|
2316
2366
|
(0, import_store25.__dispatch)(slice.actions.addStyles(styles));
|
|
2317
2367
|
}
|
|
2318
|
-
function extractStylesFromDocument(
|
|
2319
|
-
if (!
|
|
2368
|
+
function extractStylesFromDocument(document2) {
|
|
2369
|
+
if (!document2.elements?.length) {
|
|
2320
2370
|
return [];
|
|
2321
2371
|
}
|
|
2322
|
-
return
|
|
2372
|
+
return document2.elements.flatMap(extractStylesFromElement);
|
|
2323
2373
|
}
|
|
2324
2374
|
function extractStylesFromElement(element) {
|
|
2325
2375
|
return [
|
|
@@ -2345,7 +2395,7 @@ function updateDocumentState(documents) {
|
|
|
2345
2395
|
// src/components/load-template-components.tsx
|
|
2346
2396
|
var LoadTemplateComponents = () => {
|
|
2347
2397
|
const templates = (0, import_editor_templates.useLoadedTemplates)();
|
|
2348
|
-
(0,
|
|
2398
|
+
(0, import_react8.useEffect)(() => {
|
|
2349
2399
|
loadComponentsAssets(templates.flatMap((elements) => elements ?? []));
|
|
2350
2400
|
}, [templates]);
|
|
2351
2401
|
return null;
|
|
@@ -2728,10 +2778,10 @@ function createComponentModel() {
|
|
|
2728
2778
|
}
|
|
2729
2779
|
|
|
2730
2780
|
// src/populate-store.ts
|
|
2731
|
-
var
|
|
2781
|
+
var import_react9 = require("react");
|
|
2732
2782
|
var import_store29 = require("@elementor/store");
|
|
2733
2783
|
function PopulateStore() {
|
|
2734
|
-
(0,
|
|
2784
|
+
(0, import_react9.useEffect)(() => {
|
|
2735
2785
|
(0, import_store29.__dispatch)(loadComponents());
|
|
2736
2786
|
}, []);
|
|
2737
2787
|
return null;
|
|
@@ -2906,7 +2956,7 @@ async function publishDraftComponentsInPageBeforeSave({ status, elements }) {
|
|
|
2906
2956
|
return;
|
|
2907
2957
|
}
|
|
2908
2958
|
const documents = await getComponentDocuments(elements);
|
|
2909
|
-
const draftIds = [...documents.values()].filter(import_editor_documents5.isDocumentDirty).map((
|
|
2959
|
+
const draftIds = [...documents.values()].filter(import_editor_documents5.isDocumentDirty).map((document2) => document2.id);
|
|
2910
2960
|
if (draftIds.length === 0) {
|
|
2911
2961
|
return;
|
|
2912
2962
|
}
|