@elementor/editor-interactions 4.1.0-714 → 4.1.0-716

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.d.mts CHANGED
@@ -137,6 +137,15 @@ declare const EFFECT_OPTIONS: {
137
137
  };
138
138
  declare const BASE_EFFECTS: string[];
139
139
 
140
+ declare const REPEAT_OPTIONS: {
141
+ times: string;
142
+ loop: string;
143
+ };
144
+ declare const REPEAT_TOOLTIPS: {
145
+ times: string;
146
+ loop: string;
147
+ };
148
+
140
149
  type PlainKeyframeValue = {
141
150
  opacity?: number;
142
151
  scale?: {
@@ -236,4 +245,4 @@ declare const formatSizeValue: ({ size, unit }: SizeValue) => SizeStringValue;
236
245
 
237
246
  declare const useElementInteractions: (elementId: ElementID) => ElementInteractions;
238
247
 
239
- export { BASE_EASINGS, BASE_EFFECTS, BASE_REPLAY, BASE_TRIGGERS, type CreateInteractionsProviderOptions, EASING_OPTIONS, EFFECT_OPTIONS, ELEMENTS_INTERACTIONS_PROVIDER_KEY_PREFIX, EmptyState, type FieldProps, InteractionsTab, REPLAY_OPTIONS, type ReplayFieldProps, TRIGGER_OPTIONS, buildDisplayLabel, convertTimeUnit, createAnimationPreset, createBoolean, createConfig, createDefaultInteractionItem, createDefaultInteractions, createExcludedBreakpoints, createInteractionBreakpoints, createInteractionItem, createInteractionsProvider, createNumber, createString, createTimingConfig, extractBoolean, extractExcludedBreakpoints, extractSize, extractString, formatSizeValue, generateTempInteractionId, getInteractionsConfig, init, interactionsRepository, isTempId, parseSizeValue, registerInteractionsControl, resolveDirection, useElementInteractions };
248
+ export { BASE_EASINGS, BASE_EFFECTS, BASE_REPLAY, BASE_TRIGGERS, type CreateInteractionsProviderOptions, EASING_OPTIONS, EFFECT_OPTIONS, ELEMENTS_INTERACTIONS_PROVIDER_KEY_PREFIX, EmptyState, type FieldProps, InteractionsTab, REPEAT_OPTIONS, REPEAT_TOOLTIPS, REPLAY_OPTIONS, type ReplayFieldProps, TRIGGER_OPTIONS, buildDisplayLabel, convertTimeUnit, createAnimationPreset, createBoolean, createConfig, createDefaultInteractionItem, createDefaultInteractions, createExcludedBreakpoints, createInteractionBreakpoints, createInteractionItem, createInteractionsProvider, createNumber, createString, createTimingConfig, extractBoolean, extractExcludedBreakpoints, extractSize, extractString, formatSizeValue, generateTempInteractionId, getInteractionsConfig, init, interactionsRepository, isTempId, parseSizeValue, registerInteractionsControl, resolveDirection, useElementInteractions };
package/dist/index.d.ts CHANGED
@@ -137,6 +137,15 @@ declare const EFFECT_OPTIONS: {
137
137
  };
138
138
  declare const BASE_EFFECTS: string[];
139
139
 
140
+ declare const REPEAT_OPTIONS: {
141
+ times: string;
142
+ loop: string;
143
+ };
144
+ declare const REPEAT_TOOLTIPS: {
145
+ times: string;
146
+ loop: string;
147
+ };
148
+
140
149
  type PlainKeyframeValue = {
141
150
  opacity?: number;
142
151
  scale?: {
@@ -236,4 +245,4 @@ declare const formatSizeValue: ({ size, unit }: SizeValue) => SizeStringValue;
236
245
 
237
246
  declare const useElementInteractions: (elementId: ElementID) => ElementInteractions;
238
247
 
239
- export { BASE_EASINGS, BASE_EFFECTS, BASE_REPLAY, BASE_TRIGGERS, type CreateInteractionsProviderOptions, EASING_OPTIONS, EFFECT_OPTIONS, ELEMENTS_INTERACTIONS_PROVIDER_KEY_PREFIX, EmptyState, type FieldProps, InteractionsTab, REPLAY_OPTIONS, type ReplayFieldProps, TRIGGER_OPTIONS, buildDisplayLabel, convertTimeUnit, createAnimationPreset, createBoolean, createConfig, createDefaultInteractionItem, createDefaultInteractions, createExcludedBreakpoints, createInteractionBreakpoints, createInteractionItem, createInteractionsProvider, createNumber, createString, createTimingConfig, extractBoolean, extractExcludedBreakpoints, extractSize, extractString, formatSizeValue, generateTempInteractionId, getInteractionsConfig, init, interactionsRepository, isTempId, parseSizeValue, registerInteractionsControl, resolveDirection, useElementInteractions };
248
+ export { BASE_EASINGS, BASE_EFFECTS, BASE_REPLAY, BASE_TRIGGERS, type CreateInteractionsProviderOptions, EASING_OPTIONS, EFFECT_OPTIONS, ELEMENTS_INTERACTIONS_PROVIDER_KEY_PREFIX, EmptyState, type FieldProps, InteractionsTab, REPEAT_OPTIONS, REPEAT_TOOLTIPS, REPLAY_OPTIONS, type ReplayFieldProps, TRIGGER_OPTIONS, buildDisplayLabel, convertTimeUnit, createAnimationPreset, createBoolean, createConfig, createDefaultInteractionItem, createDefaultInteractions, createExcludedBreakpoints, createInteractionBreakpoints, createInteractionItem, createInteractionsProvider, createNumber, createString, createTimingConfig, extractBoolean, extractExcludedBreakpoints, extractSize, extractString, formatSizeValue, generateTempInteractionId, getInteractionsConfig, init, interactionsRepository, isTempId, parseSizeValue, registerInteractionsControl, resolveDirection, useElementInteractions };
package/dist/index.js CHANGED
@@ -39,6 +39,8 @@ __export(index_exports, {
39
39
  ELEMENTS_INTERACTIONS_PROVIDER_KEY_PREFIX: () => ELEMENTS_INTERACTIONS_PROVIDER_KEY_PREFIX,
40
40
  EmptyState: () => EmptyState,
41
41
  InteractionsTab: () => InteractionsTab,
42
+ REPEAT_OPTIONS: () => REPEAT_OPTIONS,
43
+ REPEAT_TOOLTIPS: () => REPEAT_TOOLTIPS,
42
44
  REPLAY_OPTIONS: () => REPLAY_OPTIONS,
43
45
  TRIGGER_OPTIONS: () => TRIGGER_OPTIONS,
44
46
  buildDisplayLabel: () => buildDisplayLabel,
@@ -864,7 +866,6 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
864
866
  controlVisibilityConfig.times(interactionValues)
865
867
  );
866
868
  const EasingControl = useControlComponent("easing");
867
- const containerRef = (0, import_react6.useRef)(null);
868
869
  const updateInteraction = (updates) => {
869
870
  const resolvedDirectionValue = resolveDirection(
870
871
  "direction" in updates,
@@ -899,19 +900,12 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
899
900
  onPlayInteraction(interactionId);
900
901
  }, 0);
901
902
  };
902
- return /* @__PURE__ */ React7.createElement(import_ui3.Box, { ref: containerRef }, /* @__PURE__ */ React7.createElement(import_editor_controls3.PopoverContent, { p: 1.5 }, /* @__PURE__ */ React7.createElement(import_ui3.Grid, { container: true, spacing: 1.5 }, TriggerControl && /* @__PURE__ */ React7.createElement(Field, { label: (0, import_i18n2.__)("Trigger", "elementor") }, /* @__PURE__ */ React7.createElement(
903
- TriggerControl,
904
- {
905
- value: trigger,
906
- onChange: (v) => updateInteraction({ trigger: v })
907
- }
908
- )), ReplayControl && /* @__PURE__ */ React7.createElement(Field, { label: (0, import_i18n2.__)("Replay", "elementor") }, /* @__PURE__ */ React7.createElement(
903
+ return /* @__PURE__ */ React7.createElement(import_editor_controls3.PopoverContent, { p: 1.5 }, /* @__PURE__ */ React7.createElement(import_ui3.Grid, { container: true, spacing: 1.5 }, TriggerControl && /* @__PURE__ */ React7.createElement(Field, { label: (0, import_i18n2.__)("Trigger", "elementor") }, /* @__PURE__ */ React7.createElement(TriggerControl, { value: trigger, onChange: (v) => updateInteraction({ trigger: v }) })), ReplayControl && /* @__PURE__ */ React7.createElement(Field, { label: (0, import_i18n2.__)("Replay", "elementor") }, /* @__PURE__ */ React7.createElement(
909
904
  ReplayControl,
910
905
  {
911
906
  value: replay,
912
907
  onChange: (v) => updateInteraction({ replay: v }),
913
- disabled: true,
914
- anchorRef: containerRef
908
+ disabled: true
915
909
  }
916
910
  ))), /* @__PURE__ */ React7.createElement(import_ui3.Divider, null), /* @__PURE__ */ React7.createElement(import_ui3.Grid, { container: true, spacing: 1.5 }, EffectControl && /* @__PURE__ */ React7.createElement(Field, { label: (0, import_i18n2.__)("Effect", "elementor") }, /* @__PURE__ */ React7.createElement(EffectControl, { value: effect, onChange: (v) => updateInteraction({ effect: v }) })), CustomEffectControl && /* @__PURE__ */ React7.createElement(Field, { label: (0, import_i18n2.__)("Custom Effect", "elementor") }, /* @__PURE__ */ React7.createElement(
917
911
  CustomEffectControl,
@@ -974,7 +968,7 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
974
968
  updateInteraction({ easing: v });
975
969
  }
976
970
  }
977
- )))));
971
+ ))));
978
972
  };
979
973
 
980
974
  // src/components/interaction-settings.tsx
@@ -1354,10 +1348,14 @@ function normalizeClipboardInteractions(raw) {
1354
1348
  return null;
1355
1349
  }
1356
1350
  const parsed = typeof raw === "string" ? JSON.parse(raw) : raw;
1357
- if (!parsed?.items?.length) {
1351
+ const payload = {
1352
+ version: parsed?.version ?? 1,
1353
+ items: parsed?.items?.filter((item) => isSupportedInteractionItem(item)) ?? []
1354
+ };
1355
+ if (!payload.items.length) {
1358
1356
  return null;
1359
1357
  }
1360
- return { version: parsed.version ?? 1, items: parsed.items };
1358
+ return payload;
1361
1359
  }
1362
1360
  function regenerateInteractionIds(interactions) {
1363
1361
  const cloned = structuredClone(interactions);
@@ -1573,7 +1571,6 @@ var InteractionsPromotionChip = (0, import_react12.forwardRef)(
1573
1571
  );
1574
1572
  }
1575
1573
  );
