@elementor/editor-components 4.0.0-604 → 4.0.0-607

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
@@ -1,5 +1,5 @@
1
1
  // src/init.ts
2
- import { injectIntoLogic } from "@elementor/editor";
2
+ import { injectIntoLogic as injectIntoLogic2 } from "@elementor/editor";
3
3
  import {
4
4
  registerElementType,
5
5
  settingsTransformersRegistry as settingsTransformersRegistry2
@@ -1529,406 +1529,65 @@ import { PanelBody, PanelHeader, PanelHeaderTitle } from "@elementor/editor-pane
1529
1529
  import { EllipsisWithTooltip as EllipsisWithTooltip2 } from "@elementor/editor-ui";
1530
1530
  import { ComponentsIcon as ComponentsIcon3, PencilIcon as PencilIcon2 } from "@elementor/icons";
1531
1531
  import { Box as Box8, Divider as Divider2, IconButton as IconButton2, Stack as Stack10, Tooltip } from "@elementor/ui";
1532
- import { __ as __12 } from "@wordpress/i18n";
1533
-
1534
- // src/extended/store/actions/delete-overridable-prop.ts
1535
- import { __dispatch as dispatch5, __getState as getState7 } from "@elementor/store";
1536
-
1537
- // src/extended/utils/revert-overridable-settings.ts
1538
- import {
1539
- getAllDescendants as getAllDescendants2,
1540
- getContainer as getContainer2,
1541
- getElementSetting,
1542
- updateElementSettings
1543
- } from "@elementor/editor-elements";
1544
-
1545
- // src/prop-types/component-instance-override-prop-type.ts
1546
- import { createPropUtils } from "@elementor/editor-props";
1547
- import { z as z2 } from "@elementor/schema";
1548
- var componentInstanceOverridePropTypeUtil = createPropUtils(
1549
- "override",
1550
- z2.object({
1551
- override_key: z2.string(),
1552
- override_value: z2.unknown(),
1553
- schema_source: z2.object({
1554
- type: z2.literal("component"),
1555
- id: z2.number()
1556
- })
1557
- })
1558
- );
1559
-
1560
- // src/prop-types/component-instance-overrides-prop-type.ts
1561
- import { createPropUtils as createPropUtils3 } from "@elementor/editor-props";
1562
- import { z as z4 } from "@elementor/schema";
1563
-
1564
- // src/prop-types/component-overridable-prop-type.ts
1565
- import { createPropUtils as createPropUtils2 } from "@elementor/editor-props";
1566
- import { z as z3 } from "@elementor/schema";
1567
- var componentOverridablePropTypeUtil = createPropUtils2(
1568
- "overridable",
1569
- z3.object({
1570
- override_key: z3.string(),
1571
- origin_value: z3.object({
1572
- $$type: z3.string(),
1573
- value: z3.unknown()
1574
- }).nullable()
1575
- })
1576
- );
1577
-
1578
- // src/prop-types/component-instance-overrides-prop-type.ts
1579
- var componentInstanceOverridesPropTypeUtil = createPropUtils3(
1580
- "overrides",
1581
- z4.array(z4.union([componentInstanceOverridePropTypeUtil.schema, componentOverridablePropTypeUtil.schema])).optional().default([])
1582
- );
1583
-
1584
- // src/prop-types/component-instance-prop-type.ts
1585
- import { createPropUtils as createPropUtils4, numberPropTypeUtil } from "@elementor/editor-props";
1586
- import { z as z5 } from "@elementor/schema";
1587
- var componentInstancePropTypeUtil = createPropUtils4(
1588
- "component-instance",
1589
- z5.object({
1590
- component_id: numberPropTypeUtil.schema,
1591
- overrides: z5.optional(componentInstanceOverridesPropTypeUtil.schema)
1592
- })
1593
- );
1594
-
1595
- // src/extended/utils/revert-overridable-settings.ts
1596
- function revertElementOverridableSetting(elementId, settingKey, originValue, overrideKey) {
1597
- const container = getContainer2(elementId);
1598
- if (!container) {
1599
- return;
1600
- }
1601
- if (isComponentInstance(container.model.toJSON())) {
1602
- revertComponentInstanceOverridableSetting(elementId, overrideKey);
1603
- return;
1604
- }
1605
- updateElementSettings({
1606
- id: elementId,
1607
- props: { [settingKey]: originValue ?? null },
1608
- withHistory: false
1609
- });
1610
- }
1611
- function revertComponentInstanceOverridableSetting(elementId, overrideKey) {
1612
- const setting = getElementSetting(elementId, "component_instance");
1613
- const componentInstance = componentInstancePropTypeUtil.extract(setting);
1614
- const overrides = componentInstanceOverridesPropTypeUtil.extract(componentInstance?.overrides);
1615
- if (!overrides?.length) {
1616
- return;
1617
- }
1618
- const revertedOverrides = revertComponentInstanceOverrides(overrides, overrideKey);
1619
- const updatedSetting = componentInstancePropTypeUtil.create({
1620
- ...componentInstance,
1621
- overrides: componentInstanceOverridesPropTypeUtil.create(revertedOverrides)
1622
- });
1623
- updateElementSettings({
1624
- id: elementId,
1625
- props: { component_instance: updatedSetting },
1626
- withHistory: false
1627
- });
1628
- }
1629
- function revertComponentInstanceOverrides(overrides, filterByKey) {
1630
- return overrides.map((item) => {
1631
- if (!componentOverridablePropTypeUtil.isValid(item)) {
1632
- return item;
1633
- }
1634
- if (!componentInstanceOverridePropTypeUtil.isValid(item.value.origin_value)) {
1635
- return null;
1636
- }
1637
- if (filterByKey && item.value.override_key !== filterByKey) {
1638
- return item;
1639
- }
1640
- return item.value.origin_value;
1641
- }).filter((item) => item !== null);
1642
- }
1643
- function revertOverridablePropsFromSettings(settings) {
1644
- let hasChanges = false;
1645
- const revertedSettings = {};
1646
- for (const [key, value] of Object.entries(settings)) {
1647
- if (componentOverridablePropTypeUtil.isValid(value)) {
1648
- revertedSettings[key] = value.value.origin_value;
1649
- hasChanges = true;
1650
- } else {
1651
- revertedSettings[key] = value;
1652
- }
1653
- }
1654
- return { hasChanges, settings: revertedSettings };
1655
- }
1656
- function revertAllOverridablesInElementData(elementData) {
1657
- const revertedElement = { ...elementData };
1658
- if (isComponentInstance({ widgetType: elementData.widgetType, elType: elementData.elType })) {
1659
- revertedElement.settings = revertComponentInstanceSettings(elementData.settings);
1660
- } else if (revertedElement.settings) {
1661
- const { settings } = revertOverridablePropsFromSettings(revertedElement.settings);
1662
- revertedElement.settings = settings;
1663
- }
1664
- if (revertedElement.elements) {
1665
- revertedElement.elements = revertedElement.elements.map(revertAllOverridablesInElementData);
1666
- }
1667
- return revertedElement;
1668
- }
1669
- function revertComponentInstanceSettings(settings) {
1670
- if (!settings?.component_instance) {
1671
- return settings;
1672
- }
1673
- const componentInstance = componentInstancePropTypeUtil.extract(settings.component_instance);
1674
- const overrides = componentInstanceOverridesPropTypeUtil.extract(componentInstance?.overrides);
1675
- if (!overrides?.length) {
1676
- return settings;
1677
- }
1678
- const revertedOverrides = revertComponentInstanceOverrides(overrides);
1679
- return {
1680
- ...settings,
1681
- component_instance: componentInstancePropTypeUtil.create({
1682
- ...componentInstance,
1683
- overrides: componentInstanceOverridesPropTypeUtil.create(revertedOverrides)
1684
- })
1685
- };
1686
- }
1687
- function revertAllOverridablesInContainer(container) {
1688
- getAllDescendants2(container).forEach((element) => {
1689
- if (element.model.get("widgetType") === COMPONENT_WIDGET_TYPE) {
1690
- revertComponentInstanceOverridesInElement(element);
1691
- } else {
1692
- revertElementSettings(element);
1693
- }
1694
- });
1695
- }
1696
- function revertComponentInstanceOverridesInElement(element) {
1697
- const settings = element.settings?.toJSON() ?? {};
1698
- const componentInstance = componentInstancePropTypeUtil.extract(settings.component_instance);
1699
- const overrides = componentInstanceOverridesPropTypeUtil.extract(componentInstance?.overrides);
1700
- if (!overrides?.length) {
1701
- return;
1702
- }
1703
- const revertedOverrides = revertComponentInstanceOverrides(overrides);
1704
- const updatedSetting = componentInstancePropTypeUtil.create({
1705
- ...componentInstance,
1706
- overrides: componentInstanceOverridesPropTypeUtil.create(revertedOverrides)
1707
- });
1708
- updateElementSettings({
1709
- id: element.id,
1710
- props: { component_instance: updatedSetting },
1711
- withHistory: false
1712
- });
1713
- }
1714
- function revertElementSettings(element) {
1715
- const settings = element.settings?.toJSON() ?? {};
1716
- const { hasChanges, settings: revertedSettings } = revertOverridablePropsFromSettings(settings);
1717
- if (!hasChanges) {
1718
- return;
1719
- }
1720
- updateElementSettings({
1721
- id: element.id,
1722
- props: revertedSettings,
1723
- withHistory: false
1724
- });
1725
- }
1726
-
1727
- // src/extended/store/utils/groups-transformers.ts
1728
- import { generateUniqueId } from "@elementor/utils";
1729
- import { __ as __10 } from "@wordpress/i18n";
1730
- function removePropFromAllGroups(groups, propKey) {
1731
- const propKeys = Array.isArray(propKey) ? propKey : [propKey];
1732
- return {
1733
- ...groups,
1734
- items: Object.fromEntries(
1735
- Object.entries(groups.items).map(([groupId, group]) => [
1736
- groupId,
1737
- {
1738
- ...group,
1739
- props: group.props.filter((p) => !propKeys.includes(p))
1740
- }
1741
- ])
1742
- )
1743
- };
1744
- }
1745
- function addPropToGroup(groups, groupId, propKey) {
1746
- const group = groups.items[groupId];
1747
- if (!group) {
1748
- return groups;
1749
- }
1750
- if (group.props.includes(propKey)) {
1751
- return groups;
1752
- }
1753
- return {
1754
- ...groups,
1755
- items: {
1756
- ...groups.items,
1757
- [groupId]: {
1758
- ...group,
1759
- props: [...group.props, propKey]
1760
- }
1761
- }
1762
- };
1763
- }
1764
- function movePropBetweenGroups(groups, propKey, fromGroupId, toGroupId) {
1765
- if (fromGroupId === toGroupId) {
1766
- return groups;
1767
- }
1768
- const withoutProp = removePropFromGroup(groups, fromGroupId, propKey);
1769
- return addPropToGroup(withoutProp, toGroupId, propKey);
1770
- }
1771
- function removePropFromGroup(groups, groupId, propKey) {
1772
- const group = groups.items[groupId];
1773
- if (!group) {
1774
- return groups;
1775
- }
1776
- return {
1777
- ...groups,
1778
- items: {
1779
- ...groups.items,
1780
- [groupId]: {
1781
- ...group,
1782
- props: group.props.filter((p) => p !== propKey)
1783
- }
1784
- }
1785
- };
1786
- }
1787
- function resolveOrCreateGroup(groups, requestedGroupId) {
1788
- if (requestedGroupId && groups.items[requestedGroupId]) {
1789
- return { groups, groupId: requestedGroupId };
1790
- }
1791
- if (!requestedGroupId && groups.order.length > 0) {
1792
- return { groups, groupId: groups.order[0] };
1793
- }
1794
- return createGroup(groups, requestedGroupId);
1795
- }
1796
- function createGroup(groups, groupId, label) {
1797
- const newGroupId = groupId || generateUniqueId("group");
1798
- const newLabel = label || __10("Default", "elementor");
1799
- return {
1800
- groups: {
1801
- ...groups,
1802
- items: {
1803
- ...groups.items,
1804
- [newGroupId]: {
1805
- id: newGroupId,
1806
- label: newLabel,
1807
- props: []
1808
- }
1809
- },
1810
- order: [...groups.order, newGroupId]
1811
- },
1812
- groupId: newGroupId
1813
- };
1814
- }
1815
- function removePropsFromState(overridableProps, propsToRemove) {
1816
- const overrideKeysToRemove = propsToRemove.map((prop) => prop.overrideKey);
1817
- const remainingProps = Object.fromEntries(
1818
- Object.entries(overridableProps.props).filter(([, prop]) => !propsToRemove.includes(prop))
1819
- );
1820
- const updatedGroupItems = Object.fromEntries(
1821
- Object.entries(overridableProps.groups.items).map(
1822
- ([groupId, group]) => [
1823
- groupId,
1824
- {
1825
- ...group,
1826
- props: group.props.filter((prop) => !overrideKeysToRemove.includes(prop))
1827
- }
1828
- ]
1829
- )
1830
- );
1831
- return {
1832
- props: remainingProps,
1833
- groups: {
1834
- items: updatedGroupItems,
1835
- order: overridableProps.groups.order.filter((groupId) => !overrideKeysToRemove.includes(groupId))
1836
- }
1837
- };
1838
- }
1839
- function ensureGroupInOrder(groups, groupId) {
1840
- if (groups.order.includes(groupId)) {
1841
- return groups;
1842
- }
1843
- return {
1844
- ...groups,
1845
- order: [...groups.order, groupId]
1846
- };
1847
- }
1848
- function deleteGroup(groups, groupId) {
1849
- const { [groupId]: removed, ...remainingItems } = groups.items;
1850
- return {
1851
- items: remainingItems,
1852
- order: groups.order.filter((id2) => id2 !== groupId)
1853
- };
1854
- }
1855
- function renameGroup(groups, groupId, newLabel) {
1856
- const group = groups.items[groupId];
1857
- if (!group) {
1858
- return groups;
1859
- }
1860
- return {
1861
- ...groups,
1862
- items: {
1863
- ...groups.items,
1864
- [groupId]: {
1865
- ...group,
1866
- label: newLabel
1867
- }
1868
- }
1869
- };
1870
- }
1532
+ import { __ as __11 } from "@wordpress/i18n";
1871
1533
 
1872
- // src/extended/store/actions/delete-overridable-prop.ts
1873
- function deleteOverridableProp({ componentId, propKey, source }) {
1874
- const overridableProps = selectOverridableProps(getState7(), componentId);
1875
- if (!overridableProps || Object.keys(overridableProps.props).length === 0) {
1876
- return;
1877
- }
1878
- const propKeysToDelete = Array.isArray(propKey) ? propKey : [propKey];
1879
- const deletedProps = [];
1880
- for (const key of propKeysToDelete) {
1881
- const prop = overridableProps.props[key];
1882
- if (!prop) {
1883
- continue;
1884
- }
1885
- deletedProps.push(prop);
1886
- revertElementOverridableSetting(prop.elementId, prop.propKey, prop.originValue, key);
1887
- }
1888
- if (deletedProps.length === 0) {
1889
- return;
1890
- }
1891
- const remainingProps = Object.fromEntries(
1892
- Object.entries(overridableProps.props).filter(([key]) => !propKeysToDelete.includes(key))
1893
- );
1894
- const updatedGroups = removePropFromAllGroups(overridableProps.groups, propKey);
1895
- dispatch5(
1896
- slice.actions.setOverridableProps({
1897
- componentId,
1898
- overridableProps: {
1899
- ...overridableProps,
1900
- props: remainingProps,
1901
- groups: updatedGroups
1902
- }
1534
+ // src/prop-types/component-instance-overrides-prop-type.ts
1535
+ import { createPropUtils as createPropUtils3 } from "@elementor/editor-props";
1536
+ import { z as z4 } from "@elementor/schema";
1537
+
1538
+ // src/prop-types/component-instance-override-prop-type.ts
1539
+ import { createPropUtils } from "@elementor/editor-props";
1540
+ import { z as z2 } from "@elementor/schema";
1541
+ var componentInstanceOverridePropTypeUtil = createPropUtils(
1542
+ "override",
1543
+ z2.object({
1544
+ override_key: z2.string(),
1545
+ override_value: z2.unknown(),
1546
+ schema_source: z2.object({
1547
+ type: z2.literal("component"),
1548
+ id: z2.number()
1903
1549
  })
1904
- );
1905
- const currentComponent = selectCurrentComponent(getState7());
1906
- for (const prop of deletedProps) {
1907
- trackComponentEvent({
1908
- action: "propertyRemoved",
1909
- source,
1910
- component_uid: currentComponent?.uid,
1911
- property_id: prop.overrideKey,
1912
- property_path: prop.propKey,
1913
- property_name: prop.label,
1914
- element_type: prop.widgetType ?? prop.elType
1915
- });
1916
- }
1917
- }
1550
+ })
1551
+ );
1918
1552
 
1919
- // src/extended/store/actions/update-component-sanitized-attribute.ts
1920
- import { __dispatch as dispatch6 } from "@elementor/store";
1921
- function updateComponentSanitizedAttribute(componentId, attribute) {
1922
- dispatch6(slice.actions.updateComponentSanitizedAttribute({ componentId, attribute }));
1923
- }
1553
+ // src/prop-types/component-overridable-prop-type.ts
1554
+ import { createPropUtils as createPropUtils2 } from "@elementor/editor-props";
1555
+ import { z as z3 } from "@elementor/schema";
1556
+ var componentOverridablePropTypeUtil = createPropUtils2(
1557
+ "overridable",
1558
+ z3.object({
1559
+ override_key: z3.string(),
1560
+ origin_value: z3.object({
1561
+ $$type: z3.string(),
1562
+ value: z3.unknown()
1563
+ }).nullable()
1564
+ })
1565
+ );
1566
+
1567
+ // src/prop-types/component-instance-overrides-prop-type.ts
1568
+ var componentInstanceOverridesPropTypeUtil = createPropUtils3(
1569
+ "overrides",
1570
+ z4.array(z4.union([componentInstanceOverridePropTypeUtil.schema, componentOverridablePropTypeUtil.schema])).optional().default([])
1571
+ );
1572
+
1573
+ // src/prop-types/component-instance-prop-type.ts
1574
+ import { createPropUtils as createPropUtils4, numberPropTypeUtil } from "@elementor/editor-props";
1575
+ import { z as z5 } from "@elementor/schema";
1576
+ var componentInstancePropTypeUtil = createPropUtils4(
1577
+ "component-instance",
1578
+ z5.object({
1579
+ component_id: numberPropTypeUtil.schema,
1580
+ overrides: z5.optional(componentInstanceOverridesPropTypeUtil.schema)
1581
+ })
1582
+ );
1924
1583
 
1925
1584
  // src/utils/get-container-by-origin-id.ts
1926
- import { getContainer as getContainer3 } from "@elementor/editor-elements";
1585
+ import { getContainer as getContainer2 } from "@elementor/editor-elements";
1927
1586
  function getContainerByOriginId(originElementId, instanceElementId) {
1928
1587
  if (!instanceElementId) {
1929
- return getContainer3(originElementId);
1588
+ return getContainer2(originElementId);
1930
1589
  }
1931
- const instanceContainer = getContainer3(instanceElementId);
1590
+ const instanceContainer = getContainer2(instanceElementId);
1932
1591
  if (!instanceContainer) {
1933
1592
  return null;
1934
1593
  }
@@ -1941,12 +1600,12 @@ function getContainerByOriginId(originElementId, instanceElementId) {
1941
1600
  }
1942
1601
 
1943
1602
  // src/utils/get-overridable-prop.ts
1944
- import { __getState as getState8 } from "@elementor/store";
1603
+ import { __getState as getState7 } from "@elementor/store";
1945
1604
  function getOverridableProp({
1946
1605
  componentId,
1947
1606
  overrideKey
1948
1607
  }) {
1949
- const overridableProps = selectOverridableProps(getState8(), componentId);
1608
+ const overridableProps = selectOverridableProps(getState7(), componentId);
1950
1609
  if (!overridableProps) {
1951
1610
  return void 0;
1952
1611
  }
@@ -2054,14 +1713,7 @@ function useSanitizeOverridableProps(componentId, instanceElementId) {
2054
1713
  if (isSanitized) {
2055
1714
  return overridableProps;
2056
1715
  }
2057
- const filteredOverridableProps = filterValidOverridableProps(overridableProps, instanceElementId);
2058
- const originalPropsArray = Object.entries(overridableProps.props ?? {});
2059
- const propsToDelete = originalPropsArray.filter(([key]) => !filteredOverridableProps.props[key]);
2060
- propsToDelete.forEach(([key]) => {
2061
- deleteOverridableProp({ componentId, propKey: key, source: "system" });
2062
- });
2063
- updateComponentSanitizedAttribute(componentId, "overridableProps");
2064
- return filteredOverridableProps;
1716
+ return filterValidOverridableProps(overridableProps, instanceElementId);
2065
1717
  }
2066
1718
 
2067
1719
  // src/provider/component-instance-context.tsx
@@ -2079,13 +1731,13 @@ var useComponentOverridableProps = () => useContext2(ComponentInstanceContext)?.
2079
1731
  import * as React11 from "react";
2080
1732
  import { ComponentPropListIcon, PencilIcon } from "@elementor/icons";
2081
1733
  import { Button as Button2, Stack as Stack6, Typography as Typography5 } from "@elementor/ui";
2082
- import { __ as __11 } from "@wordpress/i18n";
1734
+ import { __ as __10 } from "@wordpress/i18n";
2083
1735
  var EmptyState2 = ({ onEditComponent }) => {
2084
1736
  const { canEdit } = useComponentsPermissions();
2085
- const message = canEdit ? __11(
1737
+ const message = canEdit ? __10(
2086
1738
  "Edit the component to add properties, manage them or update the design across all instances.",
2087
1739
  "elementor"
2088
- ) : __11(
1740
+ ) : __10(
2089
1741
  "With your current role, you cannot edit this component. Contact an administrator to add properties.",
2090
1742
  "elementor"
2091
1743
  );
@@ -2100,9 +1752,9 @@ var EmptyState2 = ({ onEditComponent }) => {
2100
1752
  gap: 1.5
2101
1753
  },
2102
1754
  /* @__PURE__ */ React11.createElement(ComponentPropListIcon, { fontSize: "large" }),
2103
- /* @__PURE__ */ React11.createElement(Typography5, { align: "center", variant: "subtitle2" }, __11("No properties yet", "elementor")),
1755
+ /* @__PURE__ */ React11.createElement(Typography5, { align: "center", variant: "subtitle2" }, __10("No properties yet", "elementor")),
2104
1756
  /* @__PURE__ */ React11.createElement(Typography5, { align: "center", variant: "caption", maxWidth: "170px" }, message),
2105
- canEdit && /* @__PURE__ */ React11.createElement(Button2, { variant: "outlined", color: "secondary", size: "small", sx: { mt: 1 }, onClick: onEditComponent }, /* @__PURE__ */ React11.createElement(PencilIcon, { fontSize: "small" }), __11("Edit component", "elementor"))
1757
+ canEdit && /* @__PURE__ */ React11.createElement(Button2, { variant: "outlined", color: "secondary", size: "small", sx: { mt: 1 }, onClick: onEditComponent }, /* @__PURE__ */ React11.createElement(PencilIcon, { fontSize: "small" }), __10("Edit component", "elementor"))
2106
1758
  );
2107
1759
  };
2108
1760
 
@@ -2176,7 +1828,7 @@ var useOverridablePropValue = () => useContext3(OverridablePropContext)?.value;
2176
1828
  var useComponentInstanceElement = () => useContext3(OverridablePropContext)?.componentInstanceElement;
2177
1829
 
2178
1830
  // src/store/actions/update-overridable-prop.ts
2179
- import { __dispatch as dispatch7, __getState as getState9 } from "@elementor/store";
1831
+ import { __dispatch as dispatch5, __getState as getState8 } from "@elementor/store";
2180
1832
 
2181
1833
  // src/utils/resolve-override-prop-value.ts
2182
1834
  var resolveOverridePropValue = (originalPropValue) => {
@@ -2211,7 +1863,7 @@ function getOverrideValue(overrideProp) {
2211
1863
 
2212
1864
  // src/store/actions/update-overridable-prop.ts
2213
1865
  function updateOverridableProp(componentId, propValue, originPropFields) {
2214
- const overridableProps = selectOverridableProps(getState9(), componentId);
1866
+ const overridableProps = selectOverridableProps(getState8(), componentId);
2215
1867
  if (!overridableProps) {
2216
1868
  return;
2217
1869
  }
@@ -2236,7 +1888,7 @@ function updateOverridableProp(componentId, propValue, originPropFields) {
2236
1888
  }
2237
1889
  }
2238
1890
  };
2239
- dispatch7(
1891
+ dispatch5(
2240
1892
  slice.actions.setOverridableProps({
2241
1893
  componentId,
2242
1894
  overridableProps: newOverridableProps
@@ -2597,7 +2249,7 @@ function InstanceEditingPanel() {
2597
2249
  if (!componentId || !overridableProps || !component) {
2598
2250
  return null;
2599
2251
  }
2600
- const panelTitle = __12("Edit %s", "elementor").replace("%s", component.name);
2252
+ const panelTitle = __11("Edit %s", "elementor").replace("%s", component.name);
2601
2253
  const handleEditComponent = () => switchToComponent(componentId, componentInstanceId);
2602
2254
  const isNonEmptyGroup = (group) => group !== null && group.props.length > 0;
2603
2255
  const groups = overridableProps.groups.order.map((groupId) => overridableProps.groups.items[groupId] ?? null).filter(isNonEmptyGroup);
@@ -2631,7 +2283,7 @@ var LoadTemplateComponents = () => {
2631
2283
  };
2632
2284
 
2633
2285
  // src/extended/init.ts
2634
- import { injectIntoTop } from "@elementor/editor";
2286
+ import { injectIntoLogic, injectIntoTop } from "@elementor/editor";
2635
2287
  import { registerControlReplacement } from "@elementor/editor-controls";
2636
2288
  import { getV1CurrentDocument } from "@elementor/editor-documents";
2637
2289
  import { FIELD_TYPE, injectIntoPanelHeaderTop, registerFieldIndicator } from "@elementor/editor-editing-panel";
@@ -2671,7 +2323,7 @@ import * as React17 from "react";
2671
2323
  import { PopoverContent } from "@elementor/editor-controls";
2672
2324
  import { PopoverHeader } from "@elementor/editor-ui";
2673
2325
  import { Box as Box9, Button as Button3, Image, Link as Link2, Popover, Stack as Stack11, Typography as Typography6 } from "@elementor/ui";
2674
- import { __ as __13 } from "@wordpress/i18n";
2326
+ import { __ as __12 } from "@wordpress/i18n";
2675
2327
  var ComponentIntroduction = ({
2676
2328
  anchorRef,
2677
2329
  shouldShowIntroduction,
@@ -2695,17 +2347,17 @@ var ComponentIntroduction = ({
2695
2347
  },
2696
2348
  onClose
2697
2349
  },
2698
- /* @__PURE__ */ React17.createElement(Box9, { sx: { width: "296px" } }, /* @__PURE__ */ React17.createElement(PopoverHeader, { title: __13("Add your first property", "elementor"), onClose }), /* @__PURE__ */ React17.createElement(
2350
+ /* @__PURE__ */ React17.createElement(Box9, { sx: { width: "296px" } }, /* @__PURE__ */ React17.createElement(PopoverHeader, { title: __12("Add your first property", "elementor"), onClose }), /* @__PURE__ */ React17.createElement(
2699
2351
  Image,
2700
2352
  {
2701
2353
  sx: { width: "296px", height: "160px" },
2702
2354
  src: "https://assets.elementor.com/packages/v1/images/components-properties-intro.png",
2703
2355
  alt: ""
2704
2356
  }
2705
- ), /* @__PURE__ */ React17.createElement(PopoverContent, null, /* @__PURE__ */ React17.createElement(Stack11, { sx: { p: 2 } }, /* @__PURE__ */ React17.createElement(Typography6, { variant: "body2" }, __13("Properties make instances flexible.", "elementor")), /* @__PURE__ */ React17.createElement(Typography6, { variant: "body2" }, __13(
2357
+ ), /* @__PURE__ */ React17.createElement(PopoverContent, null, /* @__PURE__ */ React17.createElement(Stack11, { sx: { p: 2 } }, /* @__PURE__ */ React17.createElement(Typography6, { variant: "body2" }, __12("Properties make instances flexible.", "elementor")), /* @__PURE__ */ React17.createElement(Typography6, { variant: "body2" }, __12(
2706
2358
  "Select any Element, then in the General tab, click next to any setting you want users to customize - like text, images, or links.",
2707
2359
  "elementor"
2708
- )), /* @__PURE__ */ React17.createElement(Typography6, { variant: "body2", sx: { mt: 2 } }, __13(
2360
+ )), /* @__PURE__ */ React17.createElement(Typography6, { variant: "body2", sx: { mt: 2 } }, __12(
2709
2361
  "Your properties will appear in the Properties panel, where you can organize and manage them anytime.",
2710
2362
  "elementor"
2711
2363
  )), /* @__PURE__ */ React17.createElement(
@@ -2717,8 +2369,8 @@ var ComponentIntroduction = ({
2717
2369
  color: "info.main",
2718
2370
  variant: "body2"
2719
2371
  },
2720
- __13("Learn more", "elementor")
2721
- ), /* @__PURE__ */ React17.createElement(Stack11, { direction: "row", alignItems: "center", justifyContent: "flex-end", sx: { pt: 1 } }, /* @__PURE__ */ React17.createElement(Button3, { size: "medium", variant: "contained", onClick: onClose }, __13("Got it", "elementor"))))))
2372
+ __12("Learn more", "elementor")
2373
+ ), /* @__PURE__ */ React17.createElement(Stack11, { direction: "row", alignItems: "center", justifyContent: "flex-end", sx: { pt: 1 } }, /* @__PURE__ */ React17.createElement(Button3, { size: "medium", variant: "contained", onClick: onClose }, __12("Got it", "elementor"))))))
2722
2374
  );
2723
2375
  };
2724
2376
 
@@ -2741,75 +2393,410 @@ import { Divider as Divider3, IconButton as IconButton5, List as List3, Stack as
2741
2393
  import { generateUniqueId as generateUniqueId2 } from "@elementor/utils";
2742
2394
  import { __ as __20 } from "@wordpress/i18n";
2743
2395
 
2744
- // src/extended/store/actions/add-overridable-group.ts
2745
- import { __dispatch as dispatch8, __getState as getState10 } from "@elementor/store";
2746
- function addOverridableGroup({
2747
- componentId,
2748
- groupId,
2749
- label,
2750
- source
2751
- }) {
2752
- const currentComponent = selectCurrentComponent(getState10());
2396
+ // src/extended/store/actions/add-overridable-group.ts
2397
+ import { __dispatch as dispatch6, __getState as getState9 } from "@elementor/store";
2398
+ function addOverridableGroup({
2399
+ componentId,
2400
+ groupId,
2401
+ label,
2402
+ source
2403
+ }) {
2404
+ const currentComponent = selectCurrentComponent(getState9());
2405
+ const overridableProps = selectOverridableProps(getState9(), componentId);
2406
+ if (!overridableProps) {
2407
+ return;
2408
+ }
2409
+ const newGroup = {
2410
+ id: groupId,
2411
+ label,
2412
+ props: []
2413
+ };
2414
+ dispatch6(
2415
+ slice.actions.setOverridableProps({
2416
+ componentId,
2417
+ overridableProps: {
2418
+ ...overridableProps,
2419
+ groups: {
2420
+ ...overridableProps.groups,
2421
+ items: {
2422
+ ...overridableProps.groups.items,
2423
+ [groupId]: newGroup
2424
+ },
2425
+ order: [groupId, ...overridableProps.groups.order]
2426
+ }
2427
+ }
2428
+ })
2429
+ );
2430
+ trackComponentEvent({
2431
+ action: "propertiesGroupCreated",
2432
+ source,
2433
+ component_uid: currentComponent?.uid,
2434
+ group_name: label
2435
+ });
2436
+ return newGroup;
2437
+ }
2438
+
2439
+ // src/extended/store/actions/delete-overridable-group.ts
2440
+ import { __dispatch as dispatch7, __getState as getState10 } from "@elementor/store";
2441
+
2442
+ // src/extended/store/utils/groups-transformers.ts
2443
+ import { generateUniqueId } from "@elementor/utils";
2444
+ import { __ as __13 } from "@wordpress/i18n";
2445
+ function removePropFromAllGroups(groups, propKey) {
2446
+ const propKeys = Array.isArray(propKey) ? propKey : [propKey];
2447
+ return {
2448
+ ...groups,
2449
+ items: Object.fromEntries(
2450
+ Object.entries(groups.items).map(([groupId, group]) => [
2451
+ groupId,
2452
+ {
2453
+ ...group,
2454
+ props: group.props.filter((p) => !propKeys.includes(p))
2455
+ }
2456
+ ])
2457
+ )
2458
+ };
2459
+ }
2460
+ function addPropToGroup(groups, groupId, propKey) {
2461
+ const group = groups.items[groupId];
2462
+ if (!group) {
2463
+ return groups;
2464
+ }
2465
+ if (group.props.includes(propKey)) {
2466
+ return groups;
2467
+ }
2468
+ return {
2469
+ ...groups,
2470
+ items: {
2471
+ ...groups.items,
2472
+ [groupId]: {
2473
+ ...group,
2474
+ props: [...group.props, propKey]
2475
+ }
2476
+ }
2477
+ };
2478
+ }
2479
+ function movePropBetweenGroups(groups, propKey, fromGroupId, toGroupId) {
2480
+ if (fromGroupId === toGroupId) {
2481
+ return groups;
2482
+ }
2483
+ const withoutProp = removePropFromGroup(groups, fromGroupId, propKey);
2484
+ return addPropToGroup(withoutProp, toGroupId, propKey);
2485
+ }
2486
+ function removePropFromGroup(groups, groupId, propKey) {
2487
+ const group = groups.items[groupId];
2488
+ if (!group) {
2489
+ return groups;
2490
+ }
2491
+ return {
2492
+ ...groups,
2493
+ items: {
2494
+ ...groups.items,
2495
+ [groupId]: {
2496
+ ...group,
2497
+ props: group.props.filter((p) => p !== propKey)
2498
+ }
2499
+ }
2500
+ };
2501
+ }
2502
+ function resolveOrCreateGroup(groups, requestedGroupId) {
2503
+ if (requestedGroupId && groups.items[requestedGroupId]) {
2504
+ return { groups, groupId: requestedGroupId };
2505
+ }
2506
+ if (!requestedGroupId && groups.order.length > 0) {
2507
+ return { groups, groupId: groups.order[0] };
2508
+ }
2509
+ return createGroup(groups, requestedGroupId);
2510
+ }
2511
+ function createGroup(groups, groupId, label) {
2512
+ const newGroupId = groupId || generateUniqueId("group");
2513
+ const newLabel = label || __13("Default", "elementor");
2514
+ return {
2515
+ groups: {
2516
+ ...groups,
2517
+ items: {
2518
+ ...groups.items,
2519
+ [newGroupId]: {
2520
+ id: newGroupId,
2521
+ label: newLabel,
2522
+ props: []
2523
+ }
2524
+ },
2525
+ order: [...groups.order, newGroupId]
2526
+ },
2527
+ groupId: newGroupId
2528
+ };
2529
+ }
2530
+ function removePropsFromState(overridableProps, propsToRemove) {
2531
+ const overrideKeysToRemove = propsToRemove.map((prop) => prop.overrideKey);
2532
+ const remainingProps = Object.fromEntries(
2533
+ Object.entries(overridableProps.props).filter(([, prop]) => !propsToRemove.includes(prop))
2534
+ );
2535
+ const updatedGroupItems = Object.fromEntries(
2536
+ Object.entries(overridableProps.groups.items).map(
2537
+ ([groupId, group]) => [
2538
+ groupId,
2539
+ {
2540
+ ...group,
2541
+ props: group.props.filter((prop) => !overrideKeysToRemove.includes(prop))
2542
+ }
2543
+ ]
2544
+ )
2545
+ );
2546
+ return {
2547
+ props: remainingProps,
2548
+ groups: {
2549
+ items: updatedGroupItems,
2550
+ order: overridableProps.groups.order.filter((groupId) => !overrideKeysToRemove.includes(groupId))
2551
+ }
2552
+ };
2553
+ }
2554
+ function ensureGroupInOrder(groups, groupId) {
2555
+ if (groups.order.includes(groupId)) {
2556
+ return groups;
2557
+ }
2558
+ return {
2559
+ ...groups,
2560
+ order: [...groups.order, groupId]
2561
+ };
2562
+ }
2563
+ function deleteGroup(groups, groupId) {
2564
+ const { [groupId]: removed, ...remainingItems } = groups.items;
2565
+ return {
2566
+ items: remainingItems,
2567
+ order: groups.order.filter((id2) => id2 !== groupId)
2568
+ };
2569
+ }
2570
+ function renameGroup(groups, groupId, newLabel) {
2571
+ const group = groups.items[groupId];
2572
+ if (!group) {
2573
+ return groups;
2574
+ }
2575
+ return {
2576
+ ...groups,
2577
+ items: {
2578
+ ...groups.items,
2579
+ [groupId]: {
2580
+ ...group,
2581
+ label: newLabel
2582
+ }
2583
+ }
2584
+ };
2585
+ }
2586
+
2587
+ // src/extended/store/actions/delete-overridable-group.ts
2588
+ function deleteOverridableGroup({ componentId, groupId }) {
2753
2589
  const overridableProps = selectOverridableProps(getState10(), componentId);
2754
2590
  if (!overridableProps) {
2755
- return;
2591
+ return false;
2756
2592
  }
2757
- const newGroup = {
2758
- id: groupId,
2759
- label,
2760
- props: []
2761
- };
2762
- dispatch8(
2593
+ const group = overridableProps.groups.items[groupId];
2594
+ if (!group || group.props.length > 0) {
2595
+ return false;
2596
+ }
2597
+ const updatedGroups = deleteGroup(overridableProps.groups, groupId);
2598
+ dispatch7(
2763
2599
  slice.actions.setOverridableProps({
2764
2600
  componentId,
2765
2601
  overridableProps: {
2766
2602
  ...overridableProps,
2767
- groups: {
2768
- ...overridableProps.groups,
2769
- items: {
2770
- ...overridableProps.groups.items,
2771
- [groupId]: newGroup
2772
- },
2773
- order: [groupId, ...overridableProps.groups.order]
2774
- }
2603
+ groups: updatedGroups
2775
2604
  }
2776
2605
  })
2777
2606
  );
2778
- trackComponentEvent({
2779
- action: "propertiesGroupCreated",
2780
- source,
2781
- component_uid: currentComponent?.uid,
2782
- group_name: label
2607
+ return true;
2608
+ }
2609
+
2610
+ // src/extended/store/actions/delete-overridable-prop.ts
2611
+ import { __dispatch as dispatch8, __getState as getState11 } from "@elementor/store";
2612
+
2613
+ // src/extended/utils/revert-overridable-settings.ts
2614
+ import {
2615
+ getAllDescendants as getAllDescendants2,
2616
+ getContainer as getContainer3,
2617
+ getElementSetting,
2618
+ updateElementSettings
2619
+ } from "@elementor/editor-elements";
2620
+ function revertElementOverridableSetting(elementId, settingKey, originValue, overrideKey) {
2621
+ const container = getContainer3(elementId);
2622
+ if (!container) {
2623
+ return;
2624
+ }
2625
+ if (isComponentInstance(container.model.toJSON())) {
2626
+ revertComponentInstanceOverridableSetting(elementId, overrideKey);
2627
+ return;
2628
+ }
2629
+ updateElementSettings({
2630
+ id: elementId,
2631
+ props: { [settingKey]: originValue ?? null },
2632
+ withHistory: false
2633
+ });
2634
+ }
2635
+ function revertComponentInstanceOverridableSetting(elementId, overrideKey) {
2636
+ const setting = getElementSetting(elementId, "component_instance");
2637
+ const componentInstance = componentInstancePropTypeUtil.extract(setting);
2638
+ const overrides = componentInstanceOverridesPropTypeUtil.extract(componentInstance?.overrides);
2639
+ if (!overrides?.length) {
2640
+ return;
2641
+ }
2642
+ const revertedOverrides = revertComponentInstanceOverrides(overrides, overrideKey);
2643
+ const updatedSetting = componentInstancePropTypeUtil.create({
2644
+ ...componentInstance,
2645
+ overrides: componentInstanceOverridesPropTypeUtil.create(revertedOverrides)
2646
+ });
2647
+ updateElementSettings({
2648
+ id: elementId,
2649
+ props: { component_instance: updatedSetting },
2650
+ withHistory: false
2651
+ });
2652
+ }
2653
+ function revertComponentInstanceOverrides(overrides, filterByKey) {
2654
+ return overrides.map((item) => {
2655
+ if (!componentOverridablePropTypeUtil.isValid(item)) {
2656
+ return item;
2657
+ }
2658
+ if (!componentInstanceOverridePropTypeUtil.isValid(item.value.origin_value)) {
2659
+ return null;
2660
+ }
2661
+ if (filterByKey && item.value.override_key !== filterByKey) {
2662
+ return item;
2663
+ }
2664
+ return item.value.origin_value;
2665
+ }).filter((item) => item !== null);
2666
+ }
2667
+ function revertOverridablePropsFromSettings(settings) {
2668
+ let hasChanges = false;
2669
+ const revertedSettings = {};
2670
+ for (const [key, value] of Object.entries(settings)) {
2671
+ if (componentOverridablePropTypeUtil.isValid(value)) {
2672
+ revertedSettings[key] = value.value.origin_value;
2673
+ hasChanges = true;
2674
+ } else {
2675
+ revertedSettings[key] = value;
2676
+ }
2677
+ }
2678
+ return { hasChanges, settings: revertedSettings };
2679
+ }
2680
+ function revertAllOverridablesInElementData(elementData) {
2681
+ const revertedElement = { ...elementData };
2682
+ if (isComponentInstance({ widgetType: elementData.widgetType, elType: elementData.elType })) {
2683
+ revertedElement.settings = revertComponentInstanceSettings(elementData.settings);
2684
+ } else if (revertedElement.settings) {
2685
+ const { settings } = revertOverridablePropsFromSettings(revertedElement.settings);
2686
+ revertedElement.settings = settings;
2687
+ }
2688
+ if (revertedElement.elements) {
2689
+ revertedElement.elements = revertedElement.elements.map(revertAllOverridablesInElementData);
2690
+ }
2691
+ return revertedElement;
2692
+ }
2693
+ function revertComponentInstanceSettings(settings) {
2694
+ if (!settings?.component_instance) {
2695
+ return settings;
2696
+ }
2697
+ const componentInstance = componentInstancePropTypeUtil.extract(settings.component_instance);
2698
+ const overrides = componentInstanceOverridesPropTypeUtil.extract(componentInstance?.overrides);
2699
+ if (!overrides?.length) {
2700
+ return settings;
2701
+ }
2702
+ const revertedOverrides = revertComponentInstanceOverrides(overrides);
2703
+ return {
2704
+ ...settings,
2705
+ component_instance: componentInstancePropTypeUtil.create({
2706
+ ...componentInstance,
2707
+ overrides: componentInstanceOverridesPropTypeUtil.create(revertedOverrides)
2708
+ })
2709
+ };
2710
+ }
2711
+ function revertAllOverridablesInContainer(container) {
2712
+ getAllDescendants2(container).forEach((element) => {
2713
+ if (element.model.get("widgetType") === COMPONENT_WIDGET_TYPE) {
2714
+ revertComponentInstanceOverridesInElement(element);
2715
+ } else {
2716
+ revertElementSettings(element);
2717
+ }
2718
+ });
2719
+ }
2720
+ function revertComponentInstanceOverridesInElement(element) {
2721
+ const settings = element.settings?.toJSON() ?? {};
2722
+ const componentInstance = componentInstancePropTypeUtil.extract(settings.component_instance);
2723
+ const overrides = componentInstanceOverridesPropTypeUtil.extract(componentInstance?.overrides);
2724
+ if (!overrides?.length) {
2725
+ return;
2726
+ }
2727
+ const revertedOverrides = revertComponentInstanceOverrides(overrides);
2728
+ const updatedSetting = componentInstancePropTypeUtil.create({
2729
+ ...componentInstance,
2730
+ overrides: componentInstanceOverridesPropTypeUtil.create(revertedOverrides)
2731
+ });
2732
+ updateElementSettings({
2733
+ id: element.id,
2734
+ props: { component_instance: updatedSetting },
2735
+ withHistory: false
2736
+ });
2737
+ }
2738
+ function revertElementSettings(element) {
2739
+ const settings = element.settings?.toJSON() ?? {};
2740
+ const { hasChanges, settings: revertedSettings } = revertOverridablePropsFromSettings(settings);
2741
+ if (!hasChanges) {
2742
+ return;
2743
+ }
2744
+ updateElementSettings({
2745
+ id: element.id,
2746
+ props: revertedSettings,
2747
+ withHistory: false
2783
2748
  });
2784
- return newGroup;
2785
2749
  }
2786
2750
 
2787
- // src/extended/store/actions/delete-overridable-group.ts
2788
- import { __dispatch as dispatch9, __getState as getState11 } from "@elementor/store";
2789
- function deleteOverridableGroup({ componentId, groupId }) {
2751
+ // src/extended/store/actions/delete-overridable-prop.ts
2752
+ function deleteOverridableProp({ componentId, propKey, source }) {
2790
2753
  const overridableProps = selectOverridableProps(getState11(), componentId);
2791
- if (!overridableProps) {
2792
- return false;
2754
+ if (!overridableProps || Object.keys(overridableProps.props).length === 0) {
2755
+ return;
2793
2756
  }
2794
- const group = overridableProps.groups.items[groupId];
2795
- if (!group || group.props.length > 0) {
2796
- return false;
2757
+ const propKeysToDelete = Array.isArray(propKey) ? propKey : [propKey];
2758
+ const deletedProps = [];
2759
+ for (const key of propKeysToDelete) {
2760
+ const prop = overridableProps.props[key];
2761
+ if (!prop) {
2762
+ continue;
2763
+ }
2764
+ deletedProps.push(prop);
2765
+ revertElementOverridableSetting(prop.elementId, prop.propKey, prop.originValue, key);
2797
2766
  }
2798
- const updatedGroups = deleteGroup(overridableProps.groups, groupId);
2799
- dispatch9(
2767
+ if (deletedProps.length === 0) {
2768
+ return;
2769
+ }
2770
+ const remainingProps = Object.fromEntries(
2771
+ Object.entries(overridableProps.props).filter(([key]) => !propKeysToDelete.includes(key))
2772
+ );
2773
+ const updatedGroups = removePropFromAllGroups(overridableProps.groups, propKey);
2774
+ dispatch8(
2800
2775
  slice.actions.setOverridableProps({
2801
2776
  componentId,
2802
2777
  overridableProps: {
2803
2778
  ...overridableProps,
2779
+ props: remainingProps,
2804
2780
  groups: updatedGroups
2805
2781
  }
2806
2782
  })
2807
2783
  );
2808
- return true;
2784
+ const currentComponent = selectCurrentComponent(getState11());
2785
+ for (const prop of deletedProps) {
2786
+ trackComponentEvent({
2787
+ action: "propertyRemoved",
2788
+ source,
2789
+ component_uid: currentComponent?.uid,
2790
+ property_id: prop.overrideKey,
2791
+ property_path: prop.propKey,
2792
+ property_name: prop.label,
2793
+ element_type: prop.widgetType ?? prop.elType
2794
+ });
2795
+ }
2809
2796
  }
2810
2797
 
2811
2798
  // src/extended/store/actions/reorder-group-props.ts
2812
- import { __dispatch as dispatch10, __getState as getState12 } from "@elementor/store";
2799
+ import { __dispatch as dispatch9, __getState as getState12 } from "@elementor/store";
2813
2800
  function reorderGroupProps({ componentId, groupId, newPropsOrder }) {
2814
2801
  const overridableProps = selectOverridableProps(getState12(), componentId);
2815
2802
  if (!overridableProps) {
@@ -2819,7 +2806,7 @@ function reorderGroupProps({ componentId, groupId, newPropsOrder }) {
2819
2806
  if (!group) {
2820
2807
  return;
2821
2808
  }
2822
- dispatch10(
2809
+ dispatch9(
2823
2810
  slice.actions.setOverridableProps({
2824
2811
  componentId,
2825
2812
  overridableProps: {
@@ -2840,13 +2827,13 @@ function reorderGroupProps({ componentId, groupId, newPropsOrder }) {
2840
2827
  }
2841
2828
 
2842
2829
  // src/extended/store/actions/reorder-overridable-groups.ts
2843
- import { __dispatch as dispatch11, __getState as getState13 } from "@elementor/store";
2830
+ import { __dispatch as dispatch10, __getState as getState13 } from "@elementor/store";
2844
2831
  function reorderOverridableGroups({ componentId, newOrder }) {
2845
2832
  const overridableProps = selectOverridableProps(getState13(), componentId);
2846
2833
  if (!overridableProps) {
2847
2834
  return;
2848
2835
  }
2849
- dispatch11(
2836
+ dispatch10(
2850
2837
  slice.actions.setOverridableProps({
2851
2838
  componentId,
2852
2839
  overridableProps: {
@@ -2861,7 +2848,7 @@ function reorderOverridableGroups({ componentId, newOrder }) {
2861
2848
  }
2862
2849
 
2863
2850
  // src/extended/store/actions/update-overridable-prop-params.ts
2864
- import { __dispatch as dispatch12, __getState as getState14 } from "@elementor/store";
2851
+ import { __dispatch as dispatch11, __getState as getState14 } from "@elementor/store";
2865
2852
  function updateOverridablePropParams({
2866
2853
  componentId,
2867
2854
  overrideKey,
@@ -2884,7 +2871,7 @@ function updateOverridablePropParams({
2884
2871
  groupId: newGroupId
2885
2872
  };
2886
2873
  const updatedGroups = movePropBetweenGroups(overridableProps.groups, overrideKey, oldGroupId, newGroupId);
2887
- dispatch12(
2874
+ dispatch11(
2888
2875
  slice.actions.setOverridableProps({
2889
2876
  componentId,
2890
2877
  overridableProps: {
@@ -3399,7 +3386,7 @@ import { useEditable as useEditable2 } from "@elementor/editor-ui";
3399
3386
  import { __ as __19 } from "@wordpress/i18n";
3400
3387
 
3401
3388
  // src/extended/store/actions/rename-overridable-group.ts
3402
- import { __dispatch as dispatch13, __getState as getState15 } from "@elementor/store";
3389
+ import { __dispatch as dispatch12, __getState as getState15 } from "@elementor/store";
3403
3390
  function renameOverridableGroup({ componentId, groupId, label }) {
3404
3391
  const overridableProps = selectOverridableProps(getState15(), componentId);
3405
3392
  if (!overridableProps) {
@@ -3410,7 +3397,7 @@ function renameOverridableGroup({ componentId, groupId, label }) {
3410
3397
  return false;
3411
3398
  }
3412
3399
  const updatedGroups = renameGroup(overridableProps.groups, groupId, label);
3413
- dispatch13(
3400
+ dispatch12(
3414
3401
  slice.actions.setOverridableProps({
3415
3402
  componentId,
3416
3403
  overridableProps: {
@@ -3768,7 +3755,7 @@ import { __ as __26 } from "@wordpress/i18n";
3768
3755
  // src/extended/store/actions/create-unpublished-component.ts
3769
3756
  import { createElements, deleteElement, getContainer as getContainer4 } from "@elementor/editor-elements";
3770
3757
  import { __privateRunCommand as runCommand2 } from "@elementor/editor-v1-adapters";
3771
- import { __dispatch as dispatch14 } from "@elementor/store";
3758
+ import { __dispatch as dispatch13 } from "@elementor/store";
3772
3759
  import { generateUniqueId as generateUniqueId3 } from "@elementor/utils";
3773
3760
  import { __ as __24 } from "@wordpress/i18n";
3774
3761
 
@@ -3801,14 +3788,14 @@ async function createUnpublishedComponent({
3801
3788
  parentId: container?.parent?.id ?? "",
3802
3789
  index: container?.view?._index ?? 0
3803
3790
  };
3804
- dispatch14(
3791
+ dispatch13(
3805
3792
  slice.actions.addUnpublished({
3806
3793
  ...componentBase,
3807
3794
  elements: [elementDataWithOverridablesReverted],
3808
3795
  overridableProps
3809
3796
  })
3810
3797
  );
3811
- dispatch14(slice.actions.addCreatedThisSession(generatedUid));
3798
+ dispatch13(slice.actions.addCreatedThisSession(generatedUid));
3812
3799
  const componentInstance = await replaceElementWithComponent(element, componentBase);
3813
3800
  trackComponentEvent({
3814
3801
  action: "created",
@@ -3821,8 +3808,8 @@ async function createUnpublishedComponent({
3821
3808
  await runCommand2("document/save/auto");
3822
3809
  } catch (error) {
3823
3810
  restoreOriginalElement(originalElement, componentInstance.id);
3824
- dispatch14(slice.actions.removeUnpublished(generatedUid));
3825
- dispatch14(slice.actions.removeCreatedThisSession(generatedUid));
3811
+ dispatch13(slice.actions.removeUnpublished(generatedUid));
3812
+ dispatch13(slice.actions.removeCreatedThisSession(generatedUid));
3826
3813
  throw error;
3827
3814
  }
3828
3815
  return { uid: generatedUid, instanceId: componentInstance.id };
@@ -4242,9 +4229,9 @@ var OVERRIDABLE_PROP_REPLACEMENT_ID = "overridable-prop";
4242
4229
  var COMPONENT_DOCUMENT_TYPE = "elementor_component";
4243
4230
 
4244
4231
  // src/extended/store/actions/reset-sanitized-components.ts
4245
- import { __dispatch as dispatch15 } from "@elementor/store";
4232
+ import { __dispatch as dispatch14 } from "@elementor/store";
4246
4233
  function resetSanitizedComponents() {
4247
- dispatch15(slice.actions.resetSanitizedComponents());
4234
+ dispatch14(slice.actions.resetSanitizedComponents());
4248
4235
  }
4249
4236
 
4250
4237
  // src/extended/store/actions/update-current-component.ts
@@ -4627,7 +4614,7 @@ import { bindPopover as bindPopover2, bindTrigger as bindTrigger4, Popover as Po
4627
4614
  import { __ as __29 } from "@wordpress/i18n";
4628
4615
 
4629
4616
  // src/extended/store/actions/set-overridable-prop.ts
4630
- import { __dispatch as dispatch16, __getState as getState18 } from "@elementor/store";
4617
+ import { __dispatch as dispatch15, __getState as getState18 } from "@elementor/store";
4631
4618
  import { generateUniqueId as generateUniqueId4 } from "@elementor/utils";
4632
4619
  function setOverridableProp({
4633
4620
  componentId,
@@ -4679,7 +4666,7 @@ function setOverridableProp({
4679
4666
  if (isChangingGroups) {
4680
4667
  groups = removePropFromGroup(groups, existingOverridableProp.groupId, overridableProp.overrideKey);
4681
4668
  }
4682
- dispatch16(
4669
+ dispatch15(
4683
4670
  slice.actions.setOverridableProps({
4684
4671
  componentId,
4685
4672
  overridableProps: {
@@ -5287,7 +5274,7 @@ var updateArchivedComponentBeforeSave = async (status) => {
5287
5274
  };
5288
5275
 
5289
5276
  // src/extended/sync/update-component-title-before-save.ts
5290
- import { __dispatch as dispatch17, __getState as getState21 } from "@elementor/store";
5277
+ import { __dispatch as dispatch16, __getState as getState21 } from "@elementor/store";
5291
5278
  var updateComponentTitleBeforeSave = async (status) => {
5292
5279
  const updatedComponentNames = selectUpdatedComponentNames(getState21());
5293
5280
  if (!updatedComponentNames.length) {
@@ -5295,13 +5282,13 @@ var updateComponentTitleBeforeSave = async (status) => {
5295
5282
  }
5296
5283
  const result = await apiClient.updateComponentTitle(updatedComponentNames, status);
5297
5284
  if (result.failedIds.length === 0) {
5298
- dispatch17(slice.actions.cleanUpdatedComponentNames());
5285
+ dispatch16(slice.actions.cleanUpdatedComponentNames());
5299
5286
  }
5300
5287
  };
5301
5288
 
5302
5289
  // src/extended/sync/create-components-before-save.ts
5303
5290
  import { updateElementSettings as updateElementSettings2 } from "@elementor/editor-elements";
5304
- import { __dispatch as dispatch18, __getState as getState22 } from "@elementor/store";
5291
+ import { __dispatch as dispatch17, __getState as getState22 } from "@elementor/store";
5305
5292
  async function createComponentsBeforeSave({
5306
5293
  elements,
5307
5294
  status
@@ -5313,7 +5300,7 @@ async function createComponentsBeforeSave({
5313
5300
  try {
5314
5301
  const uidToComponentId = await createComponents(unpublishedComponents, status);
5315
5302
  updateComponentInstances(elements, uidToComponentId);
5316
- dispatch18(
5303
+ dispatch17(
5317
5304
  slice.actions.add(
5318
5305
  unpublishedComponents.map((component) => ({
5319
5306
  id: uidToComponentId.get(component.uid),
@@ -5323,10 +5310,10 @@ async function createComponentsBeforeSave({
5323
5310
  }))
5324
5311
  )
5325
5312
  );
5326
- dispatch18(slice.actions.resetUnpublished());
5313
+ dispatch17(slice.actions.resetUnpublished());
5327
5314
  } catch (error) {
5328
5315
  const failedUids = unpublishedComponents.map((component) => component.uid);
5329
- dispatch18(slice.actions.removeUnpublished(failedUids));
5316
+ dispatch17(slice.actions.removeUnpublished(failedUids));
5330
5317
  throw new Error(`Failed to publish components: ${error}`);
5331
5318
  }
5332
5319
  }
@@ -5561,6 +5548,36 @@ function revertOverridablesInStorage(storageKey) {
5561
5548
  });
5562
5549
  }
5563
5550
 
5551
+ // src/extended/sync/sanitize-overridable-props.ts
5552
+ import { useEffect as useEffect7 } from "react";
5553
+
5554
+ // src/extended/store/actions/update-component-sanitized-attribute.ts
5555
+ import { __dispatch as dispatch18 } from "@elementor/store";
5556
+ function updateComponentSanitizedAttribute(componentId, attribute) {
5557
+ dispatch18(slice.actions.updateComponentSanitizedAttribute({ componentId, attribute }));
5558
+ }
5559
+
5560
+ // src/extended/sync/sanitize-overridable-props.ts
5561
+ function SanitizeOverridableProps() {
5562
+ const currentComponentId = useCurrentComponentId();
5563
+ const overridableProps = useOverridableProps(currentComponentId);
5564
+ const isSanitized = useIsSanitizedComponent(currentComponentId, "overridableProps");
5565
+ useEffect7(() => {
5566
+ if (isSanitized || !overridableProps || !currentComponentId) {
5567
+ return;
5568
+ }
5569
+ const filtered = filterValidOverridableProps(overridableProps);
5570
+ const propsToDelete = Object.keys(overridableProps.props ?? {}).filter((key) => !filtered.props[key]);
5571
+ if (propsToDelete.length > 0) {
5572
+ propsToDelete.forEach((key) => {
5573
+ deleteOverridableProp({ componentId: currentComponentId, propKey: key, source: "system" });
5574
+ });
5575
+ }
5576
+ updateComponentSanitizedAttribute(currentComponentId, "overridableProps");
5577
+ }, [currentComponentId, isSanitized, overridableProps]);
5578
+ return null;
5579
+ }
5580
+
5564
5581
  // src/extended/init.ts
5565
5582
  function initExtended() {
5566
5583
  registerPanel(panel);
@@ -5601,13 +5618,17 @@ function initExtended() {
5601
5618
  initNonAtomicNestingPrevention();
5602
5619
  initHandleComponentEditModeContainer();
5603
5620
  initRevertOverridablesOnCopyOrDuplicate();
5621
+ injectIntoLogic({
5622
+ id: "sanitize-overridable-props",
5623
+ component: SanitizeOverridableProps
5624
+ });
5604
5625
  }
5605
5626
 
5606
5627
  // src/populate-store.ts
5607
- import { useEffect as useEffect7 } from "react";
5628
+ import { useEffect as useEffect8 } from "react";
5608
5629
  import { __dispatch as dispatch19 } from "@elementor/store";
5609
5630
  function PopulateStore() {
5610
- useEffect7(() => {
5631
+ useEffect8(() => {
5611
5632
  dispatch19(loadComponents());
5612
5633
  }, []);
5613
5634
  return null;
@@ -5805,7 +5826,7 @@ function init() {
5805
5826
  component: Components,
5806
5827
  position: 1
5807
5828
  });
5808
- injectIntoLogic({
5829
+ injectIntoLogic2({
5809
5830
  id: "components-populate-store",
5810
5831
  component: PopulateStore
5811
5832
  });
@@ -5816,7 +5837,7 @@ function init() {
5816
5837
  }
5817
5838
  await loadComponentsAssets(config?.elements ?? []);
5818
5839
  });
5819
- injectIntoLogic({
5840
+ injectIntoLogic2({
5820
5841
  id: "templates",
5821
5842
  component: LoadTemplateComponents
5822
5843
  });