@elementor/editor-editing-panel 1.42.0 → 1.43.0
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/CHANGELOG.md +15 -0
- package/dist/index.js +151 -118
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +107 -74
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/components/css-classes/css-class-item.tsx +4 -2
- package/src/components/css-classes/css-class-menu.tsx +4 -4
- package/src/components/css-classes/css-class-selector.tsx +36 -57
- package/src/components/css-classes/use-apply-and-unapply-class.ts +82 -10
package/dist/index.js
CHANGED
|
@@ -49,8 +49,7 @@ var { registerControlReplacement, getControlReplacements } = (0, import_editor_c
|
|
|
49
49
|
var React8 = __toESM(require("react"));
|
|
50
50
|
var import_react10 = require("react");
|
|
51
51
|
var import_editor_elements2 = require("@elementor/editor-elements");
|
|
52
|
-
var
|
|
53
|
-
var import_editor_styles_repository4 = require("@elementor/editor-styles-repository");
|
|
52
|
+
var import_editor_styles_repository5 = require("@elementor/editor-styles-repository");
|
|
54
53
|
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
55
54
|
var import_icons2 = require("@elementor/icons");
|
|
56
55
|
var import_locations = require("@elementor/locations");
|
|
@@ -468,7 +467,7 @@ var StyledGroupItems = (0, import_ui2.styled)("ul")`
|
|
|
468
467
|
// src/components/css-classes/css-class-item.tsx
|
|
469
468
|
var React7 = __toESM(require("react"));
|
|
470
469
|
var import_react9 = require("react");
|
|
471
|
-
var
|
|
470
|
+
var import_editor_styles_repository4 = require("@elementor/editor-styles-repository");
|
|
472
471
|
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
473
472
|
var import_icons = require("@elementor/icons");
|
|
474
473
|
var import_ui5 = require("@elementor/ui");
|
|
@@ -491,7 +490,7 @@ function CssClassProvider({ children, ...contextValue }) {
|
|
|
491
490
|
|
|
492
491
|
// src/components/css-classes/css-class-menu.tsx
|
|
493
492
|
var React6 = __toESM(require("react"));
|
|
494
|
-
var
|
|
493
|
+
var import_editor_styles_repository3 = require("@elementor/editor-styles-repository");
|
|
495
494
|
var import_editor_ui = require("@elementor/editor-ui");
|
|
496
495
|
var import_ui4 = require("@elementor/ui");
|
|
497
496
|
var import_i18n2 = require("@wordpress/i18n");
|
|
@@ -523,12 +522,20 @@ var import_react8 = require("react");
|
|
|
523
522
|
var import_editor_documents = require("@elementor/editor-documents");
|
|
524
523
|
var import_editor_elements = require("@elementor/editor-elements");
|
|
525
524
|
var import_editor_props = require("@elementor/editor-props");
|
|
525
|
+
var import_editor_styles_repository2 = require("@elementor/editor-styles-repository");
|
|
526
526
|
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
527
527
|
var import_i18n = require("@wordpress/i18n");
|
|
528
|
+
|
|
529
|
+
// src/sync/experiments-flags.ts
|
|
530
|
+
var EXPERIMENTAL_FEATURES = {
|
|
531
|
+
V_3_30: "e_v_3_30"
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
// src/components/css-classes/use-apply-and-unapply-class.ts
|
|
528
535
|
function useApplyClass() {
|
|
529
536
|
const { id: activeId, setId: setActiveId } = useStyle();
|
|
530
537
|
const { element } = useElement();
|
|
531
|
-
const isVersion330Active = (0, import_editor_v1_adapters.isExperimentActive)(
|
|
538
|
+
const isVersion330Active = (0, import_editor_v1_adapters.isExperimentActive)(EXPERIMENTAL_FEATURES.V_3_30);
|
|
532
539
|
const applyClass = useApply();
|
|
533
540
|
const unapplyClass = useUnapply();
|
|
534
541
|
const undoableApply = (0, import_react8.useMemo)(() => {
|
|
@@ -563,7 +570,7 @@ function useApplyClass() {
|
|
|
563
570
|
function useUnapplyClass() {
|
|
564
571
|
const { id: activeId, setId: setActiveId } = useStyle();
|
|
565
572
|
const { element } = useElement();
|
|
566
|
-
const isVersion330Active = (0, import_editor_v1_adapters.isExperimentActive)(
|
|
573
|
+
const isVersion330Active = (0, import_editor_v1_adapters.isExperimentActive)(EXPERIMENTAL_FEATURES.V_3_30);
|
|
567
574
|
const applyClass = useApply();
|
|
568
575
|
const unapplyClass = useUnapply();
|
|
569
576
|
const undoableUnapply = (0, import_react8.useMemo)(() => {
|
|
@@ -595,10 +602,58 @@ function useUnapplyClass() {
|
|
|
595
602
|
);
|
|
596
603
|
return isVersion330Active ? undoableUnapply : unapplyWithoutHistory;
|
|
597
604
|
}
|
|
605
|
+
function useCreateAndApplyClass() {
|
|
606
|
+
const { id: activeId, setId: setActiveId } = useStyle();
|
|
607
|
+
const isVersion330Active = (0, import_editor_v1_adapters.isExperimentActive)(EXPERIMENTAL_FEATURES.V_3_30);
|
|
608
|
+
const [provider, createAction] = (0, import_editor_styles_repository2.useGetStylesRepositoryCreateAction)() ?? [null, null];
|
|
609
|
+
const deleteAction = provider?.actions.delete;
|
|
610
|
+
const applyClass = useApply();
|
|
611
|
+
const unapplyClass = useUnapply();
|
|
612
|
+
const undoableCreateAndApply = (0, import_react8.useMemo)(() => {
|
|
613
|
+
if (!provider || !createAction) {
|
|
614
|
+
return;
|
|
615
|
+
}
|
|
616
|
+
return (0, import_editor_v1_adapters.undoable)(
|
|
617
|
+
{
|
|
618
|
+
do: ({ classLabel }) => {
|
|
619
|
+
const prevActiveId = activeId;
|
|
620
|
+
const createdId = createAction(classLabel);
|
|
621
|
+
applyClass(createdId);
|
|
622
|
+
return { prevActiveId, createdId };
|
|
623
|
+
},
|
|
624
|
+
undo: (_, { prevActiveId, createdId }) => {
|
|
625
|
+
unapplyClass(createdId);
|
|
626
|
+
deleteAction?.(createdId);
|
|
627
|
+
setActiveId(prevActiveId);
|
|
628
|
+
}
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
title: (0, import_i18n.__)("Class", "elementor"),
|
|
632
|
+
subtitle: ({ classLabel }) => {
|
|
633
|
+
return (0, import_i18n.__)(`%s created`, "elementor").replace("%s", classLabel);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
);
|
|
637
|
+
}, [activeId, applyClass, createAction, deleteAction, provider, setActiveId, unapplyClass]);
|
|
638
|
+
const createAndApplyWithoutHistory = (0, import_react8.useCallback)(
|
|
639
|
+
({ classLabel }) => {
|
|
640
|
+
if (!createAction) {
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
const createdId = createAction(classLabel);
|
|
644
|
+
applyClass(createdId);
|
|
645
|
+
},
|
|
646
|
+
[applyClass, createAction]
|
|
647
|
+
);
|
|
648
|
+
if (!provider || !undoableCreateAndApply) {
|
|
649
|
+
return [null, null];
|
|
650
|
+
}
|
|
651
|
+
return isVersion330Active ? [provider, undoableCreateAndApply] : [provider, createAndApplyWithoutHistory];
|
|
652
|
+
}
|
|
598
653
|
function useApply() {
|
|
599
654
|
const { element } = useElement();
|
|
600
655
|
const { setId: setActiveId } = useStyle();
|
|
601
|
-
const { setClasses, getAppliedClasses } =
|
|
656
|
+
const { setClasses, getAppliedClasses } = useClasses();
|
|
602
657
|
return (0, import_react8.useCallback)(
|
|
603
658
|
(classIDToApply) => {
|
|
604
659
|
const appliedClasses = getAppliedClasses();
|
|
@@ -617,7 +672,7 @@ function useApply() {
|
|
|
617
672
|
function useUnapply() {
|
|
618
673
|
const { element } = useElement();
|
|
619
674
|
const { id: activeId, setId: setActiveId } = useStyle();
|
|
620
|
-
const { setClasses, getAppliedClasses } =
|
|
675
|
+
const { setClasses, getAppliedClasses } = useClasses();
|
|
621
676
|
return (0, import_react8.useCallback)(
|
|
622
677
|
(classIDToUnapply) => {
|
|
623
678
|
const appliedClasses = getAppliedClasses();
|
|
@@ -635,10 +690,10 @@ function useUnapply() {
|
|
|
635
690
|
[activeId, element.id, getAppliedClasses, setActiveId, setClasses]
|
|
636
691
|
);
|
|
637
692
|
}
|
|
638
|
-
function
|
|
693
|
+
function useClasses() {
|
|
639
694
|
const { element } = useElement();
|
|
640
695
|
const currentClassesProp = useClassesProp();
|
|
641
|
-
const isVersion330Active = (0, import_editor_v1_adapters.isExperimentActive)(
|
|
696
|
+
const isVersion330Active = (0, import_editor_v1_adapters.isExperimentActive)(EXPERIMENTAL_FEATURES.V_3_30);
|
|
642
697
|
return (0, import_react8.useMemo)(() => {
|
|
643
698
|
const setClasses = (ids) => {
|
|
644
699
|
(0, import_editor_elements.updateElementSettings)({
|
|
@@ -651,10 +706,7 @@ function useSetClasses() {
|
|
|
651
706
|
}
|
|
652
707
|
};
|
|
653
708
|
const getAppliedClasses = () => (0, import_editor_elements.getElementSetting)(element.id, currentClassesProp)?.value || [];
|
|
654
|
-
return {
|
|
655
|
-
setClasses,
|
|
656
|
-
getAppliedClasses
|
|
657
|
-
};
|
|
709
|
+
return { setClasses, getAppliedClasses };
|
|
658
710
|
}, [currentClassesProp, element.id, isVersion330Active]);
|
|
659
711
|
}
|
|
660
712
|
|
|
@@ -696,7 +748,7 @@ function CssClassMenu({ popupState, anchorEl, fixed }) {
|
|
|
696
748
|
}
|
|
697
749
|
function useModifiedStates(styleId) {
|
|
698
750
|
const { meta } = useStyle();
|
|
699
|
-
const styleDef =
|
|
751
|
+
const styleDef = import_editor_styles_repository3.stylesRepository.all().find((style) => style.id === styleId);
|
|
700
752
|
return Object.fromEntries(
|
|
701
753
|
styleDef?.variants.filter((variant) => meta.breakpoint === variant.meta.breakpoint).map((variant) => [variant.meta.state ?? "normal", true]) ?? []
|
|
702
754
|
);
|
|
@@ -709,7 +761,7 @@ function getMenuItemsByProvider({
|
|
|
709
761
|
if (!provider) {
|
|
710
762
|
return [];
|
|
711
763
|
}
|
|
712
|
-
const providerInstance =
|
|
764
|
+
const providerInstance = import_editor_styles_repository3.stylesRepository.getProviderByKey(provider);
|
|
713
765
|
const providerActions = providerInstance?.actions;
|
|
714
766
|
const canUpdate = providerActions?.update;
|
|
715
767
|
const canUnapply = !fixed;
|
|
@@ -736,12 +788,12 @@ function StateMenuItem({ state, closeMenu, ...props }) {
|
|
|
736
788
|
const { id: styleId, provider } = useCssClass();
|
|
737
789
|
const { id: activeId, setId: setActiveId, setMetaState: setActiveMetaState, meta } = useStyle();
|
|
738
790
|
const { state: activeState } = meta;
|
|
739
|
-
const { userCan } = (0,
|
|
791
|
+
const { userCan } = (0, import_editor_styles_repository3.useUserStylesCapability)();
|
|
740
792
|
const modifiedStates = useModifiedStates(styleId);
|
|
741
|
-
const isUpdateAllowed = userCan(provider ?? "").updateProps;
|
|
742
|
-
const indicatorVariant = !provider || (0,
|
|
793
|
+
const isUpdateAllowed = !state || userCan(provider ?? "").updateProps;
|
|
794
|
+
const indicatorVariant = !provider || (0, import_editor_styles_repository3.isElementsStylesProvider)(provider) ? "local" : "global";
|
|
743
795
|
const isStyled = modifiedStates[state ?? "normal"] ?? false;
|
|
744
|
-
const disabled = isUpdateAllowed
|
|
796
|
+
const disabled = !isUpdateAllowed && !isStyled;
|
|
745
797
|
const isActive = styleId === activeId;
|
|
746
798
|
const isSelected = state === activeState && isActive;
|
|
747
799
|
return /* @__PURE__ */ React6.createElement(
|
|
@@ -763,7 +815,7 @@ function StateMenuItem({ state, closeMenu, ...props }) {
|
|
|
763
815
|
import_editor_ui.MenuItemInfotip,
|
|
764
816
|
{
|
|
765
817
|
showInfoTip: disabled,
|
|
766
|
-
content: (0, import_i18n2.__)("With your role
|
|
818
|
+
content: (0, import_i18n2.__)("With your current role, you can only use existing states.", "elementor")
|
|
767
819
|
},
|
|
768
820
|
/* @__PURE__ */ React6.createElement(import_ui4.Stack, { gap: 0.75, direction: "row", alignItems: "center" }, isStyled && /* @__PURE__ */ React6.createElement(StyleIndicator, { "aria-label": (0, import_i18n2.__)("Has style", "elementor"), variant: indicatorVariant }), state ?? "normal")
|
|
769
821
|
)
|
|
@@ -786,7 +838,7 @@ function UnapplyClassMenuItem({ closeMenu, ...props }) {
|
|
|
786
838
|
}
|
|
787
839
|
function RenameClassMenuItem({ closeMenu }) {
|
|
788
840
|
const { handleRename, provider } = useCssClass();
|
|
789
|
-
const { userCan } = (0,
|
|
841
|
+
const { userCan } = (0, import_editor_styles_repository3.useUserStylesCapability)();
|
|
790
842
|
if (!provider) {
|
|
791
843
|
return null;
|
|
792
844
|
}
|
|
@@ -805,7 +857,7 @@ function RenameClassMenuItem({ closeMenu }) {
|
|
|
805
857
|
{
|
|
806
858
|
showInfoTip: !isAllowed,
|
|
807
859
|
content: (0, import_i18n2.__)(
|
|
808
|
-
"With your role
|
|
860
|
+
"With your current role, you can use existing classes but can\u2019t modify them.",
|
|
809
861
|
"elementor"
|
|
810
862
|
)
|
|
811
863
|
},
|
|
@@ -823,6 +875,7 @@ function CssClassItem(props) {
|
|
|
823
875
|
const popupState = (0, import_ui5.usePopupState)({ variant: "popover" });
|
|
824
876
|
const [chipRef, setChipRef] = (0, import_react9.useState)(null);
|
|
825
877
|
const { onDelete, ...chipGroupProps } = chipProps;
|
|
878
|
+
const { userCan } = (0, import_editor_styles_repository4.useUserStylesCapability)();
|
|
826
879
|
const {
|
|
827
880
|
ref,
|
|
828
881
|
isEditing,
|
|
@@ -836,8 +889,8 @@ function CssClassItem(props) {
|
|
|
836
889
|
onError: setError
|
|
837
890
|
});
|
|
838
891
|
const color = error ? "error" : colorProp;
|
|
839
|
-
const providerActions = provider ?
|
|
840
|
-
const allowRename = Boolean(providerActions?.update);
|
|
892
|
+
const providerActions = provider ? import_editor_styles_repository4.stylesRepository.getProviderByKey(provider)?.actions : null;
|
|
893
|
+
const allowRename = Boolean(providerActions?.update) && userCan(provider ?? "")?.update;
|
|
841
894
|
const isShowingState = isActive && meta.state;
|
|
842
895
|
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(
|
|
843
896
|
import_ui5.UnstableChipGroup,
|
|
@@ -903,7 +956,7 @@ function CssClassItem(props) {
|
|
|
903
956
|
), /* @__PURE__ */ React7.createElement(CssClassProvider, { ...classProps, handleRename: openEditMode }, /* @__PURE__ */ React7.createElement(CssClassMenu, { popupState, anchorEl: chipRef, fixed })));
|
|
904
957
|
}
|
|
905
958
|
var validateLabel = (newLabel) => {
|
|
906
|
-
const result = (0,
|
|
959
|
+
const result = (0, import_editor_styles_repository4.validateStyleLabel)(newLabel, "rename");
|
|
907
960
|
if (result.isValid) {
|
|
908
961
|
return null;
|
|
909
962
|
}
|
|
@@ -924,15 +977,16 @@ var EMPTY_OPTION = {
|
|
|
924
977
|
var { Slot: ClassSelectorActionsSlot, inject: injectIntoClassSelectorActions } = (0, import_locations.createLocation)();
|
|
925
978
|
function CssClassSelector() {
|
|
926
979
|
const options12 = useOptions();
|
|
927
|
-
const { value: appliedIds, pushValue: pushAppliedId } = useAppliedClassesIds();
|
|
928
980
|
const { id: activeId, setId: setActiveId } = useStyle();
|
|
929
981
|
const autocompleteRef = (0, import_react10.useRef)(null);
|
|
930
982
|
const [renameError, setRenameError] = (0, import_react10.useState)(null);
|
|
931
983
|
const handleSelect = useHandleSelect();
|
|
932
|
-
const { create, validate, entityName } = useCreateAction(
|
|
933
|
-
const
|
|
934
|
-
const active =
|
|
935
|
-
const showPlaceholder =
|
|
984
|
+
const { create, validate, entityName } = useCreateAction();
|
|
985
|
+
const appliedOptions = useAppliedOptions(options12);
|
|
986
|
+
const active = appliedOptions.find((option) => option.value === activeId) ?? EMPTY_OPTION;
|
|
987
|
+
const showPlaceholder = appliedOptions.every(({ fixed }) => fixed);
|
|
988
|
+
const { userCan } = (0, import_editor_styles_repository5.useUserStylesCapability)();
|
|
989
|
+
const canEdit = active.provider ? userCan(active.provider).updateProps : true;
|
|
936
990
|
return /* @__PURE__ */ React8.createElement(import_ui6.Stack, { p: 2 }, /* @__PURE__ */ React8.createElement(import_ui6.Stack, { direction: "row", gap: 1, alignItems: "center", justifyContent: "space-between" }, /* @__PURE__ */ React8.createElement(import_ui6.FormLabel, { htmlFor: ID, size: "small" }, (0, import_i18n4.__)("Classes", "elementor")), /* @__PURE__ */ React8.createElement(import_ui6.Stack, { direction: "row", gap: 1 }, /* @__PURE__ */ React8.createElement(ClassSelectorActionsSlot, null))), /* @__PURE__ */ React8.createElement(
|
|
937
991
|
import_editor_ui3.WarningInfotip,
|
|
938
992
|
{
|
|
@@ -950,7 +1004,7 @@ function CssClassSelector() {
|
|
|
950
1004
|
size: "tiny",
|
|
951
1005
|
placeholder: showPlaceholder ? (0, import_i18n4.__)("Type class name", "elementor") : void 0,
|
|
952
1006
|
options: options12,
|
|
953
|
-
selected:
|
|
1007
|
+
selected: appliedOptions,
|
|
954
1008
|
entityName,
|
|
955
1009
|
onSelect: handleSelect,
|
|
956
1010
|
onCreate: create ?? void 0,
|
|
@@ -987,6 +1041,15 @@ function CssClassSelector() {
|
|
|
987
1041
|
})
|
|
988
1042
|
}
|
|
989
1043
|
)
|
|
1044
|
+
), !canEdit && /* @__PURE__ */ React8.createElement(
|
|
1045
|
+
import_editor_ui3.InfoAlert,
|
|
1046
|
+
{
|
|
1047
|
+
content: (0, import_i18n4.__)(
|
|
1048
|
+
"With your current role, you can use existing classes but can\u2019t modify them.",
|
|
1049
|
+
"elementor"
|
|
1050
|
+
),
|
|
1051
|
+
sx: { mt: 1 }
|
|
1052
|
+
}
|
|
990
1053
|
));
|
|
991
1054
|
}
|
|
992
1055
|
var EmptyState = ({ searchValue, onClear }) => /* @__PURE__ */ React8.createElement(import_ui6.Box, { sx: { py: 4 } }, /* @__PURE__ */ React8.createElement(
|
|
@@ -1007,7 +1070,7 @@ var updateClassByProvider = (provider, data) => {
|
|
|
1007
1070
|
if (!provider) {
|
|
1008
1071
|
return;
|
|
1009
1072
|
}
|
|
1010
|
-
const providerInstance =
|
|
1073
|
+
const providerInstance = import_editor_styles_repository5.stylesRepository.getProviderByKey(provider);
|
|
1011
1074
|
if (!providerInstance) {
|
|
1012
1075
|
return;
|
|
1013
1076
|
}
|
|
@@ -1016,8 +1079,8 @@ var updateClassByProvider = (provider, data) => {
|
|
|
1016
1079
|
function useOptions() {
|
|
1017
1080
|
const { element } = useElement();
|
|
1018
1081
|
const isProviderEditable = (provider) => !!provider.actions.updateProps;
|
|
1019
|
-
return (0,
|
|
1020
|
-
const isElements = (0,
|
|
1082
|
+
return (0, import_editor_styles_repository5.useProviders)().filter(isProviderEditable).flatMap((provider) => {
|
|
1083
|
+
const isElements = (0, import_editor_styles_repository5.isElementsStylesProvider)(provider.getKey());
|
|
1021
1084
|
const styleDefs = provider.actions.all({ elementId: element.id });
|
|
1022
1085
|
if (isElements && styleDefs.length === 0) {
|
|
1023
1086
|
return [EMPTY_OPTION];
|
|
@@ -1034,18 +1097,13 @@ function useOptions() {
|
|
|
1034
1097
|
});
|
|
1035
1098
|
});
|
|
1036
1099
|
}
|
|
1037
|
-
function useCreateAction({
|
|
1038
|
-
|
|
1039
|
-
setActiveId
|
|
1040
|
-
}) {
|
|
1041
|
-
const [provider, createAction] = (0, import_editor_styles_repository4.useGetStylesRepositoryCreateAction)() ?? [null, null];
|
|
1100
|
+
function useCreateAction() {
|
|
1101
|
+
const [provider, createAction] = useCreateAndApplyClass();
|
|
1042
1102
|
if (!provider || !createAction) {
|
|
1043
1103
|
return {};
|
|
1044
1104
|
}
|
|
1045
|
-
const create = (
|
|
1046
|
-
|
|
1047
|
-
pushAppliedId(createdId);
|
|
1048
|
-
setActiveId(createdId);
|
|
1105
|
+
const create = (classLabel) => {
|
|
1106
|
+
createAction({ classLabel });
|
|
1049
1107
|
};
|
|
1050
1108
|
const validate = (newClassLabel, event) => {
|
|
1051
1109
|
if (hasReachedLimit(provider)) {
|
|
@@ -1057,7 +1115,7 @@ function useCreateAction({
|
|
|
1057
1115
|
)
|
|
1058
1116
|
};
|
|
1059
1117
|
}
|
|
1060
|
-
return (0,
|
|
1118
|
+
return (0, import_editor_styles_repository5.validateStyleLabel)(newClassLabel, event);
|
|
1061
1119
|
};
|
|
1062
1120
|
const entityName = provider.labels.singular && provider.labels.plural ? provider.labels : void 0;
|
|
1063
1121
|
return { create, validate, entityName };
|
|
@@ -1065,36 +1123,18 @@ function useCreateAction({
|
|
|
1065
1123
|
function hasReachedLimit(provider) {
|
|
1066
1124
|
return provider.actions.all().length >= provider.limit;
|
|
1067
1125
|
}
|
|
1068
|
-
function useAppliedOptions(options12
|
|
1069
|
-
const
|
|
1070
|
-
const
|
|
1071
|
-
|
|
1126
|
+
function useAppliedOptions(options12) {
|
|
1127
|
+
const { element } = useElement();
|
|
1128
|
+
const currentClassesProp = useClassesProp();
|
|
1129
|
+
const appliedIds = (0, import_editor_elements2.useElementSetting)(element.id, currentClassesProp)?.value || [];
|
|
1130
|
+
const appliedOptions = options12.filter((option) => option.value && appliedIds.includes(option.value));
|
|
1131
|
+
const hasElementsProviderStyleApplied = appliedOptions.some(
|
|
1132
|
+
(option) => option.provider && (0, import_editor_styles_repository5.isElementsStylesProvider)(option.provider)
|
|
1072
1133
|
);
|
|
1073
1134
|
if (!hasElementsProviderStyleApplied) {
|
|
1074
|
-
|
|
1135
|
+
appliedOptions.unshift(EMPTY_OPTION);
|
|
1075
1136
|
}
|
|
1076
|
-
return
|
|
1077
|
-
}
|
|
1078
|
-
function useAppliedClassesIds() {
|
|
1079
|
-
const { element } = useElement();
|
|
1080
|
-
const currentClassesProp = useClassesProp();
|
|
1081
|
-
const value = (0, import_editor_elements2.useElementSetting)(element.id, currentClassesProp)?.value || [];
|
|
1082
|
-
const setValue = (ids) => {
|
|
1083
|
-
(0, import_editor_elements2.updateElementSettings)({
|
|
1084
|
-
id: element.id,
|
|
1085
|
-
props: {
|
|
1086
|
-
[currentClassesProp]: import_editor_props2.classesPropTypeUtil.create(ids)
|
|
1087
|
-
}
|
|
1088
|
-
});
|
|
1089
|
-
};
|
|
1090
|
-
const pushValue = (id) => {
|
|
1091
|
-
const ids = (0, import_editor_elements2.getElementSetting)(element.id, currentClassesProp)?.value || [];
|
|
1092
|
-
setValue([...ids, id]);
|
|
1093
|
-
};
|
|
1094
|
-
return {
|
|
1095
|
-
value,
|
|
1096
|
-
pushValue
|
|
1097
|
-
};
|
|
1137
|
+
return appliedOptions;
|
|
1098
1138
|
}
|
|
1099
1139
|
function useHandleSelect() {
|
|
1100
1140
|
const apply = useApplyClass();
|
|
@@ -1268,13 +1308,6 @@ var useDefaultPanelSettings = () => {
|
|
|
1268
1308
|
var import_react14 = require("react");
|
|
1269
1309
|
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
1270
1310
|
var import_session = require("@elementor/session");
|
|
1271
|
-
|
|
1272
|
-
// src/sync/experiments-flags.ts
|
|
1273
|
-
var EXPERIMENTAL_FEATURES = {
|
|
1274
|
-
V_3_30: "e_v_3_30"
|
|
1275
|
-
};
|
|
1276
|
-
|
|
1277
|
-
// src/hooks/use-state-by-element.ts
|
|
1278
1311
|
var useStateByElement = (key, initialValue) => {
|
|
1279
1312
|
const { element } = useElement();
|
|
1280
1313
|
const isFeatureActive = (0, import_editor_v1_adapters2.isExperimentActive)(EXPERIMENTAL_FEATURES.V_3_30);
|
|
@@ -1468,7 +1501,7 @@ var Control2 = ({ control }) => {
|
|
|
1468
1501
|
// src/components/style-tab.tsx
|
|
1469
1502
|
var React78 = __toESM(require("react"));
|
|
1470
1503
|
var import_react27 = require("react");
|
|
1471
|
-
var
|
|
1504
|
+
var import_editor_props9 = require("@elementor/editor-props");
|
|
1472
1505
|
var import_editor_responsive3 = require("@elementor/editor-responsive");
|
|
1473
1506
|
var import_editor_v1_adapters12 = require("@elementor/editor-v1-adapters");
|
|
1474
1507
|
var import_session4 = require("@elementor/session");
|
|
@@ -1479,10 +1512,10 @@ var import_i18n52 = require("@wordpress/i18n");
|
|
|
1479
1512
|
var React19 = __toESM(require("react"));
|
|
1480
1513
|
var import_react17 = require("react");
|
|
1481
1514
|
var import_editor_elements4 = require("@elementor/editor-elements");
|
|
1482
|
-
var
|
|
1515
|
+
var import_editor_props4 = require("@elementor/editor-props");
|
|
1483
1516
|
var import_editor_responsive = require("@elementor/editor-responsive");
|
|
1484
1517
|
var import_editor_styles = require("@elementor/editor-styles");
|
|
1485
|
-
var
|
|
1518
|
+
var import_editor_styles_repository6 = require("@elementor/editor-styles-repository");
|
|
1486
1519
|
|
|
1487
1520
|
// src/hooks/use-styles-rerender.ts
|
|
1488
1521
|
var import_react16 = require("react");
|
|
@@ -1493,10 +1526,10 @@ var useStylesRerender = () => {
|
|
|
1493
1526
|
};
|
|
1494
1527
|
|
|
1495
1528
|
// src/styles-inheritance/create-styles-inheritance.ts
|
|
1496
|
-
var
|
|
1529
|
+
var import_editor_props3 = require("@elementor/editor-props");
|
|
1497
1530
|
|
|
1498
1531
|
// src/styles-inheritance/create-snapshots-manager.ts
|
|
1499
|
-
var
|
|
1532
|
+
var import_editor_props2 = require("@elementor/editor-props");
|
|
1500
1533
|
|
|
1501
1534
|
// src/styles-inheritance/utils.ts
|
|
1502
1535
|
var DEFAULT_STATE = "normal";
|
|
@@ -1588,7 +1621,7 @@ function buildInitialSnapshotFromStyles(styles) {
|
|
|
1588
1621
|
variant: { props }
|
|
1589
1622
|
} = styleData;
|
|
1590
1623
|
Object.entries(props).forEach(([key, value]) => {
|
|
1591
|
-
const filteredValue = (0,
|
|
1624
|
+
const filteredValue = (0, import_editor_props2.filterEmptyValues)(value);
|
|
1592
1625
|
if (filteredValue === null) {
|
|
1593
1626
|
return;
|
|
1594
1627
|
}
|
|
@@ -1634,7 +1667,7 @@ function createStylesInheritance(styleDefs, breakpointsRoot) {
|
|
|
1634
1667
|
inheritanceChain = inheritanceChain.map(({ value: styleValue, ...rest }) => ({
|
|
1635
1668
|
...rest,
|
|
1636
1669
|
value: getValueByPath(styleValue, nextFields, filterPropType)
|
|
1637
|
-
})).filter(({ value: styleValue }) => !(0,
|
|
1670
|
+
})).filter(({ value: styleValue }) => !(0, import_editor_props3.isEmpty)(styleValue));
|
|
1638
1671
|
}
|
|
1639
1672
|
return inheritanceChain;
|
|
1640
1673
|
}
|
|
@@ -1676,7 +1709,7 @@ function getValueByPath(value, path, filterPropType) {
|
|
|
1676
1709
|
if (!currentScope) {
|
|
1677
1710
|
return null;
|
|
1678
1711
|
}
|
|
1679
|
-
if ((0,
|
|
1712
|
+
if ((0, import_editor_props3.isTransformable)(currentScope)) {
|
|
1680
1713
|
return currentScope.value?.[key] ?? null;
|
|
1681
1714
|
}
|
|
1682
1715
|
if (typeof currentScope === "object") {
|
|
@@ -1686,7 +1719,7 @@ function getValueByPath(value, path, filterPropType) {
|
|
|
1686
1719
|
}, value);
|
|
1687
1720
|
}
|
|
1688
1721
|
function shouldUseOriginalValue(filterPropType, value) {
|
|
1689
|
-
return !!filterPropType && (0,
|
|
1722
|
+
return !!filterPropType && (0, import_editor_props3.isTransformable)(value) && filterPropType.key !== value.$$type;
|
|
1690
1723
|
}
|
|
1691
1724
|
var getFilterPropType = (propType, path) => {
|
|
1692
1725
|
if (!propType || propType.kind !== "union") {
|
|
@@ -1744,8 +1777,8 @@ var useAppliedStyles = () => {
|
|
|
1744
1777
|
const baseStyles = useBaseStyles();
|
|
1745
1778
|
useStylesRerender();
|
|
1746
1779
|
const classesProp = (0, import_editor_elements4.useElementSetting)(element.id, currentClassesProp);
|
|
1747
|
-
const appliedStyles =
|
|
1748
|
-
return
|
|
1780
|
+
const appliedStyles = import_editor_props4.classesPropTypeUtil.extract(classesProp) ?? [];
|
|
1781
|
+
return import_editor_styles_repository6.stylesRepository.all().filter((style) => [...baseStyles, ...appliedStyles].includes(style.id));
|
|
1749
1782
|
};
|
|
1750
1783
|
var useBaseStyles = () => {
|
|
1751
1784
|
const { elementType } = useElement();
|
|
@@ -1761,7 +1794,7 @@ function useActiveStyleDefId(classProp) {
|
|
|
1761
1794
|
"active-style-id",
|
|
1762
1795
|
null
|
|
1763
1796
|
);
|
|
1764
|
-
const appliedClassesIds =
|
|
1797
|
+
const appliedClassesIds = useAppliedClassesIds(classProp)?.value || [];
|
|
1765
1798
|
const fallback = useFirstAppliedClass(appliedClassesIds);
|
|
1766
1799
|
const activeAndAppliedClassId = useActiveAndAppliedClassId(activeStyledDefId, appliedClassesIds);
|
|
1767
1800
|
return [activeAndAppliedClassId || fallback?.id || null, setActiveStyledDefId];
|
|
@@ -1771,7 +1804,7 @@ function useFirstAppliedClass(appliedClassesIds) {
|
|
|
1771
1804
|
const stylesDefs = (0, import_editor_elements5.getElementStyles)(element.id) ?? {};
|
|
1772
1805
|
return Object.values(stylesDefs).find((styleDef) => appliedClassesIds.includes(styleDef.id));
|
|
1773
1806
|
}
|
|
1774
|
-
function
|
|
1807
|
+
function useAppliedClassesIds(classProp) {
|
|
1775
1808
|
const { element } = useElement();
|
|
1776
1809
|
return (0, import_editor_elements5.useElementSetting)(element.id, classProp);
|
|
1777
1810
|
}
|
|
@@ -1793,7 +1826,7 @@ var import_editor_styles3 = require("@elementor/editor-styles");
|
|
|
1793
1826
|
var import_react18 = require("react");
|
|
1794
1827
|
var import_editor_elements6 = require("@elementor/editor-elements");
|
|
1795
1828
|
var import_editor_styles2 = require("@elementor/editor-styles");
|
|
1796
|
-
var
|
|
1829
|
+
var import_editor_styles_repository7 = require("@elementor/editor-styles-repository");
|
|
1797
1830
|
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
1798
1831
|
var import_i18n5 = require("@wordpress/i18n");
|
|
1799
1832
|
function useStylesFields(propNames) {
|
|
@@ -1850,7 +1883,7 @@ function useUndoableCreateElementStyle() {
|
|
|
1850
1883
|
do: (payload) => {
|
|
1851
1884
|
return (0, import_editor_elements6.createElementStyle)({
|
|
1852
1885
|
...payload,
|
|
1853
|
-
label:
|
|
1886
|
+
label: import_editor_styles_repository7.ELEMENTS_STYLES_RESERVED_LABEL
|
|
1854
1887
|
});
|
|
1855
1888
|
},
|
|
1856
1889
|
undo: ({ elementId }, styleId) => {
|
|
@@ -1860,7 +1893,7 @@ function useUndoableCreateElementStyle() {
|
|
|
1860
1893
|
return (0, import_editor_elements6.createElementStyle)({
|
|
1861
1894
|
...payload,
|
|
1862
1895
|
styleId,
|
|
1863
|
-
label:
|
|
1896
|
+
label: import_editor_styles_repository7.ELEMENTS_STYLES_RESERVED_LABEL
|
|
1864
1897
|
});
|
|
1865
1898
|
}
|
|
1866
1899
|
},
|
|
@@ -1928,8 +1961,8 @@ function useStylesField(propName) {
|
|
|
1928
1961
|
// src/styles-inheritance/styles-inheritance-indicator.tsx
|
|
1929
1962
|
var React26 = __toESM(require("react"));
|
|
1930
1963
|
var import_editor_controls5 = require("@elementor/editor-controls");
|
|
1931
|
-
var
|
|
1932
|
-
var
|
|
1964
|
+
var import_editor_props5 = require("@elementor/editor-props");
|
|
1965
|
+
var import_editor_styles_repository10 = require("@elementor/editor-styles-repository");
|
|
1933
1966
|
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
1934
1967
|
var import_ui23 = require("@elementor/ui");
|
|
1935
1968
|
var import_i18n9 = require("@wordpress/i18n");
|
|
@@ -2017,13 +2050,13 @@ var BreakpointIcon = ({ breakpoint }) => {
|
|
|
2017
2050
|
|
|
2018
2051
|
// src/styles-inheritance/components/label-chip.tsx
|
|
2019
2052
|
var React22 = __toESM(require("react"));
|
|
2020
|
-
var
|
|
2053
|
+
var import_editor_styles_repository8 = require("@elementor/editor-styles-repository");
|
|
2021
2054
|
var import_icons6 = require("@elementor/icons");
|
|
2022
2055
|
var import_ui19 = require("@elementor/ui");
|
|
2023
2056
|
var import_i18n6 = require("@wordpress/i18n");
|
|
2024
2057
|
var SIZE4 = "tiny";
|
|
2025
2058
|
var LabelChip = ({ displayLabel, provider, chipColor }) => {
|
|
2026
|
-
const isBaseStyle = provider ===
|
|
2059
|
+
const isBaseStyle = provider === import_editor_styles_repository8.ELEMENTS_BASE_STYLES_PROVIDER_KEY;
|
|
2027
2060
|
const chipIcon = isBaseStyle ? /* @__PURE__ */ React22.createElement(import_ui19.Tooltip, { title: (0, import_i18n6.__)("Inherited from base styles", "elementor"), placement: "top" }, /* @__PURE__ */ React22.createElement(import_icons6.InfoCircleIcon, { fontSize: SIZE4 })) : void 0;
|
|
2028
2061
|
return /* @__PURE__ */ React22.createElement(
|
|
2029
2062
|
import_ui19.Chip,
|
|
@@ -2078,7 +2111,7 @@ var ActionIcons = () => /* @__PURE__ */ React24.createElement(import_ui21.Box, {
|
|
|
2078
2111
|
|
|
2079
2112
|
// src/styles-inheritance/hooks/use-normalized-inheritance-chain-items.tsx
|
|
2080
2113
|
var import_react20 = require("react");
|
|
2081
|
-
var
|
|
2114
|
+
var import_editor_styles_repository9 = require("@elementor/editor-styles-repository");
|
|
2082
2115
|
var import_i18n7 = require("@wordpress/i18n");
|
|
2083
2116
|
var MAXIMUM_ITEMS = 2;
|
|
2084
2117
|
var useNormalizedInheritanceChainItems = (inheritanceChain, bind, resolve) => {
|
|
@@ -2090,7 +2123,7 @@ var useNormalizedInheritanceChainItems = (inheritanceChain, bind, resolve) => {
|
|
|
2090
2123
|
);
|
|
2091
2124
|
const validItems = normalizedItems.map((item) => ({
|
|
2092
2125
|
...item,
|
|
2093
|
-
displayLabel:
|
|
2126
|
+
displayLabel: import_editor_styles_repository9.ELEMENTS_BASE_STYLES_PROVIDER_KEY !== item.provider ? item.displayLabel : (0, import_i18n7.__)("Base", "elementor")
|
|
2094
2127
|
})).filter((item) => !item.value || item.displayLabel !== "").slice(0, MAXIMUM_ITEMS);
|
|
2095
2128
|
setItems(validItems);
|
|
2096
2129
|
})();
|
|
@@ -2136,7 +2169,7 @@ var getTransformedValue = async (item, bind, resolve) => {
|
|
|
2136
2169
|
};
|
|
2137
2170
|
var getChipColor = (item) => {
|
|
2138
2171
|
const { provider = "", style } = item;
|
|
2139
|
-
if (provider ===
|
|
2172
|
+
if (provider === import_editor_styles_repository9.ELEMENTS_BASE_STYLES_PROVIDER_KEY) {
|
|
2140
2173
|
return "default";
|
|
2141
2174
|
}
|
|
2142
2175
|
if (style?.label === "local") {
|
|
@@ -2299,9 +2332,9 @@ var StylesInheritanceIndicator = () => {
|
|
|
2299
2332
|
}
|
|
2300
2333
|
}) => style.id === currentStyleId && breakpoint === currentStyleMeta.breakpoint && state === currentStyleMeta.state
|
|
2301
2334
|
);
|
|
2302
|
-
const hasValue = !(0,
|
|
2335
|
+
const hasValue = !(0, import_editor_props5.isEmpty)(currentItem?.value);
|
|
2303
2336
|
const [actualStyle] = inheritanceChain;
|
|
2304
|
-
if (actualStyle.provider ===
|
|
2337
|
+
if (actualStyle.provider === import_editor_styles_repository10.ELEMENTS_BASE_STYLES_PROVIDER_KEY) {
|
|
2305
2338
|
return null;
|
|
2306
2339
|
}
|
|
2307
2340
|
const isFinalValue = currentItem === actualStyle;
|
|
@@ -2336,7 +2369,7 @@ var getVariant = ({
|
|
|
2336
2369
|
currentStyleProvider
|
|
2337
2370
|
}) => {
|
|
2338
2371
|
if (isFinalValue) {
|
|
2339
|
-
return (0,
|
|
2372
|
+
return (0, import_editor_styles_repository10.isElementsStylesProvider)(currentStyleProvider?.getKey?.()) ? "local" : "global";
|
|
2340
2373
|
}
|
|
2341
2374
|
if (hasValue) {
|
|
2342
2375
|
return "overridden";
|
|
@@ -2466,7 +2499,7 @@ var BorderStyleField = () => {
|
|
|
2466
2499
|
// src/components/style-sections/border-section/border-width-field.tsx
|
|
2467
2500
|
var React34 = __toESM(require("react"));
|
|
2468
2501
|
var import_editor_controls11 = require("@elementor/editor-controls");
|
|
2469
|
-
var
|
|
2502
|
+
var import_editor_props6 = require("@elementor/editor-props");
|
|
2470
2503
|
var import_icons8 = require("@elementor/icons");
|
|
2471
2504
|
var import_ui29 = require("@elementor/ui");
|
|
2472
2505
|
var import_i18n12 = require("@wordpress/i18n");
|
|
@@ -2503,7 +2536,7 @@ var BorderWidthField = () => {
|
|
|
2503
2536
|
label: (0, import_i18n12.__)("Border width", "elementor"),
|
|
2504
2537
|
icon: /* @__PURE__ */ React34.createElement(import_icons8.SideAllIcon, { fontSize: "tiny" }),
|
|
2505
2538
|
tooltipLabel: (0, import_i18n12.__)("Adjust borders", "elementor"),
|
|
2506
|
-
multiSizePropTypeUtil:
|
|
2539
|
+
multiSizePropTypeUtil: import_editor_props6.borderWidthPropTypeUtil
|
|
2507
2540
|
}
|
|
2508
2541
|
));
|
|
2509
2542
|
};
|
|
@@ -2546,7 +2579,7 @@ var BorderField = () => {
|
|
|
2546
2579
|
// src/components/style-sections/border-section/border-radius-field.tsx
|
|
2547
2580
|
var React36 = __toESM(require("react"));
|
|
2548
2581
|
var import_editor_controls12 = require("@elementor/editor-controls");
|
|
2549
|
-
var
|
|
2582
|
+
var import_editor_props7 = require("@elementor/editor-props");
|
|
2550
2583
|
var import_icons9 = require("@elementor/icons");
|
|
2551
2584
|
var import_ui30 = require("@elementor/ui");
|
|
2552
2585
|
var import_i18n14 = require("@wordpress/i18n");
|
|
@@ -2589,7 +2622,7 @@ var BorderRadiusField = () => {
|
|
|
2589
2622
|
label: (0, import_i18n14.__)("Border radius", "elementor"),
|
|
2590
2623
|
icon: /* @__PURE__ */ React36.createElement(import_icons9.BorderCornersIcon, { fontSize: "tiny" }),
|
|
2591
2624
|
tooltipLabel: (0, import_i18n14.__)("Adjust corners", "elementor"),
|
|
2592
|
-
multiSizePropTypeUtil:
|
|
2625
|
+
multiSizePropTypeUtil: import_editor_props7.borderRadiusPropTypeUtil
|
|
2593
2626
|
}
|
|
2594
2627
|
));
|
|
2595
2628
|
};
|
|
@@ -3031,7 +3064,7 @@ var getGroupControlValue = (order) => {
|
|
|
3031
3064
|
var React46 = __toESM(require("react"));
|
|
3032
3065
|
var import_react24 = require("react");
|
|
3033
3066
|
var import_editor_controls20 = require("@elementor/editor-controls");
|
|
3034
|
-
var
|
|
3067
|
+
var import_editor_props8 = require("@elementor/editor-props");
|
|
3035
3068
|
var import_icons15 = require("@elementor/icons");
|
|
3036
3069
|
var import_ui38 = require("@elementor/ui");
|
|
3037
3070
|
var import_i18n21 = require("@wordpress/i18n");
|
|
@@ -3077,7 +3110,7 @@ var FlexSizeField = () => {
|
|
|
3077
3110
|
if (group === "flex-grow") {
|
|
3078
3111
|
setFields({
|
|
3079
3112
|
"flex-basis": null,
|
|
3080
|
-
"flex-grow":
|
|
3113
|
+
"flex-grow": import_editor_props8.numberPropTypeUtil.create(DEFAULT),
|
|
3081
3114
|
"flex-shrink": null
|
|
3082
3115
|
});
|
|
3083
3116
|
return;
|
|
@@ -3085,7 +3118,7 @@ var FlexSizeField = () => {
|
|
|
3085
3118
|
setFields({
|
|
3086
3119
|
"flex-basis": null,
|
|
3087
3120
|
"flex-grow": null,
|
|
3088
|
-
"flex-shrink":
|
|
3121
|
+
"flex-shrink": import_editor_props8.numberPropTypeUtil.create(DEFAULT)
|
|
3089
3122
|
});
|
|
3090
3123
|
};
|
|
3091
3124
|
return /* @__PURE__ */ React46.createElement(import_ui38.DirectionProvider, { rtl: isSiteRtl }, /* @__PURE__ */ React46.createElement(import_ui38.ThemeProvider, null, /* @__PURE__ */ React46.createElement(SectionContent, null, /* @__PURE__ */ React46.createElement(import_ui38.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React46.createElement(StylesField, { bind: activeGroup ?? "" }, /* @__PURE__ */ React46.createElement(import_ui38.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React46.createElement(ControlLabel, null, (0, import_i18n21.__)("Size", "elementor"))), /* @__PURE__ */ React46.createElement(import_ui38.Grid, { item: true, xs: 6, sx: { display: "flex", justifyContent: "end" } }, /* @__PURE__ */ React46.createElement(
|
|
@@ -3937,7 +3970,7 @@ function ClassesHeader({ children }) {
|
|
|
3937
3970
|
function useCurrentClassesProp() {
|
|
3938
3971
|
const { elementType } = useElement();
|
|
3939
3972
|
const prop = Object.entries(elementType.propsSchema).find(
|
|
3940
|
-
([, propType]) => propType.kind === "plain" && propType.key ===
|
|
3973
|
+
([, propType]) => propType.kind === "plain" && propType.key === import_editor_props9.CLASSES_PROP_KEY
|
|
3941
3974
|
);
|
|
3942
3975
|
if (!prop) {
|
|
3943
3976
|
throw new Error("Element does not have a classes prop");
|
|
@@ -4087,7 +4120,7 @@ var getAtomicDynamicTags = () => {
|
|
|
4087
4120
|
};
|
|
4088
4121
|
|
|
4089
4122
|
// src/dynamics/utils.ts
|
|
4090
|
-
var
|
|
4123
|
+
var import_editor_props10 = require("@elementor/editor-props");
|
|
4091
4124
|
var import_schema = require("@elementor/schema");
|
|
4092
4125
|
var DYNAMIC_PROP_TYPE_KEY = "dynamic";
|
|
4093
4126
|
var isDynamicPropType = (prop) => prop.key === DYNAMIC_PROP_TYPE_KEY;
|
|
@@ -4096,12 +4129,12 @@ var getDynamicPropType = (propType) => {
|
|
|
4096
4129
|
return dynamicPropType && isDynamicPropType(dynamicPropType) ? dynamicPropType : null;
|
|
4097
4130
|
};
|
|
4098
4131
|
var isDynamicPropValue = (prop) => {
|
|
4099
|
-
return (0,
|
|
4132
|
+
return (0, import_editor_props10.isTransformable)(prop) && prop.$$type === DYNAMIC_PROP_TYPE_KEY;
|
|
4100
4133
|
};
|
|
4101
4134
|
var supportsDynamic = (propType) => {
|
|
4102
4135
|
return !!getDynamicPropType(propType);
|
|
4103
4136
|
};
|
|
4104
|
-
var dynamicPropTypeUtil = (0,
|
|
4137
|
+
var dynamicPropTypeUtil = (0, import_editor_props10.createPropUtils)(
|
|
4105
4138
|
DYNAMIC_PROP_TYPE_KEY,
|
|
4106
4139
|
import_schema.z.strictObject({
|
|
4107
4140
|
name: import_schema.z.string(),
|
|
@@ -4351,7 +4384,7 @@ var Control3 = ({ control }) => {
|
|
|
4351
4384
|
|
|
4352
4385
|
// src/dynamics/dynamic-transformer.ts
|
|
4353
4386
|
var import_editor_canvas3 = require("@elementor/editor-canvas");
|
|
4354
|
-
var
|
|
4387
|
+
var import_editor_props11 = require("@elementor/editor-props");
|
|
4355
4388
|
|
|
4356
4389
|
// src/dynamics/errors.ts
|
|
4357
4390
|
var import_utils8 = require("@elementor/utils");
|
|
@@ -4369,7 +4402,7 @@ var dynamicTransformer = (0, import_editor_canvas3.createTransformer)((value) =>
|
|
|
4369
4402
|
});
|
|
4370
4403
|
function simpleTransform(props) {
|
|
4371
4404
|
const transformed = Object.entries(props).map(([settingKey, settingValue]) => {
|
|
4372
|
-
const value = (0,
|
|
4405
|
+
const value = (0, import_editor_props11.isTransformable)(settingValue) ? settingValue.value : settingValue;
|
|
4373
4406
|
return [settingKey, value];
|
|
4374
4407
|
});
|
|
4375
4408
|
return Object.fromEntries(transformed);
|