@elementor/editor-editing-panel 4.2.0-847 → 4.2.0-849
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 +137 -73
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +116 -52
- package/dist/index.mjs.map +1 -1
- package/package.json +24 -24
- package/src/apply-unapply-actions.ts +17 -1
- package/src/components/style-sections/layout-section/grid-size-field.tsx +88 -23
package/dist/index.js
CHANGED
|
@@ -227,7 +227,7 @@ var onConvert = (opts) => {
|
|
|
227
227
|
// src/components/css-classes/css-class-selector.tsx
|
|
228
228
|
var React11 = __toESM(require("react"));
|
|
229
229
|
var import_react10 = require("react");
|
|
230
|
-
var
|
|
230
|
+
var import_editor_styles_repository10 = require("@elementor/editor-styles-repository");
|
|
231
231
|
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
232
232
|
var import_icons2 = require("@elementor/icons");
|
|
233
233
|
var import_locations2 = require("@elementor/locations");
|
|
@@ -611,7 +611,7 @@ var StyledGroupItems = (0, import_ui2.styled)("ul")`
|
|
|
611
611
|
var React10 = __toESM(require("react"));
|
|
612
612
|
var import_react9 = require("react");
|
|
613
613
|
var import_editor_styles = require("@elementor/editor-styles");
|
|
614
|
-
var
|
|
614
|
+
var import_editor_styles_repository9 = require("@elementor/editor-styles-repository");
|
|
615
615
|
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
616
616
|
var import_icons = require("@elementor/icons");
|
|
617
617
|
var import_session3 = require("@elementor/session");
|
|
@@ -635,7 +635,7 @@ function CssClassProvider({ children, ...contextValue }) {
|
|
|
635
635
|
|
|
636
636
|
// src/components/css-classes/css-class-menu.tsx
|
|
637
637
|
var React9 = __toESM(require("react"));
|
|
638
|
-
var
|
|
638
|
+
var import_editor_styles_repository8 = require("@elementor/editor-styles-repository");
|
|
639
639
|
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
640
640
|
var import_ui5 = require("@elementor/ui");
|
|
641
641
|
var import_i18n4 = require("@wordpress/i18n");
|
|
@@ -659,7 +659,7 @@ var StyleIndicator = (0, import_ui3.styled)("div", {
|
|
|
659
659
|
|
|
660
660
|
// src/components/css-classes/duplicate-class-menu-item.tsx
|
|
661
661
|
var React7 = __toESM(require("react"));
|
|
662
|
-
var
|
|
662
|
+
var import_editor_styles_repository6 = require("@elementor/editor-styles-repository");
|
|
663
663
|
var import_editor_ui = require("@elementor/editor-ui");
|
|
664
664
|
var import_session2 = require("@elementor/session");
|
|
665
665
|
var import_i18n2 = require("@wordpress/i18n");
|
|
@@ -667,7 +667,7 @@ var import_i18n2 = require("@wordpress/i18n");
|
|
|
667
667
|
// src/components/css-classes/use-apply-and-unapply-class.ts
|
|
668
668
|
var import_react8 = require("react");
|
|
669
669
|
var import_editor_elements3 = require("@elementor/editor-elements");
|
|
670
|
-
var
|
|
670
|
+
var import_editor_styles_repository5 = require("@elementor/editor-styles-repository");
|
|
671
671
|
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
672
672
|
var import_i18n = require("@wordpress/i18n");
|
|
673
673
|
|
|
@@ -675,6 +675,7 @@ var import_i18n = require("@wordpress/i18n");
|
|
|
675
675
|
var import_editor_documents = require("@elementor/editor-documents");
|
|
676
676
|
var import_editor_elements2 = require("@elementor/editor-elements");
|
|
677
677
|
var import_editor_props2 = require("@elementor/editor-props");
|
|
678
|
+
var import_editor_styles_repository4 = require("@elementor/editor-styles-repository");
|
|
678
679
|
function doGetAppliedClasses(elementId, classesPropType = "classes") {
|
|
679
680
|
return (0, import_editor_elements2.getElementSetting)(elementId, classesPropType)?.value || [];
|
|
680
681
|
}
|
|
@@ -685,6 +686,17 @@ function doApplyClasses(elementId, classIds, classesPropType = "classes") {
|
|
|
685
686
|
withHistory: false
|
|
686
687
|
});
|
|
687
688
|
(0, import_editor_documents.setDocumentModifiedStatus)(true);
|
|
689
|
+
ensureClassesAreLoaded(classIds);
|
|
690
|
+
}
|
|
691
|
+
function ensureClassesAreLoaded(classIds) {
|
|
692
|
+
const providers = import_editor_styles_repository4.stylesRepository.getProviders();
|
|
693
|
+
classIds.forEach((classId) => {
|
|
694
|
+
import_editor_styles_repository4.stylesRepository.getProviderByKey(classId)?.actions.get(classId);
|
|
695
|
+
const owningProvider = providers.find(
|
|
696
|
+
(provider) => provider.actions.all().some((style) => style.id === classId)
|
|
697
|
+
);
|
|
698
|
+
owningProvider?.actions.get(classId);
|
|
699
|
+
});
|
|
688
700
|
}
|
|
689
701
|
function doUnapplyClass(elementId, classId, classesPropType = "classes") {
|
|
690
702
|
const appliedClasses = (0, import_editor_elements2.getElementSetting)(elementId, classesPropType)?.value || [];
|
|
@@ -753,7 +765,7 @@ function useUnapplyClass() {
|
|
|
753
765
|
}
|
|
754
766
|
function useCreateAndApplyClass() {
|
|
755
767
|
const { id: activeId, setId: setActiveId } = useStyle();
|
|
756
|
-
const [provider, createAction] = (0,
|
|
768
|
+
const [provider, createAction] = (0, import_editor_styles_repository5.useGetStylesRepositoryCreateAction)() ?? [null, null];
|
|
757
769
|
const deleteAction = provider?.actions.delete;
|
|
758
770
|
const applyClass = useApply();
|
|
759
771
|
const unapplyClass = useUnapply();
|
|
@@ -859,13 +871,13 @@ function getUniqueDuplicateLabel(originalLabel, existingLabels) {
|
|
|
859
871
|
}
|
|
860
872
|
function DuplicateClassMenuItem({ closeMenu }) {
|
|
861
873
|
const { id: classId, provider } = useCssClass();
|
|
862
|
-
const { userCan } = (0,
|
|
874
|
+
const { userCan } = (0, import_editor_styles_repository6.useUserStylesCapability)();
|
|
863
875
|
const applyClass = useApplyClass();
|
|
864
876
|
const [, setPendingEditId] = (0, import_session2.useSessionStorage)(PENDING_CLASS_RENAME_SESSION_KEY, "app");
|
|
865
877
|
if (!provider || !classId) {
|
|
866
878
|
return null;
|
|
867
879
|
}
|
|
868
|
-
const providerInstance =
|
|
880
|
+
const providerInstance = import_editor_styles_repository6.stylesRepository.getProviderByKey(provider);
|
|
869
881
|
const createAction = providerInstance?.actions.create;
|
|
870
882
|
const getAction = providerInstance?.actions.get;
|
|
871
883
|
if (!createAction || !getAction) {
|
|
@@ -903,12 +915,12 @@ var import_ui4 = require("@elementor/ui");
|
|
|
903
915
|
var import_i18n3 = require("@wordpress/i18n");
|
|
904
916
|
|
|
905
917
|
// src/components/css-classes/use-can-convert-local-class-to-global.ts
|
|
906
|
-
var
|
|
918
|
+
var import_editor_styles_repository7 = require("@elementor/editor-styles-repository");
|
|
907
919
|
var useCanConvertLocalClassToGlobal = () => {
|
|
908
920
|
const { element } = useElement();
|
|
909
921
|
const { provider, id, meta } = useStyle();
|
|
910
922
|
const styleDef = provider?.actions.get(id, { elementId: element.id, ...meta });
|
|
911
|
-
const isLocalStylesProvider = provider && (0,
|
|
923
|
+
const isLocalStylesProvider = provider && (0, import_editor_styles_repository7.isElementsStylesProvider)(provider?.getKey());
|
|
912
924
|
const variants = styleDef?.variants || [];
|
|
913
925
|
const canConvert = !!(isLocalStylesProvider && variants.length);
|
|
914
926
|
return {
|
|
@@ -944,7 +956,7 @@ function usePseudoStates() {
|
|
|
944
956
|
}
|
|
945
957
|
function CssClassMenu({ popupState, anchorEl, fixed }) {
|
|
946
958
|
const { provider } = useCssClass();
|
|
947
|
-
const isLocalStyle2 = provider ? (0,
|
|
959
|
+
const isLocalStyle2 = provider ? (0, import_editor_styles_repository8.isElementsStylesProvider)(provider) : true;
|
|
948
960
|
const pseudoStates = usePseudoStates();
|
|
949
961
|
const handleKeyDown = (e) => {
|
|
950
962
|
e.stopPropagation();
|
|
@@ -1021,7 +1033,7 @@ function useElementStates() {
|
|
|
1021
1033
|
}
|
|
1022
1034
|
function useModifiedStates(styleId) {
|
|
1023
1035
|
const { meta } = useStyle();
|
|
1024
|
-
const styleDef =
|
|
1036
|
+
const styleDef = import_editor_styles_repository8.stylesRepository.all().find((style) => style.id === styleId);
|
|
1025
1037
|
return Object.fromEntries(
|
|
1026
1038
|
styleDef?.variants.filter((variant) => meta.breakpoint === variant.meta.breakpoint).map((variant) => [variant.meta.state ?? "normal", true]) ?? []
|
|
1027
1039
|
);
|
|
@@ -1034,7 +1046,7 @@ function getMenuItemsByProvider({
|
|
|
1034
1046
|
if (!provider) {
|
|
1035
1047
|
return [];
|
|
1036
1048
|
}
|
|
1037
|
-
const providerInstance =
|
|
1049
|
+
const providerInstance = import_editor_styles_repository8.stylesRepository.getProviderByKey(provider);
|
|
1038
1050
|
const providerActions = providerInstance?.actions;
|
|
1039
1051
|
const canUpdate = providerActions?.update;
|
|
1040
1052
|
const canDuplicate = providerActions?.create && providerActions?.get;
|
|
@@ -1063,7 +1075,7 @@ function StateMenuItem({ state, label, closeMenu, ...props }) {
|
|
|
1063
1075
|
const { id: styleId, provider } = useCssClass();
|
|
1064
1076
|
const { id: activeId, setId: setActiveId, setMetaState: setActiveMetaState, meta } = useStyle();
|
|
1065
1077
|
const { state: activeState } = meta;
|
|
1066
|
-
const { userCan } = (0,
|
|
1078
|
+
const { userCan } = (0, import_editor_styles_repository8.useUserStylesCapability)();
|
|
1067
1079
|
const modifiedStates = useModifiedStates(styleId);
|
|
1068
1080
|
const isUpdateAllowed = !state || userCan(provider ?? "").updateProps;
|
|
1069
1081
|
const isStyled = modifiedStates[state ?? "normal"] ?? false;
|
|
@@ -1128,7 +1140,7 @@ function UnapplyClassMenuItem({ closeMenu, ...props }) {
|
|
|
1128
1140
|
}
|
|
1129
1141
|
function RenameClassMenuItem({ closeMenu }) {
|
|
1130
1142
|
const { handleRename, provider } = useCssClass();
|
|
1131
|
-
const { userCan } = (0,
|
|
1143
|
+
const { userCan } = (0, import_editor_styles_repository8.useUserStylesCapability)();
|
|
1132
1144
|
if (!provider) {
|
|
1133
1145
|
return null;
|
|
1134
1146
|
}
|
|
@@ -1166,7 +1178,7 @@ function CssClassItem(props) {
|
|
|
1166
1178
|
const popupState = (0, import_ui6.usePopupState)({ variant: "popover" });
|
|
1167
1179
|
const [chipRef, setChipRef] = (0, import_react9.useState)(null);
|
|
1168
1180
|
const { onDelete, ...chipGroupProps } = chipProps;
|
|
1169
|
-
const { userCan } = (0,
|
|
1181
|
+
const { userCan } = (0, import_editor_styles_repository9.useUserStylesCapability)();
|
|
1170
1182
|
const [convertedFromLocalId, , clearConvertedFromLocalId] = (0, import_session3.useSessionStorage)(
|
|
1171
1183
|
PENDING_CLASS_RENAME_SESSION_KEY,
|
|
1172
1184
|
"app"
|
|
@@ -1184,7 +1196,7 @@ function CssClassItem(props) {
|
|
|
1184
1196
|
onError: setError
|
|
1185
1197
|
});
|
|
1186
1198
|
const color = error ? "error" : colorProp;
|
|
1187
|
-
const providerActions = provider ?
|
|
1199
|
+
const providerActions = provider ? import_editor_styles_repository9.stylesRepository.getProviderByKey(provider)?.actions : null;
|
|
1188
1200
|
const allowRename = Boolean(providerActions?.update) && userCan(provider ?? "")?.update;
|
|
1189
1201
|
const isShowingState = isActive && meta.state;
|
|
1190
1202
|
const stateLabel = (0, import_react9.useMemo)(() => {
|
|
@@ -1263,7 +1275,7 @@ function CssClassItem(props) {
|
|
|
1263
1275
|
), /* @__PURE__ */ React10.createElement(CssClassProvider, { ...classProps, handleRename: openEditMode }, /* @__PURE__ */ React10.createElement(CssClassMenu, { popupState, anchorEl: chipRef, fixed })));
|
|
1264
1276
|
}
|
|
1265
1277
|
var validateLabel = (newLabel) => {
|
|
1266
|
-
const result = (0,
|
|
1278
|
+
const result = (0, import_editor_styles_repository9.validateStyleLabel)(newLabel, "rename");
|
|
1267
1279
|
if (result.isValid) {
|
|
1268
1280
|
return null;
|
|
1269
1281
|
}
|
|
@@ -1292,7 +1304,7 @@ function CssClassSelector() {
|
|
|
1292
1304
|
const appliedOptions = useAppliedOptions(options13);
|
|
1293
1305
|
const active = appliedOptions.find((option) => option.value === activeId) ?? EMPTY_OPTION;
|
|
1294
1306
|
const showPlaceholder = appliedOptions.every(({ fixed }) => fixed);
|
|
1295
|
-
const { userCan } = (0,
|
|
1307
|
+
const { userCan } = (0, import_editor_styles_repository10.useUserStylesCapability)();
|
|
1296
1308
|
const canEdit = active.provider ? userCan(active.provider).updateProps : true;
|
|
1297
1309
|
return /* @__PURE__ */ React11.createElement(import_ui7.Stack, { p: 2 }, /* @__PURE__ */ React11.createElement(import_ui7.Stack, { direction: "row", gap: 1, alignItems: "center", justifyContent: "space-between" }, /* @__PURE__ */ React11.createElement(import_ui7.FormLabel, { htmlFor: ID, size: "small" }, (0, import_i18n6.__)("Classes", "elementor")), /* @__PURE__ */ React11.createElement(import_ui7.Stack, { direction: "row", gap: 1 }, /* @__PURE__ */ React11.createElement(ClassSelectorActionsSlot, null))), /* @__PURE__ */ React11.createElement(
|
|
1298
1310
|
import_editor_ui4.WarningInfotip,
|
|
@@ -1374,7 +1386,7 @@ var updateClassByProvider = (provider, data) => {
|
|
|
1374
1386
|
if (!provider) {
|
|
1375
1387
|
return;
|
|
1376
1388
|
}
|
|
1377
|
-
const providerInstance =
|
|
1389
|
+
const providerInstance = import_editor_styles_repository10.stylesRepository.getProviderByKey(provider);
|
|
1378
1390
|
if (!providerInstance) {
|
|
1379
1391
|
return;
|
|
1380
1392
|
}
|
|
@@ -1383,8 +1395,8 @@ var updateClassByProvider = (provider, data) => {
|
|
|
1383
1395
|
function useOptions() {
|
|
1384
1396
|
const { element } = useElement();
|
|
1385
1397
|
const isProviderEditable = (provider) => !!provider.actions.updateProps;
|
|
1386
|
-
return (0,
|
|
1387
|
-
const isElements = (0,
|
|
1398
|
+
return (0, import_editor_styles_repository10.useProviders)().filter(isProviderEditable).flatMap((provider) => {
|
|
1399
|
+
const isElements = (0, import_editor_styles_repository10.isElementsStylesProvider)(provider.getKey());
|
|
1388
1400
|
const styleDefs = provider.actions.all({ elementId: element.id });
|
|
1389
1401
|
if (isElements && styleDefs.length === 0) {
|
|
1390
1402
|
return [EMPTY_OPTION];
|
|
@@ -1431,7 +1443,7 @@ function useCreateAction() {
|
|
|
1431
1443
|
).replace("%s", provider.limit.toString())
|
|
1432
1444
|
};
|
|
1433
1445
|
}
|
|
1434
|
-
return (0,
|
|
1446
|
+
return (0, import_editor_styles_repository10.validateStyleLabel)(newClassLabel, event);
|
|
1435
1447
|
};
|
|
1436
1448
|
const entityName = provider.labels.singular && provider.labels.plural ? provider.labels : void 0;
|
|
1437
1449
|
return { create, validate, entityName };
|
|
@@ -1444,7 +1456,7 @@ function useAppliedOptions(options13) {
|
|
|
1444
1456
|
const appliedIds = usePanelElementSetting(currentClassesProp)?.value ?? [];
|
|
1445
1457
|
const appliedOptions = options13.filter((option) => option.value && appliedIds.includes(option.value));
|
|
1446
1458
|
const hasElementsProviderStyleApplied = appliedOptions.some(
|
|
1447
|
-
(option) => option.provider && (0,
|
|
1459
|
+
(option) => option.provider && (0, import_editor_styles_repository10.isElementsStylesProvider)(option.provider)
|
|
1448
1460
|
);
|
|
1449
1461
|
if (!hasElementsProviderStyleApplied) {
|
|
1450
1462
|
appliedOptions.unshift(EMPTY_OPTION);
|
|
@@ -1488,7 +1500,7 @@ var import_react13 = require("react");
|
|
|
1488
1500
|
var import_editor_elements5 = require("@elementor/editor-elements");
|
|
1489
1501
|
var import_editor_props3 = require("@elementor/editor-props");
|
|
1490
1502
|
var import_editor_styles3 = require("@elementor/editor-styles");
|
|
1491
|
-
var
|
|
1503
|
+
var import_editor_styles_repository13 = require("@elementor/editor-styles-repository");
|
|
1492
1504
|
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
1493
1505
|
var import_utils2 = require("@elementor/utils");
|
|
1494
1506
|
|
|
@@ -1496,8 +1508,8 @@ var import_utils2 = require("@elementor/utils");
|
|
|
1496
1508
|
var import_react12 = require("react");
|
|
1497
1509
|
var import_editor_elements4 = require("@elementor/editor-elements");
|
|
1498
1510
|
var import_editor_styles2 = require("@elementor/editor-styles");
|
|
1499
|
-
var import_editor_styles_repository10 = require("@elementor/editor-styles-repository");
|
|
1500
1511
|
var import_editor_styles_repository11 = require("@elementor/editor-styles-repository");
|
|
1512
|
+
var import_editor_styles_repository12 = require("@elementor/editor-styles-repository");
|
|
1501
1513
|
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
1502
1514
|
var import_i18n7 = require("@wordpress/i18n");
|
|
1503
1515
|
|
|
@@ -1548,7 +1560,7 @@ function useUndoableActions({
|
|
|
1548
1560
|
const classesProp = useClassesProp();
|
|
1549
1561
|
return (0, import_react12.useMemo)(() => {
|
|
1550
1562
|
const meta = { breakpoint, state };
|
|
1551
|
-
const createStyleArgs = { elementId, classesProp, meta, label:
|
|
1563
|
+
const createStyleArgs = { elementId, classesProp, meta, label: import_editor_styles_repository12.ELEMENTS_STYLES_RESERVED_LABEL };
|
|
1552
1564
|
return (0, import_editor_v1_adapters2.undoable)(
|
|
1553
1565
|
{
|
|
1554
1566
|
do: (payload) => {
|
|
@@ -1632,7 +1644,7 @@ var localStyleHistoryTitles = {
|
|
|
1632
1644
|
function capitalize(str) {
|
|
1633
1645
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
1634
1646
|
}
|
|
1635
|
-
var isLocalStyle = (provider, styleId) => !provider || !styleId || (0,
|
|
1647
|
+
var isLocalStyle = (provider, styleId) => !provider || !styleId || (0, import_editor_styles_repository11.isElementsStylesProvider)(provider.getKey());
|
|
1636
1648
|
var getTitle = ({ provider, styleId, elementId }) => {
|
|
1637
1649
|
const isLocal = isLocalStyle(provider, styleId);
|
|
1638
1650
|
if (isLocal) {
|
|
@@ -1687,7 +1699,7 @@ function useUndoableActions2({
|
|
|
1687
1699
|
const classesProp = useClassesProp();
|
|
1688
1700
|
return (0, import_react13.useMemo)(() => {
|
|
1689
1701
|
const meta = { breakpoint, state };
|
|
1690
|
-
const createStyleArgs = { elementId, classesProp, meta, label:
|
|
1702
|
+
const createStyleArgs = { elementId, classesProp, meta, label: import_editor_styles_repository13.ELEMENTS_STYLES_RESERVED_LABEL };
|
|
1691
1703
|
return (0, import_editor_v1_adapters3.undoable)(
|
|
1692
1704
|
{
|
|
1693
1705
|
do: (payload) => {
|
|
@@ -2544,7 +2556,7 @@ function isControl(control) {
|
|
|
2544
2556
|
// src/components/style-tab.tsx
|
|
2545
2557
|
var React85 = __toESM(require("react"));
|
|
2546
2558
|
var import_react37 = require("react");
|
|
2547
|
-
var
|
|
2559
|
+
var import_editor_props15 = require("@elementor/editor-props");
|
|
2548
2560
|
var import_editor_responsive3 = require("@elementor/editor-responsive");
|
|
2549
2561
|
var import_locations3 = require("@elementor/locations");
|
|
2550
2562
|
var import_session8 = require("@elementor/session");
|
|
@@ -2558,7 +2570,7 @@ var import_editor_elements7 = require("@elementor/editor-elements");
|
|
|
2558
2570
|
var import_editor_props8 = require("@elementor/editor-props");
|
|
2559
2571
|
var import_editor_responsive2 = require("@elementor/editor-responsive");
|
|
2560
2572
|
var import_editor_styles5 = require("@elementor/editor-styles");
|
|
2561
|
-
var
|
|
2573
|
+
var import_editor_styles_repository14 = require("@elementor/editor-styles-repository");
|
|
2562
2574
|
|
|
2563
2575
|
// src/styles-inheritance/create-styles-inheritance.ts
|
|
2564
2576
|
var import_editor_props7 = require("@elementor/editor-props");
|
|
@@ -2832,7 +2844,7 @@ var useAppliedStyles = () => {
|
|
|
2832
2844
|
useStylesRerender();
|
|
2833
2845
|
const classesProp = usePanelElementSetting(currentClassesProp);
|
|
2834
2846
|
const appliedStyles = import_editor_props8.classesPropTypeUtil.extract(classesProp) ?? [];
|
|
2835
|
-
return
|
|
2847
|
+
return import_editor_styles_repository14.stylesRepository.all().filter((style) => [...baseStyles, ...appliedStyles].includes(style.id));
|
|
2836
2848
|
};
|
|
2837
2849
|
var useBaseStyles = () => {
|
|
2838
2850
|
const { elementType } = useElement();
|
|
@@ -4123,47 +4135,99 @@ var GridJustifyItemsField = () => /* @__PURE__ */ React50.createElement(StylesFi
|
|
|
4123
4135
|
var React51 = __toESM(require("react"));
|
|
4124
4136
|
var import_react27 = require("react");
|
|
4125
4137
|
var import_editor_controls26 = require("@elementor/editor-controls");
|
|
4138
|
+
var import_editor_props14 = require("@elementor/editor-props");
|
|
4126
4139
|
var import_ui30 = require("@elementor/ui");
|
|
4127
4140
|
var import_i18n29 = require("@wordpress/i18n");
|
|
4128
4141
|
var FR = "fr";
|
|
4129
4142
|
var CUSTOM2 = "custom";
|
|
4130
4143
|
var UNITS = [FR, CUSTOM2];
|
|
4144
|
+
var EMPTY = { kind: "empty" };
|
|
4131
4145
|
var REPEAT_FR_PATTERN = /^repeat\(\s*(\d+)\s*,\s*1fr\s*\)$/;
|
|
4132
|
-
var
|
|
4146
|
+
var parseCss = (css) => {
|
|
4133
4147
|
if (!css) {
|
|
4134
|
-
return
|
|
4148
|
+
return EMPTY;
|
|
4135
4149
|
}
|
|
4136
4150
|
const match = css.match(REPEAT_FR_PATTERN);
|
|
4137
4151
|
if (match) {
|
|
4138
|
-
|
|
4152
|
+
const count = parseInt(match[1], 10);
|
|
4153
|
+
return count >= 1 ? { kind: "fr", count } : EMPTY;
|
|
4139
4154
|
}
|
|
4140
|
-
return {
|
|
4155
|
+
return { kind: "custom", raw: css };
|
|
4141
4156
|
};
|
|
4142
|
-
var
|
|
4143
|
-
if (
|
|
4144
|
-
return
|
|
4157
|
+
var fromSizeInput = (v) => {
|
|
4158
|
+
if (v.size === "" || Number.isNaN(v.size)) {
|
|
4159
|
+
return EMPTY;
|
|
4145
4160
|
}
|
|
4146
|
-
if (
|
|
4147
|
-
|
|
4161
|
+
if (v.unit === FR) {
|
|
4162
|
+
const n = Number(v.size);
|
|
4163
|
+
return Number.isFinite(n) && n >= 1 ? { kind: "fr", count: Math.trunc(n) } : EMPTY;
|
|
4148
4164
|
}
|
|
4149
|
-
return String(
|
|
4165
|
+
return { kind: "custom", raw: String(v.size) };
|
|
4150
4166
|
};
|
|
4151
|
-
var
|
|
4167
|
+
var toCss = (v) => {
|
|
4168
|
+
switch (v.kind) {
|
|
4169
|
+
case "empty":
|
|
4170
|
+
return null;
|
|
4171
|
+
case "fr":
|
|
4172
|
+
return `repeat(${v.count}, 1fr)`;
|
|
4173
|
+
case "custom":
|
|
4174
|
+
return v.raw;
|
|
4175
|
+
}
|
|
4176
|
+
};
|
|
4177
|
+
var toSizeInput = (v, fallbackUnit = FR) => {
|
|
4178
|
+
switch (v.kind) {
|
|
4179
|
+
case "empty":
|
|
4180
|
+
return { size: "", unit: fallbackUnit };
|
|
4181
|
+
case "fr":
|
|
4182
|
+
return { size: v.count, unit: FR };
|
|
4183
|
+
case "custom":
|
|
4184
|
+
return { size: v.raw, unit: CUSTOM2 };
|
|
4185
|
+
}
|
|
4186
|
+
};
|
|
4187
|
+
var toPlaceholder = (v) => {
|
|
4188
|
+
switch (v.kind) {
|
|
4189
|
+
case "empty":
|
|
4190
|
+
return void 0;
|
|
4191
|
+
case "fr":
|
|
4192
|
+
return String(v.count);
|
|
4193
|
+
case "custom":
|
|
4194
|
+
return v.raw;
|
|
4195
|
+
}
|
|
4196
|
+
};
|
|
4197
|
+
var unitOf = (v, fallback = FR) => {
|
|
4198
|
+
if (v.kind === "fr") {
|
|
4199
|
+
return FR;
|
|
4200
|
+
}
|
|
4201
|
+
if (v.kind === "custom") {
|
|
4202
|
+
return CUSTOM2;
|
|
4203
|
+
}
|
|
4204
|
+
return fallback;
|
|
4205
|
+
};
|
|
4206
|
+
var GridTrackField = ({ cssProp, label }) => /* @__PURE__ */ React51.createElement(UiProviders, null, /* @__PURE__ */ React51.createElement(StylesField, { bind: cssProp, propDisplayName: label }, /* @__PURE__ */ React51.createElement(GridTrackFieldContent, { cssProp, label })));
|
|
4152
4207
|
var GridTrackFieldContent = ({ cssProp, label }) => {
|
|
4153
4208
|
const { value, setValue } = useStylesField(cssProp, {
|
|
4154
4209
|
history: { propDisplayName: label }
|
|
4155
4210
|
});
|
|
4211
|
+
const { placeholder: inheritedPlaceholder } = (0, import_editor_controls26.useBoundProp)();
|
|
4156
4212
|
const anchorRef = (0, import_react27.useRef)(null);
|
|
4157
|
-
const
|
|
4158
|
-
const
|
|
4159
|
-
|
|
4160
|
-
|
|
4213
|
+
const local = parseCss(value?.value ?? null);
|
|
4214
|
+
const inherited = parseCss(import_editor_props14.stringPropTypeUtil.extract(inheritedPlaceholder));
|
|
4215
|
+
const displayValue = local.kind !== "empty" ? toSizeInput(local) : toSizeInput(EMPTY, unitOf(inherited));
|
|
4216
|
+
const placeholder = toPlaceholder(inherited);
|
|
4217
|
+
const handleChange = (raw) => {
|
|
4218
|
+
const next = fromSizeInput(raw);
|
|
4219
|
+
if (next.kind === "empty" && local.kind !== "empty" && raw.unit !== unitOf(local)) {
|
|
4220
|
+
return;
|
|
4221
|
+
}
|
|
4222
|
+
const css = toCss(next);
|
|
4223
|
+
setValue(css === null ? null : { $$type: "string", value: css });
|
|
4161
4224
|
};
|
|
4162
4225
|
return /* @__PURE__ */ React51.createElement(StylesFieldLayout, { label, direction: "column" }, /* @__PURE__ */ React51.createElement("div", { ref: anchorRef }, /* @__PURE__ */ React51.createElement(
|
|
4163
4226
|
import_editor_controls26.SizeComponent,
|
|
4164
4227
|
{
|
|
4165
4228
|
units: UNITS,
|
|
4166
|
-
value:
|
|
4229
|
+
value: displayValue,
|
|
4230
|
+
placeholder,
|
|
4167
4231
|
defaultUnit: FR,
|
|
4168
4232
|
setValue: handleChange,
|
|
4169
4233
|
onBlur: () => {
|
|
@@ -4542,7 +4606,7 @@ var import_editor_ui6 = require("@elementor/editor-ui");
|
|
|
4542
4606
|
|
|
4543
4607
|
// src/styles-inheritance/components/styles-inheritance-section-indicators.tsx
|
|
4544
4608
|
var React61 = __toESM(require("react"));
|
|
4545
|
-
var
|
|
4609
|
+
var import_editor_styles_repository15 = require("@elementor/editor-styles-repository");
|
|
4546
4610
|
var import_ui36 = require("@elementor/ui");
|
|
4547
4611
|
var import_i18n39 = require("@wordpress/i18n");
|
|
4548
4612
|
var StylesInheritanceSectionIndicators = ({ fields }) => {
|
|
@@ -4564,7 +4628,7 @@ var StylesInheritanceSectionIndicators = ({ fields }) => {
|
|
|
4564
4628
|
StyleIndicator,
|
|
4565
4629
|
{
|
|
4566
4630
|
getColor: getStylesProviderThemeColor(provider.getKey()),
|
|
4567
|
-
"data-variant": (0,
|
|
4631
|
+
"data-variant": (0, import_editor_styles_repository15.isElementsStylesProvider)(provider.getKey()) ? "local" : "global",
|
|
4568
4632
|
role: "listitem",
|
|
4569
4633
|
"aria-label": hasValueLabel
|
|
4570
4634
|
}
|
|
@@ -5278,7 +5342,7 @@ function ClassesHeader({ children }) {
|
|
|
5278
5342
|
function useCurrentClassesProp() {
|
|
5279
5343
|
const { elementType } = useElement();
|
|
5280
5344
|
const prop = Object.entries(elementType.propsSchema).find(
|
|
5281
|
-
([, propType]) => propType.kind === "plain" && propType.key ===
|
|
5345
|
+
([, propType]) => propType.kind === "plain" && propType.key === import_editor_props15.CLASSES_PROP_KEY
|
|
5282
5346
|
);
|
|
5283
5347
|
if (!prop) {
|
|
5284
5348
|
return null;
|
|
@@ -5429,7 +5493,7 @@ var init = () => {
|
|
|
5429
5493
|
var React89 = __toESM(require("react"));
|
|
5430
5494
|
var import_editor_controls58 = require("@elementor/editor-controls");
|
|
5431
5495
|
var import_editor_elements17 = require("@elementor/editor-elements");
|
|
5432
|
-
var
|
|
5496
|
+
var import_editor_props17 = require("@elementor/editor-props");
|
|
5433
5497
|
var import_icons26 = require("@elementor/icons");
|
|
5434
5498
|
var import_ui43 = require("@elementor/ui");
|
|
5435
5499
|
var import_i18n64 = require("@wordpress/i18n");
|
|
@@ -5450,12 +5514,12 @@ var getElementByType = (elementId, type) => {
|
|
|
5450
5514
|
// src/controls-registry/element-controls/tabs-control/use-actions.ts
|
|
5451
5515
|
var import_editor_controls57 = require("@elementor/editor-controls");
|
|
5452
5516
|
var import_editor_elements16 = require("@elementor/editor-elements");
|
|
5453
|
-
var
|
|
5517
|
+
var import_editor_props16 = require("@elementor/editor-props");
|
|
5454
5518
|
var import_i18n63 = require("@wordpress/i18n");
|
|
5455
5519
|
var TAB_ELEMENT_TYPE = "e-tab";
|
|
5456
5520
|
var TAB_CONTENT_ELEMENT_TYPE = "e-tab-content";
|
|
5457
5521
|
var useActions = () => {
|
|
5458
|
-
const { value, setValue: setDefaultActiveTab } = (0, import_editor_controls57.useBoundProp)(
|
|
5522
|
+
const { value, setValue: setDefaultActiveTab } = (0, import_editor_controls57.useBoundProp)(import_editor_props16.numberPropTypeUtil);
|
|
5459
5523
|
const defaultActiveTab = value ?? 0;
|
|
5460
5524
|
const duplicateItem = ({
|
|
5461
5525
|
items: items3,
|
|
@@ -5716,7 +5780,7 @@ var ItemLabel = ({ value, index }) => {
|
|
|
5716
5780
|
return /* @__PURE__ */ React89.createElement(import_ui43.Stack, { sx: { minHeight: 20 }, direction: "row", alignItems: "center", gap: 1.5 }, /* @__PURE__ */ React89.createElement("span", null, elementTitle), /* @__PURE__ */ React89.createElement(ItemDefaultTab, { index }));
|
|
5717
5781
|
};
|
|
5718
5782
|
var ItemDefaultTab = ({ index }) => {
|
|
5719
|
-
const { value: defaultItem } = (0, import_editor_controls58.useBoundProp)(
|
|
5783
|
+
const { value: defaultItem } = (0, import_editor_controls58.useBoundProp)(import_editor_props17.numberPropTypeUtil);
|
|
5720
5784
|
const isDefault = defaultItem === index;
|
|
5721
5785
|
if (!isDefault) {
|
|
5722
5786
|
return null;
|
|
@@ -5730,7 +5794,7 @@ var ItemContent = ({ value, index }) => {
|
|
|
5730
5794
|
return /* @__PURE__ */ React89.createElement(import_ui43.Stack, { p: 2, gap: 1.5 }, /* @__PURE__ */ React89.createElement(TabLabelControl, { elementId: value.id }), /* @__PURE__ */ React89.createElement(SettingsField, { bind: "default-active-tab", propDisplayName: (0, import_i18n64.__)("Tabs", "elementor") }, /* @__PURE__ */ React89.createElement(DefaultTabControl, { tabIndex: index })));
|
|
5731
5795
|
};
|
|
5732
5796
|
var DefaultTabControl = ({ tabIndex }) => {
|
|
5733
|
-
const { value, setValue } = (0, import_editor_controls58.useBoundProp)(
|
|
5797
|
+
const { value, setValue } = (0, import_editor_controls58.useBoundProp)(import_editor_props17.numberPropTypeUtil);
|
|
5734
5798
|
const isDefault = value === tabIndex;
|
|
5735
5799
|
return /* @__PURE__ */ React89.createElement(import_ui43.Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", gap: 2 }, /* @__PURE__ */ React89.createElement(import_editor_controls58.ControlFormLabel, null, (0, import_i18n64.__)("Set as default tab", "elementor")), /* @__PURE__ */ React89.createElement(ConditionalTooltip, { showTooltip: isDefault, placement: "right" }, /* @__PURE__ */ React89.createElement(
|
|
5736
5800
|
import_ui43.Switch,
|
|
@@ -5810,7 +5874,7 @@ var import_menus2 = require("@elementor/menus");
|
|
|
5810
5874
|
// src/dynamics/components/background-control-dynamic-tag.tsx
|
|
5811
5875
|
var React90 = __toESM(require("react"));
|
|
5812
5876
|
var import_editor_controls60 = require("@elementor/editor-controls");
|
|
5813
|
-
var
|
|
5877
|
+
var import_editor_props19 = require("@elementor/editor-props");
|
|
5814
5878
|
var import_icons27 = require("@elementor/icons");
|
|
5815
5879
|
|
|
5816
5880
|
// src/dynamics/hooks/use-dynamic-tag.ts
|
|
@@ -5866,11 +5930,11 @@ var filterByLicense = (tags) => {
|
|
|
5866
5930
|
};
|
|
5867
5931
|
|
|
5868
5932
|
// src/dynamics/utils.ts
|
|
5869
|
-
var
|
|
5933
|
+
var import_editor_props18 = require("@elementor/editor-props");
|
|
5870
5934
|
var import_editor_v1_adapters12 = require("@elementor/editor-v1-adapters");
|
|
5871
5935
|
var import_schema = require("@elementor/schema");
|
|
5872
5936
|
var DYNAMIC_PROP_TYPE_KEY = "dynamic";
|
|
5873
|
-
var dynamicPropTypeUtil = (0,
|
|
5937
|
+
var dynamicPropTypeUtil = (0, import_editor_props18.createPropUtils)(
|
|
5874
5938
|
DYNAMIC_PROP_TYPE_KEY,
|
|
5875
5939
|
import_schema.z.strictObject({
|
|
5876
5940
|
name: import_schema.z.string(),
|
|
@@ -5887,7 +5951,7 @@ var getDynamicPropType = (propType) => {
|
|
|
5887
5951
|
return dynamicPropType && isDynamicPropType(dynamicPropType) ? dynamicPropType : null;
|
|
5888
5952
|
};
|
|
5889
5953
|
var isDynamicPropValue = (prop) => {
|
|
5890
|
-
return (0,
|
|
5954
|
+
return (0, import_editor_props18.isTransformable)(prop) && prop.$$type === DYNAMIC_PROP_TYPE_KEY;
|
|
5891
5955
|
};
|
|
5892
5956
|
var supportsDynamic = (propType) => {
|
|
5893
5957
|
return !!getDynamicPropType(propType);
|
|
@@ -5948,7 +6012,7 @@ var useDynamicTag = (tagName) => {
|
|
|
5948
6012
|
// src/dynamics/components/background-control-dynamic-tag.tsx
|
|
5949
6013
|
var BackgroundControlDynamicTagIcon = () => /* @__PURE__ */ React90.createElement(import_icons27.DatabaseIcon, { fontSize: "tiny" });
|
|
5950
6014
|
var BackgroundControlDynamicTagLabel = ({ value }) => {
|
|
5951
|
-
const context = (0, import_editor_controls60.useBoundProp)(
|
|
6015
|
+
const context = (0, import_editor_controls60.useBoundProp)(import_editor_props19.backgroundImageOverlayPropTypeUtil);
|
|
5952
6016
|
return /* @__PURE__ */ React90.createElement(import_editor_controls60.PropProvider, { ...context, value: value.value }, /* @__PURE__ */ React90.createElement(import_editor_controls60.PropKeyProvider, { bind: "image" }, /* @__PURE__ */ React90.createElement(Wrapper2, { rawValue: value.value })));
|
|
5953
6017
|
};
|
|
5954
6018
|
var Wrapper2 = ({ rawValue }) => {
|
|
@@ -5985,7 +6049,7 @@ var import_editor_controls61 = require("@elementor/editor-controls");
|
|
|
5985
6049
|
// src/dynamics/components/dynamic-conditional-control.tsx
|
|
5986
6050
|
var React91 = __toESM(require("react"));
|
|
5987
6051
|
var import_react44 = require("react");
|
|
5988
|
-
var
|
|
6052
|
+
var import_editor_props20 = require("@elementor/editor-props");
|
|
5989
6053
|
var DynamicConditionalControl = ({
|
|
5990
6054
|
children,
|
|
5991
6055
|
propType,
|
|
@@ -6027,7 +6091,7 @@ var DynamicConditionalControl = ({
|
|
|
6027
6091
|
if (!propType?.dependencies?.terms.length) {
|
|
6028
6092
|
return /* @__PURE__ */ React91.createElement(React91.Fragment, null, children);
|
|
6029
6093
|
}
|
|
6030
|
-
const isHidden = !(0,
|
|
6094
|
+
const isHidden = !(0, import_editor_props20.isDependencyMet)(propType?.dependencies, effectiveSettings).isMet;
|
|
6031
6095
|
return isHidden ? null : /* @__PURE__ */ React91.createElement(React91.Fragment, null, children);
|
|
6032
6096
|
};
|
|
6033
6097
|
|
|
@@ -6405,7 +6469,7 @@ function ControlsItemsStack({ items: items3 }) {
|
|
|
6405
6469
|
|
|
6406
6470
|
// src/dynamics/dynamic-transformer.ts
|
|
6407
6471
|
var import_editor_canvas2 = require("@elementor/editor-canvas");
|
|
6408
|
-
var
|
|
6472
|
+
var import_editor_props21 = require("@elementor/editor-props");
|
|
6409
6473
|
|
|
6410
6474
|
// src/dynamics/errors.ts
|
|
6411
6475
|
var import_utils9 = require("@elementor/utils");
|
|
@@ -6423,7 +6487,7 @@ var dynamicTransformer = (0, import_editor_canvas2.createTransformer)((value, {
|
|
|
6423
6487
|
});
|
|
6424
6488
|
function simpleTransform(props) {
|
|
6425
6489
|
const transformed = Object.entries(props).map(([settingKey, settingValue]) => {
|
|
6426
|
-
const value = (0,
|
|
6490
|
+
const value = (0, import_editor_props21.isTransformable)(settingValue) ? settingValue.value : settingValue;
|
|
6427
6491
|
return [settingKey, value];
|
|
6428
6492
|
});
|
|
6429
6493
|
return Object.fromEntries(transformed);
|
|
@@ -6583,8 +6647,8 @@ function useResetStyleValueProps() {
|
|
|
6583
6647
|
// src/styles-inheritance/components/styles-inheritance-indicator.tsx
|
|
6584
6648
|
var React101 = __toESM(require("react"));
|
|
6585
6649
|
var import_editor_controls67 = require("@elementor/editor-controls");
|
|
6586
|
-
var
|
|
6587
|
-
var
|
|
6650
|
+
var import_editor_props22 = require("@elementor/editor-props");
|
|
6651
|
+
var import_editor_styles_repository18 = require("@elementor/editor-styles-repository");
|
|
6588
6652
|
var import_i18n72 = require("@wordpress/i18n");
|
|
6589
6653
|
|
|
6590
6654
|
// src/styles-inheritance/components/styles-inheritance-infotip.tsx
|
|
@@ -6599,7 +6663,7 @@ var import_i18n71 = require("@wordpress/i18n");
|
|
|
6599
6663
|
var import_react46 = require("react");
|
|
6600
6664
|
var import_editor_canvas4 = require("@elementor/editor-canvas");
|
|
6601
6665
|
var import_editor_styles8 = require("@elementor/editor-styles");
|
|
6602
|
-
var
|
|
6666
|
+
var import_editor_styles_repository16 = require("@elementor/editor-styles-repository");
|
|
6603
6667
|
var import_i18n69 = require("@wordpress/i18n");
|
|
6604
6668
|
var MAXIMUM_ITEMS = 2;
|
|
6605
6669
|
var useNormalizedInheritanceChainItems = (inheritanceChain, bind, resolve) => {
|
|
@@ -6611,7 +6675,7 @@ var useNormalizedInheritanceChainItems = (inheritanceChain, bind, resolve) => {
|
|
|
6611
6675
|
);
|
|
6612
6676
|
const validItems = normalizedItems.map((item) => ({
|
|
6613
6677
|
...item,
|
|
6614
|
-
displayLabel:
|
|
6678
|
+
displayLabel: import_editor_styles_repository16.ELEMENTS_BASE_STYLES_PROVIDER_KEY !== item.provider ? item.displayLabel : (0, import_i18n69.__)("Base", "elementor")
|
|
6615
6679
|
})).filter((item) => !item.value || item.displayLabel !== "").slice(0, MAXIMUM_ITEMS);
|
|
6616
6680
|
setItems(validItems);
|
|
6617
6681
|
})();
|
|
@@ -6696,13 +6760,13 @@ var BreakpointIcon = ({ breakpoint }) => {
|
|
|
6696
6760
|
|
|
6697
6761
|
// src/styles-inheritance/components/infotip/label-chip.tsx
|
|
6698
6762
|
var React97 = __toESM(require("react"));
|
|
6699
|
-
var
|
|
6763
|
+
var import_editor_styles_repository17 = require("@elementor/editor-styles-repository");
|
|
6700
6764
|
var import_icons33 = require("@elementor/icons");
|
|
6701
6765
|
var import_ui47 = require("@elementor/ui");
|
|
6702
6766
|
var import_i18n70 = require("@wordpress/i18n");
|
|
6703
6767
|
var SIZE5 = "tiny";
|
|
6704
6768
|
var LabelChip = ({ displayLabel, provider }) => {
|
|
6705
|
-
const isBaseStyle = provider ===
|
|
6769
|
+
const isBaseStyle = provider === import_editor_styles_repository17.ELEMENTS_BASE_STYLES_PROVIDER_KEY;
|
|
6706
6770
|
const chipIcon = isBaseStyle ? /* @__PURE__ */ React97.createElement(import_ui47.Tooltip, { title: (0, import_i18n70.__)("Inherited from base styles", "elementor"), placement: "top" }, /* @__PURE__ */ React97.createElement(import_icons33.InfoCircleIcon, { fontSize: SIZE5 })) : void 0;
|
|
6707
6771
|
return /* @__PURE__ */ React97.createElement(
|
|
6708
6772
|
import_ui47.Chip,
|
|
@@ -6935,9 +6999,9 @@ var StylesInheritanceIndicator = ({
|
|
|
6935
6999
|
var Indicator = ({ inheritanceChain, path, propType, isDisabled }) => {
|
|
6936
7000
|
const { id: currentStyleId, provider: currentStyleProvider, meta: currentStyleMeta } = useStyle();
|
|
6937
7001
|
const currentItem = currentStyleId ? getValueFromInheritanceChain(inheritanceChain, currentStyleId, currentStyleMeta) : null;
|
|
6938
|
-
const hasValue = !(0,
|
|
7002
|
+
const hasValue = !(0, import_editor_props22.isEmpty)(currentItem?.value);
|
|
6939
7003
|
const [actualStyle] = inheritanceChain;
|
|
6940
|
-
if (actualStyle.provider ===
|
|
7004
|
+
if (actualStyle.provider === import_editor_styles_repository18.ELEMENTS_BASE_STYLES_PROVIDER_KEY) {
|
|
6941
7005
|
return null;
|
|
6942
7006
|
}
|
|
6943
7007
|
const isFinalValue = currentItem === actualStyle;
|