@elementor/editor-editing-panel 4.2.0-871 → 4.2.0-873
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 +350 -269
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +329 -247
- package/dist/index.mjs.map +1 -1
- package/package.json +24 -24
- package/src/components/creatable-autocomplete/use-filter-options.ts +10 -2
- package/src/components/css-classes/css-class-selector.tsx +99 -28
- package/src/components/settings-tab.tsx +49 -9
package/dist/index.js
CHANGED
|
@@ -229,6 +229,7 @@ var React11 = __toESM(require("react"));
|
|
|
229
229
|
var import_react10 = require("react");
|
|
230
230
|
var import_editor_styles_repository10 = require("@elementor/editor-styles-repository");
|
|
231
231
|
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
232
|
+
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
232
233
|
var import_icons2 = require("@elementor/icons");
|
|
233
234
|
var import_locations2 = require("@elementor/locations");
|
|
234
235
|
var import_ui7 = require("@elementor/ui");
|
|
@@ -431,14 +432,20 @@ function useCreateOption(params) {
|
|
|
431
432
|
|
|
432
433
|
// src/components/creatable-autocomplete/use-filter-options.ts
|
|
433
434
|
var import_ui = require("@elementor/ui");
|
|
435
|
+
var STRIP_NON_CLASS_CHARS = /[^a-zA-Z0-9_-]/g;
|
|
436
|
+
function normalizeClassSearch(value) {
|
|
437
|
+
return value.replace(STRIP_NON_CLASS_CHARS, "").toLowerCase();
|
|
438
|
+
}
|
|
434
439
|
function useFilterOptions(parameters) {
|
|
435
440
|
const { options: options13, selected, onCreate, entityName } = parameters;
|
|
436
|
-
const filter = (0, import_ui.createFilterOptions)(
|
|
441
|
+
const filter = (0, import_ui.createFilterOptions)({
|
|
442
|
+
matchFrom: "any"
|
|
443
|
+
});
|
|
437
444
|
const filterOptions = (optionList, params) => {
|
|
438
445
|
const selectedValues = selected.map((option) => option.value);
|
|
439
446
|
const filteredOptions = filter(
|
|
440
447
|
optionList.filter((option) => !selectedValues.includes(option.value)),
|
|
441
|
-
params
|
|
448
|
+
{ ...params, inputValue: normalizeClassSearch(params.inputValue) }
|
|
442
449
|
);
|
|
443
450
|
const isExisting = options13.some((option) => params.inputValue === option.label);
|
|
444
451
|
const allowCreate = Boolean(onCreate) && params.inputValue !== "" && !selectedValues.includes(params.inputValue) && !isExisting;
|
|
@@ -1285,6 +1292,19 @@ var validateLabel = (newLabel) => {
|
|
|
1285
1292
|
// src/components/css-classes/css-class-selector.tsx
|
|
1286
1293
|
var ID = "elementor-css-class-selector";
|
|
1287
1294
|
var TAGS_LIMIT = 50;
|
|
1295
|
+
var EVENT_OPEN_GLOBAL_CLASSES_MANAGER = "elementor/open-global-classes-manager";
|
|
1296
|
+
var EVENT_TOGGLE_DESIGN_SYSTEM = "elementor/toggle-design-system";
|
|
1297
|
+
function openClassManagerPanel() {
|
|
1298
|
+
if ((0, import_editor_v1_adapters2.isExperimentActive)("e_editor_design_system_panel")) {
|
|
1299
|
+
window.dispatchEvent(
|
|
1300
|
+
new CustomEvent(EVENT_TOGGLE_DESIGN_SYSTEM, {
|
|
1301
|
+
detail: { tab: "classes" }
|
|
1302
|
+
})
|
|
1303
|
+
);
|
|
1304
|
+
return;
|
|
1305
|
+
}
|
|
1306
|
+
window.dispatchEvent(new CustomEvent(EVENT_OPEN_GLOBAL_CLASSES_MANAGER));
|
|
1307
|
+
}
|
|
1288
1308
|
var EMPTY_OPTION = {
|
|
1289
1309
|
label: (0, import_i18n6.__)("local", "elementor"),
|
|
1290
1310
|
value: null,
|
|
@@ -1300,7 +1320,7 @@ function CssClassSelector() {
|
|
|
1300
1320
|
const autocompleteRef = (0, import_react10.useRef)(null);
|
|
1301
1321
|
const [renameError, setRenameError] = (0, import_react10.useState)(null);
|
|
1302
1322
|
const handleSelect = useHandleSelect();
|
|
1303
|
-
const { create, validate, entityName } = useCreateAction();
|
|
1323
|
+
const { create, validate, entityName, isAtLimit, limitCount } = useCreateAction();
|
|
1304
1324
|
const appliedOptions = useAppliedOptions(options13);
|
|
1305
1325
|
const active = appliedOptions.find((option) => option.value === activeId) ?? EMPTY_OPTION;
|
|
1306
1326
|
const showPlaceholder = appliedOptions.every(({ fixed }) => fixed);
|
|
@@ -1329,7 +1349,7 @@ function CssClassSelector() {
|
|
|
1329
1349
|
onCreate: create ?? void 0,
|
|
1330
1350
|
validate: validate ?? void 0,
|
|
1331
1351
|
limitTags: TAGS_LIMIT,
|
|
1332
|
-
renderEmptyState: EmptyState,
|
|
1352
|
+
renderEmptyState: isAtLimit && typeof limitCount === "number" ? (props) => /* @__PURE__ */ React11.createElement(LimitReachedEmptyState, { limitCount, onClear: props.onClear }) : EmptyState,
|
|
1333
1353
|
getLimitTagsText: (more) => /* @__PURE__ */ React11.createElement(import_ui7.Chip, { size: "tiny", variant: "standard", label: `+${more}`, clickable: true }),
|
|
1334
1354
|
renderTags: (values, getTagProps) => values.map((value, index) => {
|
|
1335
1355
|
const chipProps = getTagProps({ index });
|
|
@@ -1368,7 +1388,7 @@ function CssClassSelector() {
|
|
|
1368
1388
|
)
|
|
1369
1389
|
), !canEdit && /* @__PURE__ */ React11.createElement(import_editor_ui4.InfoAlert, { sx: { mt: 1 } }, (0, import_i18n6.__)("With your current role, you can use existing classes but can\u2019t modify them.", "elementor")));
|
|
1370
1390
|
}
|
|
1371
|
-
var
|
|
1391
|
+
var EmptyStateLayout = ({ searchValue, onClear, children }) => /* @__PURE__ */ React11.createElement(import_ui7.Box, { sx: { py: 4 } }, /* @__PURE__ */ React11.createElement(
|
|
1372
1392
|
import_ui7.Stack,
|
|
1373
1393
|
{
|
|
1374
1394
|
gap: 1,
|
|
@@ -1379,9 +1399,54 @@ var EmptyState = ({ searchValue, onClear }) => /* @__PURE__ */ React11.createEle
|
|
|
1379
1399
|
},
|
|
1380
1400
|
/* @__PURE__ */ React11.createElement(import_icons2.ColorSwatchIcon, { sx: { transform: "rotate(90deg)" }, fontSize: "large" }),
|
|
1381
1401
|
/* @__PURE__ */ React11.createElement(import_ui7.Typography, { align: "center", variant: "subtitle2" }, (0, import_i18n6.__)("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React11.createElement("br", null), "\u201C", searchValue, "\u201D."),
|
|
1382
|
-
|
|
1402
|
+
children,
|
|
1383
1403
|
/* @__PURE__ */ React11.createElement(import_ui7.Link, { color: "text.secondary", variant: "caption", component: "button", onClick: onClear }, (0, import_i18n6.__)("Clear & try again", "elementor"))
|
|
1384
1404
|
));
|
|
1405
|
+
var EmptyState = (props) => /* @__PURE__ */ React11.createElement(EmptyStateLayout, { ...props }, /* @__PURE__ */ React11.createElement(import_ui7.Typography, { align: "center", variant: "caption", sx: { mb: 2 } }, (0, import_i18n6.__)("With your current role,", "elementor"), /* @__PURE__ */ React11.createElement("br", null), (0, import_i18n6.__)("you can only use existing classes.", "elementor")));
|
|
1406
|
+
var LimitReachedEmptyState = ({
|
|
1407
|
+
limitCount,
|
|
1408
|
+
onClear
|
|
1409
|
+
}) => /* @__PURE__ */ React11.createElement(import_ui7.Box, { sx: { py: 4 } }, /* @__PURE__ */ React11.createElement(
|
|
1410
|
+
import_ui7.Stack,
|
|
1411
|
+
{
|
|
1412
|
+
gap: 1,
|
|
1413
|
+
alignItems: "center",
|
|
1414
|
+
color: "text.secondary",
|
|
1415
|
+
justifyContent: "center",
|
|
1416
|
+
sx: { px: 1, m: "auto", maxWidth: "260px" }
|
|
1417
|
+
},
|
|
1418
|
+
/* @__PURE__ */ React11.createElement(import_icons2.ColorSwatchIcon, { sx: { transform: "rotate(90deg)" }, fontSize: "large" }),
|
|
1419
|
+
/* @__PURE__ */ React11.createElement(
|
|
1420
|
+
import_ui7.Typography,
|
|
1421
|
+
{ align: "center", variant: "subtitle2" },
|
|
1422
|
+
/* translators: %s is the maximum number of classes */
|
|
1423
|
+
(0, import_i18n6.__)("Limit of %s classes reached", "elementor").replace("%s", String(limitCount))
|
|
1424
|
+
),
|
|
1425
|
+
/* @__PURE__ */ React11.createElement(import_ui7.Typography, { align: "center", variant: "caption", component: "div" }, (0, import_i18n6.__)("Remove a class to create a new one.", "elementor"), " ", /* @__PURE__ */ React11.createElement(
|
|
1426
|
+
import_ui7.Link,
|
|
1427
|
+
{
|
|
1428
|
+
color: "inherit",
|
|
1429
|
+
variant: "caption",
|
|
1430
|
+
component: "button",
|
|
1431
|
+
onClick: onClear,
|
|
1432
|
+
sx: { verticalAlign: "baseline" }
|
|
1433
|
+
},
|
|
1434
|
+
(0, import_i18n6.__)("Clear", "elementor")
|
|
1435
|
+
)),
|
|
1436
|
+
/* @__PURE__ */ React11.createElement(
|
|
1437
|
+
import_ui7.Button,
|
|
1438
|
+
{
|
|
1439
|
+
variant: "outlined",
|
|
1440
|
+
color: "secondary",
|
|
1441
|
+
size: "small",
|
|
1442
|
+
onClick: () => {
|
|
1443
|
+
openClassManagerPanel();
|
|
1444
|
+
onClear();
|
|
1445
|
+
}
|
|
1446
|
+
},
|
|
1447
|
+
(0, import_i18n6.__)("Class Manager", "elementor")
|
|
1448
|
+
)
|
|
1449
|
+
));
|
|
1385
1450
|
var updateClassByProvider = (provider, data) => {
|
|
1386
1451
|
if (!provider) {
|
|
1387
1452
|
return;
|
|
@@ -1424,6 +1489,11 @@ function useCreateAction() {
|
|
|
1424
1489
|
if (!provider || !createAction) {
|
|
1425
1490
|
return {};
|
|
1426
1491
|
}
|
|
1492
|
+
const entityName = provider.labels.singular && provider.labels.plural ? provider.labels : void 0;
|
|
1493
|
+
const validate = (newClassLabel, event) => (0, import_editor_styles_repository10.validateStyleLabel)(newClassLabel, event);
|
|
1494
|
+
if (hasReachedLimit(provider)) {
|
|
1495
|
+
return { entityName, isAtLimit: true, limitCount: provider.limit, validate };
|
|
1496
|
+
}
|
|
1427
1497
|
const create = (classLabel) => {
|
|
1428
1498
|
const { createdId } = createAction({ classLabel });
|
|
1429
1499
|
trackStyles(provider.getKey() ?? "", "classCreated", {
|
|
@@ -1432,21 +1502,7 @@ function useCreateAction() {
|
|
|
1432
1502
|
classId: createdId
|
|
1433
1503
|
});
|
|
1434
1504
|
};
|
|
1435
|
-
|
|
1436
|
-
if (hasReachedLimit(provider)) {
|
|
1437
|
-
return {
|
|
1438
|
-
isValid: false,
|
|
1439
|
-
/* translators: %s is the maximum number of classes */
|
|
1440
|
-
errorMessage: (0, import_i18n6.__)(
|
|
1441
|
-
"You\u2019ve reached the limit of %s classes. Please remove an existing one to create a new class.",
|
|
1442
|
-
"elementor"
|
|
1443
|
-
).replace("%s", provider.limit.toString())
|
|
1444
|
-
};
|
|
1445
|
-
}
|
|
1446
|
-
return (0, import_editor_styles_repository10.validateStyleLabel)(newClassLabel, event);
|
|
1447
|
-
};
|
|
1448
|
-
const entityName = provider.labels.singular && provider.labels.plural ? provider.labels : void 0;
|
|
1449
|
-
return { create, validate, entityName };
|
|
1505
|
+
return { create, validate, entityName, isAtLimit: false };
|
|
1450
1506
|
}
|
|
1451
1507
|
function hasReachedLimit(provider) {
|
|
1452
1508
|
return provider.actions.all().length >= provider.limit;
|
|
@@ -1501,7 +1557,7 @@ var import_editor_elements5 = require("@elementor/editor-elements");
|
|
|
1501
1557
|
var import_editor_props3 = require("@elementor/editor-props");
|
|
1502
1558
|
var import_editor_styles3 = require("@elementor/editor-styles");
|
|
1503
1559
|
var import_editor_styles_repository13 = require("@elementor/editor-styles-repository");
|
|
1504
|
-
var
|
|
1560
|
+
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
1505
1561
|
var import_utils2 = require("@elementor/utils");
|
|
1506
1562
|
|
|
1507
1563
|
// src/hooks/use-styles-fields.ts
|
|
@@ -1510,7 +1566,7 @@ var import_editor_elements4 = require("@elementor/editor-elements");
|
|
|
1510
1566
|
var import_editor_styles2 = require("@elementor/editor-styles");
|
|
1511
1567
|
var import_editor_styles_repository11 = require("@elementor/editor-styles-repository");
|
|
1512
1568
|
var import_editor_styles_repository12 = require("@elementor/editor-styles-repository");
|
|
1513
|
-
var
|
|
1569
|
+
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
1514
1570
|
var import_i18n7 = require("@wordpress/i18n");
|
|
1515
1571
|
|
|
1516
1572
|
// src/hooks/use-styles-rerender.ts
|
|
@@ -1561,7 +1617,7 @@ function useUndoableActions({
|
|
|
1561
1617
|
return (0, import_react12.useMemo)(() => {
|
|
1562
1618
|
const meta = { breakpoint, state };
|
|
1563
1619
|
const createStyleArgs = { elementId, classesProp, meta, label: import_editor_styles_repository12.ELEMENTS_STYLES_RESERVED_LABEL };
|
|
1564
|
-
return (0,
|
|
1620
|
+
return (0, import_editor_v1_adapters3.undoable)(
|
|
1565
1621
|
{
|
|
1566
1622
|
do: (payload) => {
|
|
1567
1623
|
if ((0, import_editor_elements4.shouldCreateNewLocalStyle)(payload)) {
|
|
@@ -1700,7 +1756,7 @@ function useUndoableActions2({
|
|
|
1700
1756
|
return (0, import_react13.useMemo)(() => {
|
|
1701
1757
|
const meta = { breakpoint, state };
|
|
1702
1758
|
const createStyleArgs = { elementId, classesProp, meta, label: import_editor_styles_repository13.ELEMENTS_STYLES_RESERVED_LABEL };
|
|
1703
|
-
return (0,
|
|
1759
|
+
return (0, import_editor_v1_adapters4.undoable)(
|
|
1704
1760
|
{
|
|
1705
1761
|
do: (payload) => {
|
|
1706
1762
|
if ((0, import_editor_elements5.shouldCreateNewLocalStyle)(payload)) {
|
|
@@ -1862,7 +1918,7 @@ function EditorPanelErrorFallback() {
|
|
|
1862
1918
|
var import_react38 = require("react");
|
|
1863
1919
|
var React86 = __toESM(require("react"));
|
|
1864
1920
|
var import_editor_elements12 = require("@elementor/editor-elements");
|
|
1865
|
-
var
|
|
1921
|
+
var import_editor_v1_adapters10 = require("@elementor/editor-v1-adapters");
|
|
1866
1922
|
var import_ui41 = require("@elementor/ui");
|
|
1867
1923
|
var import_i18n60 = require("@wordpress/i18n");
|
|
1868
1924
|
|
|
@@ -1974,206 +2030,8 @@ var InteractionsTab = () => {
|
|
|
1974
2030
|
var React23 = __toESM(require("react"));
|
|
1975
2031
|
var import_session6 = require("@elementor/session");
|
|
1976
2032
|
|
|
1977
|
-
// src/components/section.tsx
|
|
1978
|
-
var React17 = __toESM(require("react"));
|
|
1979
|
-
var import_react18 = require("react");
|
|
1980
|
-
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
1981
|
-
var import_ui11 = require("@elementor/ui");
|
|
1982
|
-
function Section({ title, children, defaultExpanded = false, titleEnd, unmountOnExit = true, action }) {
|
|
1983
|
-
const [isOpen, setIsOpen] = useStateByElement(title, !!defaultExpanded);
|
|
1984
|
-
const ref = (0, import_react18.useRef)(null);
|
|
1985
|
-
const isDisabled = !!action;
|
|
1986
|
-
const handleClick = () => {
|
|
1987
|
-
if (isDisabled) {
|
|
1988
|
-
action?.onClick();
|
|
1989
|
-
} else {
|
|
1990
|
-
setIsOpen(!isOpen);
|
|
1991
|
-
}
|
|
1992
|
-
};
|
|
1993
|
-
const id = (0, import_react18.useId)();
|
|
1994
|
-
const labelId = `label-${id}`;
|
|
1995
|
-
const contentId = `content-${id}`;
|
|
1996
|
-
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(
|
|
1997
|
-
import_ui11.ListItemButton,
|
|
1998
|
-
{
|
|
1999
|
-
id: labelId,
|
|
2000
|
-
"aria-controls": contentId,
|
|
2001
|
-
"aria-label": `${title} section`,
|
|
2002
|
-
onClick: handleClick,
|
|
2003
|
-
sx: { "&:hover": { backgroundColor: "transparent" } }
|
|
2004
|
-
},
|
|
2005
|
-
/* @__PURE__ */ React17.createElement(import_ui11.Stack, { direction: "row", alignItems: "center", justifyItems: "start", flexGrow: 1, gap: 0.5 }, /* @__PURE__ */ React17.createElement(
|
|
2006
|
-
import_ui11.ListItemText,
|
|
2007
|
-
{
|
|
2008
|
-
secondary: title,
|
|
2009
|
-
secondaryTypographyProps: { color: "text.primary", variant: "caption", fontWeight: "bold" },
|
|
2010
|
-
sx: { flexGrow: 0, flexShrink: 1, marginInlineEnd: 1 }
|
|
2011
|
-
}
|
|
2012
|
-
), (0, import_editor_ui5.getCollapsibleValue)(titleEnd, isOpen)),
|
|
2013
|
-
action?.component,
|
|
2014
|
-
/* @__PURE__ */ React17.createElement(
|
|
2015
|
-
import_editor_ui5.CollapseIcon,
|
|
2016
|
-
{
|
|
2017
|
-
open: isOpen,
|
|
2018
|
-
color: "secondary",
|
|
2019
|
-
fontSize: "tiny",
|
|
2020
|
-
disabled: isDisabled,
|
|
2021
|
-
sx: { ml: 1 }
|
|
2022
|
-
}
|
|
2023
|
-
)
|
|
2024
|
-
), /* @__PURE__ */ React17.createElement(
|
|
2025
|
-
import_ui11.Collapse,
|
|
2026
|
-
{
|
|
2027
|
-
id: contentId,
|
|
2028
|
-
"aria-labelledby": labelId,
|
|
2029
|
-
in: isOpen,
|
|
2030
|
-
timeout: "auto",
|
|
2031
|
-
unmountOnExit
|
|
2032
|
-
},
|
|
2033
|
-
/* @__PURE__ */ React17.createElement(import_editor_ui5.SectionRefContext.Provider, { value: ref }, /* @__PURE__ */ React17.createElement(import_ui11.Stack, { ref, gap: 2.5, p: 2, "aria-label": `${title} section content` }, children))
|
|
2034
|
-
), /* @__PURE__ */ React17.createElement(import_ui11.Divider, null));
|
|
2035
|
-
}
|
|
2036
|
-
|
|
2037
|
-
// src/components/settings-control.tsx
|
|
2038
|
-
var React22 = __toESM(require("react"));
|
|
2039
|
-
var import_editor_controls4 = require("@elementor/editor-controls");
|
|
2040
|
-
var import_ui14 = require("@elementor/ui");
|
|
2041
|
-
|
|
2042
|
-
// src/controls-registry/control.tsx
|
|
2043
|
-
var React18 = __toESM(require("react"));
|
|
2044
|
-
|
|
2045
|
-
// src/controls-registry/controls-registry.tsx
|
|
2046
|
-
var import_editor_controls = require("@elementor/editor-controls");
|
|
2047
|
-
var import_editor_props4 = require("@elementor/editor-props");
|
|
2048
|
-
var queryArrayPropTypeUtil = (0, import_editor_props4.createArrayPropUtils)(import_editor_props4.queryPropTypeUtil.key, import_editor_props4.queryPropTypeUtil.schema);
|
|
2049
|
-
var controlTypes = {
|
|
2050
|
-
image: { component: import_editor_controls.ImageControl, layout: "custom", propTypeUtil: import_editor_props4.imagePropTypeUtil },
|
|
2051
|
-
"svg-media": { component: import_editor_controls.SvgMediaControl, layout: "full", propTypeUtil: import_editor_props4.svgSrcPropTypeUtil },
|
|
2052
|
-
text: { component: import_editor_controls.TextControl, layout: "full", propTypeUtil: import_editor_props4.stringPropTypeUtil },
|
|
2053
|
-
textarea: { component: import_editor_controls.TextAreaControl, layout: "full", propTypeUtil: import_editor_props4.stringPropTypeUtil },
|
|
2054
|
-
size: { component: import_editor_controls.SizeControl, layout: "two-columns", propTypeUtil: import_editor_props4.sizePropTypeUtil },
|
|
2055
|
-
select: { component: import_editor_controls.SelectControlWrapper, layout: "two-columns", propTypeUtil: import_editor_props4.stringPropTypeUtil },
|
|
2056
|
-
chips: { component: import_editor_controls.ChipsControl, layout: "full", propTypeUtil: import_editor_props4.stringArrayPropTypeUtil },
|
|
2057
|
-
link: { component: import_editor_controls.LinkControl, layout: "custom", propTypeUtil: import_editor_props4.linkPropTypeUtil },
|
|
2058
|
-
query: { component: import_editor_controls.QueryControl, layout: "full", propTypeUtil: import_editor_props4.queryPropTypeUtil },
|
|
2059
|
-
"query-chips": { component: import_editor_controls.QueryChipsControl, layout: "full", propTypeUtil: queryArrayPropTypeUtil },
|
|
2060
|
-
"query-filter-repeater": {
|
|
2061
|
-
component: import_editor_controls.QueryFilterRepeaterControl,
|
|
2062
|
-
layout: "full",
|
|
2063
|
-
propTypeUtil: import_editor_props4.queryFilterArrayPropTypeUtil
|
|
2064
|
-
},
|
|
2065
|
-
url: { component: import_editor_controls.UrlControl, layout: "full", propTypeUtil: import_editor_props4.stringPropTypeUtil },
|
|
2066
|
-
switch: { component: import_editor_controls.SwitchControl, layout: "two-columns", propTypeUtil: import_editor_props4.booleanPropTypeUtil },
|
|
2067
|
-
number: { component: import_editor_controls.NumberControl, layout: "two-columns", propTypeUtil: import_editor_props4.numberPropTypeUtil },
|
|
2068
|
-
repeatable: { component: import_editor_controls.RepeatableControl, layout: "full", propTypeUtil: void 0 },
|
|
2069
|
-
"key-value": { component: import_editor_controls.KeyValueControl, layout: "full", propTypeUtil: import_editor_props4.keyValuePropTypeUtil },
|
|
2070
|
-
"html-tag": { component: import_editor_controls.HtmlTagControl, layout: "two-columns", propTypeUtil: import_editor_props4.stringPropTypeUtil },
|
|
2071
|
-
toggle: { component: import_editor_controls.ToggleControl, layout: "full", propTypeUtil: import_editor_props4.stringPropTypeUtil },
|
|
2072
|
-
"date-time": { component: import_editor_controls.DateTimeControl, layout: "full", propTypeUtil: import_editor_props4.DateTimePropTypeUtil },
|
|
2073
|
-
video: { component: import_editor_controls.VideoMediaControl, layout: "full", propTypeUtil: import_editor_props4.videoSrcPropTypeUtil },
|
|
2074
|
-
"inline-editing": { component: import_editor_controls.InlineEditingControl, layout: "full", propTypeUtil: import_editor_props4.htmlV3PropTypeUtil },
|
|
2075
|
-
email: { component: import_editor_controls.EmailFormActionControl, layout: "custom", propTypeUtil: import_editor_props4.emailsPropTypeUtil },
|
|
2076
|
-
"date-range": {
|
|
2077
|
-
component: import_editor_controls.DateRangeControl,
|
|
2078
|
-
layout: "custom",
|
|
2079
|
-
propTypeUtil: import_editor_props4.dateRangePropTypeUtil
|
|
2080
|
-
},
|
|
2081
|
-
"time-range": {
|
|
2082
|
-
component: import_editor_controls.TimeRangeControl,
|
|
2083
|
-
layout: "custom",
|
|
2084
|
-
propTypeUtil: import_editor_props4.timeRangePropTypeUtil
|
|
2085
|
-
},
|
|
2086
|
-
"attachment-type": { component: import_editor_controls.AttachmentTypeControl, layout: "custom", propTypeUtil: import_editor_props4.stringPropTypeUtil }
|
|
2087
|
-
};
|
|
2088
|
-
var ControlsRegistry = class {
|
|
2089
|
-
constructor(controlsRegistry2) {
|
|
2090
|
-
this.controlsRegistry = controlsRegistry2;
|
|
2091
|
-
this.controlsRegistry = controlsRegistry2;
|
|
2092
|
-
}
|
|
2093
|
-
get(type) {
|
|
2094
|
-
return this.controlsRegistry[type]?.component;
|
|
2095
|
-
}
|
|
2096
|
-
getLayout(type) {
|
|
2097
|
-
return this.controlsRegistry[type]?.layout;
|
|
2098
|
-
}
|
|
2099
|
-
getPropTypeUtil(type) {
|
|
2100
|
-
return this.controlsRegistry[type]?.propTypeUtil;
|
|
2101
|
-
}
|
|
2102
|
-
registry() {
|
|
2103
|
-
return this.controlsRegistry;
|
|
2104
|
-
}
|
|
2105
|
-
register(type, component, layout, propTypeUtil) {
|
|
2106
|
-
if (this.controlsRegistry[type]) {
|
|
2107
|
-
throw new ControlTypeAlreadyRegisteredError({ context: { controlType: type } });
|
|
2108
|
-
}
|
|
2109
|
-
this.controlsRegistry[type] = { component, layout, propTypeUtil };
|
|
2110
|
-
}
|
|
2111
|
-
unregister(type) {
|
|
2112
|
-
if (!this.controlsRegistry[type]) {
|
|
2113
|
-
throw new ControlTypeNotRegisteredError({ context: { controlType: type } });
|
|
2114
|
-
}
|
|
2115
|
-
delete this.controlsRegistry[type];
|
|
2116
|
-
}
|
|
2117
|
-
};
|
|
2118
|
-
var controlsRegistry = new ControlsRegistry(controlTypes);
|
|
2119
|
-
|
|
2120
|
-
// src/controls-registry/control.tsx
|
|
2121
|
-
var Control = ({ props, type }) => {
|
|
2122
|
-
const ControlByType = controlsRegistry.get(type);
|
|
2123
|
-
const { element } = useElement();
|
|
2124
|
-
if (!ControlByType) {
|
|
2125
|
-
throw new ControlTypeNotFoundError({
|
|
2126
|
-
context: { controlType: type }
|
|
2127
|
-
});
|
|
2128
|
-
}
|
|
2129
|
-
return /* @__PURE__ */ React18.createElement(ControlByType, { ...props, context: { elementId: element.id } });
|
|
2130
|
-
};
|
|
2131
|
-
|
|
2132
|
-
// src/controls-registry/control-type-container.tsx
|
|
2133
|
-
var React19 = __toESM(require("react"));
|
|
2134
|
-
var import_ui12 = require("@elementor/ui");
|
|
2135
|
-
var ControlTypeContainer = ({ children, layout }) => {
|
|
2136
|
-
if (layout === "custom") {
|
|
2137
|
-
return children;
|
|
2138
|
-
}
|
|
2139
|
-
return /* @__PURE__ */ React19.createElement(StyledContainer, { layout }, children);
|
|
2140
|
-
};
|
|
2141
|
-
var StyledContainer = (0, import_ui12.styled)(import_ui12.Box, {
|
|
2142
|
-
shouldForwardProp: (prop) => !["layout"].includes(prop)
|
|
2143
|
-
})(({ layout, theme }) => ({
|
|
2144
|
-
display: "grid",
|
|
2145
|
-
gridGap: theme.spacing(1),
|
|
2146
|
-
...getGridLayout(layout)
|
|
2147
|
-
}));
|
|
2148
|
-
var getGridLayout = (layout) => ({
|
|
2149
|
-
justifyContent: "space-between",
|
|
2150
|
-
...getStyleByLayout(layout)
|
|
2151
|
-
});
|
|
2152
|
-
var getStyleByLayout = (layout) => {
|
|
2153
|
-
if (layout === "full") {
|
|
2154
|
-
return {
|
|
2155
|
-
gridTemplateColumns: "minmax(0, 1fr)"
|
|
2156
|
-
};
|
|
2157
|
-
}
|
|
2158
|
-
if (layout === "two-columns") {
|
|
2159
|
-
return {
|
|
2160
|
-
alignItems: "center",
|
|
2161
|
-
gridTemplateColumns: "repeat(2, minmax(0, 1fr))"
|
|
2162
|
-
};
|
|
2163
|
-
}
|
|
2164
|
-
};
|
|
2165
|
-
|
|
2166
|
-
// src/controls-registry/settings-field.tsx
|
|
2167
|
-
var React20 = __toESM(require("react"));
|
|
2168
|
-
var import_react19 = require("react");
|
|
2169
|
-
var import_editor_controls2 = require("@elementor/editor-controls");
|
|
2170
|
-
var import_editor_documents2 = require("@elementor/editor-documents");
|
|
2171
|
-
var import_editor_elements6 = require("@elementor/editor-elements");
|
|
2172
|
-
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
2173
|
-
var import_i18n8 = require("@wordpress/i18n");
|
|
2174
|
-
|
|
2175
2033
|
// src/utils/prop-dependency-utils.ts
|
|
2176
|
-
var
|
|
2034
|
+
var import_editor_props4 = require("@elementor/editor-props");
|
|
2177
2035
|
var import_session5 = require("@elementor/session");
|
|
2178
2036
|
function getElementSettingsWithDefaults(propsSchema, elementSettings) {
|
|
2179
2037
|
const elementSettingsWithDefaults = { ...elementSettings };
|
|
@@ -2187,12 +2045,12 @@ function getElementSettingsWithDefaults(propsSchema, elementSettings) {
|
|
|
2187
2045
|
function extractDependencyEffect(bind, propsSchema, settings) {
|
|
2188
2046
|
const settingsWithDefaults = getElementSettingsWithDefaults(propsSchema, settings);
|
|
2189
2047
|
const propType = propsSchema[bind];
|
|
2190
|
-
const depCheck = (0,
|
|
2048
|
+
const depCheck = (0, import_editor_props4.isDependencyMet)(propType?.dependencies, settingsWithDefaults);
|
|
2191
2049
|
const failingTerm = !depCheck.isMet ? depCheck.failingDependencies[0] : void 0;
|
|
2192
|
-
const isHidden = !!failingTerm && !(0,
|
|
2050
|
+
const isHidden = !!failingTerm && !(0, import_editor_props4.isDependency)(failingTerm) && failingTerm?.effect === "hide";
|
|
2193
2051
|
return {
|
|
2194
2052
|
isHidden,
|
|
2195
|
-
isDisabled: (prop) => !(0,
|
|
2053
|
+
isDisabled: (prop) => !(0, import_editor_props4.isDependencyMet)(prop?.dependencies, settingsWithDefaults).isMet
|
|
2196
2054
|
};
|
|
2197
2055
|
}
|
|
2198
2056
|
function extractOrderedDependencies(dependenciesPerTargetMapping) {
|
|
@@ -2211,8 +2069,8 @@ function getUpdatedValues(values, dependencies, propsSchema, elementValues, elem
|
|
|
2211
2069
|
return newValues;
|
|
2212
2070
|
}
|
|
2213
2071
|
const testDependencies = {
|
|
2214
|
-
previousValues: (0,
|
|
2215
|
-
newValues: (0,
|
|
2072
|
+
previousValues: (0, import_editor_props4.isDependencyMet)(propType.dependencies, elementValues),
|
|
2073
|
+
newValues: (0, import_editor_props4.isDependencyMet)(propType.dependencies, combinedValues)
|
|
2216
2074
|
};
|
|
2217
2075
|
if (!testDependencies.newValues.isMet) {
|
|
2218
2076
|
const newValue = handleUnmetCondition({
|
|
@@ -2229,7 +2087,7 @@ function getUpdatedValues(values, dependencies, propsSchema, elementValues, elem
|
|
|
2229
2087
|
}
|
|
2230
2088
|
if (!testDependencies.previousValues.isMet) {
|
|
2231
2089
|
const savedValue = retrievePreviousValueFromStorage({ path: dependency, elementId });
|
|
2232
|
-
const currentValue = (0,
|
|
2090
|
+
const currentValue = (0, import_editor_props4.extractValue)(path, combinedValues, [], {
|
|
2233
2091
|
unwrapOverridableLeaf: false
|
|
2234
2092
|
});
|
|
2235
2093
|
removePreviousValueFromStorage({ path: dependency, elementId });
|
|
@@ -2266,7 +2124,7 @@ function evaluatePropType(props) {
|
|
|
2266
2124
|
const { key, index, path, elementValues, basePropKey } = props;
|
|
2267
2125
|
switch (prop.kind) {
|
|
2268
2126
|
case "union":
|
|
2269
|
-
const value = (0,
|
|
2127
|
+
const value = (0, import_editor_props4.extractValue)(path.slice(0, index + 1), elementValues);
|
|
2270
2128
|
const type = value?.$$type ?? null;
|
|
2271
2129
|
return getPropType(
|
|
2272
2130
|
{ [basePropKey]: prop.prop_types?.[type] },
|
|
@@ -2304,9 +2162,9 @@ function cloneDescent(child) {
|
|
|
2304
2162
|
if (!child) {
|
|
2305
2163
|
return null;
|
|
2306
2164
|
}
|
|
2307
|
-
if ((0,
|
|
2165
|
+
if ((0, import_editor_props4.isOverridable)(child)) {
|
|
2308
2166
|
const origin = child.value.origin_value;
|
|
2309
|
-
if (!origin || !(0,
|
|
2167
|
+
if (!origin || !(0, import_editor_props4.isTransformable)(origin)) {
|
|
2310
2168
|
return null;
|
|
2311
2169
|
}
|
|
2312
2170
|
const descended = { ...origin.value };
|
|
@@ -2319,7 +2177,7 @@ function cloneDescent(child) {
|
|
|
2319
2177
|
};
|
|
2320
2178
|
return { replacement, descended };
|
|
2321
2179
|
}
|
|
2322
|
-
if ((0,
|
|
2180
|
+
if ((0, import_editor_props4.isTransformable)(child)) {
|
|
2323
2181
|
const descended = { ...child.value };
|
|
2324
2182
|
const replacement = { ...child, value: descended };
|
|
2325
2183
|
return { replacement, descended };
|
|
@@ -2330,17 +2188,17 @@ function isCompatibleSavedValue(saved, current) {
|
|
|
2330
2188
|
if (!saved) {
|
|
2331
2189
|
return false;
|
|
2332
2190
|
}
|
|
2333
|
-
return (0,
|
|
2191
|
+
return (0, import_editor_props4.isOverridable)(saved) === (0, import_editor_props4.isOverridable)(current);
|
|
2334
2192
|
}
|
|
2335
2193
|
function mergeLeafValue(existing, incoming) {
|
|
2336
2194
|
if (incoming === null) {
|
|
2337
2195
|
return null;
|
|
2338
2196
|
}
|
|
2339
|
-
if (incoming && (0,
|
|
2197
|
+
if (incoming && (0, import_editor_props4.isOverridable)(incoming)) {
|
|
2340
2198
|
return incoming;
|
|
2341
2199
|
}
|
|
2342
|
-
if (existing && (0,
|
|
2343
|
-
return (0,
|
|
2200
|
+
if (existing && (0, import_editor_props4.isOverridable)(existing) && incoming) {
|
|
2201
|
+
return (0, import_editor_props4.rewrapOverridableValue)(existing, incoming);
|
|
2344
2202
|
}
|
|
2345
2203
|
return incoming;
|
|
2346
2204
|
}
|
|
@@ -2350,7 +2208,7 @@ function handleUnmetCondition(props) {
|
|
|
2350
2208
|
(term) => "newValue" in term && !!term.newValue
|
|
2351
2209
|
);
|
|
2352
2210
|
const newValue = termWithNewValue?.newValue ?? null;
|
|
2353
|
-
const currentValue = (0,
|
|
2211
|
+
const currentValue = (0, import_editor_props4.extractValue)(dependency.split("."), elementValues, [], { unwrapOverridableLeaf: false }) ?? defaultValue;
|
|
2354
2212
|
savePreviousValueToStorage({
|
|
2355
2213
|
path: dependency,
|
|
2356
2214
|
elementId,
|
|
@@ -2378,6 +2236,204 @@ function removePreviousValueFromStorage({ path, elementId }) {
|
|
|
2378
2236
|
(0, import_session5.removeSessionStorageItem)(key);
|
|
2379
2237
|
}
|
|
2380
2238
|
|
|
2239
|
+
// src/components/section.tsx
|
|
2240
|
+
var React17 = __toESM(require("react"));
|
|
2241
|
+
var import_react18 = require("react");
|
|
2242
|
+
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
2243
|
+
var import_ui11 = require("@elementor/ui");
|
|
2244
|
+
function Section({ title, children, defaultExpanded = false, titleEnd, unmountOnExit = true, action }) {
|
|
2245
|
+
const [isOpen, setIsOpen] = useStateByElement(title, !!defaultExpanded);
|
|
2246
|
+
const ref = (0, import_react18.useRef)(null);
|
|
2247
|
+
const isDisabled = !!action;
|
|
2248
|
+
const handleClick = () => {
|
|
2249
|
+
if (isDisabled) {
|
|
2250
|
+
action?.onClick();
|
|
2251
|
+
} else {
|
|
2252
|
+
setIsOpen(!isOpen);
|
|
2253
|
+
}
|
|
2254
|
+
};
|
|
2255
|
+
const id = (0, import_react18.useId)();
|
|
2256
|
+
const labelId = `label-${id}`;
|
|
2257
|
+
const contentId = `content-${id}`;
|
|
2258
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(
|
|
2259
|
+
import_ui11.ListItemButton,
|
|
2260
|
+
{
|
|
2261
|
+
id: labelId,
|
|
2262
|
+
"aria-controls": contentId,
|
|
2263
|
+
"aria-label": `${title} section`,
|
|
2264
|
+
onClick: handleClick,
|
|
2265
|
+
sx: { "&:hover": { backgroundColor: "transparent" } }
|
|
2266
|
+
},
|
|
2267
|
+
/* @__PURE__ */ React17.createElement(import_ui11.Stack, { direction: "row", alignItems: "center", justifyItems: "start", flexGrow: 1, gap: 0.5 }, /* @__PURE__ */ React17.createElement(
|
|
2268
|
+
import_ui11.ListItemText,
|
|
2269
|
+
{
|
|
2270
|
+
secondary: title,
|
|
2271
|
+
secondaryTypographyProps: { color: "text.primary", variant: "caption", fontWeight: "bold" },
|
|
2272
|
+
sx: { flexGrow: 0, flexShrink: 1, marginInlineEnd: 1 }
|
|
2273
|
+
}
|
|
2274
|
+
), (0, import_editor_ui5.getCollapsibleValue)(titleEnd, isOpen)),
|
|
2275
|
+
action?.component,
|
|
2276
|
+
/* @__PURE__ */ React17.createElement(
|
|
2277
|
+
import_editor_ui5.CollapseIcon,
|
|
2278
|
+
{
|
|
2279
|
+
open: isOpen,
|
|
2280
|
+
color: "secondary",
|
|
2281
|
+
fontSize: "tiny",
|
|
2282
|
+
disabled: isDisabled,
|
|
2283
|
+
sx: { ml: 1 }
|
|
2284
|
+
}
|
|
2285
|
+
)
|
|
2286
|
+
), /* @__PURE__ */ React17.createElement(
|
|
2287
|
+
import_ui11.Collapse,
|
|
2288
|
+
{
|
|
2289
|
+
id: contentId,
|
|
2290
|
+
"aria-labelledby": labelId,
|
|
2291
|
+
in: isOpen,
|
|
2292
|
+
timeout: "auto",
|
|
2293
|
+
unmountOnExit
|
|
2294
|
+
},
|
|
2295
|
+
/* @__PURE__ */ React17.createElement(import_editor_ui5.SectionRefContext.Provider, { value: ref }, /* @__PURE__ */ React17.createElement(import_ui11.Stack, { ref, gap: 2.5, p: 2, "aria-label": `${title} section content` }, children))
|
|
2296
|
+
), /* @__PURE__ */ React17.createElement(import_ui11.Divider, null));
|
|
2297
|
+
}
|
|
2298
|
+
|
|
2299
|
+
// src/components/settings-control.tsx
|
|
2300
|
+
var React22 = __toESM(require("react"));
|
|
2301
|
+
var import_editor_controls4 = require("@elementor/editor-controls");
|
|
2302
|
+
var import_ui14 = require("@elementor/ui");
|
|
2303
|
+
|
|
2304
|
+
// src/controls-registry/control.tsx
|
|
2305
|
+
var React18 = __toESM(require("react"));
|
|
2306
|
+
|
|
2307
|
+
// src/controls-registry/controls-registry.tsx
|
|
2308
|
+
var import_editor_controls = require("@elementor/editor-controls");
|
|
2309
|
+
var import_editor_props5 = require("@elementor/editor-props");
|
|
2310
|
+
var queryArrayPropTypeUtil = (0, import_editor_props5.createArrayPropUtils)(import_editor_props5.queryPropTypeUtil.key, import_editor_props5.queryPropTypeUtil.schema);
|
|
2311
|
+
var controlTypes = {
|
|
2312
|
+
image: { component: import_editor_controls.ImageControl, layout: "custom", propTypeUtil: import_editor_props5.imagePropTypeUtil },
|
|
2313
|
+
"svg-media": { component: import_editor_controls.SvgMediaControl, layout: "full", propTypeUtil: import_editor_props5.svgSrcPropTypeUtil },
|
|
2314
|
+
text: { component: import_editor_controls.TextControl, layout: "full", propTypeUtil: import_editor_props5.stringPropTypeUtil },
|
|
2315
|
+
textarea: { component: import_editor_controls.TextAreaControl, layout: "full", propTypeUtil: import_editor_props5.stringPropTypeUtil },
|
|
2316
|
+
size: { component: import_editor_controls.SizeControl, layout: "two-columns", propTypeUtil: import_editor_props5.sizePropTypeUtil },
|
|
2317
|
+
select: { component: import_editor_controls.SelectControlWrapper, layout: "two-columns", propTypeUtil: import_editor_props5.stringPropTypeUtil },
|
|
2318
|
+
chips: { component: import_editor_controls.ChipsControl, layout: "full", propTypeUtil: import_editor_props5.stringArrayPropTypeUtil },
|
|
2319
|
+
link: { component: import_editor_controls.LinkControl, layout: "custom", propTypeUtil: import_editor_props5.linkPropTypeUtil },
|
|
2320
|
+
query: { component: import_editor_controls.QueryControl, layout: "full", propTypeUtil: import_editor_props5.queryPropTypeUtil },
|
|
2321
|
+
"query-chips": { component: import_editor_controls.QueryChipsControl, layout: "full", propTypeUtil: queryArrayPropTypeUtil },
|
|
2322
|
+
"query-filter-repeater": {
|
|
2323
|
+
component: import_editor_controls.QueryFilterRepeaterControl,
|
|
2324
|
+
layout: "full",
|
|
2325
|
+
propTypeUtil: import_editor_props5.queryFilterArrayPropTypeUtil
|
|
2326
|
+
},
|
|
2327
|
+
url: { component: import_editor_controls.UrlControl, layout: "full", propTypeUtil: import_editor_props5.stringPropTypeUtil },
|
|
2328
|
+
switch: { component: import_editor_controls.SwitchControl, layout: "two-columns", propTypeUtil: import_editor_props5.booleanPropTypeUtil },
|
|
2329
|
+
number: { component: import_editor_controls.NumberControl, layout: "two-columns", propTypeUtil: import_editor_props5.numberPropTypeUtil },
|
|
2330
|
+
repeatable: { component: import_editor_controls.RepeatableControl, layout: "full", propTypeUtil: void 0 },
|
|
2331
|
+
"key-value": { component: import_editor_controls.KeyValueControl, layout: "full", propTypeUtil: import_editor_props5.keyValuePropTypeUtil },
|
|
2332
|
+
"html-tag": { component: import_editor_controls.HtmlTagControl, layout: "two-columns", propTypeUtil: import_editor_props5.stringPropTypeUtil },
|
|
2333
|
+
toggle: { component: import_editor_controls.ToggleControl, layout: "full", propTypeUtil: import_editor_props5.stringPropTypeUtil },
|
|
2334
|
+
"date-time": { component: import_editor_controls.DateTimeControl, layout: "full", propTypeUtil: import_editor_props5.DateTimePropTypeUtil },
|
|
2335
|
+
video: { component: import_editor_controls.VideoMediaControl, layout: "full", propTypeUtil: import_editor_props5.videoSrcPropTypeUtil },
|
|
2336
|
+
"inline-editing": { component: import_editor_controls.InlineEditingControl, layout: "full", propTypeUtil: import_editor_props5.htmlV3PropTypeUtil },
|
|
2337
|
+
email: { component: import_editor_controls.EmailFormActionControl, layout: "custom", propTypeUtil: import_editor_props5.emailsPropTypeUtil },
|
|
2338
|
+
"date-range": {
|
|
2339
|
+
component: import_editor_controls.DateRangeControl,
|
|
2340
|
+
layout: "custom",
|
|
2341
|
+
propTypeUtil: import_editor_props5.dateRangePropTypeUtil
|
|
2342
|
+
},
|
|
2343
|
+
"time-range": {
|
|
2344
|
+
component: import_editor_controls.TimeRangeControl,
|
|
2345
|
+
layout: "custom",
|
|
2346
|
+
propTypeUtil: import_editor_props5.timeRangePropTypeUtil
|
|
2347
|
+
},
|
|
2348
|
+
"attachment-type": { component: import_editor_controls.AttachmentTypeControl, layout: "custom", propTypeUtil: import_editor_props5.stringPropTypeUtil }
|
|
2349
|
+
};
|
|
2350
|
+
var ControlsRegistry = class {
|
|
2351
|
+
constructor(controlsRegistry2) {
|
|
2352
|
+
this.controlsRegistry = controlsRegistry2;
|
|
2353
|
+
this.controlsRegistry = controlsRegistry2;
|
|
2354
|
+
}
|
|
2355
|
+
get(type) {
|
|
2356
|
+
return this.controlsRegistry[type]?.component;
|
|
2357
|
+
}
|
|
2358
|
+
getLayout(type) {
|
|
2359
|
+
return this.controlsRegistry[type]?.layout;
|
|
2360
|
+
}
|
|
2361
|
+
getPropTypeUtil(type) {
|
|
2362
|
+
return this.controlsRegistry[type]?.propTypeUtil;
|
|
2363
|
+
}
|
|
2364
|
+
registry() {
|
|
2365
|
+
return this.controlsRegistry;
|
|
2366
|
+
}
|
|
2367
|
+
register(type, component, layout, propTypeUtil) {
|
|
2368
|
+
if (this.controlsRegistry[type]) {
|
|
2369
|
+
throw new ControlTypeAlreadyRegisteredError({ context: { controlType: type } });
|
|
2370
|
+
}
|
|
2371
|
+
this.controlsRegistry[type] = { component, layout, propTypeUtil };
|
|
2372
|
+
}
|
|
2373
|
+
unregister(type) {
|
|
2374
|
+
if (!this.controlsRegistry[type]) {
|
|
2375
|
+
throw new ControlTypeNotRegisteredError({ context: { controlType: type } });
|
|
2376
|
+
}
|
|
2377
|
+
delete this.controlsRegistry[type];
|
|
2378
|
+
}
|
|
2379
|
+
};
|
|
2380
|
+
var controlsRegistry = new ControlsRegistry(controlTypes);
|
|
2381
|
+
|
|
2382
|
+
// src/controls-registry/control.tsx
|
|
2383
|
+
var Control = ({ props, type }) => {
|
|
2384
|
+
const ControlByType = controlsRegistry.get(type);
|
|
2385
|
+
const { element } = useElement();
|
|
2386
|
+
if (!ControlByType) {
|
|
2387
|
+
throw new ControlTypeNotFoundError({
|
|
2388
|
+
context: { controlType: type }
|
|
2389
|
+
});
|
|
2390
|
+
}
|
|
2391
|
+
return /* @__PURE__ */ React18.createElement(ControlByType, { ...props, context: { elementId: element.id } });
|
|
2392
|
+
};
|
|
2393
|
+
|
|
2394
|
+
// src/controls-registry/control-type-container.tsx
|
|
2395
|
+
var React19 = __toESM(require("react"));
|
|
2396
|
+
var import_ui12 = require("@elementor/ui");
|
|
2397
|
+
var ControlTypeContainer = ({ children, layout }) => {
|
|
2398
|
+
if (layout === "custom") {
|
|
2399
|
+
return children;
|
|
2400
|
+
}
|
|
2401
|
+
return /* @__PURE__ */ React19.createElement(StyledContainer, { layout }, children);
|
|
2402
|
+
};
|
|
2403
|
+
var StyledContainer = (0, import_ui12.styled)(import_ui12.Box, {
|
|
2404
|
+
shouldForwardProp: (prop) => !["layout"].includes(prop)
|
|
2405
|
+
})(({ layout, theme }) => ({
|
|
2406
|
+
display: "grid",
|
|
2407
|
+
gridGap: theme.spacing(1),
|
|
2408
|
+
...getGridLayout(layout)
|
|
2409
|
+
}));
|
|
2410
|
+
var getGridLayout = (layout) => ({
|
|
2411
|
+
justifyContent: "space-between",
|
|
2412
|
+
...getStyleByLayout(layout)
|
|
2413
|
+
});
|
|
2414
|
+
var getStyleByLayout = (layout) => {
|
|
2415
|
+
if (layout === "full") {
|
|
2416
|
+
return {
|
|
2417
|
+
gridTemplateColumns: "minmax(0, 1fr)"
|
|
2418
|
+
};
|
|
2419
|
+
}
|
|
2420
|
+
if (layout === "two-columns") {
|
|
2421
|
+
return {
|
|
2422
|
+
alignItems: "center",
|
|
2423
|
+
gridTemplateColumns: "repeat(2, minmax(0, 1fr))"
|
|
2424
|
+
};
|
|
2425
|
+
}
|
|
2426
|
+
};
|
|
2427
|
+
|
|
2428
|
+
// src/controls-registry/settings-field.tsx
|
|
2429
|
+
var React20 = __toESM(require("react"));
|
|
2430
|
+
var import_react19 = require("react");
|
|
2431
|
+
var import_editor_controls2 = require("@elementor/editor-controls");
|
|
2432
|
+
var import_editor_documents2 = require("@elementor/editor-documents");
|
|
2433
|
+
var import_editor_elements6 = require("@elementor/editor-elements");
|
|
2434
|
+
var import_editor_v1_adapters5 = require("@elementor/editor-v1-adapters");
|
|
2435
|
+
var import_i18n8 = require("@wordpress/i18n");
|
|
2436
|
+
|
|
2381
2437
|
// src/controls-registry/create-top-level-object-type.ts
|
|
2382
2438
|
var createTopLevelObjectType = ({ schema }) => {
|
|
2383
2439
|
const schemaPropType = {
|
|
@@ -2427,7 +2483,7 @@ function useUndoableUpdateElementProp({
|
|
|
2427
2483
|
propDisplayName
|
|
2428
2484
|
}) {
|
|
2429
2485
|
return (0, import_react19.useMemo)(() => {
|
|
2430
|
-
return (0,
|
|
2486
|
+
return (0, import_editor_v1_adapters5.undoable)(
|
|
2431
2487
|
{
|
|
2432
2488
|
do: (newSettings) => {
|
|
2433
2489
|
const prevPropValue = (0, import_editor_elements6.getElementSettings)(elementId, Object.keys(newSettings));
|
|
@@ -2521,8 +2577,9 @@ function populateChildControlProps(props) {
|
|
|
2521
2577
|
|
|
2522
2578
|
// src/components/settings-tab.tsx
|
|
2523
2579
|
var SettingsTab = () => {
|
|
2524
|
-
const { elementType, element } = useElement();
|
|
2580
|
+
const { elementType, element, settings } = useElement();
|
|
2525
2581
|
const settingsDefault = useDefaultPanelSettings();
|
|
2582
|
+
const currentSettings = settings;
|
|
2526
2583
|
const isDefaultExpanded = (sectionId) => settingsDefault.defaultSectionsExpanded.settings?.includes(sectionId);
|
|
2527
2584
|
return /* @__PURE__ */ React23.createElement(import_session6.SessionStorageProvider, { prefix: element.id }, /* @__PURE__ */ React23.createElement(SectionsList, null, elementType.controls.map((control, index) => {
|
|
2528
2585
|
if (isControl(control)) {
|
|
@@ -2530,6 +2587,15 @@ var SettingsTab = () => {
|
|
|
2530
2587
|
}
|
|
2531
2588
|
const { type, value } = control;
|
|
2532
2589
|
if (type === "section") {
|
|
2590
|
+
const sectionItems = renderSectionItems({
|
|
2591
|
+
items: value.items,
|
|
2592
|
+
element,
|
|
2593
|
+
propsSchema: elementType.propsSchema,
|
|
2594
|
+
settings: currentSettings
|
|
2595
|
+
});
|
|
2596
|
+
if (!sectionItems.length) {
|
|
2597
|
+
return null;
|
|
2598
|
+
}
|
|
2533
2599
|
return /* @__PURE__ */ React23.createElement(
|
|
2534
2600
|
Section,
|
|
2535
2601
|
{
|
|
@@ -2537,12 +2603,7 @@ var SettingsTab = () => {
|
|
|
2537
2603
|
key: type + "." + index,
|
|
2538
2604
|
defaultExpanded: isDefaultExpanded(value.label)
|
|
2539
2605
|
},
|
|
2540
|
-
|
|
2541
|
-
if (isControl(item)) {
|
|
2542
|
-
return /* @__PURE__ */ React23.createElement(SettingsControl, { key: getKey(item, element), control: item });
|
|
2543
|
-
}
|
|
2544
|
-
return null;
|
|
2545
|
-
})
|
|
2606
|
+
sectionItems
|
|
2546
2607
|
);
|
|
2547
2608
|
}
|
|
2548
2609
|
return null;
|
|
@@ -2557,6 +2618,26 @@ function getKey(control, element) {
|
|
|
2557
2618
|
function isControl(control) {
|
|
2558
2619
|
return control.type === "control" || control.type === "element-control";
|
|
2559
2620
|
}
|
|
2621
|
+
function renderSectionItems({
|
|
2622
|
+
items: items3,
|
|
2623
|
+
element,
|
|
2624
|
+
propsSchema,
|
|
2625
|
+
settings
|
|
2626
|
+
}) {
|
|
2627
|
+
return items3?.flatMap((item) => {
|
|
2628
|
+
if (!isControl(item)) {
|
|
2629
|
+
return [];
|
|
2630
|
+
}
|
|
2631
|
+
if (item.type === "control" && isControlHiddenByDependencies(item, propsSchema, settings)) {
|
|
2632
|
+
return [];
|
|
2633
|
+
}
|
|
2634
|
+
return [/* @__PURE__ */ React23.createElement(SettingsControl, { key: getKey(item, element), control: item })];
|
|
2635
|
+
}) ?? [];
|
|
2636
|
+
}
|
|
2637
|
+
function isControlHiddenByDependencies(control, propsSchema, settings) {
|
|
2638
|
+
const { isHidden } = extractDependencyEffect(control.value.bind, propsSchema, settings);
|
|
2639
|
+
return isHidden;
|
|
2640
|
+
}
|
|
2560
2641
|
|
|
2561
2642
|
// src/components/style-tab.tsx
|
|
2562
2643
|
var React85 = __toESM(require("react"));
|
|
@@ -3123,11 +3204,11 @@ var import_ui19 = require("@elementor/ui");
|
|
|
3123
3204
|
var import_i18n11 = require("@wordpress/i18n");
|
|
3124
3205
|
|
|
3125
3206
|
// src/hooks/use-direction.ts
|
|
3126
|
-
var
|
|
3207
|
+
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
3127
3208
|
var import_ui17 = require("@elementor/ui");
|
|
3128
3209
|
function useDirection() {
|
|
3129
3210
|
const theme = (0, import_ui17.useTheme)();
|
|
3130
|
-
const isUiRtl = "rtl" === theme.direction, isSiteRtl = !!(0,
|
|
3211
|
+
const isUiRtl = "rtl" === theme.direction, isSiteRtl = !!(0, import_editor_v1_adapters6.getElementorFrontendConfig)()?.is_rtl;
|
|
3131
3212
|
return { isSiteRtl, isUiRtl };
|
|
3132
3213
|
}
|
|
3133
3214
|
|
|
@@ -3373,18 +3454,18 @@ var EffectsSection = () => {
|
|
|
3373
3454
|
var React55 = __toESM(require("react"));
|
|
3374
3455
|
var import_editor_controls30 = require("@elementor/editor-controls");
|
|
3375
3456
|
var import_editor_elements11 = require("@elementor/editor-elements");
|
|
3376
|
-
var
|
|
3457
|
+
var import_editor_v1_adapters9 = require("@elementor/editor-v1-adapters");
|
|
3377
3458
|
var import_i18n33 = require("@wordpress/i18n");
|
|
3378
3459
|
|
|
3379
3460
|
// src/hooks/use-computed-style.ts
|
|
3380
|
-
var
|
|
3461
|
+
var import_editor_v1_adapters7 = require("@elementor/editor-v1-adapters");
|
|
3381
3462
|
function useComputedStyle(elementId) {
|
|
3382
|
-
return (0,
|
|
3463
|
+
return (0, import_editor_v1_adapters7.__privateUseListenTo)(
|
|
3383
3464
|
[
|
|
3384
|
-
(0,
|
|
3385
|
-
(0,
|
|
3386
|
-
(0,
|
|
3387
|
-
(0,
|
|
3465
|
+
(0, import_editor_v1_adapters7.windowEvent)("elementor/device-mode/change"),
|
|
3466
|
+
(0, import_editor_v1_adapters7.commandEndEvent)("document/elements/reset-style"),
|
|
3467
|
+
(0, import_editor_v1_adapters7.commandEndEvent)("document/elements/settings"),
|
|
3468
|
+
(0, import_editor_v1_adapters7.commandEndEvent)("document/elements/paste-style")
|
|
3388
3469
|
],
|
|
3389
3470
|
() => {
|
|
3390
3471
|
if (!elementId) {
|
|
@@ -3674,7 +3755,7 @@ var getOptions2 = (parentStyleDirection) => {
|
|
|
3674
3755
|
var React44 = __toESM(require("react"));
|
|
3675
3756
|
var import_react24 = require("react");
|
|
3676
3757
|
var import_editor_controls19 = require("@elementor/editor-controls");
|
|
3677
|
-
var
|
|
3758
|
+
var import_editor_v1_adapters8 = require("@elementor/editor-v1-adapters");
|
|
3678
3759
|
var import_i18n22 = require("@wordpress/i18n");
|
|
3679
3760
|
var DISPLAY_LABEL = (0, import_i18n22.__)("Display", "elementor");
|
|
3680
3761
|
var displayFieldItems = [
|
|
@@ -3717,7 +3798,7 @@ var displayFieldItems = [
|
|
|
3717
3798
|
];
|
|
3718
3799
|
var DisplayField = () => {
|
|
3719
3800
|
const placeholder = useDisplayPlaceholderValue();
|
|
3720
|
-
const isGridActive = (0,
|
|
3801
|
+
const isGridActive = (0, import_editor_v1_adapters8.isExperimentActive)("e_css_grid");
|
|
3721
3802
|
const items3 = (0, import_react24.useMemo)(
|
|
3722
3803
|
() => isGridActive ? displayFieldItems : displayFieldItems.filter((item) => item.value !== "grid"),
|
|
3723
3804
|
[isGridActive]
|
|
@@ -4347,7 +4428,7 @@ var LayoutSection = () => {
|
|
|
4347
4428
|
history: { propDisplayName: DISPLAY_LABEL2 }
|
|
4348
4429
|
});
|
|
4349
4430
|
const displayPlaceholder = useDisplayPlaceholderValue();
|
|
4350
|
-
const isGridExperimentActive = (0,
|
|
4431
|
+
const isGridExperimentActive = (0, import_editor_v1_adapters9.isExperimentActive)("e_css_grid");
|
|
4351
4432
|
const isDisplayFlex = shouldDisplayFlexFields(display, displayPlaceholder);
|
|
4352
4433
|
const isDisplayGrid = "grid" === (display?.value ?? displayPlaceholder?.value);
|
|
4353
4434
|
const { element } = useElement();
|
|
@@ -5339,7 +5420,7 @@ var PanelTabContent = () => {
|
|
|
5339
5420
|
const { element } = useElement();
|
|
5340
5421
|
const editorDefaults = useDefaultPanelSettings();
|
|
5341
5422
|
const defaultComponentTab = editorDefaults.defaultTab;
|
|
5342
|
-
const isInteractionsActive = (0,
|
|
5423
|
+
const isInteractionsActive = (0, import_editor_v1_adapters10.isExperimentActive)("e_interactions");
|
|
5343
5424
|
const isPromotedElement = !!(0, import_editor_elements12.getWidgetsCache)()?.[element.type]?.meta?.is_pro_promotion;
|
|
5344
5425
|
const [storedTab, setCurrentTab] = useStateByElement("tab", defaultComponentTab);
|
|
5345
5426
|
const currentTab = isPromotedElement && storedTab === "settings" ? "style" : storedTab;
|
|
@@ -5384,11 +5465,11 @@ var EditingPanel = () => {
|
|
|
5384
5465
|
// src/init.ts
|
|
5385
5466
|
var import_editor = require("@elementor/editor");
|
|
5386
5467
|
var import_editor_panels3 = require("@elementor/editor-panels");
|
|
5387
|
-
var
|
|
5468
|
+
var import_editor_v1_adapters14 = require("@elementor/editor-v1-adapters");
|
|
5388
5469
|
|
|
5389
5470
|
// src/hooks/use-open-editor-panel.ts
|
|
5390
5471
|
var import_react39 = require("react");
|
|
5391
|
-
var
|
|
5472
|
+
var import_editor_v1_adapters11 = require("@elementor/editor-v1-adapters");
|
|
5392
5473
|
|
|
5393
5474
|
// src/panel.ts
|
|
5394
5475
|
var import_editor_panels2 = require("@elementor/editor-panels");
|
|
@@ -5412,7 +5493,7 @@ var isAtomicWidgetSelected = () => {
|
|
|
5412
5493
|
var useOpenEditorPanel = () => {
|
|
5413
5494
|
const { open } = usePanelActions();
|
|
5414
5495
|
(0, import_react39.useEffect)(() => {
|
|
5415
|
-
return (0,
|
|
5496
|
+
return (0, import_editor_v1_adapters11.__privateListenTo)((0, import_editor_v1_adapters11.commandStartEvent)("panel/editor/open"), () => {
|
|
5416
5497
|
if (isAtomicWidgetSelected()) {
|
|
5417
5498
|
open();
|
|
5418
5499
|
}
|
|
@@ -5861,7 +5942,7 @@ var import_react42 = require("react");
|
|
|
5861
5942
|
var import_editor_controls59 = require("@elementor/editor-controls");
|
|
5862
5943
|
|
|
5863
5944
|
// src/dynamics/sync/get-atomic-dynamic-tags.ts
|
|
5864
|
-
var
|
|
5945
|
+
var import_editor_v1_adapters12 = require("@elementor/editor-v1-adapters");
|
|
5865
5946
|
|
|
5866
5947
|
// src/hooks/use-license-config.ts
|
|
5867
5948
|
var import_react41 = require("react");
|
|
@@ -5884,7 +5965,7 @@ function useLicenseConfig() {
|
|
|
5884
5965
|
|
|
5885
5966
|
// src/dynamics/sync/get-atomic-dynamic-tags.ts
|
|
5886
5967
|
var getAtomicDynamicTags = (shouldFilterByLicense = true) => {
|
|
5887
|
-
const { atomicDynamicTags } = (0,
|
|
5968
|
+
const { atomicDynamicTags } = (0, import_editor_v1_adapters12.getElementorConfig)();
|
|
5888
5969
|
if (!atomicDynamicTags) {
|
|
5889
5970
|
return null;
|
|
5890
5971
|
}
|
|
@@ -5907,7 +5988,7 @@ var filterByLicense = (tags) => {
|
|
|
5907
5988
|
|
|
5908
5989
|
// src/dynamics/utils.ts
|
|
5909
5990
|
var import_editor_props18 = require("@elementor/editor-props");
|
|
5910
|
-
var
|
|
5991
|
+
var import_editor_v1_adapters13 = require("@elementor/editor-v1-adapters");
|
|
5911
5992
|
var import_schema = require("@elementor/schema");
|
|
5912
5993
|
var DYNAMIC_PROP_TYPE_KEY = "dynamic";
|
|
5913
5994
|
var dynamicPropTypeUtil = (0, import_editor_props18.createPropUtils)(
|
|
@@ -5919,7 +6000,7 @@ var dynamicPropTypeUtil = (0, import_editor_props18.createPropUtils)(
|
|
|
5919
6000
|
})
|
|
5920
6001
|
);
|
|
5921
6002
|
var isDynamicTagSupported = (tagName) => {
|
|
5922
|
-
return !!(0,
|
|
6003
|
+
return !!(0, import_editor_v1_adapters13.getElementorConfig)()?.atomicDynamicTags?.tags?.[tagName];
|
|
5923
6004
|
};
|
|
5924
6005
|
var isDynamicPropType = (prop) => prop.key === DYNAMIC_PROP_TYPE_KEY;
|
|
5925
6006
|
var getDynamicPropType = (propType) => {
|
|
@@ -7246,7 +7327,7 @@ function init4() {
|
|
|
7246
7327
|
init();
|
|
7247
7328
|
}
|
|
7248
7329
|
var blockV1Panel = () => {
|
|
7249
|
-
(0,
|
|
7330
|
+
(0, import_editor_v1_adapters14.blockCommand)({
|
|
7250
7331
|
command: "panel/editor/open",
|
|
7251
7332
|
condition: isAtomicWidgetSelected
|
|
7252
7333
|
});
|