@elementor/editor-editing-panel 1.33.1 → 1.35.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.js +131 -81
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +79 -29
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
- package/src/components/editing-panel-tabs.tsx +37 -20
- package/src/components/section.tsx +4 -3
- package/src/components/style-sections/layout-section/display-field.tsx +21 -7
- package/src/components/style-sections/position-section/position-section.tsx +3 -3
- package/src/components/style-sections/typography-section/font-family-field.tsx +1 -1
- package/src/components/style-sections/typography-section/hooks/use-font-families.ts +1 -1
- package/src/hooks/use-direction.ts +3 -4
- package/src/hooks/use-state-by-element.ts +18 -0
- package/src/styles-inheritance/styles-inheritance-indicator.tsx +2 -2
- package/src/sync/get-elementor-globals.ts +19 -0
- package/src/sync/is-experiment-active.ts +7 -0
- package/src/sync/types.ts +1 -4
- package/src/sync/get-elementor-config.ts +0 -7
- package/src/sync/get-experiments-config.ts +0 -7
package/dist/index.mjs
CHANGED
|
@@ -1004,6 +1004,21 @@ function useScrollDirection() {
|
|
|
1004
1004
|
return useContext4(ScrollContext)?.direction ?? DEFAULT_SCROLL_DIRECTION;
|
|
1005
1005
|
}
|
|
1006
1006
|
|
|
1007
|
+
// src/hooks/use-state-by-element.ts
|
|
1008
|
+
import { useState as useState5 } from "react";
|
|
1009
|
+
import { getSessionStorageItem, setSessionStorageItem } from "@elementor/session";
|
|
1010
|
+
var useStateByElement = (key, initialValue) => {
|
|
1011
|
+
const { element } = useElement();
|
|
1012
|
+
const lookup = `elementor/editor-state/${element.id}/${key}`;
|
|
1013
|
+
const storedValue = getSessionStorageItem(lookup);
|
|
1014
|
+
const [value, setValue] = useState5(storedValue ?? initialValue);
|
|
1015
|
+
const doUpdate = (newValue) => {
|
|
1016
|
+
setSessionStorageItem(lookup, newValue);
|
|
1017
|
+
setValue(newValue);
|
|
1018
|
+
};
|
|
1019
|
+
return [value, doUpdate];
|
|
1020
|
+
};
|
|
1021
|
+
|
|
1007
1022
|
// src/components/settings-tab.tsx
|
|
1008
1023
|
import * as React16 from "react";
|
|
1009
1024
|
import { ControlFormLabel } from "@elementor/editor-controls";
|
|
@@ -1105,7 +1120,7 @@ var SettingsField = ({ bind, children }) => {
|
|
|
1105
1120
|
|
|
1106
1121
|
// src/components/section.tsx
|
|
1107
1122
|
import * as React14 from "react";
|
|
1108
|
-
import { useId as useId3
|
|
1123
|
+
import { useId as useId3 } from "react";
|
|
1109
1124
|
import { Collapse, Divider as Divider2, ListItemButton, ListItemText, Stack as Stack5 } from "@elementor/ui";
|
|
1110
1125
|
|
|
1111
1126
|
// src/components/collapse-icon.tsx
|
|
@@ -1122,7 +1137,7 @@ var CollapseIcon = styled5(ChevronDownIcon, {
|
|
|
1122
1137
|
|
|
1123
1138
|
// src/components/section.tsx
|
|
1124
1139
|
function Section({ title, children, defaultExpanded = false }) {
|
|
1125
|
-
const [isOpen, setIsOpen] =
|
|
1140
|
+
const [isOpen, setIsOpen] = useStateByElement(title, !!defaultExpanded);
|
|
1126
1141
|
const id = useId3();
|
|
1127
1142
|
const labelId = `label-${id}`;
|
|
1128
1143
|
const contentId = `content-${id}`;
|
|
@@ -1131,7 +1146,7 @@ function Section({ title, children, defaultExpanded = false }) {
|
|
|
1131
1146
|
{
|
|
1132
1147
|
id: labelId,
|
|
1133
1148
|
"aria-controls": contentId,
|
|
1134
|
-
onClick: () => setIsOpen(
|
|
1149
|
+
onClick: () => setIsOpen(!isOpen),
|
|
1135
1150
|
sx: { "&:hover": { backgroundColor: "transparent" } }
|
|
1136
1151
|
},
|
|
1137
1152
|
/* @__PURE__ */ React14.createElement(
|
|
@@ -1583,10 +1598,24 @@ import { ELEMENTS_BASE_STYLES_PROVIDER_KEY, isElementsStylesProvider as isElemen
|
|
|
1583
1598
|
import { IconButton as IconButton2, Infotip } from "@elementor/ui";
|
|
1584
1599
|
import { __ as __5 } from "@wordpress/i18n";
|
|
1585
1600
|
|
|
1586
|
-
// src/sync/get-
|
|
1587
|
-
var
|
|
1601
|
+
// src/sync/get-elementor-globals.ts
|
|
1602
|
+
var getElementorConfig = () => {
|
|
1603
|
+
const extendedWindow = window;
|
|
1604
|
+
return extendedWindow.elementor?.config ?? {};
|
|
1605
|
+
};
|
|
1606
|
+
var getElementorFrontendConfig = () => {
|
|
1607
|
+
const extendedWindow = window;
|
|
1608
|
+
return extendedWindow.elementorFrontend?.config ?? {};
|
|
1609
|
+
};
|
|
1610
|
+
var getElementorCommonConfig = () => {
|
|
1588
1611
|
const extendedWindow = window;
|
|
1589
|
-
return extendedWindow.elementorCommon?.config
|
|
1612
|
+
return extendedWindow.elementorCommon?.config ?? {};
|
|
1613
|
+
};
|
|
1614
|
+
|
|
1615
|
+
// src/sync/is-experiment-active.ts
|
|
1616
|
+
var isExperimentActive = (experiment) => {
|
|
1617
|
+
const allFeatures = getElementorCommonConfig()?.experimentalFeatures ?? {};
|
|
1618
|
+
return !!allFeatures?.[experiment];
|
|
1590
1619
|
};
|
|
1591
1620
|
|
|
1592
1621
|
// src/styles-inheritance/styles-inheritance-infotip.tsx
|
|
@@ -1673,7 +1702,7 @@ var StylesInheritanceIndicator = () => {
|
|
|
1673
1702
|
const hasValue = value !== null && value !== void 0;
|
|
1674
1703
|
const label = getLabel({ isFinalValue, hasValue });
|
|
1675
1704
|
const variantType = getVariant({ isFinalValue, hasValue, currentStyleProvider });
|
|
1676
|
-
const
|
|
1705
|
+
const eIndicationsPopover = isExperimentActive("e_indications_popover");
|
|
1677
1706
|
if (!eIndicationsPopover) {
|
|
1678
1707
|
return /* @__PURE__ */ React19.createElement(StyleIndicator, { variant: variantType, "aria-label": label });
|
|
1679
1708
|
}
|
|
@@ -1839,8 +1868,8 @@ import { __ as __8 } from "@wordpress/i18n";
|
|
|
1839
1868
|
// src/hooks/use-direction.ts
|
|
1840
1869
|
import { useTheme } from "@elementor/ui";
|
|
1841
1870
|
function useDirection() {
|
|
1842
|
-
const theme = useTheme()
|
|
1843
|
-
const isUiRtl = "rtl" === theme.direction, isSiteRtl = !!
|
|
1871
|
+
const theme = useTheme();
|
|
1872
|
+
const isUiRtl = "rtl" === theme.direction, isSiteRtl = !!getElementorFrontendConfig()?.is_rtl;
|
|
1844
1873
|
return { isSiteRtl, isUiRtl };
|
|
1845
1874
|
}
|
|
1846
1875
|
|
|
@@ -2260,7 +2289,7 @@ import * as React37 from "react";
|
|
|
2260
2289
|
import { ToggleControl as ToggleControl4 } from "@elementor/editor-controls";
|
|
2261
2290
|
import { Stack as Stack10 } from "@elementor/ui";
|
|
2262
2291
|
import { __ as __14 } from "@wordpress/i18n";
|
|
2263
|
-
var
|
|
2292
|
+
var displayFieldItems = [
|
|
2264
2293
|
{
|
|
2265
2294
|
value: "block",
|
|
2266
2295
|
renderContent: () => __14("Block", "elementor"),
|
|
@@ -2278,17 +2307,27 @@ var displayFieldOptions = [
|
|
|
2278
2307
|
renderContent: () => __14("In-blk", "elementor"),
|
|
2279
2308
|
label: __14("Inline-block", "elementor"),
|
|
2280
2309
|
showTooltip: true
|
|
2281
|
-
}
|
|
2282
|
-
|
|
2310
|
+
}
|
|
2311
|
+
];
|
|
2312
|
+
var DisplayField = () => {
|
|
2313
|
+
const isDisplayNoneFeatureActive = isExperimentActive("e_v_3_30");
|
|
2314
|
+
const items3 = [...displayFieldItems];
|
|
2315
|
+
if (isDisplayNoneFeatureActive) {
|
|
2316
|
+
items3.push({
|
|
2317
|
+
value: "none",
|
|
2318
|
+
renderContent: () => __14("None", "elementor"),
|
|
2319
|
+
label: __14("None", "elementor"),
|
|
2320
|
+
showTooltip: true
|
|
2321
|
+
});
|
|
2322
|
+
}
|
|
2323
|
+
items3.push({
|
|
2283
2324
|
value: "inline-flex",
|
|
2284
2325
|
renderContent: () => __14("In-flx", "elementor"),
|
|
2285
2326
|
label: __14("Inline-flex", "elementor"),
|
|
2286
2327
|
showTooltip: true
|
|
2287
|
-
}
|
|
2288
|
-
];
|
|
2289
|
-
var DisplayField = () => {
|
|
2328
|
+
});
|
|
2290
2329
|
const placeholder = useDisplayPlaceholderValue();
|
|
2291
|
-
return /* @__PURE__ */ React37.createElement(StylesField, { bind: "display", placeholder }, /* @__PURE__ */ React37.createElement(Stack10, { gap: 0.75 }, /* @__PURE__ */ React37.createElement(ControlLabel, null, __14("Display", "elementor")), /* @__PURE__ */ React37.createElement(ToggleControl4, { options:
|
|
2330
|
+
return /* @__PURE__ */ React37.createElement(StylesField, { bind: "display", placeholder }, /* @__PURE__ */ React37.createElement(Stack10, { gap: 0.75 }, /* @__PURE__ */ React37.createElement(ControlLabel, null, __14("Display", "elementor")), /* @__PURE__ */ React37.createElement(ToggleControl4, { options: items3, maxItems: 4, fullWidth: true })));
|
|
2292
2331
|
};
|
|
2293
2332
|
var useDisplayPlaceholderValue = () => useStylesInheritanceField("display")[0]?.value ?? void 0;
|
|
2294
2333
|
|
|
@@ -2702,7 +2741,7 @@ var PositionSection = () => {
|
|
|
2702
2741
|
"inset-inline-end"
|
|
2703
2742
|
]);
|
|
2704
2743
|
const [dimensionsValuesFromHistory, updateDimensionsHistory, clearDimensionsHistory] = usePersistDimensions();
|
|
2705
|
-
const
|
|
2744
|
+
const isCssIdFeatureActive = isExperimentActive("e_v_3_30");
|
|
2706
2745
|
const onPositionChange = (newPosition, previousPosition) => {
|
|
2707
2746
|
if (newPosition === "static") {
|
|
2708
2747
|
if (dimensionsValues) {
|
|
@@ -2722,7 +2761,7 @@ var PositionSection = () => {
|
|
|
2722
2761
|
}
|
|
2723
2762
|
};
|
|
2724
2763
|
const isNotStatic = positionValue && positionValue?.value !== "static";
|
|
2725
|
-
return /* @__PURE__ */ React49.createElement(SectionContent, null, /* @__PURE__ */ React49.createElement(PositionField, { onChange: onPositionChange }), isNotStatic ? /* @__PURE__ */ React49.createElement(React49.Fragment, null, /* @__PURE__ */ React49.createElement(DimensionsField, null), /* @__PURE__ */ React49.createElement(ZIndexField, null)) : null,
|
|
2764
|
+
return /* @__PURE__ */ React49.createElement(SectionContent, null, /* @__PURE__ */ React49.createElement(PositionField, { onChange: onPositionChange }), isNotStatic ? /* @__PURE__ */ React49.createElement(React49.Fragment, null, /* @__PURE__ */ React49.createElement(DimensionsField, null), /* @__PURE__ */ React49.createElement(ZIndexField, null)) : null, isCssIdFeatureActive && /* @__PURE__ */ React49.createElement(React49.Fragment, null, /* @__PURE__ */ React49.createElement(PanelDivider, null), /* @__PURE__ */ React49.createElement(OffsetField, null)));
|
|
2726
2765
|
};
|
|
2727
2766
|
var usePersistDimensions = () => {
|
|
2728
2767
|
const { id: styleDefID, meta } = useStyle();
|
|
@@ -2842,14 +2881,6 @@ import { __ as __31 } from "@wordpress/i18n";
|
|
|
2842
2881
|
// src/components/style-sections/typography-section/hooks/use-font-families.ts
|
|
2843
2882
|
import { useMemo as useMemo5 } from "react";
|
|
2844
2883
|
import { __ as __30 } from "@wordpress/i18n";
|
|
2845
|
-
|
|
2846
|
-
// src/sync/get-elementor-config.ts
|
|
2847
|
-
var getElementorConfig = () => {
|
|
2848
|
-
const extendedWindow = window;
|
|
2849
|
-
return extendedWindow.elementor?.config ?? {};
|
|
2850
|
-
};
|
|
2851
|
-
|
|
2852
|
-
// src/components/style-sections/typography-section/hooks/use-font-families.ts
|
|
2853
2884
|
var supportedCategories = {
|
|
2854
2885
|
system: __30("System", "elementor"),
|
|
2855
2886
|
custom: __30("Custom Fonts", "elementor"),
|
|
@@ -2890,7 +2921,7 @@ var FontFamilyField = () => {
|
|
|
2890
2921
|
if (fontFamilies.length === 0) {
|
|
2891
2922
|
return null;
|
|
2892
2923
|
}
|
|
2893
|
-
return /* @__PURE__ */ React54.createElement(StylesField, { bind: "font-family" }, /* @__PURE__ */ React54.createElement(Grid15, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React54.createElement(Grid15, { item: true, xs: 6 }, /* @__PURE__ */ React54.createElement(ControlLabel, null, __31("Font family", "elementor"))), /* @__PURE__ */ React54.createElement(Grid15, { item: true, xs: 6, sx: {
|
|
2924
|
+
return /* @__PURE__ */ React54.createElement(StylesField, { bind: "font-family" }, /* @__PURE__ */ React54.createElement(Grid15, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React54.createElement(Grid15, { item: true, xs: 6 }, /* @__PURE__ */ React54.createElement(ControlLabel, null, __31("Font family", "elementor"))), /* @__PURE__ */ React54.createElement(Grid15, { item: true, xs: 6, sx: { minWidth: 0 } }, /* @__PURE__ */ React54.createElement(FontFamilyControl, { fontFamilies }))));
|
|
2894
2925
|
};
|
|
2895
2926
|
|
|
2896
2927
|
// src/components/style-sections/typography-section/font-size-field.tsx
|
|
@@ -3203,13 +3234,32 @@ function useCurrentClassesProp() {
|
|
|
3203
3234
|
// src/components/editing-panel-tabs.tsx
|
|
3204
3235
|
var EditingPanelTabs = () => {
|
|
3205
3236
|
const { element } = useElement();
|
|
3206
|
-
const { getTabProps, getTabPanelProps, getTabsProps } = useTabs("settings");
|
|
3207
3237
|
return (
|
|
3208
3238
|
// When switching between elements, the local states should be reset. We are using key to rerender the tabs.
|
|
3209
3239
|
// Reference: https://react.dev/learn/preserving-and-resetting-state#resetting-a-form-with-a-key
|
|
3210
|
-
/* @__PURE__ */ React69.createElement(Fragment8, { key: element.id }, /* @__PURE__ */ React69.createElement(
|
|
3240
|
+
/* @__PURE__ */ React69.createElement(Fragment8, { key: element.id }, /* @__PURE__ */ React69.createElement(PanelTabContent, null))
|
|
3211
3241
|
);
|
|
3212
3242
|
};
|
|
3243
|
+
var PanelTabContent = () => {
|
|
3244
|
+
const defaultComponentTab = "settings";
|
|
3245
|
+
const [currentTab, setCurrentTab] = useStateByElement("tab", defaultComponentTab);
|
|
3246
|
+
const { getTabProps, getTabPanelProps, getTabsProps } = useTabs(currentTab);
|
|
3247
|
+
return /* @__PURE__ */ React69.createElement(ScrollProvider, null, /* @__PURE__ */ React69.createElement(Stack17, { direction: "column", sx: { width: "100%" } }, /* @__PURE__ */ React69.createElement(Stack17, { sx: { ...stickyHeaderStyles, top: 0 } }, /* @__PURE__ */ React69.createElement(
|
|
3248
|
+
Tabs,
|
|
3249
|
+
{
|
|
3250
|
+
variant: "fullWidth",
|
|
3251
|
+
size: "small",
|
|
3252
|
+
sx: { mt: 0.5 },
|
|
3253
|
+
...getTabsProps(),
|
|
3254
|
+
onChange: (_, newValue) => {
|
|
3255
|
+
getTabsProps().onChange(_, newValue);
|
|
3256
|
+
setCurrentTab(newValue);
|
|
3257
|
+
}
|
|
3258
|
+
},
|
|
3259
|
+
/* @__PURE__ */ React69.createElement(Tab, { label: __45("General", "elementor"), ...getTabProps("settings") }),
|
|
3260
|
+
/* @__PURE__ */ React69.createElement(Tab, { label: __45("Style", "elementor"), ...getTabProps("style") })
|
|
3261
|
+
), /* @__PURE__ */ React69.createElement(Divider6, null)), /* @__PURE__ */ React69.createElement(TabPanel, { ...getTabPanelProps("settings"), disablePadding: true }, /* @__PURE__ */ React69.createElement(SettingsTab, null)), /* @__PURE__ */ React69.createElement(TabPanel, { ...getTabPanelProps("style"), disablePadding: true }, /* @__PURE__ */ React69.createElement(StyleTab, null))));
|
|
3262
|
+
};
|
|
3213
3263
|
|
|
3214
3264
|
// src/components/editing-panel.tsx
|
|
3215
3265
|
var { useMenuItems } = controlActionsMenu;
|