1576
- InteractionsPromotionChip.displayName = "InteractionsPromotionChip";
1577
1574
 
1578
1575
  // src/ui/promotion-select.tsx
1579
1576
  function PromotionSelect({
@@ -1721,58 +1718,128 @@ function EffectType({ value, onChange }) {
1721
1718
  return /* @__PURE__ */ React17.createElement(import_editor_controls8.ToggleButtonGroupUi, { items: options, exclusive: true, onChange, value });
1722
1719
  }
1723
1720
 
1724
- // src/components/controls/replay.tsx
1725
- var React18 = __toESM(require("react"));
1721
+ // src/components/controls/repeat.tsx
1722
+ var React19 = __toESM(require("react"));
1723
+ var import_react15 = require("react");
1726
1724
  var import_editor_controls9 = require("@elementor/editor-controls");
1727
1725
  var import_icons4 = require("@elementor/icons");
1728
- var import_ui11 = require("@elementor/ui");
1729
1726
  var import_i18n13 = require("@wordpress/i18n");
1730
- var TRACKING_DATA3 = { target_name: "interactions_replay", location_l2: "interactions" };
1727
+
1728
+ // src/ui/promotion-overlay-layout.tsx
1729
+ var React18 = __toESM(require("react"));
1730
+ var import_react14 = require("react");
1731
+ var import_ui11 = require("@elementor/ui");
1732
+ var OVERLAY_GRID = "1 / 1";
1733
+ var CHIP_OFFSET = "50%";
1734
+ var PromotionOverlayLayout = (0, import_react14.forwardRef)(
1735
+ ({ children, promotionChip }, ref) => /* @__PURE__ */ React18.createElement(import_ui11.Box, { ref, sx: { display: "grid", alignItems: "center" } }, /* @__PURE__ */ React18.createElement(import_ui11.Box, { sx: { gridArea: OVERLAY_GRID } }, children), /* @__PURE__ */ React18.createElement(import_ui11.Box, { sx: { gridArea: OVERLAY_GRID, marginInlineEnd: CHIP_OFFSET, justifySelf: "end" } }, promotionChip))
1736
+ );
1737
+
1738
+ // src/components/controls/repeat.tsx
1739
+ var TRACKING_DATA3 = { target_name: "interactions_repeat", location_l2: "interactions" };
1740
+ var REPEAT_OPTIONS = {
1741
+ times: (0, import_i18n13.__)("times", "elementor"),
1742
+ loop: (0, import_i18n13.__)("loop", "elementor")
1743
+ };
1744
+ var REPEAT_TOOLTIPS = {
1745
+ times: (0, import_i18n13.__)("Enable number", "elementor"),
1746
+ loop: (0, import_i18n13.__)("Infinite repeat", "elementor")
1747
+ };
1748
+ function Repeat() {
1749
+ const repeatContainerRef = (0, import_react15.useRef)(null);
1750
+ const options = [
1751
+ {
1752
+ value: REPEAT_OPTIONS.times,
1753
+ disabled: true,
1754
+ label: REPEAT_TOOLTIPS.times,
1755
+ renderContent: ({ size }) => /* @__PURE__ */ React19.createElement(import_icons4.Number123Icon, { fontSize: size }),
1756
+ showTooltip: true
1757
+ },
1758
+ {
1759
+ value: REPEAT_OPTIONS.loop,
1760
+ disabled: true,
1761
+ label: REPEAT_TOOLTIPS.loop,
1762
+ renderContent: ({ size }) => /* @__PURE__ */ React19.createElement(import_icons4.RepeatIcon, { fontSize: size }),
1763
+ showTooltip: true
1764
+ }
1765
+ ];
1766
+ return /* @__PURE__ */ React19.createElement(
1767
+ PromotionOverlayLayout,
1768
+ {
1769
+ ref: repeatContainerRef,
1770
+ promotionChip: /* @__PURE__ */ React19.createElement(
1771
+ InteractionsPromotionChip,
1772
+ {
1773
+ content: (0, import_i18n13.__)("Upgrade to control how many times the animation repeats.", "elementor"),
1774
+ upgradeUrl: "https://go.elementor.com/go-pro-interactions-repeat-modal/",
1775
+ anchorRef: repeatContainerRef,
1776
+ trackingData: TRACKING_DATA3
1777
+ }
1778
+ )
1779
+ },
1780
+ /* @__PURE__ */ React19.createElement(import_editor_controls9.ToggleButtonGroupUi, { items: options, exclusive: true, onChange: () => {
1781
+ }, value: "" })
1782
+ );
1783
+ }
1784
+
1785
+ // src/components/controls/replay.tsx
1786
+ var React20 = __toESM(require("react"));
1787
+ var import_react16 = require("react");
1788
+ var import_editor_controls10 = require("@elementor/editor-controls");
1789
+ var import_icons5 = require("@elementor/icons");
1790
+ var import_i18n14 = require("@wordpress/i18n");
1791
+ var TRACKING_DATA4 = { target_name: "interactions_replay", location_l2: "interactions" };
1731
1792
  var REPLAY_OPTIONS = {
1732
- no: (0, import_i18n13.__)("No", "elementor"),
1733
- yes: (0, import_i18n13.__)("Yes", "elementor")
1793
+ no: (0, import_i18n14.__)("No", "elementor"),
1794
+ yes: (0, import_i18n14.__)("Yes", "elementor")
1734
1795
  };
1735
1796
  var BASE_REPLAY = ["no"];
1736
- var OVERLAY_GRID = "1 / 1";
1737
- var CHIP_OFFSET = "50%";
1738
- function Replay({ onChange, anchorRef }) {
1797
+ function Replay({ onChange }) {
1798
+ const replayContainerRef = (0, import_react16.useRef)(null);
1739
1799
  const options = [
1740
1800
  {
1741
1801
  value: false,
1742
1802
  disabled: false,
1743
1803
  label: REPLAY_OPTIONS.no,
1744
- renderContent: ({ size }) => /* @__PURE__ */ React18.createElement(import_icons4.MinusIcon, { fontSize: size }),
1804
+ renderContent: ({ size }) => /* @__PURE__ */ React20.createElement(import_icons5.MinusIcon, { fontSize: size }),
1745
1805
  showTooltip: true
1746
1806
  },
1747
1807
  {
1748
1808
  value: true,
1749
1809
  disabled: true,
1750
1810
  label: REPLAY_OPTIONS.yes,
1751
- renderContent: ({ size }) => /* @__PURE__ */ React18.createElement(import_icons4.CheckIcon, { fontSize: size }),
1811
+ renderContent: ({ size }) => /* @__PURE__ */ React20.createElement(import_icons5.CheckIcon, { fontSize: size }),
1752
1812
  showTooltip: true
1753
1813
  }
1754
1814
  ];
1755
- return /* @__PURE__ */ React18.createElement(import_ui11.Box, { sx: { display: "grid", alignItems: "center" } }, /* @__PURE__ */ React18.createElement(import_ui11.Box, { sx: { gridArea: OVERLAY_GRID } }, /* @__PURE__ */ React18.createElement(import_editor_controls9.ToggleButtonGroupUi, { items: options, exclusive: true, onChange, value: false })), /* @__PURE__ */ React18.createElement(import_ui11.Box, { sx: { gridArea: OVERLAY_GRID, marginInlineEnd: CHIP_OFFSET, justifySelf: "end" } }, /* @__PURE__ */ React18.createElement(
1756
- InteractionsPromotionChip,
1815
+ return /* @__PURE__ */ React20.createElement(
1816
+ PromotionOverlayLayout,
1757
1817
  {
1758
- content: (0, import_i18n13.__)("Upgrade to run the animation every time its trigger occurs.", "elementor"),
1759
- upgradeUrl: "https://go.elementor.com/go-pro-interactions-replay-modal/",
1760
- anchorRef,
1761
- trackingData: TRACKING_DATA3
1762
- }
1763
- )));
1818
+ ref: replayContainerRef,
1819
+ promotionChip: /* @__PURE__ */ React20.createElement(
1820
+ InteractionsPromotionChip,
1821
+ {
1822
+ content: (0, import_i18n14.__)("Upgrade to run the animation every time its trigger occurs.", "elementor"),
1823
+ upgradeUrl: "https://go.elementor.com/go-pro-interactions-replay-modal/",
1824
+ anchorRef: replayContainerRef,
1825
+ trackingData: TRACKING_DATA4
1826
+ }
1827
+ )
1828
+ },
1829
+ /* @__PURE__ */ React20.createElement(import_editor_controls10.ToggleButtonGroupUi, { items: options, exclusive: true, onChange, value: false })
1830
+ );
1764
1831
  }
1765
1832
 
1766
1833
  // src/components/controls/trigger.tsx
1767
- var React19 = __toESM(require("react"));
1768
- var import_i18n14 = require("@wordpress/i18n");
1769
- var TRACKING_DATA4 = { target_name: "interactions_trigger", location_l2: "interactions" };
1834
+ var React21 = __toESM(require("react"));
1835
+ var import_i18n15 = require("@wordpress/i18n");
1836
+ var TRACKING_DATA5 = { target_name: "interactions_trigger", location_l2: "interactions" };
1770
1837
  var TRIGGER_OPTIONS = {
1771
- load: (0, import_i18n14.__)("Page load", "elementor"),
1772
- scrollIn: (0, import_i18n14.__)("Scroll into view", "elementor"),
1773
- scrollOn: (0, import_i18n14.__)("While scrolling", "elementor"),
1774
- hover: (0, import_i18n14.__)("On hover", "elementor"),
1775
- click: (0, import_i18n14.__)("On click", "elementor")
1838
+ load: (0, import_i18n15.__)("Page load", "elementor"),
1839
+ scrollIn: (0, import_i18n15.__)("Scroll into view", "elementor"),
1840
+ scrollOn: (0, import_i18n15.__)("While scrolling", "elementor"),
1841
+ hover: (0, import_i18n15.__)("On hover", "elementor"),
1842
+ click: (0, import_i18n15.__)("On click", "elementor")
1776
1843
  };
1777
1844
  var BASE_TRIGGERS = ["load", "scrollIn"];
1778
1845
  function Trigger({ value, onChange }) {
@@ -1782,17 +1849,17 @@ function Trigger({ value, onChange }) {
1782
1849
  const disabledOptions = Object.fromEntries(
1783
1850
  Object.entries(TRIGGER_OPTIONS).filter(([key]) => !BASE_TRIGGERS.includes(key))
1784
1851
  );
1785
- return /* @__PURE__ */ React19.createElement(
1852
+ return /* @__PURE__ */ React21.createElement(
1786
1853
  PromotionSelect,
1787
1854
  {
1788
1855
  value: value in baseOptions ? value : DEFAULT_VALUES.trigger,
1789
1856
  onChange,
1790
1857
  baseOptions,
1791
1858
  disabledOptions,
1792
- promotionLabel: (0, import_i18n14.__)("PRO triggers", "elementor"),
1793
- promotionContent: (0, import_i18n14.__)("Upgrade to unlock more interactions triggers.", "elementor"),
1859
+ promotionLabel: (0, import_i18n15.__)("PRO triggers", "elementor"),
1860
+ promotionContent: (0, import_i18n15.__)("Upgrade to unlock more interactions triggers.", "elementor"),
1794
1861
  upgradeUrl: "https://go.elementor.com/go-pro-interactions-triggers-modal/",
1795
- trackingData: TRACKING_DATA4
1862
+ trackingData: TRACKING_DATA5
1796
1863
  }
1797
1864
  );
1798
1865
  }
@@ -2172,6 +2239,10 @@ function init() {
2172
2239
  component: Effect,
2173
2240
  options: ["fade", "slide", "scale"]
2174
2241
  });
2242
+ registerInteractionsControl({
2243
+ type: "repeat",
2244
+ component: Repeat
2245
+ });
2175
2246
  initMcpInteractions();
2176
2247
  } catch (error) {
2177
2248
  throw error;
@@ -2188,6 +2259,8 @@ function init() {
2188
2259
  ELEMENTS_INTERACTIONS_PROVIDER_KEY_PREFIX,
2189
2260
  EmptyState,
2190
2261
  InteractionsTab,
2262
+ REPEAT_OPTIONS,
2263
+ REPEAT_TOOLTIPS,
2191
2264
  REPLAY_OPTIONS,
2192
2265
  TRIGGER_OPTIONS,
2193
2266
  buildDisplayLabel,