@elementor/editor-components 3.35.0-431 → 3.35.0-433
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 +343 -182
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +338 -173
- package/dist/index.mjs.map +1 -1
- package/package.json +22 -22
- package/src/components/component-properties-panel/properties-group.tsx +1 -0
- package/src/components/component-properties-panel/property-item.tsx +3 -0
- package/src/components/consts.ts +1 -0
- package/src/components/instance-editing-panel/override-prop-control.tsx +125 -51
- package/src/components/overridable-props/overridable-prop-control.tsx +16 -8
- package/src/components/overridable-props/overridable-prop-form.tsx +35 -4
- package/src/components/overridable-props/overridable-prop-indicator.tsx +9 -4
- package/src/components/overridable-props/utils/validate-prop-label.ts +38 -0
- package/src/init.ts +2 -1
- package/src/prop-types/component-instance-overrides-prop-type.ts +2 -0
- package/src/prop-types/component-overridable-prop-type.ts +3 -1
- package/src/provider/overridable-prop-context.tsx +5 -1
- package/src/store/actions/update-overridable-prop.ts +5 -2
- package/src/types.ts +1 -1
- package/src/utils/get-prop-type-for-component-override.ts +2 -1
- package/src/utils/resolve-override-prop-value.ts +51 -0
package/dist/index.js
CHANGED
|
@@ -44,7 +44,7 @@ var import_editor_panels4 = require("@elementor/editor-panels");
|
|
|
44
44
|
var import_editor_styles_repository2 = require("@elementor/editor-styles-repository");
|
|
45
45
|
var import_editor_v1_adapters10 = require("@elementor/editor-v1-adapters");
|
|
46
46
|
var import_store78 = require("@elementor/store");
|
|
47
|
-
var
|
|
47
|
+
var import_i18n30 = require("@wordpress/i18n");
|
|
48
48
|
|
|
49
49
|
// src/component-instance-transformer.ts
|
|
50
50
|
var import_editor_canvas = require("@elementor/editor-canvas");
|
|
@@ -379,7 +379,7 @@ var import_editor_documents5 = require("@elementor/editor-documents");
|
|
|
379
379
|
var import_icons7 = require("@elementor/icons");
|
|
380
380
|
var import_store25 = require("@elementor/store");
|
|
381
381
|
var import_ui10 = require("@elementor/ui");
|
|
382
|
-
var
|
|
382
|
+
var import_i18n12 = require("@wordpress/i18n");
|
|
383
383
|
|
|
384
384
|
// src/hooks/use-navigate-back.ts
|
|
385
385
|
var import_react = require("react");
|
|
@@ -463,7 +463,7 @@ var import_editor_elements4 = require("@elementor/editor-elements");
|
|
|
463
463
|
var import_editor_panels2 = require("@elementor/editor-panels");
|
|
464
464
|
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
465
465
|
var import_ui8 = require("@elementor/ui");
|
|
466
|
-
var
|
|
466
|
+
var import_i18n10 = require("@wordpress/i18n");
|
|
467
467
|
|
|
468
468
|
// src/components/component-properties-panel/component-properties-panel-content.tsx
|
|
469
469
|
var React7 = __toESM(require("react"));
|
|
@@ -473,7 +473,7 @@ var import_editor_panels = require("@elementor/editor-panels");
|
|
|
473
473
|
var import_icons5 = require("@elementor/icons");
|
|
474
474
|
var import_ui7 = require("@elementor/ui");
|
|
475
475
|
var import_utils2 = require("@elementor/utils");
|
|
476
|
-
var
|
|
476
|
+
var import_i18n9 = require("@wordpress/i18n");
|
|
477
477
|
|
|
478
478
|
// src/store/actions/add-overridable-group.ts
|
|
479
479
|
var import_store7 = require("@elementor/store");
|
|
@@ -926,7 +926,7 @@ var React6 = __toESM(require("react"));
|
|
|
926
926
|
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
927
927
|
var import_icons4 = require("@elementor/icons");
|
|
928
928
|
var import_ui6 = require("@elementor/ui");
|
|
929
|
-
var
|
|
929
|
+
var import_i18n6 = require("@wordpress/i18n");
|
|
930
930
|
|
|
931
931
|
// src/components/component-properties-panel/property-item.tsx
|
|
932
932
|
var React5 = __toESM(require("react"));
|
|
@@ -939,18 +939,55 @@ var React3 = __toESM(require("react"));
|
|
|
939
939
|
var import_react3 = require("react");
|
|
940
940
|
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
941
941
|
var import_ui3 = require("@elementor/ui");
|
|
942
|
+
var import_i18n5 = require("@wordpress/i18n");
|
|
943
|
+
|
|
944
|
+
// src/components/overridable-props/utils/validate-prop-label.ts
|
|
942
945
|
var import_i18n4 = require("@wordpress/i18n");
|
|
946
|
+
var ERROR_MESSAGES = {
|
|
947
|
+
EMPTY_NAME: (0, import_i18n4.__)("Property name is required", "elementor"),
|
|
948
|
+
DUPLICATE_NAME: (0, import_i18n4.__)("Property name already exists", "elementor")
|
|
949
|
+
};
|
|
950
|
+
function validatePropLabel(label, existingLabels, currentLabel) {
|
|
951
|
+
const trimmedLabel = label.trim();
|
|
952
|
+
if (!trimmedLabel) {
|
|
953
|
+
return { isValid: false, errorMessage: ERROR_MESSAGES.EMPTY_NAME };
|
|
954
|
+
}
|
|
955
|
+
const normalizedLabel = trimmedLabel.toLowerCase();
|
|
956
|
+
const normalizedCurrentLabel = currentLabel?.trim().toLowerCase();
|
|
957
|
+
const isDuplicate = existingLabels.some((existingLabel) => {
|
|
958
|
+
const normalizedExisting = existingLabel.trim().toLowerCase();
|
|
959
|
+
if (normalizedCurrentLabel && normalizedExisting === normalizedCurrentLabel) {
|
|
960
|
+
return false;
|
|
961
|
+
}
|
|
962
|
+
return normalizedExisting === normalizedLabel;
|
|
963
|
+
});
|
|
964
|
+
if (isDuplicate) {
|
|
965
|
+
return { isValid: false, errorMessage: ERROR_MESSAGES.DUPLICATE_NAME };
|
|
966
|
+
}
|
|
967
|
+
return { isValid: true, errorMessage: null };
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
// src/components/overridable-props/overridable-prop-form.tsx
|
|
943
971
|
var SIZE = "tiny";
|
|
944
|
-
var DEFAULT_GROUP = { value: null, label: (0,
|
|
945
|
-
function OverridablePropForm({ onSubmit, groups, currentValue, sx }) {
|
|
972
|
+
var DEFAULT_GROUP = { value: null, label: (0, import_i18n5.__)("Default", "elementor") };
|
|
973
|
+
function OverridablePropForm({ onSubmit, groups, currentValue, existingLabels = [], sx }) {
|
|
946
974
|
const [propLabel, setPropLabel] = (0, import_react3.useState)(currentValue?.label ?? null);
|
|
947
975
|
const [group, setGroup] = (0, import_react3.useState)(currentValue?.groupId ?? groups?.[0]?.value ?? null);
|
|
948
|
-
const
|
|
949
|
-
const
|
|
976
|
+
const [error, setError] = (0, import_react3.useState)(null);
|
|
977
|
+
const name = (0, import_i18n5.__)("Name", "elementor");
|
|
978
|
+
const groupName = (0, import_i18n5.__)("Group Name", "elementor");
|
|
950
979
|
const isCreate = currentValue === void 0;
|
|
951
|
-
const title = isCreate ? (0,
|
|
952
|
-
const ctaLabel = isCreate ? (0,
|
|
953
|
-
|
|
980
|
+
const title = isCreate ? (0, import_i18n5.__)("Create new property", "elementor") : (0, import_i18n5.__)("Update property", "elementor");
|
|
981
|
+
const ctaLabel = isCreate ? (0, import_i18n5.__)("Create", "elementor") : (0, import_i18n5.__)("Update", "elementor");
|
|
982
|
+
const handleSubmit = () => {
|
|
983
|
+
const validationResult = validatePropLabel(propLabel ?? "", existingLabels, currentValue?.label);
|
|
984
|
+
if (!validationResult.isValid) {
|
|
985
|
+
setError(validationResult.errorMessage);
|
|
986
|
+
return;
|
|
987
|
+
}
|
|
988
|
+
onSubmit({ label: propLabel ?? "", group });
|
|
989
|
+
};
|
|
990
|
+
return /* @__PURE__ */ React3.createElement(import_editor_ui2.Form, { onSubmit: handleSubmit }, /* @__PURE__ */ React3.createElement(import_ui3.Stack, { alignItems: "start", sx: { width: "268px", ...sx } }, /* @__PURE__ */ React3.createElement(
|
|
954
991
|
import_ui3.Stack,
|
|
955
992
|
{
|
|
956
993
|
direction: "row",
|
|
@@ -966,9 +1003,20 @@ function OverridablePropForm({ onSubmit, groups, currentValue, sx }) {
|
|
|
966
1003
|
name,
|
|
967
1004
|
size: SIZE,
|
|
968
1005
|
fullWidth: true,
|
|
969
|
-
placeholder: (0,
|
|
1006
|
+
placeholder: (0, import_i18n5.__)("Enter value", "elementor"),
|
|
970
1007
|
value: propLabel ?? "",
|
|
971
|
-
onChange: (e) =>
|
|
1008
|
+
onChange: (e) => {
|
|
1009
|
+
const newValue = e.target.value;
|
|
1010
|
+
setPropLabel(newValue);
|
|
1011
|
+
const validationResult = validatePropLabel(
|
|
1012
|
+
newValue,
|
|
1013
|
+
existingLabels,
|
|
1014
|
+
currentValue?.label
|
|
1015
|
+
);
|
|
1016
|
+
setError(validationResult.errorMessage);
|
|
1017
|
+
},
|
|
1018
|
+
error: Boolean(error),
|
|
1019
|
+
helperText: error
|
|
972
1020
|
}
|
|
973
1021
|
))), /* @__PURE__ */ React3.createElement(import_ui3.Grid, { container: true, gap: 0.75, alignItems: "start", px: 1.5, mb: 1.5 }, /* @__PURE__ */ React3.createElement(import_ui3.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React3.createElement(import_ui3.FormLabel, { size: "tiny" }, groupName)), /* @__PURE__ */ React3.createElement(import_ui3.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React3.createElement(
|
|
974
1022
|
import_ui3.Select,
|
|
@@ -988,7 +1036,17 @@ function OverridablePropForm({ onSubmit, groups, currentValue, sx }) {
|
|
|
988
1036
|
}
|
|
989
1037
|
},
|
|
990
1038
|
(groups ?? [DEFAULT_GROUP]).map(({ label: groupLabel, ...props }) => /* @__PURE__ */ React3.createElement(import_editor_ui2.MenuListItem, { key: props.value, ...props, value: props.value ?? "" }, groupLabel))
|
|
991
|
-
))), /* @__PURE__ */ React3.createElement(import_ui3.Stack, { direction: "row", justifyContent: "flex-end", alignSelf: "end", mt: 1.5, py: 1, px: 1.5 }, /* @__PURE__ */ React3.createElement(
|
|
1039
|
+
))), /* @__PURE__ */ React3.createElement(import_ui3.Stack, { direction: "row", justifyContent: "flex-end", alignSelf: "end", mt: 1.5, py: 1, px: 1.5 }, /* @__PURE__ */ React3.createElement(
|
|
1040
|
+
import_ui3.Button,
|
|
1041
|
+
{
|
|
1042
|
+
type: "submit",
|
|
1043
|
+
disabled: !propLabel || Boolean(error),
|
|
1044
|
+
variant: "contained",
|
|
1045
|
+
color: "primary",
|
|
1046
|
+
size: "small"
|
|
1047
|
+
},
|
|
1048
|
+
ctaLabel
|
|
1049
|
+
))));
|
|
992
1050
|
}
|
|
993
1051
|
|
|
994
1052
|
// src/components/component-properties-panel/sortable.tsx
|
|
@@ -1061,6 +1119,7 @@ function PropertyItem({
|
|
|
1061
1119
|
sortableTriggerProps,
|
|
1062
1120
|
isDragPlaceholder,
|
|
1063
1121
|
groups,
|
|
1122
|
+
existingLabels,
|
|
1064
1123
|
onDelete,
|
|
1065
1124
|
onUpdate
|
|
1066
1125
|
}) {
|
|
@@ -1136,6 +1195,7 @@ function PropertyItem({
|
|
|
1136
1195
|
onSubmit: handleSubmit,
|
|
1137
1196
|
currentValue: prop,
|
|
1138
1197
|
groups,
|
|
1198
|
+
existingLabels,
|
|
1139
1199
|
sx: { width: "100%" }
|
|
1140
1200
|
}
|
|
1141
1201
|
)
|
|
@@ -1246,7 +1306,7 @@ function PropertiesGroup({
|
|
|
1246
1306
|
className: "group-menu",
|
|
1247
1307
|
size: "tiny",
|
|
1248
1308
|
sx: { p: 0.25, visibility: isThisGroupEditing ? "visible" : void 0 },
|
|
1249
|
-
"aria-label": (0,
|
|
1309
|
+
"aria-label": (0, import_i18n6.__)("Group actions", "elementor"),
|
|
1250
1310
|
...(0, import_ui6.bindTrigger)(popupState)
|
|
1251
1311
|
},
|
|
1252
1312
|
/* @__PURE__ */ React6.createElement(import_icons4.DotsVerticalIcon, { fontSize: "tiny" })
|
|
@@ -1258,6 +1318,7 @@ function PropertiesGroup({
|
|
|
1258
1318
|
sortableTriggerProps: { ...triggerProps, style: triggerStyle },
|
|
1259
1319
|
isDragPlaceholder: isItemDragPlaceholder,
|
|
1260
1320
|
groups: allGroups,
|
|
1321
|
+
existingLabels: Object.values(props).map((p) => p.label),
|
|
1261
1322
|
onDelete: onPropertyDelete,
|
|
1262
1323
|
onUpdate: (data) => onPropertyUpdate(prop.overrideKey, data)
|
|
1263
1324
|
}
|
|
@@ -1269,11 +1330,11 @@ function PropertiesGroup({
|
|
|
1269
1330
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
1270
1331
|
transformOrigin: { vertical: "top", horizontal: "right" }
|
|
1271
1332
|
},
|
|
1272
|
-
/* @__PURE__ */ React6.createElement(import_editor_ui3.MenuListItem, { sx: { minWidth: "160px" }, onClick: handleRenameClick }, /* @__PURE__ */ React6.createElement(import_ui6.Typography, { variant: "caption", sx: { color: "text.primary" } }, (0,
|
|
1333
|
+
/* @__PURE__ */ React6.createElement(import_editor_ui3.MenuListItem, { sx: { minWidth: "160px" }, onClick: handleRenameClick }, /* @__PURE__ */ React6.createElement(import_ui6.Typography, { variant: "caption", sx: { color: "text.primary" } }, (0, import_i18n6.__)("Rename", "elementor"))),
|
|
1273
1334
|
/* @__PURE__ */ React6.createElement(
|
|
1274
1335
|
import_ui6.Tooltip,
|
|
1275
1336
|
{
|
|
1276
|
-
title: hasProperties ? (0,
|
|
1337
|
+
title: hasProperties ? (0, import_i18n6.__)("To delete the group, first remove all the properties", "elementor") : "",
|
|
1277
1338
|
placement: "right"
|
|
1278
1339
|
},
|
|
1279
1340
|
/* @__PURE__ */ React6.createElement("span", null, /* @__PURE__ */ React6.createElement(import_editor_ui3.MenuListItem, { onClick: handleDeleteClick, disabled: hasProperties }, /* @__PURE__ */ React6.createElement(
|
|
@@ -1282,7 +1343,7 @@ function PropertiesGroup({
|
|
|
1282
1343
|
variant: "caption",
|
|
1283
1344
|
sx: { color: hasProperties ? "text.disabled" : "error.light" }
|
|
1284
1345
|
},
|
|
1285
|
-
(0,
|
|
1346
|
+
(0, import_i18n6.__)("Delete", "elementor")
|
|
1286
1347
|
)))
|
|
1287
1348
|
)
|
|
1288
1349
|
)
|
|
@@ -1293,7 +1354,7 @@ function PropertiesGroup({
|
|
|
1293
1354
|
var import_react4 = require("react");
|
|
1294
1355
|
var import_editor_documents3 = require("@elementor/editor-documents");
|
|
1295
1356
|
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
1296
|
-
var
|
|
1357
|
+
var import_i18n8 = require("@wordpress/i18n");
|
|
1297
1358
|
|
|
1298
1359
|
// src/store/actions/rename-overridable-group.ts
|
|
1299
1360
|
var import_store21 = require("@elementor/store");
|
|
@@ -1320,19 +1381,19 @@ function renameOverridableGroup({ componentId, groupId, label }) {
|
|
|
1320
1381
|
}
|
|
1321
1382
|
|
|
1322
1383
|
// src/components/component-properties-panel/utils/validate-group-label.ts
|
|
1323
|
-
var
|
|
1324
|
-
var
|
|
1325
|
-
EMPTY_NAME: (0,
|
|
1326
|
-
DUPLICATE_NAME: (0,
|
|
1384
|
+
var import_i18n7 = require("@wordpress/i18n");
|
|
1385
|
+
var ERROR_MESSAGES2 = {
|
|
1386
|
+
EMPTY_NAME: (0, import_i18n7.__)("Group name is required", "elementor"),
|
|
1387
|
+
DUPLICATE_NAME: (0, import_i18n7.__)("Group name already exists", "elementor")
|
|
1327
1388
|
};
|
|
1328
1389
|
function validateGroupLabel(label, existingGroups) {
|
|
1329
1390
|
const trimmedLabel = label.trim();
|
|
1330
1391
|
if (!trimmedLabel) {
|
|
1331
|
-
return
|
|
1392
|
+
return ERROR_MESSAGES2.EMPTY_NAME;
|
|
1332
1393
|
}
|
|
1333
1394
|
const isDuplicate = Object.values(existingGroups).some((group) => group.label === trimmedLabel);
|
|
1334
1395
|
if (isDuplicate) {
|
|
1335
|
-
return
|
|
1396
|
+
return ERROR_MESSAGES2.DUPLICATE_NAME;
|
|
1336
1397
|
}
|
|
1337
1398
|
return "";
|
|
1338
1399
|
}
|
|
@@ -1352,7 +1413,7 @@ function useCurrentEditableItem() {
|
|
|
1352
1413
|
};
|
|
1353
1414
|
const handleSubmit = (newLabel) => {
|
|
1354
1415
|
if (!editingGroupId || !currentComponentId) {
|
|
1355
|
-
throw new Error((0,
|
|
1416
|
+
throw new Error((0, import_i18n8.__)("Group ID or component ID is missing", "elementor"));
|
|
1356
1417
|
}
|
|
1357
1418
|
renameOverridableGroup({
|
|
1358
1419
|
componentId: currentComponentId,
|
|
@@ -1460,20 +1521,20 @@ function ComponentPropertiesPanelContent({ onClose }) {
|
|
|
1460
1521
|
deleteOverridableGroup({ componentId: currentComponentId, groupId });
|
|
1461
1522
|
(0, import_editor_documents4.setDocumentModifiedStatus)(true);
|
|
1462
1523
|
};
|
|
1463
|
-
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(import_editor_panels.PanelHeader, { sx: { justifyContent: "start", pl: 1.5, pr: 1, py: 1 } }, /* @__PURE__ */ React7.createElement(import_ui7.Stack, { direction: "row", alignItems: "center", gap: 0.5, flexGrow: 1 }, /* @__PURE__ */ React7.createElement(import_icons5.ComponentPropListIcon, { fontSize: "tiny" }), /* @__PURE__ */ React7.createElement(import_editor_panels.PanelHeaderTitle, { variant: "subtitle2" }, (0,
|
|
1524
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(import_editor_panels.PanelHeader, { sx: { justifyContent: "start", pl: 1.5, pr: 1, py: 1 } }, /* @__PURE__ */ React7.createElement(import_ui7.Stack, { direction: "row", alignItems: "center", gap: 0.5, flexGrow: 1 }, /* @__PURE__ */ React7.createElement(import_icons5.ComponentPropListIcon, { fontSize: "tiny" }), /* @__PURE__ */ React7.createElement(import_editor_panels.PanelHeaderTitle, { variant: "subtitle2" }, (0, import_i18n9.__)("Component properties", "elementor"))), !showEmptyState && /* @__PURE__ */ React7.createElement(import_ui7.Tooltip, { title: (0, import_i18n9.__)("Add new group", "elementor") }, /* @__PURE__ */ React7.createElement(
|
|
1464
1525
|
import_ui7.IconButton,
|
|
1465
1526
|
{
|
|
1466
1527
|
size: "tiny",
|
|
1467
|
-
"aria-label": (0,
|
|
1528
|
+
"aria-label": (0, import_i18n9.__)("Add new group", "elementor"),
|
|
1468
1529
|
onClick: handleAddGroupClick
|
|
1469
1530
|
},
|
|
1470
1531
|
/* @__PURE__ */ React7.createElement(import_icons5.FolderPlusIcon, { fontSize: "tiny" })
|
|
1471
|
-
)), /* @__PURE__ */ React7.createElement(import_ui7.Tooltip, { title: (0,
|
|
1532
|
+
)), /* @__PURE__ */ React7.createElement(import_ui7.Tooltip, { title: (0, import_i18n9.__)("Close panel", "elementor") }, /* @__PURE__ */ React7.createElement(
|
|
1472
1533
|
import_ui7.IconButton,
|
|
1473
1534
|
{
|
|
1474
1535
|
ref: introductionRef,
|
|
1475
1536
|
size: "tiny",
|
|
1476
|
-
"aria-label": (0,
|
|
1537
|
+
"aria-label": (0, import_i18n9.__)("Close panel", "elementor"),
|
|
1477
1538
|
onClick: onClose
|
|
1478
1539
|
},
|
|
1479
1540
|
/* @__PURE__ */ React7.createElement(import_icons5.XIcon, { fontSize: "tiny" })
|
|
@@ -1519,14 +1580,14 @@ function ComponentPropertiesPanel() {
|
|
|
1519
1580
|
}
|
|
1520
1581
|
)))));
|
|
1521
1582
|
}
|
|
1522
|
-
var ErrorBoundaryFallback = () => /* @__PURE__ */ React8.createElement(import_ui8.Box, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React8.createElement(import_ui8.Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React8.createElement("strong", null, (0,
|
|
1583
|
+
var ErrorBoundaryFallback = () => /* @__PURE__ */ React8.createElement(import_ui8.Box, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React8.createElement(import_ui8.Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React8.createElement("strong", null, (0, import_i18n10.__)("Something went wrong", "elementor"))));
|
|
1523
1584
|
|
|
1524
1585
|
// src/components/component-panel-header/component-badge.tsx
|
|
1525
1586
|
var React9 = __toESM(require("react"));
|
|
1526
1587
|
var import_react6 = require("react");
|
|
1527
1588
|
var import_icons6 = require("@elementor/icons");
|
|
1528
1589
|
var import_ui9 = require("@elementor/ui");
|
|
1529
|
-
var
|
|
1590
|
+
var import_i18n11 = require("@wordpress/i18n");
|
|
1530
1591
|
var ComponentsBadge = React9.forwardRef(
|
|
1531
1592
|
({ overridesCount, onClick }, ref) => {
|
|
1532
1593
|
const prevCount = usePrevious(overridesCount);
|
|
@@ -1548,7 +1609,7 @@ var ComponentsBadge = React9.forwardRef(
|
|
|
1548
1609
|
value: "overrides",
|
|
1549
1610
|
size: "tiny",
|
|
1550
1611
|
onClick,
|
|
1551
|
-
"aria-label": (0,
|
|
1612
|
+
"aria-label": (0, import_i18n11.__)("View overrides", "elementor")
|
|
1552
1613
|
},
|
|
1553
1614
|
/* @__PURE__ */ React9.createElement(import_icons6.ComponentPropListIcon, { fontSize: "tiny" })
|
|
1554
1615
|
)
|
|
@@ -1611,7 +1672,7 @@ var ComponentPanelHeader = () => {
|
|
|
1611
1672
|
justifyContent: "space-between",
|
|
1612
1673
|
sx: { height: 48, pl: 1.5, pr: 2, py: 1 }
|
|
1613
1674
|
},
|
|
1614
|
-
/* @__PURE__ */ React10.createElement(import_ui10.Stack, { direction: "row", alignItems: "center" }, /* @__PURE__ */ React10.createElement(import_ui10.Tooltip, { title: (0,
|
|
1675
|
+
/* @__PURE__ */ React10.createElement(import_ui10.Stack, { direction: "row", alignItems: "center" }, /* @__PURE__ */ React10.createElement(import_ui10.Tooltip, { title: (0, import_i18n12.__)("Back", "elementor") }, /* @__PURE__ */ React10.createElement(import_ui10.IconButton, { size: "tiny", onClick: onBack, "aria-label": (0, import_i18n12.__)("Back", "elementor") }, /* @__PURE__ */ React10.createElement(import_icons7.ArrowLeftIcon, { fontSize: "tiny" }))), /* @__PURE__ */ React10.createElement(import_ui10.Stack, { direction: "row", alignItems: "center", gap: 0.5 }, /* @__PURE__ */ React10.createElement(import_icons7.ComponentsFilledIcon, { fontSize: "tiny", stroke: "currentColor" }), /* @__PURE__ */ React10.createElement(import_ui10.Typography, { variant: "caption", sx: { fontWeight: 500 } }, componentName))),
|
|
1615
1676
|
/* @__PURE__ */ React10.createElement(ComponentsBadge, { overridesCount, ref: anchorRef, onClick: openPropertiesPanel })
|
|
1616
1677
|
), /* @__PURE__ */ React10.createElement(import_ui10.Divider, null), /* @__PURE__ */ React10.createElement(
|
|
1617
1678
|
ComponentIntroduction,
|
|
@@ -1650,7 +1711,7 @@ var useComponents = () => {
|
|
|
1650
1711
|
var React12 = __toESM(require("react"));
|
|
1651
1712
|
var import_icons8 = require("@elementor/icons");
|
|
1652
1713
|
var import_ui11 = require("@elementor/ui");
|
|
1653
|
-
var
|
|
1714
|
+
var import_i18n13 = require("@wordpress/i18n");
|
|
1654
1715
|
|
|
1655
1716
|
// src/components/components-tab/search-provider.tsx
|
|
1656
1717
|
var React11 = __toESM(require("react"));
|
|
@@ -1685,7 +1746,7 @@ var ComponentSearch = () => {
|
|
|
1685
1746
|
fullWidth: true,
|
|
1686
1747
|
size: "tiny",
|
|
1687
1748
|
value: inputValue,
|
|
1688
|
-
placeholder: (0,
|
|
1749
|
+
placeholder: (0, import_i18n13.__)("Search", "elementor"),
|
|
1689
1750
|
onChange: (e) => handleChange(e.target.value),
|
|
1690
1751
|
InputProps: {
|
|
1691
1752
|
startAdornment: /* @__PURE__ */ React12.createElement(import_ui11.InputAdornment, { position: "start" }, /* @__PURE__ */ React12.createElement(import_icons8.SearchIcon, { fontSize: "tiny" }))
|
|
@@ -1700,7 +1761,7 @@ var import_react9 = require("react");
|
|
|
1700
1761
|
var import_editor_mcp = require("@elementor/editor-mcp");
|
|
1701
1762
|
var import_icons10 = require("@elementor/icons");
|
|
1702
1763
|
var import_ui15 = require("@elementor/ui");
|
|
1703
|
-
var
|
|
1764
|
+
var import_i18n20 = require("@wordpress/i18n");
|
|
1704
1765
|
|
|
1705
1766
|
// src/store/actions/rename-component.ts
|
|
1706
1767
|
var import_editor_documents7 = require("@elementor/editor-documents");
|
|
@@ -1711,7 +1772,7 @@ var import_store33 = require("@elementor/store");
|
|
|
1711
1772
|
var import_editor_canvas4 = require("@elementor/editor-canvas");
|
|
1712
1773
|
var import_editor_documents6 = require("@elementor/editor-documents");
|
|
1713
1774
|
var import_store31 = require("@elementor/store");
|
|
1714
|
-
var
|
|
1775
|
+
var import_i18n14 = require("@wordpress/i18n");
|
|
1715
1776
|
|
|
1716
1777
|
// src/utils/tracking.ts
|
|
1717
1778
|
var import_mixpanel = require("@elementor/mixpanel");
|
|
@@ -1864,7 +1925,7 @@ function createComponentView(options) {
|
|
|
1864
1925
|
action: {
|
|
1865
1926
|
name: "edit component",
|
|
1866
1927
|
icon: "eicon-edit",
|
|
1867
|
-
title: () => (0,
|
|
1928
|
+
title: () => (0, import_i18n14.__)("Edit Component", "elementor"),
|
|
1868
1929
|
isEnabled: () => true,
|
|
1869
1930
|
callback: (_, eventData) => this.editComponent(eventData)
|
|
1870
1931
|
}
|
|
@@ -2014,7 +2075,7 @@ function findComponentInstancesByUid(documentContainer, componentUid) {
|
|
|
2014
2075
|
// src/components/components-tab/angie-promotion-modal.tsx
|
|
2015
2076
|
var React13 = __toESM(require("react"));
|
|
2016
2077
|
var import_ui12 = require("@elementor/ui");
|
|
2017
|
-
var
|
|
2078
|
+
var import_i18n15 = require("@wordpress/i18n");
|
|
2018
2079
|
var ANGIE_INSTALL_URL = "/wp-admin/plugin-install.php?tab=plugin-information&plugin=angie";
|
|
2019
2080
|
var PLACEHOLDER_IMAGE_URL = "https://assets.elementor.com/packages/v1/images/components-angie-promo.svg";
|
|
2020
2081
|
var AngiePromotionModal = ({ children, open, onClose }) => {
|
|
@@ -2028,7 +2089,7 @@ function AngiePromotionCard({ onClose }) {
|
|
|
2028
2089
|
return /* @__PURE__ */ React13.createElement(import_ui12.ClickAwayListener, { disableReactTree: true, mouseEvent: "onMouseDown", touchEvent: "onTouchStart", onClickAway: onClose }, /* @__PURE__ */ React13.createElement(import_ui12.Card, { elevation: 0, sx: { maxWidth: 296 } }, /* @__PURE__ */ React13.createElement(
|
|
2029
2090
|
import_ui12.CardHeader,
|
|
2030
2091
|
{
|
|
2031
|
-
title: (0,
|
|
2092
|
+
title: (0, import_i18n15.__)("Add new component with AI", "elementor"),
|
|
2032
2093
|
titleTypographyProps: { variant: "subtitle2" },
|
|
2033
2094
|
action: /* @__PURE__ */ React13.createElement(import_ui12.CloseButton, { slotProps: { icon: { fontSize: "tiny" } }, onClick: onClose })
|
|
2034
2095
|
}
|
|
@@ -2040,10 +2101,10 @@ function AngiePromotionCard({ onClose }) {
|
|
|
2040
2101
|
alt: "",
|
|
2041
2102
|
sx: { width: "100%", aspectRatio: "16 / 9" }
|
|
2042
2103
|
}
|
|
2043
|
-
), /* @__PURE__ */ React13.createElement(import_ui12.CardContent, null, /* @__PURE__ */ React13.createElement(import_ui12.Typography, { variant: "body2", color: "text.secondary" }, (0,
|
|
2104
|
+
), /* @__PURE__ */ React13.createElement(import_ui12.CardContent, null, /* @__PURE__ */ React13.createElement(import_ui12.Typography, { variant: "body2", color: "text.secondary" }, (0, import_i18n15.__)(
|
|
2044
2105
|
"Angie our AI assistant can easily create new components and save you the hassle of doing it yourself",
|
|
2045
2106
|
"elementor"
|
|
2046
|
-
))), /* @__PURE__ */ React13.createElement(import_ui12.CardActions, { sx: { justifyContent: "flex-end" } }, /* @__PURE__ */ React13.createElement(import_ui12.Button, { size: "medium", variant: "contained", color: "accent", onClick: handleCtaClick }, (0,
|
|
2107
|
+
))), /* @__PURE__ */ React13.createElement(import_ui12.CardActions, { sx: { justifyContent: "flex-end" } }, /* @__PURE__ */ React13.createElement(import_ui12.Button, { size: "medium", variant: "contained", color: "accent", onClick: handleCtaClick }, (0, import_i18n15.__)("Get Angie", "elementor")))));
|
|
2047
2108
|
}
|
|
2048
2109
|
|
|
2049
2110
|
// src/components/components-tab/components-item.tsx
|
|
@@ -2054,17 +2115,17 @@ var import_editor_elements8 = require("@elementor/editor-elements");
|
|
|
2054
2115
|
var import_editor_ui7 = require("@elementor/editor-ui");
|
|
2055
2116
|
var import_icons9 = require("@elementor/icons");
|
|
2056
2117
|
var import_ui13 = require("@elementor/ui");
|
|
2057
|
-
var
|
|
2118
|
+
var import_i18n19 = require("@wordpress/i18n");
|
|
2058
2119
|
|
|
2059
2120
|
// src/store/actions/archive-component.ts
|
|
2060
2121
|
var import_editor_documents8 = require("@elementor/editor-documents");
|
|
2061
2122
|
var import_editor_notifications = require("@elementor/editor-notifications");
|
|
2062
2123
|
var import_store35 = require("@elementor/store");
|
|
2063
|
-
var
|
|
2124
|
+
var import_i18n16 = require("@wordpress/i18n");
|
|
2064
2125
|
var successNotification = (componentId, componentName) => ({
|
|
2065
2126
|
type: "success",
|
|
2066
2127
|
/* translators: %s: component name */
|
|
2067
|
-
message: (0,
|
|
2128
|
+
message: (0, import_i18n16.__)("Successfully deleted component %s", "elementor").replace("%s", componentName),
|
|
2068
2129
|
id: `success-archived-components-notification-${componentId}`
|
|
2069
2130
|
});
|
|
2070
2131
|
var archiveComponent = (componentId, componentName) => {
|
|
@@ -2186,14 +2247,14 @@ var import_store41 = require("@elementor/store");
|
|
|
2186
2247
|
|
|
2187
2248
|
// src/components/create-component-form/utils/component-form-schema.ts
|
|
2188
2249
|
var import_schema = require("@elementor/schema");
|
|
2189
|
-
var
|
|
2250
|
+
var import_i18n17 = require("@wordpress/i18n");
|
|
2190
2251
|
var MIN_NAME_LENGTH = 2;
|
|
2191
2252
|
var MAX_NAME_LENGTH = 50;
|
|
2192
|
-
var baseComponentSchema = import_schema.z.string().trim().max(MAX_NAME_LENGTH, (0,
|
|
2253
|
+
var baseComponentSchema = import_schema.z.string().trim().max(MAX_NAME_LENGTH, (0, import_i18n17.__)("Component name is too long. Please keep it under 50 characters.", "elementor"));
|
|
2193
2254
|
var createBaseComponentSchema = (existingNames) => {
|
|
2194
2255
|
return import_schema.z.object({
|
|
2195
2256
|
componentName: baseComponentSchema.refine((value) => !existingNames.includes(value), {
|
|
2196
|
-
message: (0,
|
|
2257
|
+
message: (0, import_i18n17.__)("Component name already exists", "elementor")
|
|
2197
2258
|
})
|
|
2198
2259
|
});
|
|
2199
2260
|
};
|
|
@@ -2201,9 +2262,9 @@ var createSubmitComponentSchema = (existingNames) => {
|
|
|
2201
2262
|
const baseSchema = createBaseComponentSchema(existingNames);
|
|
2202
2263
|
return baseSchema.extend({
|
|
2203
2264
|
componentName: baseSchema.shape.componentName.refine((value) => value.length > 0, {
|
|
2204
|
-
message: (0,
|
|
2265
|
+
message: (0, import_i18n17.__)("Component name is required.", "elementor")
|
|
2205
2266
|
}).refine((value) => value.length >= MIN_NAME_LENGTH, {
|
|
2206
|
-
message: (0,
|
|
2267
|
+
message: (0, import_i18n17.__)("Component name is too short. Please enter at least 2 characters.", "elementor")
|
|
2207
2268
|
})
|
|
2208
2269
|
});
|
|
2209
2270
|
};
|
|
@@ -2297,9 +2358,9 @@ var createComponentModel2 = (component) => {
|
|
|
2297
2358
|
// src/components/components-tab/delete-confirmation-dialog.tsx
|
|
2298
2359
|
var React14 = __toESM(require("react"));
|
|
2299
2360
|
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
2300
|
-
var
|
|
2361
|
+
var import_i18n18 = require("@wordpress/i18n");
|
|
2301
2362
|
function DeleteConfirmationDialog({ open, onClose, onConfirm }) {
|
|
2302
|
-
return /* @__PURE__ */ React14.createElement(import_editor_ui6.ConfirmationDialog, { open, onClose }, /* @__PURE__ */ React14.createElement(import_editor_ui6.ConfirmationDialog.Title, null, (0,
|
|
2363
|
+
return /* @__PURE__ */ React14.createElement(import_editor_ui6.ConfirmationDialog, { open, onClose }, /* @__PURE__ */ React14.createElement(import_editor_ui6.ConfirmationDialog.Title, null, (0, import_i18n18.__)("Delete this component?", "elementor")), /* @__PURE__ */ React14.createElement(import_editor_ui6.ConfirmationDialog.Content, null, /* @__PURE__ */ React14.createElement(import_editor_ui6.ConfirmationDialog.ContentText, null, (0, import_i18n18.__)(
|
|
2303
2364
|
"Existing instances on your pages will remain functional. You will no longer find this component in your list.",
|
|
2304
2365
|
"elementor"
|
|
2305
2366
|
))), /* @__PURE__ */ React14.createElement(import_editor_ui6.ConfirmationDialog.Actions, { onClose, onConfirm }));
|
|
@@ -2427,9 +2488,9 @@ var ComponentItem = ({ component, renameComponent: renameComponent2 }) => {
|
|
|
2427
2488
|
openEditMode();
|
|
2428
2489
|
}
|
|
2429
2490
|
},
|
|
2430
|
-
(0,
|
|
2491
|
+
(0, import_i18n19.__)("Rename", "elementor")
|
|
2431
2492
|
),
|
|
2432
|
-
/* @__PURE__ */ React15.createElement(import_editor_ui7.MenuListItem, { sx: { minWidth: "160px" }, onClick: handleDeleteClick }, /* @__PURE__ */ React15.createElement(import_ui13.Typography, { variant: "caption", sx: { color: "error.light" } }, (0,
|
|
2493
|
+
/* @__PURE__ */ React15.createElement(import_editor_ui7.MenuListItem, { sx: { minWidth: "160px" }, onClick: handleDeleteClick }, /* @__PURE__ */ React15.createElement(import_ui13.Typography, { variant: "caption", sx: { color: "error.light" } }, (0, import_i18n19.__)("Delete", "elementor")))
|
|
2433
2494
|
), /* @__PURE__ */ React15.createElement(
|
|
2434
2495
|
DeleteConfirmationDialog,
|
|
2435
2496
|
{
|
|
@@ -2555,7 +2616,7 @@ var EmptyState = () => {
|
|
|
2555
2616
|
const sdk = (0, import_editor_mcp.getAngieSdk)();
|
|
2556
2617
|
if (sdk.isAngieReady()) {
|
|
2557
2618
|
sdk.triggerAngie({
|
|
2558
|
-
prompt: (0,
|
|
2619
|
+
prompt: (0, import_i18n20.__)(
|
|
2559
2620
|
"Create a [hero/testimonial/product card/CTA/feature] component for my [business type]. Include [describe what you want]",
|
|
2560
2621
|
"elementor"
|
|
2561
2622
|
),
|
|
@@ -2575,7 +2636,7 @@ var EmptyState = () => {
|
|
|
2575
2636
|
gap: 2,
|
|
2576
2637
|
overflow: "hidden"
|
|
2577
2638
|
},
|
|
2578
|
-
/* @__PURE__ */ React17.createElement(import_ui15.Stack, { alignItems: "center", gap: 1 }, /* @__PURE__ */ React17.createElement(import_icons10.ComponentsIcon, { fontSize: "large", sx: { color: "text.secondary" } }), /* @__PURE__ */ React17.createElement(import_ui15.Typography, { align: "center", variant: "subtitle2", color: "text.secondary", sx: SUBTITLE_OVERRIDE_SX }, (0,
|
|
2639
|
+
/* @__PURE__ */ React17.createElement(import_ui15.Stack, { alignItems: "center", gap: 1 }, /* @__PURE__ */ React17.createElement(import_icons10.ComponentsIcon, { fontSize: "large", sx: { color: "text.secondary" } }), /* @__PURE__ */ React17.createElement(import_ui15.Typography, { align: "center", variant: "subtitle2", color: "text.secondary", sx: SUBTITLE_OVERRIDE_SX }, (0, import_i18n20.__)("No components yet", "elementor")), /* @__PURE__ */ React17.createElement(import_ui15.Typography, { align: "center", variant: "caption", color: "secondary", sx: { maxWidth: 200 } }, (0, import_i18n20.__)("Components are reusable blocks that sync across your site.", "elementor"), /* @__PURE__ */ React17.createElement("br", null), (0, import_i18n20.__)("Create once, use everywhere.", "elementor")), /* @__PURE__ */ React17.createElement(
|
|
2579
2640
|
import_ui15.Link,
|
|
2580
2641
|
{
|
|
2581
2642
|
href: LEARN_MORE_URL,
|
|
@@ -2584,13 +2645,13 @@ var EmptyState = () => {
|
|
|
2584
2645
|
variant: "caption",
|
|
2585
2646
|
color: "info.main"
|
|
2586
2647
|
},
|
|
2587
|
-
(0,
|
|
2648
|
+
(0, import_i18n20.__)("Learn more about components", "elementor")
|
|
2588
2649
|
)),
|
|
2589
2650
|
/* @__PURE__ */ React17.createElement(import_ui15.Divider, { sx: { width: "100%" } }),
|
|
2590
|
-
/* @__PURE__ */ React17.createElement(import_ui15.Stack, { alignItems: "center", gap: 1, width: "100%" }, /* @__PURE__ */ React17.createElement(import_ui15.Typography, { align: "center", variant: "subtitle2", color: "text.secondary", sx: SUBTITLE_OVERRIDE_SX }, (0,
|
|
2651
|
+
/* @__PURE__ */ React17.createElement(import_ui15.Stack, { alignItems: "center", gap: 1, width: "100%" }, /* @__PURE__ */ React17.createElement(import_ui15.Typography, { align: "center", variant: "subtitle2", color: "text.secondary", sx: SUBTITLE_OVERRIDE_SX }, (0, import_i18n20.__)("Create your first one:", "elementor")), /* @__PURE__ */ React17.createElement(import_ui15.Typography, { align: "center", variant: "caption", color: "secondary", sx: { maxWidth: 228 } }, (0, import_i18n20.__)(
|
|
2591
2652
|
'Right-click any div-block or flexbox on your canvas or structure and select "Create component"',
|
|
2592
2653
|
"elementor"
|
|
2593
|
-
)), /* @__PURE__ */ React17.createElement(import_ui15.Typography, { align: "center", variant: "caption", color: "secondary" }, (0,
|
|
2654
|
+
)), /* @__PURE__ */ React17.createElement(import_ui15.Typography, { align: "center", variant: "caption", color: "secondary" }, (0, import_i18n20.__)("Or", "elementor")), /* @__PURE__ */ React17.createElement(AngiePromotionModal, { open: isAngieModalOpen, onClose: () => setIsAngieModalOpen(false) }, /* @__PURE__ */ React17.createElement(
|
|
2594
2655
|
import_ui15.Button,
|
|
2595
2656
|
{
|
|
2596
2657
|
color: "secondary",
|
|
@@ -2599,7 +2660,7 @@ var EmptyState = () => {
|
|
|
2599
2660
|
onClick: handleCreateWithAI,
|
|
2600
2661
|
endIcon: /* @__PURE__ */ React17.createElement(import_icons10.AIIcon, null)
|
|
2601
2662
|
},
|
|
2602
|
-
(0,
|
|
2663
|
+
(0, import_i18n20.__)("Create component with AI", "elementor")
|
|
2603
2664
|
)))
|
|
2604
2665
|
);
|
|
2605
2666
|
};
|
|
@@ -2623,7 +2684,7 @@ var EmptySearchResult = () => {
|
|
|
2623
2684
|
width: "100%"
|
|
2624
2685
|
}
|
|
2625
2686
|
},
|
|
2626
|
-
/* @__PURE__ */ React17.createElement(import_ui15.Typography, { align: "center", variant: "subtitle2", color: "inherit", sx: SUBTITLE_OVERRIDE_SX }, (0,
|
|
2687
|
+
/* @__PURE__ */ React17.createElement(import_ui15.Typography, { align: "center", variant: "subtitle2", color: "inherit", sx: SUBTITLE_OVERRIDE_SX }, (0, import_i18n20.__)("Sorry, nothing matched", "elementor")),
|
|
2627
2688
|
searchValue && /* @__PURE__ */ React17.createElement(
|
|
2628
2689
|
import_ui15.Typography,
|
|
2629
2690
|
{
|
|
@@ -2651,8 +2712,8 @@ var EmptySearchResult = () => {
|
|
|
2651
2712
|
/* @__PURE__ */ React17.createElement("span", null, "\u201D.")
|
|
2652
2713
|
)
|
|
2653
2714
|
),
|
|
2654
|
-
/* @__PURE__ */ React17.createElement(import_ui15.Typography, { align: "center", variant: "caption", color: "inherit" }, (0,
|
|
2655
|
-
/* @__PURE__ */ React17.createElement(import_ui15.Typography, { align: "center", variant: "caption", color: "inherit" }, /* @__PURE__ */ React17.createElement(import_ui15.Link, { color: "secondary", variant: "caption", component: "button", onClick: clearSearch }, (0,
|
|
2715
|
+
/* @__PURE__ */ React17.createElement(import_ui15.Typography, { align: "center", variant: "caption", color: "inherit" }, (0, import_i18n20.__)("Try something else.", "elementor")),
|
|
2716
|
+
/* @__PURE__ */ React17.createElement(import_ui15.Typography, { align: "center", variant: "caption", color: "inherit" }, /* @__PURE__ */ React17.createElement(import_ui15.Link, { color: "secondary", variant: "caption", component: "button", onClick: clearSearch }, (0, import_i18n20.__)("Clear & try again", "elementor")))
|
|
2656
2717
|
);
|
|
2657
2718
|
};
|
|
2658
2719
|
var useFilteredComponents = () => {
|
|
@@ -2679,6 +2740,7 @@ var Components = () => {
|
|
|
2679
2740
|
|
|
2680
2741
|
// src/components/consts.ts
|
|
2681
2742
|
var COMPONENT_DOCUMENT_TYPE = "elementor_component";
|
|
2743
|
+
var OVERRIDABLE_PROP_REPLACEMENT_ID = "overridable-prop";
|
|
2682
2744
|
|
|
2683
2745
|
// src/components/create-component-form/create-component-form.tsx
|
|
2684
2746
|
var React19 = __toESM(require("react"));
|
|
@@ -2689,7 +2751,7 @@ var import_editor_ui9 = require("@elementor/editor-ui");
|
|
|
2689
2751
|
var import_icons11 = require("@elementor/icons");
|
|
2690
2752
|
var import_store47 = require("@elementor/store");
|
|
2691
2753
|
var import_ui16 = require("@elementor/ui");
|
|
2692
|
-
var
|
|
2754
|
+
var import_i18n22 = require("@wordpress/i18n");
|
|
2693
2755
|
|
|
2694
2756
|
// src/prevent-non-atomic-nesting.ts
|
|
2695
2757
|
var import_editor_canvas6 = require("@elementor/editor-canvas");
|
|
@@ -2697,10 +2759,10 @@ var import_editor_elements9 = require("@elementor/editor-elements");
|
|
|
2697
2759
|
var import_editor_notifications2 = require("@elementor/editor-notifications");
|
|
2698
2760
|
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
2699
2761
|
var import_store43 = require("@elementor/store");
|
|
2700
|
-
var
|
|
2762
|
+
var import_i18n21 = require("@wordpress/i18n");
|
|
2701
2763
|
var NON_ATOMIC_ELEMENT_ALERT = {
|
|
2702
2764
|
type: "default",
|
|
2703
|
-
message: (0,
|
|
2765
|
+
message: (0, import_i18n21.__)("This widget isn't compatible with components. Use atomic elements instead.", "elementor"),
|
|
2704
2766
|
id: "non-atomic-element-blocked"
|
|
2705
2767
|
};
|
|
2706
2768
|
function initNonAtomicNestingPrevention() {
|
|
@@ -2920,7 +2982,7 @@ function CreateComponentForm() {
|
|
|
2920
2982
|
if (nonAtomicElements.length > 0) {
|
|
2921
2983
|
(0, import_editor_notifications3.notify)({
|
|
2922
2984
|
type: "default",
|
|
2923
|
-
message: (0,
|
|
2985
|
+
message: (0, import_i18n22.__)(
|
|
2924
2986
|
"Components require atomic elements only. Remove widgets to create this component.",
|
|
2925
2987
|
"elementor"
|
|
2926
2988
|
),
|
|
@@ -2959,12 +3021,12 @@ function CreateComponentForm() {
|
|
|
2959
3021
|
}
|
|
2960
3022
|
(0, import_editor_notifications3.notify)({
|
|
2961
3023
|
type: "success",
|
|
2962
|
-
message: (0,
|
|
3024
|
+
message: (0, import_i18n22.__)("Component created successfully.", "elementor"),
|
|
2963
3025
|
id: `component-saved-successfully-${uid}`
|
|
2964
3026
|
});
|
|
2965
3027
|
resetAndClosePopup();
|
|
2966
3028
|
} catch {
|
|
2967
|
-
const errorMessage = (0,
|
|
3029
|
+
const errorMessage = (0, import_i18n22.__)("Failed to create component. Please try again.", "elementor");
|
|
2968
3030
|
(0, import_editor_notifications3.notify)({
|
|
2969
3031
|
type: "error",
|
|
2970
3032
|
message: errorMessage,
|
|
@@ -3027,10 +3089,10 @@ var Form2 = ({
|
|
|
3027
3089
|
}
|
|
3028
3090
|
};
|
|
3029
3091
|
const texts = {
|
|
3030
|
-
heading: (0,
|
|
3031
|
-
name: (0,
|
|
3032
|
-
cancel: (0,
|
|
3033
|
-
create: (0,
|
|
3092
|
+
heading: (0, import_i18n22.__)("Create component", "elementor"),
|
|
3093
|
+
name: (0, import_i18n22.__)("Name", "elementor"),
|
|
3094
|
+
cancel: (0, import_i18n22.__)("Cancel", "elementor"),
|
|
3095
|
+
create: (0, import_i18n22.__)("Create", "elementor")
|
|
3034
3096
|
};
|
|
3035
3097
|
const nameInputId = "component-name";
|
|
3036
3098
|
return /* @__PURE__ */ React19.createElement(import_editor_ui9.Form, { onSubmit: handleSubmit }, /* @__PURE__ */ React19.createElement(import_ui16.Stack, { alignItems: "start", width: "268px" }, /* @__PURE__ */ React19.createElement(
|
|
@@ -3086,7 +3148,7 @@ function updateCurrentComponent({
|
|
|
3086
3148
|
var React20 = __toESM(require("react"));
|
|
3087
3149
|
var import_react13 = require("react");
|
|
3088
3150
|
var import_react_dom = require("react-dom");
|
|
3089
|
-
var
|
|
3151
|
+
var import_i18n23 = require("@wordpress/i18n");
|
|
3090
3152
|
|
|
3091
3153
|
// src/hooks/use-canvas-document.ts
|
|
3092
3154
|
var import_editor_canvas7 = require("@elementor/editor-canvas");
|
|
@@ -3208,7 +3270,7 @@ function Backdrop({ canvas, element, onClose }) {
|
|
|
3208
3270
|
onKeyDown: handleKeyDown,
|
|
3209
3271
|
role: "button",
|
|
3210
3272
|
tabIndex: 0,
|
|
3211
|
-
"aria-label": (0,
|
|
3273
|
+
"aria-label": (0, import_i18n23.__)("Exit component editing mode", "elementor")
|
|
3212
3274
|
}
|
|
3213
3275
|
);
|
|
3214
3276
|
}
|
|
@@ -3339,29 +3401,29 @@ var React22 = __toESM(require("react"));
|
|
|
3339
3401
|
var import_editor_ui10 = require("@elementor/editor-ui");
|
|
3340
3402
|
var import_icons12 = require("@elementor/icons");
|
|
3341
3403
|
var import_ui17 = require("@elementor/ui");
|
|
3342
|
-
var
|
|
3404
|
+
var import_i18n24 = require("@wordpress/i18n");
|
|
3343
3405
|
var openEditModeDialog = (lockedBy) => {
|
|
3344
3406
|
(0, import_editor_ui10.openDialog)({
|
|
3345
3407
|
component: /* @__PURE__ */ React22.createElement(EditModeDialog, { lockedBy })
|
|
3346
3408
|
});
|
|
3347
3409
|
};
|
|
3348
3410
|
var EditModeDialog = ({ lockedBy }) => {
|
|
3349
|
-
const content = (0,
|
|
3350
|
-
return /* @__PURE__ */ React22.createElement(React22.Fragment, null, /* @__PURE__ */ React22.createElement(import_ui17.DialogHeader, { logo: false }, /* @__PURE__ */ React22.createElement(import_ui17.Box, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React22.createElement(import_ui17.Icon, { color: "secondary" }, /* @__PURE__ */ React22.createElement(import_icons12.InfoCircleFilledIcon, { fontSize: "medium" })), /* @__PURE__ */ React22.createElement(import_ui17.Typography, { variant: "subtitle1" }, content))), /* @__PURE__ */ React22.createElement(import_ui17.DialogContent, null, /* @__PURE__ */ React22.createElement(import_ui17.Stack, { spacing: 2, direction: "column" }, /* @__PURE__ */ React22.createElement(import_ui17.Typography, { variant: "body2" }, (0,
|
|
3411
|
+
const content = (0, import_i18n24.__)("%s is currently editing this document", "elementor").replace("%s", lockedBy);
|
|
3412
|
+
return /* @__PURE__ */ React22.createElement(React22.Fragment, null, /* @__PURE__ */ React22.createElement(import_ui17.DialogHeader, { logo: false }, /* @__PURE__ */ React22.createElement(import_ui17.Box, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React22.createElement(import_ui17.Icon, { color: "secondary" }, /* @__PURE__ */ React22.createElement(import_icons12.InfoCircleFilledIcon, { fontSize: "medium" })), /* @__PURE__ */ React22.createElement(import_ui17.Typography, { variant: "subtitle1" }, content))), /* @__PURE__ */ React22.createElement(import_ui17.DialogContent, null, /* @__PURE__ */ React22.createElement(import_ui17.Stack, { spacing: 2, direction: "column" }, /* @__PURE__ */ React22.createElement(import_ui17.Typography, { variant: "body2" }, (0, import_i18n24.__)(
|
|
3351
3413
|
"You can wait for them to finish or reach out to coordinate your changes together.",
|
|
3352
3414
|
"elementor"
|
|
3353
|
-
)), /* @__PURE__ */ React22.createElement(import_ui17.DialogActions, null, /* @__PURE__ */ React22.createElement(import_ui17.Button, { color: "secondary", variant: "contained", onClick: import_editor_ui10.closeDialog }, (0,
|
|
3415
|
+
)), /* @__PURE__ */ React22.createElement(import_ui17.DialogActions, null, /* @__PURE__ */ React22.createElement(import_ui17.Button, { color: "secondary", variant: "contained", onClick: import_editor_ui10.closeDialog }, (0, import_i18n24.__)("Close", "elementor"))))));
|
|
3354
3416
|
};
|
|
3355
3417
|
|
|
3356
3418
|
// src/components/instance-editing-panel/instance-editing-panel.tsx
|
|
3357
|
-
var
|
|
3419
|
+
var React28 = __toESM(require("react"));
|
|
3358
3420
|
var import_editor_controls4 = require("@elementor/editor-controls");
|
|
3359
3421
|
var import_editor_editing_panel5 = require("@elementor/editor-editing-panel");
|
|
3360
|
-
var
|
|
3422
|
+
var import_editor_elements15 = require("@elementor/editor-elements");
|
|
3361
3423
|
var import_editor_panels3 = require("@elementor/editor-panels");
|
|
3362
3424
|
var import_icons14 = require("@elementor/icons");
|
|
3363
3425
|
var import_ui22 = require("@elementor/ui");
|
|
3364
|
-
var
|
|
3426
|
+
var import_i18n26 = require("@wordpress/i18n");
|
|
3365
3427
|
|
|
3366
3428
|
// src/hooks/use-component-instance-settings.ts
|
|
3367
3429
|
var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
|
|
@@ -3430,7 +3492,7 @@ function useComponentInstanceSettings() {
|
|
|
3430
3492
|
var React23 = __toESM(require("react"));
|
|
3431
3493
|
var import_icons13 = require("@elementor/icons");
|
|
3432
3494
|
var import_ui18 = require("@elementor/ui");
|
|
3433
|
-
var
|
|
3495
|
+
var import_i18n25 = require("@wordpress/i18n");
|
|
3434
3496
|
var EmptyState2 = ({ onEditComponent }) => {
|
|
3435
3497
|
return /* @__PURE__ */ React23.createElement(
|
|
3436
3498
|
import_ui18.Stack,
|
|
@@ -3443,26 +3505,27 @@ var EmptyState2 = ({ onEditComponent }) => {
|
|
|
3443
3505
|
gap: 1.5
|
|
3444
3506
|
},
|
|
3445
3507
|
/* @__PURE__ */ React23.createElement(import_icons13.ComponentPropListIcon, { fontSize: "large" }),
|
|
3446
|
-
/* @__PURE__ */ React23.createElement(import_ui18.Typography, { align: "center", variant: "subtitle2" }, (0,
|
|
3447
|
-
/* @__PURE__ */ React23.createElement(import_ui18.Typography, { align: "center", variant: "caption", maxWidth: "170px" }, (0,
|
|
3508
|
+
/* @__PURE__ */ React23.createElement(import_ui18.Typography, { align: "center", variant: "subtitle2" }, (0, import_i18n25.__)("No properties yet", "elementor")),
|
|
3509
|
+
/* @__PURE__ */ React23.createElement(import_ui18.Typography, { align: "center", variant: "caption", maxWidth: "170px" }, (0, import_i18n25.__)(
|
|
3448
3510
|
"Edit the component to add properties, manage them or update the design across all instances.",
|
|
3449
3511
|
"elementor"
|
|
3450
3512
|
)),
|
|
3451
|
-
/* @__PURE__ */ React23.createElement(import_ui18.Button, { variant: "outlined", color: "secondary", size: "small", sx: { mt: 1 }, onClick: onEditComponent }, /* @__PURE__ */ React23.createElement(import_icons13.PencilIcon, { fontSize: "small" }), (0,
|
|
3513
|
+
/* @__PURE__ */ React23.createElement(import_ui18.Button, { variant: "outlined", color: "secondary", size: "small", sx: { mt: 1 }, onClick: onEditComponent }, /* @__PURE__ */ React23.createElement(import_icons13.PencilIcon, { fontSize: "small" }), (0, import_i18n25.__)("Edit component", "elementor"))
|
|
3452
3514
|
);
|
|
3453
3515
|
};
|
|
3454
3516
|
|
|
3455
3517
|
// src/components/instance-editing-panel/override-props-group.tsx
|
|
3456
|
-
var
|
|
3457
|
-
var
|
|
3518
|
+
var React27 = __toESM(require("react"));
|
|
3519
|
+
var import_react16 = require("react");
|
|
3458
3520
|
var import_editor_editing_panel4 = require("@elementor/editor-editing-panel");
|
|
3459
3521
|
var import_editor_ui11 = require("@elementor/editor-ui");
|
|
3460
3522
|
var import_ui21 = require("@elementor/ui");
|
|
3461
3523
|
|
|
3462
3524
|
// src/components/instance-editing-panel/override-prop-control.tsx
|
|
3463
|
-
var
|
|
3525
|
+
var React26 = __toESM(require("react"));
|
|
3464
3526
|
var import_editor_controls3 = require("@elementor/editor-controls");
|
|
3465
3527
|
var import_editor_editing_panel3 = require("@elementor/editor-editing-panel");
|
|
3528
|
+
var import_editor_elements14 = require("@elementor/editor-elements");
|
|
3466
3529
|
var import_ui20 = require("@elementor/ui");
|
|
3467
3530
|
|
|
3468
3531
|
// src/hooks/use-controls-by-widget-type.ts
|
|
@@ -3496,8 +3559,51 @@ function getControlsByBind(controls) {
|
|
|
3496
3559
|
);
|
|
3497
3560
|
}
|
|
3498
3561
|
|
|
3562
|
+
// src/provider/overridable-prop-context.tsx
|
|
3563
|
+
var React24 = __toESM(require("react"));
|
|
3564
|
+
var import_react15 = require("react");
|
|
3565
|
+
var OverridablePropContext = (0, import_react15.createContext)(null);
|
|
3566
|
+
function OverridablePropProvider({ children, ...props }) {
|
|
3567
|
+
return /* @__PURE__ */ React24.createElement(OverridablePropContext.Provider, { value: props }, children);
|
|
3568
|
+
}
|
|
3569
|
+
var useOverridablePropValue = () => (0, import_react15.useContext)(OverridablePropContext)?.value;
|
|
3570
|
+
var useComponentInstanceElement = () => (0, import_react15.useContext)(OverridablePropContext)?.componentInstanceElement;
|
|
3571
|
+
|
|
3499
3572
|
// src/store/actions/update-overridable-prop.ts
|
|
3500
3573
|
var import_store53 = require("@elementor/store");
|
|
3574
|
+
|
|
3575
|
+
// src/utils/resolve-override-prop-value.ts
|
|
3576
|
+
var resolveOverridePropValue = (originalPropValue) => {
|
|
3577
|
+
const isOverridable = componentOverridablePropTypeUtil.isValid(originalPropValue);
|
|
3578
|
+
if (isOverridable) {
|
|
3579
|
+
return getOverridableValue(originalPropValue);
|
|
3580
|
+
}
|
|
3581
|
+
const isOverride = componentInstanceOverridePropTypeUtil.isValid(originalPropValue);
|
|
3582
|
+
if (isOverride) {
|
|
3583
|
+
return getOverrideValue(originalPropValue);
|
|
3584
|
+
}
|
|
3585
|
+
return originalPropValue;
|
|
3586
|
+
};
|
|
3587
|
+
function getOverridableValue(overridableProp) {
|
|
3588
|
+
const overridableValue = componentOverridablePropTypeUtil.extract(overridableProp);
|
|
3589
|
+
if (!overridableValue) {
|
|
3590
|
+
return null;
|
|
3591
|
+
}
|
|
3592
|
+
const isOverride = componentInstanceOverridePropTypeUtil.isValid(overridableValue.origin_value);
|
|
3593
|
+
if (isOverride) {
|
|
3594
|
+
return getOverrideValue(overridableValue.origin_value);
|
|
3595
|
+
}
|
|
3596
|
+
return overridableValue.origin_value;
|
|
3597
|
+
}
|
|
3598
|
+
function getOverrideValue(overrideProp) {
|
|
3599
|
+
const overrideValue = componentInstanceOverridePropTypeUtil.extract(overrideProp);
|
|
3600
|
+
if (!overrideValue) {
|
|
3601
|
+
return null;
|
|
3602
|
+
}
|
|
3603
|
+
return overrideValue.override_value;
|
|
3604
|
+
}
|
|
3605
|
+
|
|
3606
|
+
// src/store/actions/update-overridable-prop.ts
|
|
3501
3607
|
function updateOverridableProp(componentId, propValue, originPropFields) {
|
|
3502
3608
|
const overridableProps = selectOverridableProps((0, import_store53.__getState)(), componentId);
|
|
3503
3609
|
if (!overridableProps) {
|
|
@@ -3507,11 +3613,12 @@ function updateOverridableProp(componentId, propValue, originPropFields) {
|
|
|
3507
3613
|
if (!existingOverridableProp) {
|
|
3508
3614
|
return;
|
|
3509
3615
|
}
|
|
3616
|
+
const originValue = resolveOverridePropValue(propValue.origin_value);
|
|
3510
3617
|
const newOverridableProp = originPropFields ? {
|
|
3511
|
-
originValue
|
|
3618
|
+
originValue,
|
|
3512
3619
|
originPropFields
|
|
3513
3620
|
} : {
|
|
3514
|
-
originValue
|
|
3621
|
+
originValue
|
|
3515
3622
|
};
|
|
3516
3623
|
const newOverridableProps = {
|
|
3517
3624
|
...overridableProps,
|
|
@@ -3537,11 +3644,12 @@ var getPropTypeForComponentOverride = (overridableProp) => {
|
|
|
3537
3644
|
if (overridableProp.originPropFields) {
|
|
3538
3645
|
return getPropType(overridableProp.originPropFields);
|
|
3539
3646
|
}
|
|
3540
|
-
const { elType, widgetType, propKey } = overridableProp;
|
|
3647
|
+
const { elType, widgetType, propKey, elementId } = overridableProp;
|
|
3541
3648
|
return getPropType({
|
|
3542
3649
|
elType,
|
|
3543
3650
|
widgetType,
|
|
3544
|
-
propKey
|
|
3651
|
+
propKey,
|
|
3652
|
+
elementId
|
|
3545
3653
|
});
|
|
3546
3654
|
};
|
|
3547
3655
|
function getPropType({ widgetType, propKey }) {
|
|
@@ -3550,23 +3658,25 @@ function getPropType({ widgetType, propKey }) {
|
|
|
3550
3658
|
}
|
|
3551
3659
|
|
|
3552
3660
|
// src/components/control-label.tsx
|
|
3553
|
-
var
|
|
3661
|
+
var React25 = __toESM(require("react"));
|
|
3554
3662
|
var import_editor_controls2 = require("@elementor/editor-controls");
|
|
3555
3663
|
var import_ui19 = require("@elementor/ui");
|
|
3556
3664
|
var ControlLabel = ({ children, ...props }) => {
|
|
3557
|
-
return /* @__PURE__ */
|
|
3665
|
+
return /* @__PURE__ */ React25.createElement(import_ui19.Stack, { direction: "row", alignItems: "center", justifyItems: "start", gap: 0.25 }, /* @__PURE__ */ React25.createElement(import_editor_controls2.ControlFormLabel, { ...props }, children), /* @__PURE__ */ React25.createElement(import_editor_controls2.ControlAdornments, null));
|
|
3558
3666
|
};
|
|
3559
3667
|
|
|
3560
3668
|
// src/components/instance-editing-panel/override-prop-control.tsx
|
|
3561
3669
|
function OverridePropControl({ overridableProp, overrides }) {
|
|
3562
|
-
return /* @__PURE__ */
|
|
3670
|
+
return /* @__PURE__ */ React26.createElement(import_editor_editing_panel3.SettingsField, { bind: "component_instance", propDisplayName: overridableProp.label }, /* @__PURE__ */ React26.createElement(OverrideControl, { overridableProp, overrides }));
|
|
3563
3671
|
}
|
|
3564
3672
|
function OverrideControl({ overridableProp, overrides }) {
|
|
3673
|
+
const componentInstanceElement = (0, import_editor_editing_panel3.useElement)();
|
|
3565
3674
|
const componentId = useCurrentComponentId();
|
|
3566
3675
|
const { value: instanceValue, setValue: setInstanceValue } = (0, import_editor_controls3.useBoundProp)(componentInstancePropTypeUtil);
|
|
3567
3676
|
const controls = useControlsByWidgetType(
|
|
3568
3677
|
overridableProp?.originPropFields?.widgetType ?? overridableProp.widgetType
|
|
3569
3678
|
);
|
|
3679
|
+
const controlReplacements = (0, import_editor_editing_panel3.getControlReplacements)();
|
|
3570
3680
|
const propType = getPropTypeForComponentOverride(overridableProp);
|
|
3571
3681
|
if (!propType) {
|
|
3572
3682
|
return null;
|
|
@@ -3581,13 +3691,18 @@ function OverrideControl({ overridableProp, overrides }) {
|
|
|
3581
3691
|
throw new Error("Component ID is required");
|
|
3582
3692
|
}
|
|
3583
3693
|
const matchingOverride = getMatchingOverride(overrides, overridableProp.overrideKey);
|
|
3584
|
-
const propValue = matchingOverride ?
|
|
3694
|
+
const propValue = matchingOverride ? resolveOverridePropValue(matchingOverride) : overridableProp.originValue;
|
|
3585
3695
|
const value = {
|
|
3586
3696
|
[overridableProp.overrideKey]: propValue
|
|
3587
3697
|
};
|
|
3588
3698
|
const setValue = (newValue) => {
|
|
3589
3699
|
const newPropValue = newValue[overridableProp.overrideKey];
|
|
3590
|
-
const newOverrideValue = createOverrideValue(
|
|
3700
|
+
const newOverrideValue = createOverrideValue({
|
|
3701
|
+
matchingOverride,
|
|
3702
|
+
overrideKey: overridableProp.overrideKey,
|
|
3703
|
+
overrideValue: newPropValue,
|
|
3704
|
+
componentId: componentInstanceId
|
|
3705
|
+
});
|
|
3591
3706
|
let newOverrides = overrides?.map((override) => override === matchingOverride ? newOverrideValue : override) ?? [];
|
|
3592
3707
|
if (!matchingOverride) {
|
|
3593
3708
|
newOverrides = [...newOverrides, newOverrideValue];
|
|
@@ -3602,33 +3717,41 @@ function OverrideControl({ overridableProp, overrides }) {
|
|
|
3602
3717
|
updateOverridableProp(componentId, overridableValue, overridableProp.originPropFields);
|
|
3603
3718
|
return;
|
|
3604
3719
|
}
|
|
3605
|
-
const { elType, widgetType, propKey } = overridableProp;
|
|
3606
|
-
updateOverridableProp(componentId, overridableValue, { elType, widgetType, propKey });
|
|
3720
|
+
const { elType: elType2, widgetType: widgetType2, propKey: propKey2, elementId: elementId2 } = overridableProp;
|
|
3721
|
+
updateOverridableProp(componentId, overridableValue, { elType: elType2, widgetType: widgetType2, propKey: propKey2, elementId: elementId2 });
|
|
3607
3722
|
}
|
|
3608
3723
|
};
|
|
3609
|
-
|
|
3610
|
-
|
|
3724
|
+
const { control, controlProps, layout } = getControlParams(
|
|
3725
|
+
controls,
|
|
3726
|
+
overridableProp?.originPropFields ?? overridableProp,
|
|
3727
|
+
overridableProp.label
|
|
3728
|
+
);
|
|
3729
|
+
const { elementId, widgetType, elType, propKey } = overridableProp.originPropFields ?? overridableProp;
|
|
3730
|
+
const type = elType === "widget" ? widgetType : elType;
|
|
3731
|
+
const elementType = (0, import_editor_elements14.getElementType)(type);
|
|
3732
|
+
if (!elementType) {
|
|
3733
|
+
return null;
|
|
3734
|
+
}
|
|
3735
|
+
return /* @__PURE__ */ React26.createElement(
|
|
3736
|
+
OverridablePropProvider,
|
|
3611
3737
|
{
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
setValue,
|
|
3615
|
-
isDisabled: () => {
|
|
3616
|
-
return false;
|
|
3617
|
-
}
|
|
3738
|
+
value: componentOverridablePropTypeUtil.extract(matchingOverride) ?? void 0,
|
|
3739
|
+
componentInstanceElement
|
|
3618
3740
|
},
|
|
3619
|
-
/* @__PURE__ */
|
|
3741
|
+
/* @__PURE__ */ React26.createElement(import_editor_editing_panel3.ElementProvider, { element: { id: elementId, type }, elementType }, /* @__PURE__ */ React26.createElement(import_editor_editing_panel3.SettingsField, { bind: propKey, propDisplayName: overridableProp.label }, /* @__PURE__ */ React26.createElement(
|
|
3742
|
+
import_editor_controls3.PropProvider,
|
|
3743
|
+
{
|
|
3744
|
+
propType: propTypeSchema,
|
|
3745
|
+
value,
|
|
3746
|
+
setValue,
|
|
3747
|
+
isDisabled: () => {
|
|
3748
|
+
return false;
|
|
3749
|
+
}
|
|
3750
|
+
},
|
|
3751
|
+
/* @__PURE__ */ React26.createElement(import_editor_controls3.PropKeyProvider, { bind: overridableProp.overrideKey }, /* @__PURE__ */ React26.createElement(import_editor_controls3.ControlReplacementsProvider, { replacements: controlReplacements }, /* @__PURE__ */ React26.createElement(import_ui20.Stack, { direction: "column", gap: 1, mb: 1.5 }, layout !== "custom" && /* @__PURE__ */ React26.createElement(ControlLabel, null, overridableProp.label), /* @__PURE__ */ React26.createElement(OriginalControl, { control, controlProps }))))
|
|
3752
|
+
)))
|
|
3620
3753
|
);
|
|
3621
3754
|
}
|
|
3622
|
-
function getPropValue(value) {
|
|
3623
|
-
const overridableValue = componentOverridablePropTypeUtil.extract(value);
|
|
3624
|
-
if (overridableValue) {
|
|
3625
|
-
return value;
|
|
3626
|
-
}
|
|
3627
|
-
if (componentInstanceOverridePropTypeUtil.isValid(value)) {
|
|
3628
|
-
return value.value.override_value;
|
|
3629
|
-
}
|
|
3630
|
-
return null;
|
|
3631
|
-
}
|
|
3632
3755
|
function getMatchingOverride(overrides, overrideKey) {
|
|
3633
3756
|
return overrides?.find((override) => {
|
|
3634
3757
|
const overridableValue = componentOverridablePropTypeUtil.extract(override);
|
|
@@ -3641,19 +3764,26 @@ function getMatchingOverride(overrides, overrideKey) {
|
|
|
3641
3764
|
return comparedOverrideKey === overrideKey;
|
|
3642
3765
|
}) ?? null;
|
|
3643
3766
|
}
|
|
3644
|
-
function createOverrideValue(
|
|
3645
|
-
|
|
3646
|
-
|
|
3767
|
+
function createOverrideValue({
|
|
3768
|
+
matchingOverride,
|
|
3769
|
+
overrideKey,
|
|
3770
|
+
overrideValue,
|
|
3771
|
+
componentId
|
|
3772
|
+
}) {
|
|
3773
|
+
const overridableValue = componentOverridablePropTypeUtil.extract(matchingOverride);
|
|
3774
|
+
const newOverridableValue = componentOverridablePropTypeUtil.extract(overrideValue);
|
|
3775
|
+
const anyOverridable = newOverridableValue ?? overridableValue;
|
|
3776
|
+
if (anyOverridable) {
|
|
3647
3777
|
const innerOverride = componentInstanceOverridePropTypeUtil.create({
|
|
3648
3778
|
override_key: overrideKey,
|
|
3649
|
-
override_value:
|
|
3779
|
+
override_value: resolveOverridePropValue(overrideValue),
|
|
3650
3780
|
schema_source: {
|
|
3651
3781
|
type: "component",
|
|
3652
3782
|
id: componentId
|
|
3653
3783
|
}
|
|
3654
3784
|
});
|
|
3655
3785
|
return componentOverridablePropTypeUtil.create({
|
|
3656
|
-
override_key:
|
|
3786
|
+
override_key: anyOverridable.override_key,
|
|
3657
3787
|
origin_value: innerOverride
|
|
3658
3788
|
});
|
|
3659
3789
|
}
|
|
@@ -3666,10 +3796,41 @@ function createOverrideValue(overrideKey, overrideValue, componentId) {
|
|
|
3666
3796
|
}
|
|
3667
3797
|
});
|
|
3668
3798
|
}
|
|
3669
|
-
function
|
|
3670
|
-
const
|
|
3671
|
-
const
|
|
3672
|
-
|
|
3799
|
+
function getControlParams(controls, originPropFields, label) {
|
|
3800
|
+
const control = controls[originPropFields.propKey];
|
|
3801
|
+
const { value } = control;
|
|
3802
|
+
const layout = getControlLayout(control);
|
|
3803
|
+
const controlProps = populateChildControlProps(value.props);
|
|
3804
|
+
if (layout === "custom") {
|
|
3805
|
+
controlProps.label = label ?? value.label;
|
|
3806
|
+
}
|
|
3807
|
+
return {
|
|
3808
|
+
control,
|
|
3809
|
+
controlProps,
|
|
3810
|
+
layout
|
|
3811
|
+
};
|
|
3812
|
+
}
|
|
3813
|
+
function OriginalControl({ control, controlProps }) {
|
|
3814
|
+
const { value } = control;
|
|
3815
|
+
return /* @__PURE__ */ React26.createElement(import_editor_editing_panel3.BaseControl, { type: value.type, props: controlProps });
|
|
3816
|
+
}
|
|
3817
|
+
function getControlLayout(control) {
|
|
3818
|
+
return control.value.meta?.layout || import_editor_editing_panel3.controlsRegistry.getLayout(control.value.type);
|
|
3819
|
+
}
|
|
3820
|
+
function populateChildControlProps(props) {
|
|
3821
|
+
if (props.childControlType) {
|
|
3822
|
+
const childComponent = import_editor_editing_panel3.controlsRegistry.get(props.childControlType);
|
|
3823
|
+
const childPropType = import_editor_editing_panel3.controlsRegistry.getPropTypeUtil(props.childControlType);
|
|
3824
|
+
props = {
|
|
3825
|
+
...props,
|
|
3826
|
+
childControlConfig: {
|
|
3827
|
+
component: childComponent,
|
|
3828
|
+
props: props.childControlProps || {},
|
|
3829
|
+
propTypeUtil: childPropType
|
|
3830
|
+
}
|
|
3831
|
+
};
|
|
3832
|
+
}
|
|
3833
|
+
return props;
|
|
3673
3834
|
}
|
|
3674
3835
|
|
|
3675
3836
|
// src/components/instance-editing-panel/override-props-group.tsx
|
|
@@ -3678,11 +3839,11 @@ function OverridePropsGroup({ group, props, overrides }) {
|
|
|
3678
3839
|
const handleClick = () => {
|
|
3679
3840
|
setIsOpen(!isOpen);
|
|
3680
3841
|
};
|
|
3681
|
-
const id2 = (0,
|
|
3842
|
+
const id2 = (0, import_react16.useId)();
|
|
3682
3843
|
const labelId = `label-${id2}`;
|
|
3683
3844
|
const contentId = `content-${id2}`;
|
|
3684
3845
|
const title = group.label;
|
|
3685
|
-
return /* @__PURE__ */
|
|
3846
|
+
return /* @__PURE__ */ React27.createElement(import_ui21.Box, { "aria-label": `${title} section` }, /* @__PURE__ */ React27.createElement(
|
|
3686
3847
|
import_ui21.ListItemButton,
|
|
3687
3848
|
{
|
|
3688
3849
|
id: labelId,
|
|
@@ -3692,7 +3853,7 @@ function OverridePropsGroup({ group, props, overrides }) {
|
|
|
3692
3853
|
p: 0,
|
|
3693
3854
|
sx: { "&:hover": { backgroundColor: "transparent" } }
|
|
3694
3855
|
},
|
|
3695
|
-
/* @__PURE__ */
|
|
3856
|
+
/* @__PURE__ */ React27.createElement(import_ui21.Stack, { direction: "row", alignItems: "center", justifyItems: "start", flexGrow: 1, gap: 0.5 }, /* @__PURE__ */ React27.createElement(
|
|
3696
3857
|
import_ui21.ListItemText,
|
|
3697
3858
|
{
|
|
3698
3859
|
secondary: title,
|
|
@@ -3700,8 +3861,8 @@ function OverridePropsGroup({ group, props, overrides }) {
|
|
|
3700
3861
|
sx: { flexGrow: 0, flexShrink: 1, marginInlineEnd: 1 }
|
|
3701
3862
|
}
|
|
3702
3863
|
)),
|
|
3703
|
-
/* @__PURE__ */
|
|
3704
|
-
), /* @__PURE__ */
|
|
3864
|
+
/* @__PURE__ */ React27.createElement(import_editor_ui11.CollapseIcon, { open: isOpen, color: "secondary", fontSize: "tiny" })
|
|
3865
|
+
), /* @__PURE__ */ React27.createElement(import_ui21.Collapse, { id: contentId, "aria-labelledby": labelId, in: isOpen, timeout: "auto" }, /* @__PURE__ */ React27.createElement(import_ui21.Stack, { direction: "column", gap: 1, p: 2 }, group.props.map((overrideKey) => /* @__PURE__ */ React27.createElement(
|
|
3705
3866
|
OverridePropControl,
|
|
3706
3867
|
{
|
|
3707
3868
|
key: overrideKey,
|
|
@@ -3718,16 +3879,16 @@ function InstanceEditingPanel() {
|
|
|
3718
3879
|
const overrides = settings?.overrides?.value;
|
|
3719
3880
|
const component = useComponent(componentId ?? null);
|
|
3720
3881
|
const overridableProps = useOverridableProps(componentId ?? null);
|
|
3721
|
-
const componentInstanceId = (0,
|
|
3882
|
+
const componentInstanceId = (0, import_editor_elements15.useSelectedElement)()?.element?.id ?? null;
|
|
3722
3883
|
if (!componentId || !overridableProps || !component) {
|
|
3723
3884
|
return null;
|
|
3724
3885
|
}
|
|
3725
|
-
const panelTitle = (0,
|
|
3886
|
+
const panelTitle = (0, import_i18n26.__)("Edit %s", "elementor").replace("%s", component.name);
|
|
3726
3887
|
const handleEditComponent = () => switchToComponent(componentId, componentInstanceId);
|
|
3727
3888
|
const isNonEmptyGroup = (group) => group !== null && group.props.length > 0;
|
|
3728
3889
|
const groups = overridableProps.groups.order.map((groupId) => overridableProps.groups.items[groupId] ?? null).filter(isNonEmptyGroup);
|
|
3729
3890
|
const isEmpty = groups.length === 0 || Object.keys(overridableProps.props).length === 0;
|
|
3730
|
-
return /* @__PURE__ */
|
|
3891
|
+
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(import_editor_panels3.PanelHeader, { sx: { justifyContent: "start", px: 2 } }, /* @__PURE__ */ React28.createElement(import_ui22.Stack, { direction: "row", alignContent: "space-between", flexGrow: 1 }, /* @__PURE__ */ React28.createElement(import_ui22.Stack, { direction: "row", alignItems: "center", justifyContent: "start", gap: 1, flexGrow: 1 }, /* @__PURE__ */ React28.createElement(import_icons14.ComponentsIcon, { fontSize: "small", sx: { color: "text.tertiary" } }), /* @__PURE__ */ React28.createElement(import_editor_panels3.PanelHeaderTitle, null, component.name)), /* @__PURE__ */ React28.createElement(import_ui22.Tooltip, { title: panelTitle }, /* @__PURE__ */ React28.createElement(import_ui22.IconButton, { size: "tiny", onClick: handleEditComponent, "aria-label": panelTitle }, /* @__PURE__ */ React28.createElement(import_icons14.PencilIcon, { fontSize: "tiny" }))))), /* @__PURE__ */ React28.createElement(import_editor_panels3.PanelBody, null, /* @__PURE__ */ React28.createElement(import_editor_controls4.ControlAdornmentsProvider, { items: (0, import_editor_editing_panel5.getFieldIndicators)("settings") }, isEmpty ? /* @__PURE__ */ React28.createElement(EmptyState2, { onEditComponent: handleEditComponent }) : /* @__PURE__ */ React28.createElement(import_ui22.Stack, { direction: "column", alignItems: "stretch" }, groups.map((group) => /* @__PURE__ */ React28.createElement(
|
|
3731
3892
|
OverridePropsGroup,
|
|
3732
3893
|
{
|
|
3733
3894
|
key: group.id,
|
|
@@ -3742,25 +3903,17 @@ function InstanceEditingPanel() {
|
|
|
3742
3903
|
var React29 = __toESM(require("react"));
|
|
3743
3904
|
var import_editor_controls5 = require("@elementor/editor-controls");
|
|
3744
3905
|
var import_editor_editing_panel6 = require("@elementor/editor-editing-panel");
|
|
3745
|
-
|
|
3746
|
-
// src/provider/overridable-prop-context.tsx
|
|
3747
|
-
var React28 = __toESM(require("react"));
|
|
3748
|
-
var import_react16 = require("react");
|
|
3749
|
-
var OverridablePropContext = (0, import_react16.createContext)(null);
|
|
3750
|
-
function OverridablePropProvider({ children, ...props }) {
|
|
3751
|
-
return /* @__PURE__ */ React28.createElement(OverridablePropContext.Provider, { value: props }, children);
|
|
3752
|
-
}
|
|
3753
|
-
var useOverridablePropValue = () => (0, import_react16.useContext)(OverridablePropContext)?.value;
|
|
3754
|
-
|
|
3755
|
-
// src/components/overridable-props/overridable-prop-control.tsx
|
|
3756
3906
|
function OverridablePropControl({
|
|
3757
|
-
OriginalControl,
|
|
3907
|
+
OriginalControl: OriginalControl2,
|
|
3758
3908
|
...props
|
|
3759
3909
|
}) {
|
|
3760
3910
|
const { elementType } = (0, import_editor_editing_panel6.useElement)();
|
|
3761
3911
|
const { value, bind, setValue, placeholder, ...propContext } = (0, import_editor_controls5.useBoundProp)(componentOverridablePropTypeUtil);
|
|
3762
3912
|
const componentId = useCurrentComponentId();
|
|
3763
3913
|
const overridableProps = useOverridableProps(componentId);
|
|
3914
|
+
const filteredReplacements = (0, import_editor_editing_panel6.getControlReplacements)().filter(
|
|
3915
|
+
(r) => !r.id || r.id !== OVERRIDABLE_PROP_REPLACEMENT_ID
|
|
3916
|
+
);
|
|
3764
3917
|
if (!componentId) {
|
|
3765
3918
|
return null;
|
|
3766
3919
|
}
|
|
@@ -3768,6 +3921,7 @@ function OverridablePropControl({
|
|
|
3768
3921
|
throw new Error("Override key is required");
|
|
3769
3922
|
}
|
|
3770
3923
|
const isComponentInstance2 = elementType.key === "e-component";
|
|
3924
|
+
const overridablePropData = overridableProps?.props?.[value.override_key];
|
|
3771
3925
|
const setOverridableValue = (newValue) => {
|
|
3772
3926
|
const propValue2 = {
|
|
3773
3927
|
...value,
|
|
@@ -3775,14 +3929,18 @@ function OverridablePropControl({
|
|
|
3775
3929
|
};
|
|
3776
3930
|
setValue(propValue2);
|
|
3777
3931
|
if (!isComponentInstance2) {
|
|
3778
|
-
|
|
3779
|
-
updateOverridableProp(componentId, propValue2, existingProp?.originPropFields);
|
|
3932
|
+
updateOverridableProp(componentId, propValue2, overridablePropData?.originPropFields);
|
|
3780
3933
|
}
|
|
3781
3934
|
};
|
|
3782
3935
|
const defaultPropType = elementType.propsSchema[bind];
|
|
3936
|
+
const overridePropType = overridablePropData ? getPropTypeForComponentOverride(overridablePropData) : void 0;
|
|
3937
|
+
const resolvedPropType = overridePropType ?? defaultPropType;
|
|
3938
|
+
if (!resolvedPropType) {
|
|
3939
|
+
return null;
|
|
3940
|
+
}
|
|
3783
3941
|
const propType = (0, import_editor_editing_panel6.createTopLevelObjectType)({
|
|
3784
3942
|
schema: {
|
|
3785
|
-
[bind]:
|
|
3943
|
+
[bind]: resolvedPropType
|
|
3786
3944
|
}
|
|
3787
3945
|
});
|
|
3788
3946
|
const propValue = isComponentInstance2 ? (value.origin_value?.value).override_value : value.origin_value;
|
|
@@ -3798,7 +3956,7 @@ function OverridablePropControl({
|
|
|
3798
3956
|
},
|
|
3799
3957
|
placeholder: objectPlaceholder
|
|
3800
3958
|
},
|
|
3801
|
-
/* @__PURE__ */ React29.createElement(import_editor_controls5.PropKeyProvider, { bind }, /* @__PURE__ */ React29.createElement(import_editor_controls5.ControlReplacementsProvider, { replacements:
|
|
3959
|
+
/* @__PURE__ */ React29.createElement(import_editor_controls5.PropKeyProvider, { bind }, /* @__PURE__ */ React29.createElement(import_editor_controls5.ControlReplacementsProvider, { replacements: filteredReplacements }, /* @__PURE__ */ React29.createElement(OriginalControl2, { ...props })))
|
|
3802
3960
|
));
|
|
3803
3961
|
}
|
|
3804
3962
|
|
|
@@ -3806,9 +3964,9 @@ function OverridablePropControl({
|
|
|
3806
3964
|
var React31 = __toESM(require("react"));
|
|
3807
3965
|
var import_editor_controls6 = require("@elementor/editor-controls");
|
|
3808
3966
|
var import_editor_editing_panel7 = require("@elementor/editor-editing-panel");
|
|
3809
|
-
var
|
|
3967
|
+
var import_editor_elements16 = require("@elementor/editor-elements");
|
|
3810
3968
|
var import_ui24 = require("@elementor/ui");
|
|
3811
|
-
var
|
|
3969
|
+
var import_i18n28 = require("@wordpress/i18n");
|
|
3812
3970
|
|
|
3813
3971
|
// src/store/actions/set-overridable-prop.ts
|
|
3814
3972
|
var import_store58 = require("@elementor/store");
|
|
@@ -3879,7 +4037,7 @@ var React30 = __toESM(require("react"));
|
|
|
3879
4037
|
var import_react17 = require("react");
|
|
3880
4038
|
var import_icons15 = require("@elementor/icons");
|
|
3881
4039
|
var import_ui23 = require("@elementor/ui");
|
|
3882
|
-
var
|
|
4040
|
+
var import_i18n27 = require("@wordpress/i18n");
|
|
3883
4041
|
var SIZE2 = "tiny";
|
|
3884
4042
|
var IconContainer = (0, import_ui23.styled)(import_ui23.Box)`
|
|
3885
4043
|
pointer-events: none;
|
|
@@ -3939,7 +4097,7 @@ var Indicator2 = (0, import_react17.forwardRef)(({ isOpen, isOverridable, ...pro
|
|
|
3939
4097
|
IconContainer,
|
|
3940
4098
|
{
|
|
3941
4099
|
className: "icon",
|
|
3942
|
-
"aria-label": isOverridable ? (0,
|
|
4100
|
+
"aria-label": isOverridable ? (0, import_i18n27.__)("Overridable property", "elementor") : (0, import_i18n27.__)("Make prop overridable", "elementor")
|
|
3943
4101
|
},
|
|
3944
4102
|
isOverridable ? /* @__PURE__ */ React30.createElement(import_icons15.CheckIcon, { fontSize: SIZE2 }) : /* @__PURE__ */ React30.createElement(import_icons15.PlusIcon, { fontSize: SIZE2 })
|
|
3945
4103
|
)));
|
|
@@ -3975,6 +4133,7 @@ function Content2({ componentId, overridableProps }) {
|
|
|
3975
4133
|
} = (0, import_editor_editing_panel7.useElement)();
|
|
3976
4134
|
const { value, bind, propType } = (0, import_editor_controls6.useBoundProp)();
|
|
3977
4135
|
const contextOverridableValue = useOverridablePropValue();
|
|
4136
|
+
const componentInstanceElement = useComponentInstanceElement();
|
|
3978
4137
|
const { value: boundPropOverridableValue, setValue: setOverridableValue } = (0, import_editor_controls6.useBoundProp)(
|
|
3979
4138
|
componentOverridablePropTypeUtil
|
|
3980
4139
|
);
|
|
@@ -3984,20 +4143,20 @@ function Content2({ componentId, overridableProps }) {
|
|
|
3984
4143
|
});
|
|
3985
4144
|
const triggerProps = (0, import_ui24.bindTrigger)(popupState);
|
|
3986
4145
|
const popoverProps = (0, import_ui24.bindPopover)(popupState);
|
|
3987
|
-
const { elType } = (0,
|
|
4146
|
+
const { elType } = (0, import_editor_elements16.getWidgetsCache)()?.[elementType.key] ?? { elType: "widget" };
|
|
3988
4147
|
const handleSubmit = ({ label, group }) => {
|
|
3989
4148
|
const propTypeDefault = propType.default ?? {};
|
|
3990
|
-
const originValue = (
|
|
4149
|
+
const originValue = resolveOverridePropValue(overridableValue?.origin_value) ?? value ?? propTypeDefault;
|
|
3991
4150
|
const matchingOverridableProp = overridableValue ? overridableProps?.props?.[overridableValue.override_key] : void 0;
|
|
3992
4151
|
const overridablePropConfig = setOverridableProp({
|
|
3993
4152
|
componentId,
|
|
3994
4153
|
overrideKey: overridableValue?.override_key ?? null,
|
|
3995
|
-
elementId,
|
|
4154
|
+
elementId: componentInstanceElement?.element.id ?? elementId,
|
|
3996
4155
|
label,
|
|
3997
4156
|
groupId: group,
|
|
3998
4157
|
propKey: bind,
|
|
3999
4158
|
elType: elType ?? "widget",
|
|
4000
|
-
widgetType: elementType.key,
|
|
4159
|
+
widgetType: componentInstanceElement?.elementType.key ?? elementType.key,
|
|
4001
4160
|
originValue,
|
|
4002
4161
|
originPropFields: matchingOverridableProp?.originPropFields
|
|
4003
4162
|
});
|
|
@@ -4010,7 +4169,7 @@ function Content2({ componentId, overridableProps }) {
|
|
|
4010
4169
|
popupState.close();
|
|
4011
4170
|
};
|
|
4012
4171
|
const overridableConfig = overridableValue ? getOverridableProp({ componentId, overrideKey: overridableValue.override_key }) : void 0;
|
|
4013
|
-
return /* @__PURE__ */ React31.createElement(React31.Fragment, null, /* @__PURE__ */ React31.createElement(import_ui24.Tooltip, { placement: "top", title: (0,
|
|
4172
|
+
return /* @__PURE__ */ React31.createElement(React31.Fragment, null, /* @__PURE__ */ React31.createElement(import_ui24.Tooltip, { placement: "top", title: (0, import_i18n28.__)("Override Property", "elementor") }, /* @__PURE__ */ React31.createElement(Indicator2, { ...triggerProps, isOpen: !!popoverProps.open, isOverridable: !!overridableValue })), /* @__PURE__ */ React31.createElement(
|
|
4014
4173
|
import_ui24.Popover,
|
|
4015
4174
|
{
|
|
4016
4175
|
disableScrollLock: true,
|
|
@@ -4035,6 +4194,7 @@ function Content2({ componentId, overridableProps }) {
|
|
|
4035
4194
|
value: groupId,
|
|
4036
4195
|
label: overridableProps.groups.items[groupId].label
|
|
4037
4196
|
})),
|
|
4197
|
+
existingLabels: Object.values(overridableProps?.props ?? {}).map((prop) => prop.label),
|
|
4038
4198
|
currentValue: overridableConfig
|
|
4039
4199
|
}
|
|
4040
4200
|
)
|
|
@@ -4045,7 +4205,7 @@ function isPropAllowed(bind) {
|
|
|
4045
4205
|
}
|
|
4046
4206
|
|
|
4047
4207
|
// src/hooks/regenerate-override-keys.ts
|
|
4048
|
-
var
|
|
4208
|
+
var import_editor_elements17 = require("@elementor/editor-elements");
|
|
4049
4209
|
var import_editor_v1_adapters8 = require("@elementor/editor-v1-adapters");
|
|
4050
4210
|
var import_utils8 = require("@elementor/utils");
|
|
4051
4211
|
function initRegenerateOverrideKeys() {
|
|
@@ -4066,11 +4226,11 @@ function regenerateOverrideKeysForContainers(result) {
|
|
|
4066
4226
|
});
|
|
4067
4227
|
}
|
|
4068
4228
|
function regenerateOverrideKeysRecursive(elementId) {
|
|
4069
|
-
const container = (0,
|
|
4229
|
+
const container = (0, import_editor_elements17.getContainer)(elementId);
|
|
4070
4230
|
if (!container) {
|
|
4071
4231
|
return;
|
|
4072
4232
|
}
|
|
4073
|
-
(0,
|
|
4233
|
+
(0, import_editor_elements17.getAllDescendants)(container).forEach(regenerateOverrideKeys);
|
|
4074
4234
|
}
|
|
4075
4235
|
function regenerateOverrideKeys(element) {
|
|
4076
4236
|
if (!isComponentInstance(element.model.toJSON())) {
|
|
@@ -4104,7 +4264,7 @@ function regenerateOverrideKeys(element) {
|
|
|
4104
4264
|
}
|
|
4105
4265
|
}
|
|
4106
4266
|
};
|
|
4107
|
-
(0,
|
|
4267
|
+
(0, import_editor_elements17.updateElementSettings)({
|
|
4108
4268
|
id: element.id,
|
|
4109
4269
|
props: { component_instance: newComponentInstance },
|
|
4110
4270
|
withHistory: false
|
|
@@ -4128,7 +4288,7 @@ var import_editor_mcp3 = require("@elementor/editor-mcp");
|
|
|
4128
4288
|
|
|
4129
4289
|
// src/mcp/save-as-component-tool.ts
|
|
4130
4290
|
var import_editor_canvas8 = require("@elementor/editor-canvas");
|
|
4131
|
-
var
|
|
4291
|
+
var import_editor_elements18 = require("@elementor/editor-elements");
|
|
4132
4292
|
var import_editor_mcp2 = require("@elementor/editor-mcp");
|
|
4133
4293
|
var import_http_client2 = require("@elementor/http-client");
|
|
4134
4294
|
var import_schema6 = require("@elementor/schema");
|
|
@@ -4158,7 +4318,7 @@ var OutputSchema = {
|
|
|
4158
4318
|
message: import_schema6.z.string().optional().describe("Additional information about the operation result"),
|
|
4159
4319
|
component_uid: import_schema6.z.string().optional().describe("The unique identifier of the newly created component (only present on success)")
|
|
4160
4320
|
};
|
|
4161
|
-
var
|
|
4321
|
+
var ERROR_MESSAGES3 = {
|
|
4162
4322
|
ELEMENT_NOT_FOUND: "Element not found. Use 'list-elements' to get valid element IDs.",
|
|
4163
4323
|
ELEMENT_NOT_ONE_OF_TYPES: (validTypes) => `Element is not one of the following types: ${validTypes.join(", ")}`,
|
|
4164
4324
|
ELEMENT_IS_LOCKED: "Cannot save a locked element as a component."
|
|
@@ -4166,17 +4326,17 @@ var ERROR_MESSAGES2 = {
|
|
|
4166
4326
|
var handleSaveAsComponent = async (params) => {
|
|
4167
4327
|
const { element_id: elementId, component_name: componentName, overridable_props: overridablePropsInput } = params;
|
|
4168
4328
|
const validElementTypes = getValidElementTypes();
|
|
4169
|
-
const container = (0,
|
|
4329
|
+
const container = (0, import_editor_elements18.getContainer)(elementId);
|
|
4170
4330
|
if (!container) {
|
|
4171
|
-
throw new Error(
|
|
4331
|
+
throw new Error(ERROR_MESSAGES3.ELEMENT_NOT_FOUND);
|
|
4172
4332
|
}
|
|
4173
4333
|
const elType = container.model.get("elType");
|
|
4174
4334
|
if (!validElementTypes.includes(elType)) {
|
|
4175
|
-
throw new Error(
|
|
4335
|
+
throw new Error(ERROR_MESSAGES3.ELEMENT_NOT_ONE_OF_TYPES(validElementTypes));
|
|
4176
4336
|
}
|
|
4177
4337
|
const element = container.model.toJSON({ remove: ["default"] });
|
|
4178
4338
|
if (element?.isLocked) {
|
|
4179
|
-
throw new Error(
|
|
4339
|
+
throw new Error(ERROR_MESSAGES3.ELEMENT_IS_LOCKED);
|
|
4180
4340
|
}
|
|
4181
4341
|
const overridableProps = overridablePropsInput ? enrichOverridableProps(overridablePropsInput, element) : void 0;
|
|
4182
4342
|
if (overridableProps) {
|
|
@@ -4213,7 +4373,7 @@ function enrichOverridableProps(input, rootElement) {
|
|
|
4213
4373
|
}
|
|
4214
4374
|
const elType = element.elType;
|
|
4215
4375
|
const widgetType = element.widgetType || element.elType;
|
|
4216
|
-
const elementType = (0,
|
|
4376
|
+
const elementType = (0, import_editor_elements18.getElementType)(widgetType);
|
|
4217
4377
|
if (!elementType) {
|
|
4218
4378
|
throw new Error(
|
|
4219
4379
|
`Element type "${widgetType}" is not atomic or does not have a settings schema. Cannot expose property "${propKey}" for element "${elementId}".`
|
|
@@ -4282,7 +4442,7 @@ function findElementById(root, targetId) {
|
|
|
4282
4442
|
return null;
|
|
4283
4443
|
}
|
|
4284
4444
|
function getValidElementTypes() {
|
|
4285
|
-
const types = (0,
|
|
4445
|
+
const types = (0, import_editor_elements18.getWidgetsCache)();
|
|
4286
4446
|
if (!types) {
|
|
4287
4447
|
return [];
|
|
4288
4448
|
}
|
|
@@ -4469,15 +4629,15 @@ function PopulateStore() {
|
|
|
4469
4629
|
}
|
|
4470
4630
|
|
|
4471
4631
|
// src/prevent-circular-nesting.ts
|
|
4472
|
-
var
|
|
4632
|
+
var import_editor_elements19 = require("@elementor/editor-elements");
|
|
4473
4633
|
var import_editor_notifications4 = require("@elementor/editor-notifications");
|
|
4474
4634
|
var import_editor_v1_adapters9 = require("@elementor/editor-v1-adapters");
|
|
4475
4635
|
var import_store64 = require("@elementor/store");
|
|
4476
|
-
var
|
|
4636
|
+
var import_i18n29 = require("@wordpress/i18n");
|
|
4477
4637
|
var COMPONENT_TYPE = "e-component";
|
|
4478
4638
|
var COMPONENT_CIRCULAR_NESTING_ALERT = {
|
|
4479
4639
|
type: "default",
|
|
4480
|
-
message: (0,
|
|
4640
|
+
message: (0, import_i18n29.__)("Can't add this component - components that contain each other can't be nested.", "elementor"),
|
|
4481
4641
|
id: "circular-component-nesting-blocked"
|
|
4482
4642
|
};
|
|
4483
4643
|
function initCircularNestingPrevention() {
|
|
@@ -4564,7 +4724,7 @@ function blockCircularMove(args) {
|
|
|
4564
4724
|
if (!container) {
|
|
4565
4725
|
return false;
|
|
4566
4726
|
}
|
|
4567
|
-
const allElements = (0,
|
|
4727
|
+
const allElements = (0, import_editor_elements19.getAllDescendants)(container);
|
|
4568
4728
|
return allElements.some((element) => {
|
|
4569
4729
|
const componentId = extractComponentIdFromContainer(element);
|
|
4570
4730
|
if (componentId === null) {
|
|
@@ -4625,7 +4785,7 @@ var componentsStylesProvider = (0, import_editor_styles_repository.createStylesP
|
|
|
4625
4785
|
});
|
|
4626
4786
|
|
|
4627
4787
|
// src/sync/create-components-before-save.ts
|
|
4628
|
-
var
|
|
4788
|
+
var import_editor_elements20 = require("@elementor/editor-elements");
|
|
4629
4789
|
var import_store70 = require("@elementor/store");
|
|
4630
4790
|
async function createComponentsBeforeSave({
|
|
4631
4791
|
elements,
|
|
@@ -4693,7 +4853,7 @@ function shouldUpdateElement(element, uidToComponentId) {
|
|
|
4693
4853
|
return { shouldUpdate: false, newComponentId: null };
|
|
4694
4854
|
}
|
|
4695
4855
|
function updateElementComponentId(elementId, componentId) {
|
|
4696
|
-
(0,
|
|
4856
|
+
(0, import_editor_elements20.updateElementSettings)({
|
|
4697
4857
|
id: elementId,
|
|
4698
4858
|
props: {
|
|
4699
4859
|
component_instance: {
|
|
@@ -4809,7 +4969,7 @@ function init() {
|
|
|
4809
4969
|
window.elementorCommon.__beforeSave = beforeSave;
|
|
4810
4970
|
(0, import_editor_elements_panel.injectTab)({
|
|
4811
4971
|
id: "components",
|
|
4812
|
-
label: (0,
|
|
4972
|
+
label: (0, import_i18n30.__)("Components", "elementor"),
|
|
4813
4973
|
component: Components,
|
|
4814
4974
|
position: 1
|
|
4815
4975
|
});
|
|
@@ -4843,6 +5003,7 @@ function init() {
|
|
|
4843
5003
|
indicator: OverridablePropIndicator
|
|
4844
5004
|
});
|
|
4845
5005
|
(0, import_editor_editing_panel8.registerControlReplacement)({
|
|
5006
|
+
id: OVERRIDABLE_PROP_REPLACEMENT_ID,
|
|
4846
5007
|
component: OverridablePropControl,
|
|
4847
5008
|
condition: ({ value }) => componentOverridablePropTypeUtil.isValid(value)
|
|
4848
5009
|
});
|