@elementor/editor-editing-panel 1.27.0 → 1.28.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 +38 -0
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +173 -134
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +146 -107
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
- package/src/components/css-classes/css-class-item.tsx +8 -10
- package/src/components/css-classes/css-class-menu.tsx +7 -5
- package/src/components/css-classes/css-class-selector.tsx +22 -22
- package/src/components/multi-combobox.tsx +3 -0
- package/src/components/style-sections/layout-section/display-field.tsx +34 -28
- package/src/components/style-sections/layout-section/layout-section.tsx +14 -2
- package/src/components/style-tab.tsx +2 -19
- package/src/contexts/style-context.tsx +1 -1
- package/src/controls-registry/styles-field.tsx +9 -2
- package/src/hooks/use-active-style-def-id.ts +36 -0
- package/src/hooks/use-styles-fields.ts +7 -7
- package/src/index.ts +1 -3
- package/src/init.ts +1 -1
- package/src/styles-inheritance/create-snapshots-manager.ts +8 -1
- package/src/styles-inheritance/create-styles-inheritance.ts +1 -1
- package/src/styles-inheritance/styles-inheritance-indicator.tsx +2 -2
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
init: () => init2,
|
|
33
34
|
injectIntoClassSelectorActions: () => injectIntoClassSelectorActions,
|
|
34
35
|
replaceControl: () => replaceControl,
|
|
35
36
|
useBoundProp: () => import_editor_controls50.useBoundProp,
|
|
@@ -125,7 +126,7 @@ function useStyle() {
|
|
|
125
126
|
}
|
|
126
127
|
function getProviderByStyleId(styleId) {
|
|
127
128
|
const styleProvider = import_editor_styles_repository.stylesRepository.getProviders().find((provider) => {
|
|
128
|
-
return provider.actions.
|
|
129
|
+
return provider.actions.all().find((style) => style.id === styleId);
|
|
129
130
|
});
|
|
130
131
|
return styleProvider ?? null;
|
|
131
132
|
}
|
|
@@ -139,6 +140,7 @@ function MultiCombobox({
|
|
|
139
140
|
selected,
|
|
140
141
|
options: options13,
|
|
141
142
|
onSelect,
|
|
143
|
+
placeholder,
|
|
142
144
|
...props
|
|
143
145
|
}) {
|
|
144
146
|
const filter = useFilterOptions();
|
|
@@ -161,6 +163,7 @@ function MultiCombobox({
|
|
|
161
163
|
import_ui.TextField,
|
|
162
164
|
{
|
|
163
165
|
...params,
|
|
166
|
+
placeholder,
|
|
164
167
|
sx: (theme) => ({
|
|
165
168
|
".MuiAutocomplete-inputRoot.MuiInputBase-adornedStart": {
|
|
166
169
|
paddingLeft: theme.spacing(0.25),
|
|
@@ -318,7 +321,7 @@ var StyleIndicator = (0, import_ui2.styled)("div", {
|
|
|
318
321
|
var STATES = ["hover", "focus", "active"];
|
|
319
322
|
function CssClassMenu({ styleId, provider, popupState, handleRename, anchorEl }) {
|
|
320
323
|
const styledStates = useStyledStates(styleId);
|
|
321
|
-
const indicatorVariant = provider
|
|
324
|
+
const indicatorVariant = !provider || (0, import_editor_styles_repository2.isElementsStylesProvider)(provider) ? "local" : "global";
|
|
322
325
|
const handleKeyDown = (e) => {
|
|
323
326
|
e.stopPropagation();
|
|
324
327
|
};
|
|
@@ -336,7 +339,8 @@ function CssClassMenu({ styleId, provider, popupState, handleRename, anchorEl })
|
|
|
336
339
|
horizontal: "left",
|
|
337
340
|
vertical: -4
|
|
338
341
|
},
|
|
339
|
-
onKeyDown: handleKeyDown
|
|
342
|
+
onKeyDown: handleKeyDown,
|
|
343
|
+
disableAutoFocusItem: true
|
|
340
344
|
},
|
|
341
345
|
getMenuItemsByProvider({ provider, styleId, handleRename, closeMenu: popupState.close }),
|
|
342
346
|
/* @__PURE__ */ React5.createElement(import_ui3.MenuSubheader, { sx: { typography: "caption", color: "text.secondary", pb: 0.5, pt: 1 } }, (0, import_i18n.__)("States", "elementor")),
|
|
@@ -379,7 +383,7 @@ function getMenuItemsByProvider({
|
|
|
379
383
|
handleRename,
|
|
380
384
|
closeMenu
|
|
381
385
|
}) {
|
|
382
|
-
if (!styleId) {
|
|
386
|
+
if (!styleId || !provider) {
|
|
383
387
|
return [];
|
|
384
388
|
}
|
|
385
389
|
const providerInstance = import_editor_styles_repository2.stylesRepository.getProviderByKey(provider);
|
|
@@ -469,8 +473,8 @@ function RenameClassMenuItem({
|
|
|
469
473
|
var CHIP_SIZE = "tiny";
|
|
470
474
|
function CssClassItem({
|
|
471
475
|
id,
|
|
472
|
-
label,
|
|
473
476
|
provider,
|
|
477
|
+
label,
|
|
474
478
|
isActive,
|
|
475
479
|
color: colorProp,
|
|
476
480
|
icon,
|
|
@@ -494,7 +498,7 @@ function CssClassItem({
|
|
|
494
498
|
validation: validateLabel
|
|
495
499
|
});
|
|
496
500
|
const color = error ? "error" : colorProp;
|
|
497
|
-
const providerActions = import_editor_styles_repository3.stylesRepository.getProviderByKey(provider)?.actions;
|
|
501
|
+
const providerActions = provider ? import_editor_styles_repository3.stylesRepository.getProviderByKey(provider)?.actions : null;
|
|
498
502
|
const allowRename = Boolean(providerActions?.update);
|
|
499
503
|
const isShowingState = isActive && meta.state;
|
|
500
504
|
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(
|
|
@@ -569,13 +573,11 @@ function CssClassItem({
|
|
|
569
573
|
));
|
|
570
574
|
}
|
|
571
575
|
var validateLabel = (newLabel) => {
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
if (import_editor_styles_repository3.stylesRepository.isLabelExist(newLabel)) {
|
|
576
|
-
return (0, import_i18n2.__)("Name exists", "elementor");
|
|
576
|
+
const result = (0, import_editor_styles_repository3.validateStyleLabel)(newLabel);
|
|
577
|
+
if (result.isValid) {
|
|
578
|
+
return null;
|
|
577
579
|
}
|
|
578
|
-
return
|
|
580
|
+
return result.error;
|
|
579
581
|
};
|
|
580
582
|
|
|
581
583
|
// src/components/css-classes/css-class-selector.tsx
|
|
@@ -587,7 +589,7 @@ var EMPTY_OPTION = {
|
|
|
587
589
|
fixed: true,
|
|
588
590
|
color: "accent",
|
|
589
591
|
icon: /* @__PURE__ */ React7.createElement(import_icons2.MapPinIcon, null),
|
|
590
|
-
provider:
|
|
592
|
+
provider: null
|
|
591
593
|
};
|
|
592
594
|
var { Slot: ClassSelectorActionsSlot, inject: injectIntoClassSelectorActions } = (0, import_locations.createLocation)();
|
|
593
595
|
function CssClassSelector() {
|
|
@@ -598,11 +600,13 @@ function CssClassSelector() {
|
|
|
598
600
|
const handleApply = useHandleApply(appliedIds, setAppliedIds);
|
|
599
601
|
const applied = useAppliedOptions(options13, appliedIds);
|
|
600
602
|
const active = applied.find((option) => option.value === activeId) ?? EMPTY_OPTION;
|
|
601
|
-
|
|
603
|
+
const showPlaceholder = applied.every(({ fixed }) => fixed);
|
|
604
|
+
return /* @__PURE__ */ React7.createElement(import_ui5.Stack, { p: 2 }, /* @__PURE__ */ React7.createElement(import_ui5.Stack, { direction: "row", gap: 1, alignItems: "center", justifyContent: "space-between" }, /* @__PURE__ */ React7.createElement(import_ui5.FormLabel, { htmlFor: ID, size: "small" }, (0, import_i18n3.__)("Classes", "elementor")), /* @__PURE__ */ React7.createElement(import_ui5.Stack, { direction: "row", gap: 1 }, /* @__PURE__ */ React7.createElement(ClassSelectorActionsSlot, null))), /* @__PURE__ */ React7.createElement(
|
|
602
605
|
MultiCombobox,
|
|
603
606
|
{
|
|
604
607
|
id: ID,
|
|
605
608
|
size: "tiny",
|
|
609
|
+
placeholder: showPlaceholder ? (0, import_i18n3.__)("Type to search/add global classes", "elementor") : void 0,
|
|
606
610
|
options: options13,
|
|
607
611
|
selected: applied,
|
|
608
612
|
onSelect: handleApply,
|
|
@@ -638,6 +642,9 @@ function CssClassSelector() {
|
|
|
638
642
|
));
|
|
639
643
|
}
|
|
640
644
|
var updateClassByProvider = (provider, data) => {
|
|
645
|
+
if (!provider) {
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
641
648
|
const providerInstance = import_editor_styles_repository4.stylesRepository.getProviderByKey(provider);
|
|
642
649
|
if (!providerInstance) {
|
|
643
650
|
return;
|
|
@@ -648,8 +655,8 @@ function useOptions() {
|
|
|
648
655
|
const { element } = useElement();
|
|
649
656
|
const isProviderEditable = (provider) => !!provider.actions.updateProps;
|
|
650
657
|
return (0, import_editor_styles_repository4.useProviders)().filter(isProviderEditable).flatMap((provider) => {
|
|
651
|
-
const isElements =
|
|
652
|
-
const styleDefs = provider.actions.
|
|
658
|
+
const isElements = (0, import_editor_styles_repository4.isElementsStylesProvider)(provider.getKey());
|
|
659
|
+
const styleDefs = provider.actions.all({ elementId: element.id });
|
|
653
660
|
if (isElements && styleDefs.length === 0) {
|
|
654
661
|
return [EMPTY_OPTION];
|
|
655
662
|
}
|
|
@@ -660,7 +667,7 @@ function useOptions() {
|
|
|
660
667
|
fixed: isElements,
|
|
661
668
|
color: isElements ? "accent" : "global",
|
|
662
669
|
icon: isElements ? /* @__PURE__ */ React7.createElement(import_icons2.MapPinIcon, null) : null,
|
|
663
|
-
provider: provider.
|
|
670
|
+
provider: provider.getKey(),
|
|
664
671
|
// translators: %s is the plural label of the provider (e.g "Existing classes").
|
|
665
672
|
group: (0, import_i18n3.__)("Existing %s", "elementor").replace("%s", provider.labels?.plural ?? "")
|
|
666
673
|
};
|
|
@@ -677,7 +684,7 @@ function useCreateActions({
|
|
|
677
684
|
label: (value) => (0, import_i18n3.__)('Create "%s"', "elementor").replace("%s", value),
|
|
678
685
|
// translators: %s is the singular label of css class provider (e.g "CSS Class").
|
|
679
686
|
group: (0, import_i18n3.__)("Create a new %s", "elementor").replace("%s", provider.labels?.singular ?? ""),
|
|
680
|
-
condition: (_, inputValue) =>
|
|
687
|
+
condition: (_, inputValue) => (0, import_editor_styles_repository4.validateStyleLabel)(inputValue).isValid && !hasReachedLimit(provider),
|
|
681
688
|
apply: (label) => {
|
|
682
689
|
const createdId = create(label);
|
|
683
690
|
if (!createdId) {
|
|
@@ -690,18 +697,12 @@ function useCreateActions({
|
|
|
690
697
|
});
|
|
691
698
|
}
|
|
692
699
|
function hasReachedLimit(provider) {
|
|
693
|
-
|
|
694
|
-
return false;
|
|
695
|
-
}
|
|
696
|
-
return provider.actions.get().length >= provider.limit;
|
|
697
|
-
}
|
|
698
|
-
function isLabelValid(newLabel) {
|
|
699
|
-
return import_editor_styles_repository4.stylesRepository.isLabelValid(newLabel) && !import_editor_styles_repository4.stylesRepository.isLabelExist(newLabel);
|
|
700
|
+
return provider.actions.all().length >= provider.limit;
|
|
700
701
|
}
|
|
701
702
|
function useAppliedOptions(options13, appliedIds) {
|
|
702
703
|
const applied = options13.filter((option) => option.value && appliedIds.includes(option.value));
|
|
703
704
|
const hasElementsProviderStyleApplied = applied.some(
|
|
704
|
-
(option) => option.provider
|
|
705
|
+
(option) => option.provider && (0, import_editor_styles_repository4.isElementsStylesProvider)(option.provider)
|
|
705
706
|
);
|
|
706
707
|
if (!hasElementsProviderStyleApplied) {
|
|
707
708
|
applied.unshift(EMPTY_OPTION);
|
|
@@ -820,7 +821,7 @@ function EditorPanelErrorFallback() {
|
|
|
820
821
|
|
|
821
822
|
// src/components/editing-panel-tabs.tsx
|
|
822
823
|
var React66 = __toESM(require("react"));
|
|
823
|
-
var
|
|
824
|
+
var import_react18 = require("react");
|
|
824
825
|
var import_ui51 = require("@elementor/ui");
|
|
825
826
|
var import_i18n44 = require("@wordpress/i18n");
|
|
826
827
|
|
|
@@ -993,9 +994,8 @@ var Control2 = ({ control }) => {
|
|
|
993
994
|
|
|
994
995
|
// src/components/style-tab.tsx
|
|
995
996
|
var React65 = __toESM(require("react"));
|
|
996
|
-
var
|
|
997
|
-
var
|
|
998
|
-
var import_editor_props6 = require("@elementor/editor-props");
|
|
997
|
+
var import_react17 = require("react");
|
|
998
|
+
var import_editor_props7 = require("@elementor/editor-props");
|
|
999
999
|
var import_editor_responsive2 = require("@elementor/editor-responsive");
|
|
1000
1000
|
var import_session3 = require("@elementor/session");
|
|
1001
1001
|
var import_ui50 = require("@elementor/ui");
|
|
@@ -1005,7 +1005,7 @@ var import_i18n43 = require("@wordpress/i18n");
|
|
|
1005
1005
|
var React16 = __toESM(require("react"));
|
|
1006
1006
|
var import_react9 = require("react");
|
|
1007
1007
|
var import_editor_elements4 = require("@elementor/editor-elements");
|
|
1008
|
-
var
|
|
1008
|
+
var import_editor_props3 = require("@elementor/editor-props");
|
|
1009
1009
|
var import_editor_responsive = require("@elementor/editor-responsive");
|
|
1010
1010
|
var import_editor_styles_repository5 = require("@elementor/editor-styles-repository");
|
|
1011
1011
|
|
|
@@ -1017,6 +1017,9 @@ var useStylesRerender = () => {
|
|
|
1017
1017
|
(0, import_react8.useEffect)(() => provider?.subscribe(reRender), [provider]);
|
|
1018
1018
|
};
|
|
1019
1019
|
|
|
1020
|
+
// src/styles-inheritance/create-snapshots-manager.ts
|
|
1021
|
+
var import_editor_props2 = require("@elementor/editor-props");
|
|
1022
|
+
|
|
1020
1023
|
// src/styles-inheritance/utils.ts
|
|
1021
1024
|
var DEFAULT_STATE = "normal";
|
|
1022
1025
|
var DEFAULT_BREAKPOINT = "desktop";
|
|
@@ -1107,12 +1110,16 @@ function buildInitialSnapshotFromStyles(styles) {
|
|
|
1107
1110
|
variant: { props }
|
|
1108
1111
|
} = styleData;
|
|
1109
1112
|
Object.entries(props).forEach(([key, value]) => {
|
|
1113
|
+
const filteredValue = (0, import_editor_props2.filterEmptyValues)(value);
|
|
1114
|
+
if (filteredValue === null) {
|
|
1115
|
+
return;
|
|
1116
|
+
}
|
|
1110
1117
|
if (!snapshot[key]) {
|
|
1111
1118
|
snapshot[key] = [];
|
|
1112
1119
|
}
|
|
1113
1120
|
const snapshotPropValue = {
|
|
1114
1121
|
...styleData,
|
|
1115
|
-
value
|
|
1122
|
+
value: filteredValue
|
|
1116
1123
|
};
|
|
1117
1124
|
snapshot[key].push(snapshotPropValue);
|
|
1118
1125
|
});
|
|
@@ -1144,7 +1151,7 @@ function createStylesInheritance(styleDefs, breakpointsRoot) {
|
|
|
1144
1151
|
function buildStyleVariantsByMetaMapping(styleDefs) {
|
|
1145
1152
|
const breakpointStateSlots = {};
|
|
1146
1153
|
styleDefs.forEach((styleDef) => {
|
|
1147
|
-
const provider = getProviderByStyleId(styleDef.id)?.
|
|
1154
|
+
const provider = getProviderByStyleId(styleDef.id)?.getKey() ?? null;
|
|
1148
1155
|
styleDef.variants.forEach((variant) => {
|
|
1149
1156
|
const { meta } = variant;
|
|
1150
1157
|
const { state, breakpoint } = meta;
|
|
@@ -1199,7 +1206,7 @@ var useAppliedStyles = () => {
|
|
|
1199
1206
|
const baseStyles = useBaseStyles();
|
|
1200
1207
|
useStylesRerender();
|
|
1201
1208
|
const classesProp = (0, import_editor_elements4.useElementSetting)(element.id, currentClassesProp);
|
|
1202
|
-
const appliedStyles =
|
|
1209
|
+
const appliedStyles = import_editor_props3.classesPropTypeUtil.extract(classesProp);
|
|
1203
1210
|
return import_editor_styles_repository5.stylesRepository.all().filter((style) => appliedStyles?.includes(style.id)).concat(baseStyles);
|
|
1204
1211
|
};
|
|
1205
1212
|
var useBaseStyles = () => {
|
|
@@ -1209,6 +1216,30 @@ var useBaseStyles = () => {
|
|
|
1209
1216
|
return Object.values(widgetCache?.base_styles ?? {});
|
|
1210
1217
|
};
|
|
1211
1218
|
|
|
1219
|
+
// src/hooks/use-active-style-def-id.ts
|
|
1220
|
+
var import_react10 = require("react");
|
|
1221
|
+
var import_editor_elements5 = require("@elementor/editor-elements");
|
|
1222
|
+
function useActiveStyleDefId(classProp) {
|
|
1223
|
+
const [activeStyledDefId, setActiveStyledDefId] = (0, import_react10.useState)(null);
|
|
1224
|
+
const appliedClassesIds = useAppliedClassesIds2(classProp)?.value || [];
|
|
1225
|
+
const fallback = useFirstAppliedClass(appliedClassesIds);
|
|
1226
|
+
const activeAndAppliedClassId = useActiveAndAppliedClassId(activeStyledDefId, appliedClassesIds);
|
|
1227
|
+
return [activeAndAppliedClassId || fallback?.id || null, setActiveStyledDefId];
|
|
1228
|
+
}
|
|
1229
|
+
function useFirstAppliedClass(appliedClassesIds) {
|
|
1230
|
+
const { element } = useElement();
|
|
1231
|
+
const stylesDefs = (0, import_editor_elements5.getElementStyles)(element.id) ?? {};
|
|
1232
|
+
return Object.values(stylesDefs).find((styleDef) => appliedClassesIds.includes(styleDef.id));
|
|
1233
|
+
}
|
|
1234
|
+
function useAppliedClassesIds2(classProp) {
|
|
1235
|
+
const { element } = useElement();
|
|
1236
|
+
return (0, import_editor_elements5.useElementSetting)(element.id, classProp);
|
|
1237
|
+
}
|
|
1238
|
+
function useActiveAndAppliedClassId(id, appliedClassesIds) {
|
|
1239
|
+
const isClassApplied = !!id && appliedClassesIds.includes(id);
|
|
1240
|
+
return isClassApplied ? id : null;
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1212
1243
|
// src/components/style-sections/background-section/background-section.tsx
|
|
1213
1244
|
var React19 = __toESM(require("react"));
|
|
1214
1245
|
var import_editor_controls7 = require("@elementor/editor-controls");
|
|
@@ -1219,8 +1250,8 @@ var import_editor_controls6 = require("@elementor/editor-controls");
|
|
|
1219
1250
|
var import_editor_styles2 = require("@elementor/editor-styles");
|
|
1220
1251
|
|
|
1221
1252
|
// src/hooks/use-styles-fields.ts
|
|
1222
|
-
var
|
|
1223
|
-
var
|
|
1253
|
+
var import_react11 = require("react");
|
|
1254
|
+
var import_editor_elements6 = require("@elementor/editor-elements");
|
|
1224
1255
|
var import_editor_styles = require("@elementor/editor-styles");
|
|
1225
1256
|
var import_editor_styles_repository6 = require("@elementor/editor-styles-repository");
|
|
1226
1257
|
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
@@ -1263,9 +1294,9 @@ function getProps({ styleId, elementId, provider, meta, propNames }) {
|
|
|
1263
1294
|
if (!provider || !styleId) {
|
|
1264
1295
|
return null;
|
|
1265
1296
|
}
|
|
1266
|
-
const style = provider.actions.
|
|
1297
|
+
const style = provider.actions.get(styleId, { elementId });
|
|
1267
1298
|
if (!style) {
|
|
1268
|
-
throw new StyleNotFoundUnderProviderError({ context: { styleId, providerKey: provider.
|
|
1299
|
+
throw new StyleNotFoundUnderProviderError({ context: { styleId, providerKey: provider.getKey() } });
|
|
1269
1300
|
}
|
|
1270
1301
|
const variant = (0, import_editor_styles.getVariantByMeta)(style, meta);
|
|
1271
1302
|
return Object.fromEntries(
|
|
@@ -1273,44 +1304,44 @@ function getProps({ styleId, elementId, provider, meta, propNames }) {
|
|
|
1273
1304
|
);
|
|
1274
1305
|
}
|
|
1275
1306
|
function useUndoableCreateElementStyle() {
|
|
1276
|
-
return (0,
|
|
1307
|
+
return (0, import_react11.useMemo)(() => {
|
|
1277
1308
|
return (0, import_editor_v1_adapters.undoable)(
|
|
1278
1309
|
{
|
|
1279
1310
|
do: (payload) => {
|
|
1280
|
-
return (0,
|
|
1311
|
+
return (0, import_editor_elements6.createElementStyle)({
|
|
1281
1312
|
...payload,
|
|
1282
|
-
label: import_editor_styles_repository6.
|
|
1313
|
+
label: import_editor_styles_repository6.ELEMENTS_STYLES_RESERVED_LABEL
|
|
1283
1314
|
});
|
|
1284
1315
|
},
|
|
1285
1316
|
undo: ({ elementId }, styleId) => {
|
|
1286
|
-
(0,
|
|
1317
|
+
(0, import_editor_elements6.deleteElementStyle)(elementId, styleId);
|
|
1287
1318
|
},
|
|
1288
1319
|
redo: (payload, styleId) => {
|
|
1289
|
-
return (0,
|
|
1320
|
+
return (0, import_editor_elements6.createElementStyle)({
|
|
1290
1321
|
...payload,
|
|
1291
1322
|
styleId,
|
|
1292
|
-
label: import_editor_styles_repository6.
|
|
1323
|
+
label: import_editor_styles_repository6.ELEMENTS_STYLES_RESERVED_LABEL
|
|
1293
1324
|
});
|
|
1294
1325
|
}
|
|
1295
1326
|
},
|
|
1296
1327
|
{
|
|
1297
|
-
title: ({ elementId }) => (0,
|
|
1328
|
+
title: ({ elementId }) => (0, import_editor_elements6.getElementLabel)(elementId),
|
|
1298
1329
|
subtitle: (0, import_i18n4.__)("Style edited", "elementor")
|
|
1299
1330
|
}
|
|
1300
1331
|
);
|
|
1301
1332
|
}, []);
|
|
1302
1333
|
}
|
|
1303
1334
|
function useUndoableUpdateStyle() {
|
|
1304
|
-
return (0,
|
|
1335
|
+
return (0, import_react11.useMemo)(() => {
|
|
1305
1336
|
return (0, import_editor_v1_adapters.undoable)(
|
|
1306
1337
|
{
|
|
1307
1338
|
do: ({ elementId, styleId, provider, meta, props }) => {
|
|
1308
1339
|
if (!provider.actions.updateProps) {
|
|
1309
1340
|
throw new StylesProviderCannotUpdatePropsError({
|
|
1310
|
-
context: { providerKey: provider.
|
|
1341
|
+
context: { providerKey: provider.getKey() }
|
|
1311
1342
|
});
|
|
1312
1343
|
}
|
|
1313
|
-
const style = provider.actions.
|
|
1344
|
+
const style = provider.actions.get(styleId, { elementId });
|
|
1314
1345
|
const prevProps = getCurrentProps(style, meta);
|
|
1315
1346
|
provider.actions.updateProps(
|
|
1316
1347
|
{
|
|
@@ -1327,7 +1358,7 @@ function useUndoableUpdateStyle() {
|
|
|
1327
1358
|
}
|
|
1328
1359
|
},
|
|
1329
1360
|
{
|
|
1330
|
-
title: ({ elementId }) => (0,
|
|
1361
|
+
title: ({ elementId }) => (0, import_editor_elements6.getElementLabel)(elementId),
|
|
1331
1362
|
subtitle: (0, import_i18n4.__)("Style edited", "elementor")
|
|
1332
1363
|
}
|
|
1333
1364
|
);
|
|
@@ -1377,7 +1408,7 @@ var StylesInheritanceIndicator = () => {
|
|
|
1377
1408
|
StyleIndicator,
|
|
1378
1409
|
{
|
|
1379
1410
|
"aria-label": (0, import_i18n5.__)("This is the final value", "elementor"),
|
|
1380
|
-
variant:
|
|
1411
|
+
variant: (0, import_editor_styles_repository7.isElementsStylesProvider)(currentStyleProvider?.getKey()) ? "local" : "global"
|
|
1381
1412
|
}
|
|
1382
1413
|
);
|
|
1383
1414
|
}
|
|
@@ -1394,11 +1425,12 @@ var StylesInheritanceIndicator = () => {
|
|
|
1394
1425
|
};
|
|
1395
1426
|
|
|
1396
1427
|
// src/controls-registry/styles-field.tsx
|
|
1397
|
-
var StylesField = ({ bind, children }) => {
|
|
1428
|
+
var StylesField = ({ bind, placeholder, children }) => {
|
|
1398
1429
|
const [value, setValue] = useStylesField(bind);
|
|
1399
1430
|
const stylesSchema = (0, import_editor_styles2.getStylesSchema)();
|
|
1400
1431
|
const propType = createTopLevelOjectType({ schema: stylesSchema });
|
|
1401
1432
|
const values = { [bind]: value };
|
|
1433
|
+
const placeholderValues = { [bind]: placeholder };
|
|
1402
1434
|
const setValues = (newValue) => {
|
|
1403
1435
|
setValue(newValue[bind]);
|
|
1404
1436
|
};
|
|
@@ -1412,7 +1444,16 @@ var StylesField = ({ bind, children }) => {
|
|
|
1412
1444
|
}
|
|
1413
1445
|
]
|
|
1414
1446
|
},
|
|
1415
|
-
/* @__PURE__ */ React18.createElement(
|
|
1447
|
+
/* @__PURE__ */ React18.createElement(
|
|
1448
|
+
import_editor_controls6.PropProvider,
|
|
1449
|
+
{
|
|
1450
|
+
propType,
|
|
1451
|
+
value: values,
|
|
1452
|
+
setValue: setValues,
|
|
1453
|
+
placeholder: placeholderValues
|
|
1454
|
+
},
|
|
1455
|
+
/* @__PURE__ */ React18.createElement(import_editor_controls6.PropKeyProvider, { bind }, children)
|
|
1456
|
+
)
|
|
1416
1457
|
);
|
|
1417
1458
|
};
|
|
1418
1459
|
|
|
@@ -1500,7 +1541,7 @@ var BorderStyleField = () => {
|
|
|
1500
1541
|
// src/components/style-sections/border-section/border-width-field.tsx
|
|
1501
1542
|
var React26 = __toESM(require("react"));
|
|
1502
1543
|
var import_editor_controls11 = require("@elementor/editor-controls");
|
|
1503
|
-
var
|
|
1544
|
+
var import_editor_props4 = require("@elementor/editor-props");
|
|
1504
1545
|
var import_icons6 = require("@elementor/icons");
|
|
1505
1546
|
var import_ui19 = require("@elementor/ui");
|
|
1506
1547
|
var import_i18n8 = require("@wordpress/i18n");
|
|
@@ -1547,7 +1588,7 @@ var BorderWidthField = () => {
|
|
|
1547
1588
|
label: (0, import_i18n8.__)("Border width", "elementor"),
|
|
1548
1589
|
icon: /* @__PURE__ */ React26.createElement(import_icons6.SideAllIcon, { fontSize: "tiny" }),
|
|
1549
1590
|
tooltipLabel: (0, import_i18n8.__)("Adjust borders", "elementor"),
|
|
1550
|
-
multiSizePropTypeUtil:
|
|
1591
|
+
multiSizePropTypeUtil: import_editor_props4.borderWidthPropTypeUtil
|
|
1551
1592
|
}
|
|
1552
1593
|
));
|
|
1553
1594
|
};
|
|
@@ -1588,7 +1629,7 @@ var BorderField = () => {
|
|
|
1588
1629
|
// src/components/style-sections/border-section/border-radius-field.tsx
|
|
1589
1630
|
var React28 = __toESM(require("react"));
|
|
1590
1631
|
var import_editor_controls12 = require("@elementor/editor-controls");
|
|
1591
|
-
var
|
|
1632
|
+
var import_editor_props5 = require("@elementor/editor-props");
|
|
1592
1633
|
var import_icons7 = require("@elementor/icons");
|
|
1593
1634
|
var import_ui20 = require("@elementor/ui");
|
|
1594
1635
|
var import_i18n10 = require("@wordpress/i18n");
|
|
@@ -1631,7 +1672,7 @@ var BorderRadiusField = () => {
|
|
|
1631
1672
|
label: (0, import_i18n10.__)("Border radius", "elementor"),
|
|
1632
1673
|
icon: /* @__PURE__ */ React28.createElement(import_icons7.BorderCornersIcon, { fontSize: "tiny" }),
|
|
1633
1674
|
tooltipLabel: (0, import_i18n10.__)("Adjust corners", "elementor"),
|
|
1634
|
-
multiSizePropTypeUtil:
|
|
1675
|
+
multiSizePropTypeUtil: import_editor_props5.borderRadiusPropTypeUtil
|
|
1635
1676
|
}
|
|
1636
1677
|
));
|
|
1637
1678
|
};
|
|
@@ -1649,7 +1690,7 @@ var EffectsSection = () => {
|
|
|
1649
1690
|
// src/components/style-sections/layout-section/layout-section.tsx
|
|
1650
1691
|
var React42 = __toESM(require("react"));
|
|
1651
1692
|
var import_editor_controls24 = require("@elementor/editor-controls");
|
|
1652
|
-
var
|
|
1693
|
+
var import_editor_elements7 = require("@elementor/editor-elements");
|
|
1653
1694
|
var import_i18n21 = require("@wordpress/i18n");
|
|
1654
1695
|
|
|
1655
1696
|
// src/hooks/use-computed-style.ts
|
|
@@ -1686,7 +1727,7 @@ var import_i18n11 = require("@wordpress/i18n");
|
|
|
1686
1727
|
|
|
1687
1728
|
// src/components/style-sections/layout-section/utils/rotated-icon.tsx
|
|
1688
1729
|
var React31 = __toESM(require("react"));
|
|
1689
|
-
var
|
|
1730
|
+
var import_react12 = require("react");
|
|
1690
1731
|
var import_ui21 = require("@elementor/ui");
|
|
1691
1732
|
var CLOCKWISE_ANGLES = {
|
|
1692
1733
|
row: 0,
|
|
@@ -1707,7 +1748,7 @@ var RotatedIcon = ({
|
|
|
1707
1748
|
offset = 0,
|
|
1708
1749
|
disableRotationForReversed = false
|
|
1709
1750
|
}) => {
|
|
1710
|
-
const rotate = (0,
|
|
1751
|
+
const rotate = (0, import_react12.useRef)(useGetTargetAngle(isClockwise, offset, disableRotationForReversed));
|
|
1711
1752
|
rotate.current = useGetTargetAngle(isClockwise, offset, disableRotationForReversed, rotate);
|
|
1712
1753
|
return /* @__PURE__ */ React31.createElement(Icon, { fontSize: size, sx: { transition: ".3s", rotate: `${rotate.current}deg` } });
|
|
1713
1754
|
};
|
|
@@ -1869,35 +1910,37 @@ var React35 = __toESM(require("react"));
|
|
|
1869
1910
|
var import_editor_controls17 = require("@elementor/editor-controls");
|
|
1870
1911
|
var import_ui25 = require("@elementor/ui");
|
|
1871
1912
|
var import_i18n14 = require("@wordpress/i18n");
|
|
1913
|
+
var displayFieldOptions = [
|
|
1914
|
+
{
|
|
1915
|
+
value: "block",
|
|
1916
|
+
renderContent: () => (0, import_i18n14.__)("Block", "elementor"),
|
|
1917
|
+
label: (0, import_i18n14.__)("Block", "elementor"),
|
|
1918
|
+
showTooltip: true
|
|
1919
|
+
},
|
|
1920
|
+
{
|
|
1921
|
+
value: "flex",
|
|
1922
|
+
renderContent: () => (0, import_i18n14.__)("Flex", "elementor"),
|
|
1923
|
+
label: (0, import_i18n14.__)("Flex", "elementor"),
|
|
1924
|
+
showTooltip: true
|
|
1925
|
+
},
|
|
1926
|
+
{
|
|
1927
|
+
value: "inline-block",
|
|
1928
|
+
renderContent: () => (0, import_i18n14.__)("In-blk", "elementor"),
|
|
1929
|
+
label: (0, import_i18n14.__)("Inline-block", "elementor"),
|
|
1930
|
+
showTooltip: true
|
|
1931
|
+
},
|
|
1932
|
+
{
|
|
1933
|
+
value: "inline-flex",
|
|
1934
|
+
renderContent: () => (0, import_i18n14.__)("In-flx", "elementor"),
|
|
1935
|
+
label: (0, import_i18n14.__)("Inline-flex", "elementor"),
|
|
1936
|
+
showTooltip: true
|
|
1937
|
+
}
|
|
1938
|
+
];
|
|
1872
1939
|
var DisplayField = () => {
|
|
1873
|
-
const
|
|
1874
|
-
|
|
1875
|
-
value: "block",
|
|
1876
|
-
renderContent: () => (0, import_i18n14.__)("Block", "elementor"),
|
|
1877
|
-
label: (0, import_i18n14.__)("Block", "elementor"),
|
|
1878
|
-
showTooltip: true
|
|
1879
|
-
},
|
|
1880
|
-
{
|
|
1881
|
-
value: "flex",
|
|
1882
|
-
renderContent: () => (0, import_i18n14.__)("Flex", "elementor"),
|
|
1883
|
-
label: (0, import_i18n14.__)("Flex", "elementor"),
|
|
1884
|
-
showTooltip: true
|
|
1885
|
-
},
|
|
1886
|
-
{
|
|
1887
|
-
value: "inline-block",
|
|
1888
|
-
renderContent: () => (0, import_i18n14.__)("In-blk", "elementor"),
|
|
1889
|
-
label: (0, import_i18n14.__)("Inline-block", "elementor"),
|
|
1890
|
-
showTooltip: true
|
|
1891
|
-
},
|
|
1892
|
-
{
|
|
1893
|
-
value: "inline-flex",
|
|
1894
|
-
renderContent: () => (0, import_i18n14.__)("In-flx", "elementor"),
|
|
1895
|
-
label: (0, import_i18n14.__)("Inline-flex", "elementor"),
|
|
1896
|
-
showTooltip: true
|
|
1897
|
-
}
|
|
1898
|
-
];
|
|
1899
|
-
return /* @__PURE__ */ React35.createElement(StylesField, { bind: "display" }, /* @__PURE__ */ React35.createElement(import_ui25.Stack, { gap: 0.75 }, /* @__PURE__ */ React35.createElement(ControlLabel, null, (0, import_i18n14.__)("Display", "elementor")), /* @__PURE__ */ React35.createElement(import_editor_controls17.ToggleControl, { options: options13, fullWidth: true })));
|
|
1940
|
+
const placeholder = useDisplayPlaceholderValue();
|
|
1941
|
+
return /* @__PURE__ */ React35.createElement(StylesField, { bind: "display", placeholder }, /* @__PURE__ */ React35.createElement(import_ui25.Stack, { gap: 0.75 }, /* @__PURE__ */ React35.createElement(ControlLabel, null, (0, import_i18n14.__)("Display", "elementor")), /* @__PURE__ */ React35.createElement(import_editor_controls17.ToggleControl, { options: displayFieldOptions, fullWidth: true })));
|
|
1900
1942
|
};
|
|
1943
|
+
var useDisplayPlaceholderValue = () => useStylesInheritanceField("display")[0]?.value ?? void 0;
|
|
1901
1944
|
|
|
1902
1945
|
// src/components/style-sections/layout-section/flex-direction-field.tsx
|
|
1903
1946
|
var React36 = __toESM(require("react"));
|
|
@@ -1944,7 +1987,7 @@ var FlexDirectionField = () => {
|
|
|
1944
1987
|
|
|
1945
1988
|
// src/components/style-sections/layout-section/flex-order-field.tsx
|
|
1946
1989
|
var React37 = __toESM(require("react"));
|
|
1947
|
-
var
|
|
1990
|
+
var import_react13 = require("react");
|
|
1948
1991
|
var import_editor_controls19 = require("@elementor/editor-controls");
|
|
1949
1992
|
var import_icons12 = require("@elementor/icons");
|
|
1950
1993
|
var import_ui27 = require("@elementor/ui");
|
|
@@ -1980,7 +2023,7 @@ var items = [
|
|
|
1980
2023
|
];
|
|
1981
2024
|
var FlexOrderField = () => {
|
|
1982
2025
|
const { isSiteRtl } = useDirection(), [order, setOrder] = useStylesField("order");
|
|
1983
|
-
const [groupControlValue, setGroupControlValue] = (0,
|
|
2026
|
+
const [groupControlValue, setGroupControlValue] = (0, import_react13.useState)(getGroupControlValue(order?.value || null));
|
|
1984
2027
|
const handleToggleButtonChange = (group) => {
|
|
1985
2028
|
setGroupControlValue(group);
|
|
1986
2029
|
if (!group || group === CUSTOM) {
|
|
@@ -2018,9 +2061,9 @@ var getGroupControlValue = (order) => {
|
|
|
2018
2061
|
|
|
2019
2062
|
// src/components/style-sections/layout-section/flex-size-field.tsx
|
|
2020
2063
|
var React38 = __toESM(require("react"));
|
|
2021
|
-
var
|
|
2064
|
+
var import_react14 = require("react");
|
|
2022
2065
|
var import_editor_controls20 = require("@elementor/editor-controls");
|
|
2023
|
-
var
|
|
2066
|
+
var import_editor_props6 = require("@elementor/editor-props");
|
|
2024
2067
|
var import_icons13 = require("@elementor/icons");
|
|
2025
2068
|
var import_ui28 = require("@elementor/ui");
|
|
2026
2069
|
var import_i18n17 = require("@wordpress/i18n");
|
|
@@ -2051,7 +2094,7 @@ var FlexSizeField = () => {
|
|
|
2051
2094
|
const grow = fields?.["flex-grow"]?.value || null;
|
|
2052
2095
|
const shrink = fields?.["flex-shrink"]?.value || null;
|
|
2053
2096
|
const basis = fields?.["flex-basis"]?.value || null;
|
|
2054
|
-
const currentGroup = (0,
|
|
2097
|
+
const currentGroup = (0, import_react14.useMemo)(() => getActiveGroup({ grow, shrink, basis }), [grow, shrink, basis]), [activeGroup, setActiveGroup] = (0, import_react14.useState)(currentGroup);
|
|
2055
2098
|
const onChangeGroup = (group = null) => {
|
|
2056
2099
|
setActiveGroup(group);
|
|
2057
2100
|
if (!group || group === "custom") {
|
|
@@ -2065,7 +2108,7 @@ var FlexSizeField = () => {
|
|
|
2065
2108
|
if (group === "flex-grow") {
|
|
2066
2109
|
setFields({
|
|
2067
2110
|
"flex-basis": null,
|
|
2068
|
-
"flex-grow":
|
|
2111
|
+
"flex-grow": import_editor_props6.numberPropTypeUtil.create(DEFAULT),
|
|
2069
2112
|
"flex-shrink": null
|
|
2070
2113
|
});
|
|
2071
2114
|
return;
|
|
@@ -2073,7 +2116,7 @@ var FlexSizeField = () => {
|
|
|
2073
2116
|
setFields({
|
|
2074
2117
|
"flex-basis": null,
|
|
2075
2118
|
"flex-grow": null,
|
|
2076
|
-
"flex-shrink":
|
|
2119
|
+
"flex-shrink": import_editor_props6.numberPropTypeUtil.create(DEFAULT)
|
|
2077
2120
|
});
|
|
2078
2121
|
};
|
|
2079
2122
|
return /* @__PURE__ */ React38.createElement(import_ui28.DirectionProvider, { rtl: isSiteRtl }, /* @__PURE__ */ React38.createElement(import_ui28.ThemeProvider, null, /* @__PURE__ */ React38.createElement(SectionContent, null, /* @__PURE__ */ React38.createElement(import_ui28.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React38.createElement(import_ui28.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React38.createElement(StylesField, { bind: activeGroup ?? "" }, /* @__PURE__ */ React38.createElement(ControlLabel, null, (0, import_i18n17.__)("Size", "elementor")))), /* @__PURE__ */ React38.createElement(import_ui28.Grid, { item: true, xs: 6, sx: { display: "flex", justifyContent: "end" } }, /* @__PURE__ */ React38.createElement(
|
|
@@ -2205,16 +2248,25 @@ var WrapField = () => {
|
|
|
2205
2248
|
// src/components/style-sections/layout-section/layout-section.tsx
|
|
2206
2249
|
var LayoutSection = () => {
|
|
2207
2250
|
const [display] = useStylesField("display");
|
|
2251
|
+
const displayPlaceholder = useDisplayPlaceholderValue();
|
|
2252
|
+
const isDisplayFlex = shouldDisplayFlexFields(display, displayPlaceholder);
|
|
2208
2253
|
const { element } = useElement();
|
|
2209
|
-
const parent = (0,
|
|
2254
|
+
const parent = (0, import_editor_elements7.useParentElement)(element.id);
|
|
2210
2255
|
const parentStyle = useComputedStyle(parent?.id || null);
|
|
2211
|
-
return /* @__PURE__ */ React42.createElement(SectionContent, null, /* @__PURE__ */ React42.createElement(DisplayField, null),
|
|
2256
|
+
return /* @__PURE__ */ React42.createElement(SectionContent, null, /* @__PURE__ */ React42.createElement(DisplayField, null), isDisplayFlex && /* @__PURE__ */ React42.createElement(FlexFields, null), "flex" === parentStyle?.display && /* @__PURE__ */ React42.createElement(FlexChildFields, null));
|
|
2212
2257
|
};
|
|
2213
2258
|
var FlexFields = () => {
|
|
2214
2259
|
const [flexWrap] = useStylesField("flex-wrap");
|
|
2215
2260
|
return /* @__PURE__ */ React42.createElement(React42.Fragment, null, /* @__PURE__ */ React42.createElement(FlexDirectionField, null), /* @__PURE__ */ React42.createElement(JustifyContentField, null), /* @__PURE__ */ React42.createElement(AlignItemsField, null), /* @__PURE__ */ React42.createElement(PanelDivider, null), /* @__PURE__ */ React42.createElement(GapControlField, null), /* @__PURE__ */ React42.createElement(WrapField, null), ["wrap", "wrap-reverse"].includes(flexWrap?.value) && /* @__PURE__ */ React42.createElement(AlignContentField, null));
|
|
2216
2261
|
};
|
|
2217
2262
|
var FlexChildFields = () => /* @__PURE__ */ React42.createElement(React42.Fragment, null, /* @__PURE__ */ React42.createElement(PanelDivider, null), /* @__PURE__ */ React42.createElement(import_editor_controls24.ControlFormLabel, null, (0, import_i18n21.__)("Flex child", "elementor")), /* @__PURE__ */ React42.createElement(AlignSelfChild, null), /* @__PURE__ */ React42.createElement(FlexOrderField, null), /* @__PURE__ */ React42.createElement(FlexSizeField, null));
|
|
2263
|
+
var shouldDisplayFlexFields = (display, local) => {
|
|
2264
|
+
const value = display?.value ?? local?.value;
|
|
2265
|
+
if (!value) {
|
|
2266
|
+
return false;
|
|
2267
|
+
}
|
|
2268
|
+
return "flex" === value || "inline-flex" === value;
|
|
2269
|
+
};
|
|
2218
2270
|
|
|
2219
2271
|
// src/components/style-sections/position-section/position-section.tsx
|
|
2220
2272
|
var React46 = __toESM(require("react"));
|
|
@@ -2386,11 +2438,11 @@ var React64 = __toESM(require("react"));
|
|
|
2386
2438
|
|
|
2387
2439
|
// src/components/collapsible-content.tsx
|
|
2388
2440
|
var React50 = __toESM(require("react"));
|
|
2389
|
-
var
|
|
2441
|
+
var import_react15 = require("react");
|
|
2390
2442
|
var import_ui37 = require("@elementor/ui");
|
|
2391
2443
|
var import_i18n28 = require("@wordpress/i18n");
|
|
2392
2444
|
var CollapsibleContent = ({ children, defaultOpen = false }) => {
|
|
2393
|
-
const [open, setOpen] = (0,
|
|
2445
|
+
const [open, setOpen] = (0, import_react15.useState)(defaultOpen);
|
|
2394
2446
|
const handleToggle = () => {
|
|
2395
2447
|
setOpen((prevOpen) => !prevOpen);
|
|
2396
2448
|
};
|
|
@@ -2416,7 +2468,7 @@ var import_ui38 = require("@elementor/ui");
|
|
|
2416
2468
|
var import_i18n30 = require("@wordpress/i18n");
|
|
2417
2469
|
|
|
2418
2470
|
// src/components/style-sections/typography-section/hooks/use-font-families.ts
|
|
2419
|
-
var
|
|
2471
|
+
var import_react16 = require("react");
|
|
2420
2472
|
var import_i18n29 = require("@wordpress/i18n");
|
|
2421
2473
|
|
|
2422
2474
|
// src/sync/get-elementor-config.ts
|
|
@@ -2441,7 +2493,7 @@ var getFontFamilies = () => {
|
|
|
2441
2493
|
};
|
|
2442
2494
|
var useFontFamilies = () => {
|
|
2443
2495
|
const fontFamilies = getFontFamilies();
|
|
2444
|
-
return (0,
|
|
2496
|
+
return (0, import_react16.useMemo)(() => {
|
|
2445
2497
|
const categoriesOrder = ["system", "custom", "googlefonts"];
|
|
2446
2498
|
return Object.entries(fontFamilies || {}).reduce((acc, [font, category]) => {
|
|
2447
2499
|
if (!supportedCategories[category]) {
|
|
@@ -2737,7 +2789,7 @@ var TypographySection = () => {
|
|
|
2737
2789
|
var StyleTab = () => {
|
|
2738
2790
|
const currentClassesProp = useCurrentClassesProp();
|
|
2739
2791
|
const [activeStyleDefId, setActiveStyleDefId] = useActiveStyleDefId(currentClassesProp);
|
|
2740
|
-
const [activeStyleState, setActiveStyleState] = (0,
|
|
2792
|
+
const [activeStyleState, setActiveStyleState] = (0, import_react17.useState)(null);
|
|
2741
2793
|
const breakpoint = (0, import_editor_responsive2.useActiveBreakpoint)();
|
|
2742
2794
|
return /* @__PURE__ */ React65.createElement(ClassesPropProvider, { prop: currentClassesProp }, /* @__PURE__ */ React65.createElement(
|
|
2743
2795
|
StyleProvider,
|
|
@@ -2753,21 +2805,10 @@ var StyleTab = () => {
|
|
|
2753
2805
|
/* @__PURE__ */ React65.createElement(import_session3.SessionStorageProvider, { prefix: activeStyleDefId ?? "" }, /* @__PURE__ */ React65.createElement(StyleInheritanceProvider, null, /* @__PURE__ */ React65.createElement(CssClassSelector, null), /* @__PURE__ */ React65.createElement(import_ui50.Divider, null), /* @__PURE__ */ React65.createElement(SectionsList, null, /* @__PURE__ */ React65.createElement(Section, { title: (0, import_i18n43.__)("Layout", "elementor") }, /* @__PURE__ */ React65.createElement(LayoutSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: (0, import_i18n43.__)("Spacing", "elementor") }, /* @__PURE__ */ React65.createElement(SpacingSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: (0, import_i18n43.__)("Size", "elementor") }, /* @__PURE__ */ React65.createElement(SizeSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: (0, import_i18n43.__)("Position", "elementor") }, /* @__PURE__ */ React65.createElement(PositionSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: (0, import_i18n43.__)("Typography", "elementor") }, /* @__PURE__ */ React65.createElement(TypographySection, null)), /* @__PURE__ */ React65.createElement(Section, { title: (0, import_i18n43.__)("Background", "elementor") }, /* @__PURE__ */ React65.createElement(BackgroundSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: (0, import_i18n43.__)("Border", "elementor") }, /* @__PURE__ */ React65.createElement(BorderSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: (0, import_i18n43.__)("Effects", "elementor") }, /* @__PURE__ */ React65.createElement(EffectsSection, null)))))
|
|
2754
2806
|
));
|
|
2755
2807
|
};
|
|
2756
|
-
function useActiveStyleDefId(currentClassesProp) {
|
|
2757
|
-
const [activeStyledDefId, setActiveStyledDefId] = (0, import_react16.useState)(null);
|
|
2758
|
-
const fallback = useFirstElementStyleDef(currentClassesProp);
|
|
2759
|
-
return [activeStyledDefId || fallback?.id || null, setActiveStyledDefId];
|
|
2760
|
-
}
|
|
2761
|
-
function useFirstElementStyleDef(currentClassesProp) {
|
|
2762
|
-
const { element } = useElement();
|
|
2763
|
-
const classesIds = (0, import_editor_elements7.useElementSetting)(element.id, currentClassesProp)?.value || [];
|
|
2764
|
-
const stylesDefs = (0, import_editor_elements7.getElementStyles)(element.id) ?? {};
|
|
2765
|
-
return Object.values(stylesDefs).find((styleDef) => classesIds.includes(styleDef.id));
|
|
2766
|
-
}
|
|
2767
2808
|
function useCurrentClassesProp() {
|
|
2768
2809
|
const { elementType } = useElement();
|
|
2769
2810
|
const prop = Object.entries(elementType.propsSchema).find(
|
|
2770
|
-
([, propType]) => propType.kind === "plain" && propType.key ===
|
|
2811
|
+
([, propType]) => propType.kind === "plain" && propType.key === import_editor_props7.CLASSES_PROP_KEY
|
|
2771
2812
|
);
|
|
2772
2813
|
if (!prop) {
|
|
2773
2814
|
throw new Error("Element does not have a classes prop");
|
|
@@ -2782,7 +2823,7 @@ var EditingPanelTabs = () => {
|
|
|
2782
2823
|
return (
|
|
2783
2824
|
// When switching between elements, the local states should be reset. We are using key to rerender the tabs.
|
|
2784
2825
|
// Reference: https://react.dev/learn/preserving-and-resetting-state#resetting-a-form-with-a-key
|
|
2785
|
-
/* @__PURE__ */ React66.createElement(
|
|
2826
|
+
/* @__PURE__ */ React66.createElement(import_react18.Fragment, { key: element.id }, /* @__PURE__ */ React66.createElement(import_ui51.Stack, { direction: "column", sx: { width: "100%" } }, /* @__PURE__ */ React66.createElement(import_ui51.Tabs, { variant: "fullWidth", size: "small", sx: { mt: 0.5 }, ...getTabsProps() }, /* @__PURE__ */ React66.createElement(import_ui51.Tab, { label: (0, import_i18n44.__)("General", "elementor"), ...getTabProps("settings") }), /* @__PURE__ */ React66.createElement(import_ui51.Tab, { label: (0, import_i18n44.__)("Style", "elementor"), ...getTabProps("style") })), /* @__PURE__ */ React66.createElement(import_ui51.Divider, null), /* @__PURE__ */ React66.createElement(import_ui51.TabPanel, { ...getTabPanelProps("settings"), disablePadding: true }, /* @__PURE__ */ React66.createElement(SettingsTab, null)), /* @__PURE__ */ React66.createElement(import_ui51.TabPanel, { ...getTabPanelProps("style"), disablePadding: true }, /* @__PURE__ */ React66.createElement(StyleTab, null))))
|
|
2786
2827
|
);
|
|
2787
2828
|
};
|
|
2788
2829
|
|
|
@@ -2812,7 +2853,7 @@ var import_editor_panels3 = require("@elementor/editor-panels");
|
|
|
2812
2853
|
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
2813
2854
|
|
|
2814
2855
|
// src/hooks/use-open-editor-panel.ts
|
|
2815
|
-
var
|
|
2856
|
+
var import_react19 = require("react");
|
|
2816
2857
|
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
2817
2858
|
|
|
2818
2859
|
// src/sync/is-atomic-widget-selected.ts
|
|
@@ -2829,7 +2870,7 @@ var isAtomicWidgetSelected = () => {
|
|
|
2829
2870
|
// src/hooks/use-open-editor-panel.ts
|
|
2830
2871
|
var useOpenEditorPanel = () => {
|
|
2831
2872
|
const { open } = usePanelActions();
|
|
2832
|
-
(0,
|
|
2873
|
+
(0, import_react19.useEffect)(() => {
|
|
2833
2874
|
return (0, import_editor_v1_adapters3.__privateListenTo)((0, import_editor_v1_adapters3.commandStartEvent)("panel/editor/open"), () => {
|
|
2834
2875
|
if (isAtomicWidgetSelected()) {
|
|
2835
2876
|
open();
|
|
@@ -2849,7 +2890,7 @@ var import_editor_canvas2 = require("@elementor/editor-canvas");
|
|
|
2849
2890
|
|
|
2850
2891
|
// src/dynamics/components/dynamic-selection-control.tsx
|
|
2851
2892
|
var React71 = __toESM(require("react"));
|
|
2852
|
-
var
|
|
2893
|
+
var import_react23 = require("react");
|
|
2853
2894
|
var import_editor_controls48 = require("@elementor/editor-controls");
|
|
2854
2895
|
var import_icons25 = require("@elementor/icons");
|
|
2855
2896
|
var import_ui55 = require("@elementor/ui");
|
|
@@ -2873,10 +2914,10 @@ var React69 = __toESM(require("react"));
|
|
|
2873
2914
|
var import_editor_controls46 = require("@elementor/editor-controls");
|
|
2874
2915
|
|
|
2875
2916
|
// src/dynamics/hooks/use-dynamic-tag.ts
|
|
2876
|
-
var
|
|
2917
|
+
var import_react21 = require("react");
|
|
2877
2918
|
|
|
2878
2919
|
// src/dynamics/hooks/use-prop-dynamic-tags.ts
|
|
2879
|
-
var
|
|
2920
|
+
var import_react20 = require("react");
|
|
2880
2921
|
var import_editor_controls45 = require("@elementor/editor-controls");
|
|
2881
2922
|
|
|
2882
2923
|
// src/dynamics/sync/get-elementor-config.ts
|
|
@@ -2898,7 +2939,7 @@ var getAtomicDynamicTags = () => {
|
|
|
2898
2939
|
};
|
|
2899
2940
|
|
|
2900
2941
|
// src/dynamics/utils.ts
|
|
2901
|
-
var
|
|
2942
|
+
var import_editor_props8 = require("@elementor/editor-props");
|
|
2902
2943
|
var import_schema = require("@elementor/schema");
|
|
2903
2944
|
var DYNAMIC_PROP_TYPE_KEY = "dynamic";
|
|
2904
2945
|
var isDynamicPropType = (prop) => prop.key === DYNAMIC_PROP_TYPE_KEY;
|
|
@@ -2907,12 +2948,12 @@ var getDynamicPropType = (propType) => {
|
|
|
2907
2948
|
return dynamicPropType && isDynamicPropType(dynamicPropType) ? dynamicPropType : null;
|
|
2908
2949
|
};
|
|
2909
2950
|
var isDynamicPropValue = (prop) => {
|
|
2910
|
-
return (0,
|
|
2951
|
+
return (0, import_editor_props8.isTransformable)(prop) && prop.$$type === DYNAMIC_PROP_TYPE_KEY;
|
|
2911
2952
|
};
|
|
2912
2953
|
var supportsDynamic = (propType) => {
|
|
2913
2954
|
return !!getDynamicPropType(propType);
|
|
2914
2955
|
};
|
|
2915
|
-
var dynamicPropTypeUtil = (0,
|
|
2956
|
+
var dynamicPropTypeUtil = (0, import_editor_props8.createPropUtils)(
|
|
2916
2957
|
DYNAMIC_PROP_TYPE_KEY,
|
|
2917
2958
|
import_schema.z.strictObject({
|
|
2918
2959
|
name: import_schema.z.string(),
|
|
@@ -2928,7 +2969,7 @@ var usePropDynamicTags = () => {
|
|
|
2928
2969
|
const propDynamicType = getDynamicPropType(propType);
|
|
2929
2970
|
categories = propDynamicType?.settings.categories || [];
|
|
2930
2971
|
}
|
|
2931
|
-
return (0,
|
|
2972
|
+
return (0, import_react20.useMemo)(() => getDynamicTagsByCategories(categories), [categories.join()]);
|
|
2932
2973
|
};
|
|
2933
2974
|
var getDynamicTagsByCategories = (categories) => {
|
|
2934
2975
|
const dynamicTags = getAtomicDynamicTags();
|
|
@@ -2944,7 +2985,7 @@ var getDynamicTagsByCategories = (categories) => {
|
|
|
2944
2985
|
// src/dynamics/hooks/use-dynamic-tag.ts
|
|
2945
2986
|
var useDynamicTag = (tagName) => {
|
|
2946
2987
|
const dynamicTags = usePropDynamicTags();
|
|
2947
|
-
return (0,
|
|
2988
|
+
return (0, import_react21.useMemo)(() => dynamicTags.find((tag) => tag.name === tagName) ?? null, [dynamicTags, tagName]);
|
|
2948
2989
|
};
|
|
2949
2990
|
|
|
2950
2991
|
// src/dynamics/dynamic-control.tsx
|
|
@@ -2973,14 +3014,14 @@ var DynamicControl = ({ bind, children }) => {
|
|
|
2973
3014
|
|
|
2974
3015
|
// src/dynamics/components/dynamic-selection.tsx
|
|
2975
3016
|
var React70 = __toESM(require("react"));
|
|
2976
|
-
var
|
|
3017
|
+
var import_react22 = require("react");
|
|
2977
3018
|
var import_editor_controls47 = require("@elementor/editor-controls");
|
|
2978
3019
|
var import_icons24 = require("@elementor/icons");
|
|
2979
3020
|
var import_ui54 = require("@elementor/ui");
|
|
2980
3021
|
var import_i18n46 = require("@wordpress/i18n");
|
|
2981
3022
|
var SIZE3 = "tiny";
|
|
2982
3023
|
var DynamicSelection = ({ onSelect }) => {
|
|
2983
|
-
const [searchValue, setSearchValue] = (0,
|
|
3024
|
+
const [searchValue, setSearchValue] = (0, import_react22.useState)("");
|
|
2984
3025
|
const { groups: dynamicGroups } = getAtomicDynamicTags() || {};
|
|
2985
3026
|
const { value: anyValue } = (0, import_editor_controls47.useBoundProp)();
|
|
2986
3027
|
const { bind, value: dynamicValue, setValue } = (0, import_editor_controls47.useBoundProp)(dynamicPropTypeUtil);
|
|
@@ -2998,7 +3039,7 @@ var DynamicSelection = ({ onSelect }) => {
|
|
|
2998
3039
|
setValue({ name: value, settings: { label } });
|
|
2999
3040
|
onSelect?.();
|
|
3000
3041
|
};
|
|
3001
|
-
return /* @__PURE__ */ React70.createElement(import_ui54.Stack, null, hasNoDynamicTags ? /* @__PURE__ */ React70.createElement(NoDynamicTags, null) : /* @__PURE__ */ React70.createElement(
|
|
3042
|
+
return /* @__PURE__ */ React70.createElement(import_ui54.Stack, null, hasNoDynamicTags ? /* @__PURE__ */ React70.createElement(NoDynamicTags, null) : /* @__PURE__ */ React70.createElement(import_react22.Fragment, null, /* @__PURE__ */ React70.createElement(import_ui54.Box, { px: 1.5, pb: 1 }, /* @__PURE__ */ React70.createElement(
|
|
3002
3043
|
import_ui54.TextField,
|
|
3003
3044
|
{
|
|
3004
3045
|
fullWidth: true,
|
|
@@ -3010,7 +3051,7 @@ var DynamicSelection = ({ onSelect }) => {
|
|
|
3010
3051
|
startAdornment: /* @__PURE__ */ React70.createElement(import_ui54.InputAdornment, { position: "start" }, /* @__PURE__ */ React70.createElement(import_icons24.SearchIcon, { fontSize: SIZE3 }))
|
|
3011
3052
|
}
|
|
3012
3053
|
}
|
|
3013
|
-
)), /* @__PURE__ */ React70.createElement(import_ui54.Divider, null), /* @__PURE__ */ React70.createElement(import_ui54.Box, { sx: { overflowY: "auto", height: 260, width: 220 } }, options13.length > 0 ? /* @__PURE__ */ React70.createElement(import_ui54.MenuList, { role: "listbox", tabIndex: 0 }, options13.map(([category, items3], index) => /* @__PURE__ */ React70.createElement(
|
|
3054
|
+
)), /* @__PURE__ */ React70.createElement(import_ui54.Divider, null), /* @__PURE__ */ React70.createElement(import_ui54.Box, { sx: { overflowY: "auto", height: 260, width: 220 } }, options13.length > 0 ? /* @__PURE__ */ React70.createElement(import_ui54.MenuList, { role: "listbox", tabIndex: 0 }, options13.map(([category, items3], index) => /* @__PURE__ */ React70.createElement(import_react22.Fragment, { key: index }, /* @__PURE__ */ React70.createElement(
|
|
3014
3055
|
import_ui54.MenuSubheader,
|
|
3015
3056
|
{
|
|
3016
3057
|
sx: { px: 1.5, typography: "caption", color: "text.tertiary" }
|
|
@@ -3084,7 +3125,7 @@ var DynamicSelectionControl = () => {
|
|
|
3084
3125
|
const { bind, value } = (0, import_editor_controls48.useBoundProp)(dynamicPropTypeUtil);
|
|
3085
3126
|
const [propValueFromHistory] = usePersistDynamicValue(bind);
|
|
3086
3127
|
const { name: tagName = "" } = value;
|
|
3087
|
-
const selectionPopoverId = (0,
|
|
3128
|
+
const selectionPopoverId = (0, import_react23.useId)();
|
|
3088
3129
|
const selectionPopoverState = (0, import_ui55.usePopupState)({ variant: "popover", popupId: selectionPopoverId });
|
|
3089
3130
|
const dynamicTag = useDynamicTag(tagName);
|
|
3090
3131
|
const removeDynamicTag = () => {
|
|
@@ -3123,7 +3164,7 @@ var DynamicSelectionControl = () => {
|
|
|
3123
3164
|
));
|
|
3124
3165
|
};
|
|
3125
3166
|
var DynamicSettingsPopover = ({ dynamicTag }) => {
|
|
3126
|
-
const popupId = (0,
|
|
3167
|
+
const popupId = (0, import_react23.useId)();
|
|
3127
3168
|
const settingsPopupState = (0, import_ui55.usePopupState)({ variant: "popover", popupId });
|
|
3128
3169
|
const hasDynamicSettings = !!dynamicTag.atomic_controls.length;
|
|
3129
3170
|
if (!hasDynamicSettings) {
|
|
@@ -3171,7 +3212,7 @@ var Control3 = ({ control }) => {
|
|
|
3171
3212
|
|
|
3172
3213
|
// src/dynamics/dynamic-transformer.ts
|
|
3173
3214
|
var import_editor_canvas = require("@elementor/editor-canvas");
|
|
3174
|
-
var
|
|
3215
|
+
var import_editor_props9 = require("@elementor/editor-props");
|
|
3175
3216
|
|
|
3176
3217
|
// src/dynamics/errors.ts
|
|
3177
3218
|
var import_utils8 = require("@elementor/utils");
|
|
@@ -3189,7 +3230,7 @@ var dynamicTransformer = (0, import_editor_canvas.createTransformer)((value) =>
|
|
|
3189
3230
|
});
|
|
3190
3231
|
function simpleTransform(props) {
|
|
3191
3232
|
const transformed = Object.entries(props).map(([settingKey, settingValue]) => {
|
|
3192
|
-
const value = (0,
|
|
3233
|
+
const value = (0, import_editor_props9.isTransformable)(settingValue) ? settingValue.value : settingValue;
|
|
3193
3234
|
return [settingKey, value];
|
|
3194
3235
|
});
|
|
3195
3236
|
return Object.fromEntries(transformed);
|
|
@@ -3269,11 +3310,9 @@ var blockV1Panel = () => {
|
|
|
3269
3310
|
condition: isAtomicWidgetSelected
|
|
3270
3311
|
});
|
|
3271
3312
|
};
|
|
3272
|
-
|
|
3273
|
-
// src/index.ts
|
|
3274
|
-
init2();
|
|
3275
3313
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3276
3314
|
0 && (module.exports = {
|
|
3315
|
+
init,
|
|
3277
3316
|
injectIntoClassSelectorActions,
|
|
3278
3317
|
replaceControl,
|
|
3279
3318
|
useBoundProp,
|