@elementor/editor-editing-panel 4.5.0-1195 → 4.5.0-1196

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1989,6 +1989,7 @@ import { Fragment as Fragment10 } from "react";
1989
1989
  import * as React92 from "react";
1990
1990
  import { useHasContentOnlyAccess } from "@elementor/editor-current-user";
1991
1991
  import { getWidgetsCache as getWidgetsCache3 } from "@elementor/editor-elements";
1992
+ import { createReplaceableLocation } from "@elementor/locations";
1992
1993
  import { Divider as Divider6, Stack as Stack14, Tab, TabPanel, Tabs, useTabs } from "@elementor/ui";
1993
1994
  import { __ as __65 } from "@wordpress/i18n";
1994
1995
 
@@ -5911,6 +5912,7 @@ function useCurrentClassesProp() {
5911
5912
  // src/components/editing-panel-tabs.tsx
5912
5913
  var CONTENT_ONLY_TAB = "settings";
5913
5914
  var DESIGN_TABS = ["style", "interactions"];
5915
+ var { Slot: SettingsTabSlot, inject: injectIntoSettingsTab } = createReplaceableLocation();
5914
5916
  var EditingPanelTabs = () => {
5915
5917
  const { element } = useElement();
5916
5918
  return (
@@ -5920,7 +5922,7 @@ var EditingPanelTabs = () => {
5920
5922
  );
5921
5923
  };
5922
5924
  var PanelTabContent = () => {
5923
- const { element } = useElement();
5925
+ const { element, elementType } = useElement();
5924
5926
  const editorDefaults = useDefaultPanelSettings();
5925
5927
  const defaultComponentTab = editorDefaults.defaultTab;
5926
5928
  const elementMeta = getWidgetsCache3()?.[element.type]?.meta;
@@ -5967,7 +5969,7 @@ var PanelTabContent = () => {
5967
5969
  ...getDesignTabProps("interactions")
5968
5970
  }
5969
5971
  )
5970
- ), /* @__PURE__ */ React92.createElement(Divider6, null)), !isPromotedElement && /* @__PURE__ */ React92.createElement(TabPanel, { ...getTabPanelProps("settings"), disablePadding: true }, /* @__PURE__ */ React92.createElement(SettingsTab, null)), hasDesignTabs && !areDesignTabsRestricted && /* @__PURE__ */ React92.createElement(React92.Fragment, null, /* @__PURE__ */ React92.createElement(TabPanel, { ...getTabPanelProps("style"), disablePadding: true }, /* @__PURE__ */ React92.createElement(StyleTab, null)), /* @__PURE__ */ React92.createElement(TabPanel, { ...getTabPanelProps("interactions"), disablePadding: true }, /* @__PURE__ */ React92.createElement(InteractionsTab, null)))));
5972
+ ), /* @__PURE__ */ React92.createElement(Divider6, null)), !isPromotedElement && /* @__PURE__ */ React92.createElement(TabPanel, { ...getTabPanelProps("settings"), disablePadding: true }, /* @__PURE__ */ React92.createElement(SettingsTabSlot, { element, elementType }, /* @__PURE__ */ React92.createElement(SettingsTab, null))), hasDesignTabs && !areDesignTabsRestricted && /* @__PURE__ */ React92.createElement(React92.Fragment, null, /* @__PURE__ */ React92.createElement(TabPanel, { ...getTabPanelProps("style"), disablePadding: true }, /* @__PURE__ */ React92.createElement(StyleTab, null)), /* @__PURE__ */ React92.createElement(TabPanel, { ...getTabPanelProps("interactions"), disablePadding: true }, /* @__PURE__ */ React92.createElement(InteractionsTab, null)))));
5971
5973
  };
