@elementor/editor-components 4.0.0-680 → 4.0.0-682
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.mjs
CHANGED
|
@@ -411,6 +411,7 @@ var componentOverrideTransformer = createTransformer3((override) => {
|
|
|
411
411
|
|
|
412
412
|
// src/components/components-tab/components.tsx
|
|
413
413
|
import * as React8 from "react";
|
|
414
|
+
import { useLayoutEffect } from "react";
|
|
414
415
|
import { ThemeProvider } from "@elementor/editor-ui";
|
|
415
416
|
import { Stack as Stack4 } from "@elementor/ui";
|
|
416
417
|
import { hasProInstalled as hasProInstalled2 } from "@elementor/utils";
|
|
@@ -780,7 +781,7 @@ import { CrownFilledIcon as CrownFilledIcon2 } from "@elementor/icons";
|
|
|
780
781
|
import { Alert, AlertAction, AlertTitle, Box as Box5, Typography as Typography3 } from "@elementor/ui";
|
|
781
782
|
import { __ as __3 } from "@wordpress/i18n";
|
|
782
783
|
function ComponentsUpgradeAlert({ title, description, upgradeUrl }) {
|
|
783
|
-
return /* @__PURE__ */ React6.createElement(Box5, { sx: { mt: "auto" } }, /* @__PURE__ */ React6.createElement(
|
|
784
|
+
return /* @__PURE__ */ React6.createElement(Box5, { sx: { mt: "auto", position: "sticky", bottom: 0 } }, /* @__PURE__ */ React6.createElement(
|
|
784
785
|
Alert,
|
|
785
786
|
{
|
|
786
787
|
variant: "standard",
|
|
@@ -820,12 +821,49 @@ function ComponentsProNotification() {
|
|
|
820
821
|
}
|
|
821
822
|
|
|
822
823
|
// src/components/components-tab/components.tsx
|
|
824
|
+
var FULL_HEIGHT_STYLE_ID = "components-full-height-panel";
|
|
825
|
+
var FULL_HEIGHT_CSS = `
|
|
826
|
+
#elementor-panel-page-elements {
|
|
827
|
+
display: flex;
|
|
828
|
+
flex-direction: column;
|
|
829
|
+
height: 100%;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
#elementor-panel-elements {
|
|
833
|
+
display: flex;
|
|
834
|
+
flex-direction: column;
|
|
835
|
+
flex: 1;
|
|
836
|
+
min-height: 0;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
#elementor-panel-elements-wrapper {
|
|
840
|
+
display: flex;
|
|
841
|
+
flex-direction: column;
|
|
842
|
+
flex: 1;
|
|
843
|
+
min-height: 0;
|
|
844
|
+
}
|
|
845
|
+
`;
|
|
846
|
+
var useFullHeightPanel = () => {
|
|
847
|
+
useLayoutEffect(() => {
|
|
848
|
+
let style = document.getElementById(FULL_HEIGHT_STYLE_ID);
|
|
849
|
+
if (!style) {
|
|
850
|
+
style = document.createElement("style");
|
|
851
|
+
style.id = FULL_HEIGHT_STYLE_ID;
|
|
852
|
+
style.textContent = FULL_HEIGHT_CSS;
|
|
853
|
+
document.head.appendChild(style);
|
|
854
|
+
}
|
|
855
|
+
return () => {
|
|
856
|
+
document.getElementById(FULL_HEIGHT_STYLE_ID)?.remove();
|
|
857
|
+
};
|
|
858
|
+
}, []);
|
|
859
|
+
};
|
|
823
860
|
var ComponentsContent = () => {
|
|
824
861
|
const { components, isLoading } = useComponents();
|
|
825
862
|
const hasComponents = !isLoading && components.length > 0;
|
|
826
863
|
const hasPro = hasProInstalled2();
|
|
827
864
|
const showProNotification = !hasPro && hasComponents;
|
|
828
|
-
|
|
865
|
+
useFullHeightPanel();
|
|
866
|
+
return /* @__PURE__ */ React8.createElement(Stack4, { 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));
|
|
829
867
|
};
|
|
830
868
|
var Components = () => {
|
|
831
869
|
return /* @__PURE__ */ React8.createElement(ThemeProvider, null, /* @__PURE__ */ React8.createElement(SearchProvider, { localStorageKey: "elementor-components-search" }, /* @__PURE__ */ React8.createElement(ComponentsContent, null)));
|
|
@@ -1369,7 +1407,19 @@ var EmptyState2 = ({ onEditComponent }) => {
|
|
|
1369
1407
|
/* @__PURE__ */ React14.createElement(ComponentPropListIcon, { fontSize: "large" }),
|
|
1370
1408
|
/* @__PURE__ */ React14.createElement(Typography5, { align: "center", variant: "subtitle2" }, __9("No properties yet", "elementor")),
|
|
1371
1409
|
/* @__PURE__ */ React14.createElement(Typography5, { align: "center", variant: "caption", maxWidth: "170px" }, message),
|
|
1372
|
-
canEdit &&
|
|
1410
|
+
canEdit && /* @__PURE__ */ React14.createElement(
|
|
1411
|
+
Button3,
|
|
1412
|
+
{
|
|
1413
|
+
variant: "outlined",
|
|
1414
|
+
color: "secondary",
|
|
1415
|
+
size: "small",
|
|
1416
|
+
sx: { mt: 1 },
|
|
1417
|
+
disabled: !onEditComponent,
|
|
1418
|
+
onClick: onEditComponent
|
|
1419
|
+
},
|
|
1420
|
+
/* @__PURE__ */ React14.createElement(PencilIcon, { fontSize: "small" }),
|
|
1421
|
+
__9("Edit component", "elementor")
|
|
1422
|
+
)
|
|
1373
1423
|
);
|
|
1374
1424
|
};
|
|
1375
1425
|
|
|
@@ -2195,14 +2245,14 @@ async function getComponentIds(elements, cache) {
|
|
|
2195
2245
|
async function getDocumentsMap(ids, cache) {
|
|
2196
2246
|
const documents = await Promise.all(
|
|
2197
2247
|
ids.map(async (id) => {
|
|
2198
|
-
const
|
|
2199
|
-
if (!
|
|
2248
|
+
const document2 = await cache.get(id);
|
|
2249
|
+
if (!document2) {
|
|
2200
2250
|
return null;
|
|
2201
2251
|
}
|
|
2202
|
-
return [id,
|
|
2252
|
+
return [id, document2];
|
|
2203
2253
|
})
|
|
2204
2254
|
);
|
|
2205
|
-
return new Map(documents.filter((
|
|
2255
|
+
return new Map(documents.filter((document2) => document2 !== null));
|
|
2206
2256
|
}
|
|
2207
2257
|
|
|
2208
2258
|
// src/store/actions/load-components-overridable-props.ts
|
|
@@ -2245,15 +2295,15 @@ function loadComponentsStyles(documents) {
|
|
|
2245
2295
|
}
|
|
2246
2296
|
function addStyles(documents) {
|
|
2247
2297
|
const styles = Object.fromEntries(
|
|
2248
|
-
[...documents.entries()].map(([id,
|
|
2298
|
+
[...documents.entries()].map(([id, document2]) => [id, extractStylesFromDocument(document2)])
|
|
2249
2299
|
);
|
|
2250
2300
|
dispatch5(slice.actions.addStyles(styles));
|
|
2251
2301
|
}
|
|
2252
|
-
function extractStylesFromDocument(
|
|
2253
|
-
if (!
|
|
2302
|
+
function extractStylesFromDocument(document2) {
|
|
2303
|
+
if (!document2.elements?.length) {
|
|
2254
2304
|
return [];
|
|
2255
2305
|
}
|
|
2256
|
-
return
|
|
2306
|
+
return document2.elements.flatMap(extractStylesFromElement);
|
|
2257
2307
|
}
|
|
2258
2308
|
function extractStylesFromElement(element) {
|
|
2259
2309
|
return [
|
|
@@ -2842,7 +2892,7 @@ async function publishDraftComponentsInPageBeforeSave({ status, elements }) {
|
|
|
2842
2892
|
return;
|
|
2843
2893
|
}
|
|
2844
2894
|
const documents = await getComponentDocuments(elements);
|
|
2845
|
-
const draftIds = [...documents.values()].filter(isDocumentDirty2).map((
|
|
2895
|
+
const draftIds = [...documents.values()].filter(isDocumentDirty2).map((document2) => document2.id);
|
|
2846
2896
|
if (draftIds.length === 0) {
|
|
2847
2897
|
return;
|
|
2848
2898
|
}
|