5972
5974
  var resolveCurrentTab = ({
5973
5975
  storedTab,
@@ -6043,6 +6045,37 @@ var {
6043
6045
  useInjections: useCustomCssHeaderInjections
6044
6046
  } = createLocation8();
6045
6047
 
6048
+ // src/hooks/use-controls-by-widget-type.ts
6049
+ import { getElementType } from "@elementor/editor-elements";
6050
+ function useControlsByWidgetType(type) {
6051
+ const elementType = getElementType(type);
6052
+ if (!elementType) {
6053
+ return {};
6054
+ }
6055
+ const controls = iterateControls(elementType.controls);
6056
+ return getControlsByBind(controls);
6057
+ }
6058
+ function iterateControls(controls) {
6059
+ return controls.map((control) => {
6060
+ if (control.type === "control" && "bind" in control.value) {
6061
+ return control;
6062
+ }
6063
+ if (control.type === "section") {
6064
+ return iterateControls(control.value.items);
6065
+ }
6066
+ return null;
6067
+ }).filter(Boolean).flat();
6068
+ }
6069
+ function getControlsByBind(controls) {
6070
+ return controls.reduce(
6071
+ (controlsByBind, control) => ({
6072
+ ...controlsByBind,
6073
+ [control.value.bind]: control
6074
+ }),
6075
+ {}
6076
+ );
6077
+ }
6078
+
6046
6079
  // src/init.ts
6047
6080
  import { injectIntoLogic } from "@elementor/editor";
6048
6081
  import { init as initEditorControls } from "@elementor/editor-controls";
@@ -6849,7 +6882,7 @@ import * as React98 from "react";
6849
6882
  import { useId as useId3 } from "react";
6850
6883
  import { ControlFormLabel as ControlFormLabel5, Repeater as Repeater3 } from "@elementor/editor-controls";
6851
6884
  import {
6852
- getElementType as getElementType2,
6885
+ getElementType as getElementType3,
6853
6886
  updateElementEditorSettings as updateElementEditorSettings4,
6854
6887
  useElementChildren as useElementChildren3,
6855
6888
  useElementEditorSettings as useElementEditorSettings4
@@ -6973,7 +7006,7 @@ var useActions2 = () => {
6973
7006
  };
6974
7007
 
6975
7008
  // src/controls-registry/element-controls/menu-items-control/use-entry-item.ts
6976
- import { getContainer as getContainer9, getElementSettings as getElementSettings4, getElementType } from "@elementor/editor-elements";
7009
+ import { getContainer as getContainer9, getElementSettings as getElementSettings4, getElementType as getElementType2 } from "@elementor/editor-elements";
6977
7010
  import { __privateUseListenTo as useListenTo4, commandEndEvent as commandEndEvent4 } from "@elementor/editor-v1-adapters";
6978
7011
  var useEntryItem = (entryId) => {
6979
7012
  return useListenTo4(
@@ -6991,7 +7024,7 @@ var useEntryItem = (entryId) => {
6991
7024
  );
6992
7025
  };
6993
7026
  var getEntrySettings = (itemId) => {
6994
- const propsSchema = getElementType(MENU_ITEM_ELEMENT_TYPE)?.propsSchema ?? {};
7027
+ const propsSchema = getElementType2(MENU_ITEM_ELEMENT_TYPE)?.propsSchema ?? {};
6995
7028
  return getElementSettings4(itemId, Object.keys(propsSchema));
6996
7029
  };
6997
7030
 
@@ -7081,7 +7114,7 @@ var ItemNameControl2 = ({ elementId }) => {
7081
7114
  };
7082
7115
  var ItemLinkControl = ({ entryId }) => {
7083
7116
  const { itemId, settings } = useEntryItem(entryId);
7084
- const elementType = itemId ? getElementType2(MENU_ITEM_ELEMENT_TYPE) : null;
7117
+ const elementType = itemId ? getElementType3(MENU_ITEM_ELEMENT_TYPE) : null;
7085
7118
  const linkControl = elementType ? findControlByBind(elementType.controls, LINK_BIND) : null;
7086
7119
  if (!itemId || !elementType || !linkControl) {
7087
7120
  return null;
@@ -8986,10 +9019,12 @@ export {
8986
9019
  PseudoStateMenuItems,
8987
9020
  STYLE_SECTIONS,
8988
9021
  STYLE_SECTION_NAMES,
9022
+ Section,
8989
9023
  SectionContent,
8990
9024
  SectionsList,
8991
9025
  SettingsControl,
8992
9026
  SettingsField,
9027
+ SettingsTab,
8993
9028
  StyleIndicator,
8994
9029
  StyleInheritanceProvider,
8995
9030
  StyleProvider,
@@ -9015,6 +9050,7 @@ export {
9015
9050
  injectIntoCustomCssHeader,
9016
9051
  injectIntoGridFields,
9017
9052
  injectIntoPanelHeaderTop,
9053
+ injectIntoSettingsTab,
9018
9054
  injectIntoStyleSectionHeader,
9019
9055
  injectIntoStyleTab,
9020
9056
  injectIntoStyleTabHeader,
@@ -9025,6 +9061,7 @@ export {
9025
9061
  registerStyleProviderToColors,
9026
9062
  setLicenseConfig,
9027
9063
  useClassesProp,
9064
+ useControlsByWidgetType,
9028
9065
  useCustomCss,
9029
9066
  useElement,
9030
9067
  usePanelActions,