@elementor/editor-interactions 4.1.0-742 → 4.1.0-744

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
@@ -32,11 +32,15 @@ import { Stack as Stack3 } from "@elementor/ui";
32
32
 
33
33
  // src/contexts/interactions-context.tsx
34
34
  import * as React2 from "react";
35
- import { createContext, useContext, useEffect } from "react";
35
+ import { createContext, useContext, useEffect, useMemo } from "react";
36
36
  import {
37
+ getElementInteractions as getElementInteractions2,
38
+ getElementLabel,
37
39
  playElementInteractions,
38
40
  updateElementInteractions
39
41
  } from "@elementor/editor-elements";
42
+ import { undoable } from "@elementor/editor-v1-adapters";
43
+ import { __ as __2 } from "@wordpress/i18n";
40
44
 
41
45
  // src/hooks/use-element-interactions.ts
42
46
  import { useState } from "react";
@@ -487,12 +491,39 @@ var InteractionsProvider = ({ children, elementId }) => {
487
491
  window.dispatchEvent(new CustomEvent("elementor/element/update_interactions"));
488
492
  }, []);
489
493
  const interactions = rawInteractions ?? DEFAULT_INTERACTIONS;
494
+ const undoableSetInteractions = useMemo(
495
+ () => undoable(
496
+ {
497
+ do: ({ interactions: newInteractions }) => {
498
+ const previous = getElementInteractions2(elementId);
499
+ updateElementInteractions({ elementId, interactions: newInteractions });
500
+ return previous;
501
+ },
502
+ undo: (_, previous) => {
503
+ updateElementInteractions({
504
+ elementId,
505
+ interactions: previous?.items?.length ? previous : void 0
506
+ });
507
+ }
508
+ },
509
+ {
510
+ title: getElementLabel(elementId),
511
+ subtitle: ({ operationType }) => operationType === "apply" ? __2("Interaction Applied", "elementor") : __2("Interaction Deleted", "elementor")
512
+ }
513
+ ),
514
+ [elementId]
515
+ );
490
516
  const setInteractions = (value) => {
491
517
  const normalizedValue = value && value.items?.length === 0 ? void 0 : value;
492
- updateElementInteractions({
493
- elementId,
494
- interactions: normalizedValue
495
- });
518
+ const prevItemCount = interactions.items?.length ?? 0;
519
+ const newItemCount = normalizedValue?.items?.length ?? 0;
520
+ if (newItemCount > prevItemCount) {
521
+ undoableSetInteractions({ interactions: normalizedValue, operationType: "apply" });
522
+ } else if (newItemCount < prevItemCount) {
523
+ undoableSetInteractions({ interactions: normalizedValue, operationType: "delete" });
524
+ } else {
525
+ updateElementInteractions({ elementId, interactions: normalizedValue });
526
+ }
496
527
  };
497
528
  const playInteractions = (interactionId) => {
498
529
  playElementInteractions(elementId, interactionId);
@@ -529,7 +560,7 @@ var PopupStateProvider = ({ children }) => {
529
560
  };
530
561
 
531
562
  // src/utils/tracking.ts
532
- import { getElementLabel } from "@elementor/editor-elements";
563
+ import { getElementLabel as getElementLabel2 } from "@elementor/editor-elements";
533
564
  import { getMixpanel } from "@elementor/events";
534
565
  var TRIGGER_LABELS2 = {
535
566
  load: "On page load",
@@ -552,10 +583,10 @@ var trackInteractionCreated = (elementId, item) => {
552
583
  app_type: config?.appTypes?.editor,
553
584
  window_name: config?.appTypes?.editor,
554
585
  interaction_type: config?.triggers?.click,
555
- target_name: getElementLabel(elementId),
586
+ target_name: getElementLabel2(elementId),
556
587
  interaction_result: "interaction_created",
557
588
  target_location: config?.locations?.widgetPanel,
558
- location_l1: getElementLabel(elementId),
589
+ location_l1: getElementLabel2(elementId),
559
590
  location_l2: "interactions",
560
591
  interaction_description: "interaction_created",
561
592
  interaction_trigger: TRIGGER_LABELS2[trigger] ?? capitalize2(trigger),
@@ -565,11 +596,11 @@ var trackInteractionCreated = (elementId, item) => {
565
596
 
566
597
  // src/components/interactions-list.tsx
567
598
  import * as React10 from "react";
568
- import { useCallback as useCallback5, useEffect as useEffect2, useMemo as useMemo3, useRef as useRef2 } from "react";
599
+ import { useCallback as useCallback5, useEffect as useEffect2, useMemo as useMemo4, useRef as useRef2 } from "react";
569
600
  import { Repeater } from "@elementor/editor-controls";
570
601
  import { InfoCircleFilledIcon, PlayerPlayIcon } from "@elementor/icons";
571
602
  import { Alert, AlertTitle, Box, IconButton, Tooltip } from "@elementor/ui";
572
- import { __ as __5 } from "@wordpress/i18n";
603
+ import { __ as __6 } from "@wordpress/i18n";
573
604
 
574
605
  // src/contexts/interactions-item-context.tsx
575
606
  import * as React4 from "react";
@@ -612,10 +643,10 @@ function syncGridOverlay(trigger, start, end, relativeTo) {
612
643
 
613
644
  // src/components/interaction-details.tsx
614
645
  import * as React7 from "react";
615
- import { useMemo } from "react";
646
+ import { useMemo as useMemo2 } from "react";
616
647
  import { PopoverContent } from "@elementor/editor-controls";
617
648
  import { Divider, Grid as Grid2 } from "@elementor/ui";
618
- import { __ as __2 } from "@wordpress/i18n";
649
+ import { __ as __3 } from "@wordpress/i18n";
619
650
 
620
651
  // src/utils/resolve-direction.ts
621
652
  var resolveDirection = (hasDirection, newEffect, newDirection, currentDirection, currentEffect) => {
@@ -742,7 +773,7 @@ function normalizeTimesValue(value, fallback) {
742
773
  return Math.max(1, Math.floor(numericValue));
743
774
  }
744
775
  function useControlComponent(controlName, isVisible = true) {
745
- return useMemo(() => {
776
+ return useMemo2(() => {
746
777
  if (!isVisible) {
747
778
  return null;
748
779
  }
@@ -848,27 +879,27 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
848
879
  onPlayInteraction(interactionId);
849
880
  }, 0);
850
881
  };
851
- return /* @__PURE__ */ React7.createElement(PopoverContent, { p: 1.5 }, /* @__PURE__ */ React7.createElement(Grid2, { container: true, spacing: 1.5 }, TriggerControl && /* @__PURE__ */ React7.createElement(Field, { label: __2("Trigger", "elementor") }, /* @__PURE__ */ React7.createElement(TriggerControl, { value: trigger, onChange: (v) => updateInteraction({ trigger: v }) })), ReplayControl && /* @__PURE__ */ React7.createElement(Field, { label: __2("Replay", "elementor") }, /* @__PURE__ */ React7.createElement(
882
+ return /* @__PURE__ */ React7.createElement(PopoverContent, { p: 1.5 }, /* @__PURE__ */ React7.createElement(Grid2, { container: true, spacing: 1.5 }, TriggerControl && /* @__PURE__ */ React7.createElement(Field, { label: __3("Trigger", "elementor") }, /* @__PURE__ */ React7.createElement(TriggerControl, { value: trigger, onChange: (v) => updateInteraction({ trigger: v }) })), ReplayControl && /* @__PURE__ */ React7.createElement(Field, { label: __3("Replay", "elementor") }, /* @__PURE__ */ React7.createElement(
852
883
  ReplayControl,
853
884
  {
854
885
  value: replay,
855
886
  onChange: (v) => updateInteraction({ replay: v }),
856
887
  disabled: true
857
888
  }
858
- ))), /* @__PURE__ */ React7.createElement(Divider, null), /* @__PURE__ */ React7.createElement(Grid2, { container: true, spacing: 1.5 }, EffectControl && /* @__PURE__ */ React7.createElement(Field, { label: __2("Effect", "elementor") }, /* @__PURE__ */ React7.createElement(EffectControl, { value: effect, onChange: (v) => updateInteraction({ effect: v }) })), CustomEffectControl && /* @__PURE__ */ React7.createElement(Field, { label: __2("Custom Effect", "elementor") }, /* @__PURE__ */ React7.createElement(
889
+ ))), /* @__PURE__ */ React7.createElement(Divider, null), /* @__PURE__ */ React7.createElement(Grid2, { container: true, spacing: 1.5 }, EffectControl && /* @__PURE__ */ React7.createElement(Field, { label: __3("Effect", "elementor") }, /* @__PURE__ */ React7.createElement(EffectControl, { value: effect, onChange: (v) => updateInteraction({ effect: v }) })), CustomEffectControl && /* @__PURE__ */ React7.createElement(Field, { label: __3("Custom Effect", "elementor") }, /* @__PURE__ */ React7.createElement(
859
890
  CustomEffectControl,
860
891
  {
861
892
  value: customEffects,
862
893
  onChange: (v) => updateInteraction({ customEffects: v })
863
894
  }
864
- )), EffectTypeControl && /* @__PURE__ */ React7.createElement(Field, { label: __2("Type", "elementor") }, /* @__PURE__ */ React7.createElement(EffectTypeControl, { value: type, onChange: (v) => updateInteraction({ type: v }) })), DirectionControl && /* @__PURE__ */ React7.createElement(Field, { label: __2("Direction", "elementor") }, /* @__PURE__ */ React7.createElement(
895
+ )), EffectTypeControl && /* @__PURE__ */ React7.createElement(Field, { label: __3("Type", "elementor") }, /* @__PURE__ */ React7.createElement(EffectTypeControl, { value: type, onChange: (v) => updateInteraction({ type: v }) })), DirectionControl && /* @__PURE__ */ React7.createElement(Field, { label: __3("Direction", "elementor") }, /* @__PURE__ */ React7.createElement(
865
896
  DirectionControl,
866
897
  {
867
898
  value: direction,
868
899
  onChange: (v) => updateInteraction({ direction: v }),
869
900
  interactionType: type
870
901
  }
871
- )), RepeatControl && /* @__PURE__ */ React7.createElement(Field, { label: __2("Repeat", "elementor") }, /* @__PURE__ */ React7.createElement(RepeatControl, { value: repeat, onChange: (v) => updateInteraction({ repeat: v }) })), TimesControl && /* @__PURE__ */ React7.createElement(Field, { label: __2("Times", "elementor") }, /* @__PURE__ */ React7.createElement(
902
+ )), RepeatControl && /* @__PURE__ */ React7.createElement(Field, { label: __3("Repeat", "elementor") }, /* @__PURE__ */ React7.createElement(RepeatControl, { value: repeat, onChange: (v) => updateInteraction({ repeat: v }) })), TimesControl && /* @__PURE__ */ React7.createElement(Field, { label: __3("Times", "elementor") }, /* @__PURE__ */ React7.createElement(
872
903
  TimesControl,
873
904
  {
874
905
  value: times,
@@ -876,39 +907,39 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
876
907
  times: normalizeTimesValue(v, DEFAULT_VALUES.times)
877
908
  })
878
909
  }
879
- )), controlVisibilityConfig.duration(interactionValues) && /* @__PURE__ */ React7.createElement(Field, { label: __2("Duration", "elementor") }, /* @__PURE__ */ React7.createElement(
910
+ )), controlVisibilityConfig.duration(interactionValues) && /* @__PURE__ */ React7.createElement(Field, { label: __3("Duration", "elementor") }, /* @__PURE__ */ React7.createElement(
880
911
  TimeFrameIndicator,
881
912
  {
882
913
  value: String(duration),
883
914
  onChange: (v) => updateInteraction({ duration: v }),
884
915
  defaultValue: DEFAULT_VALUES.duration
885
916
  }
886
- )), controlVisibilityConfig.delay(interactionValues) && /* @__PURE__ */ React7.createElement(Field, { label: __2("Delay", "elementor") }, /* @__PURE__ */ React7.createElement(
917
+ )), controlVisibilityConfig.delay(interactionValues) && /* @__PURE__ */ React7.createElement(Field, { label: __3("Delay", "elementor") }, /* @__PURE__ */ React7.createElement(
887
918
  TimeFrameIndicator,
888
919
  {
889
920
  value: String(delay),
890
921
  onChange: (v) => updateInteraction({ delay: v }),
891
922
  defaultValue: DEFAULT_VALUES.delay
892
923
  }
893
- ))), controlVisibilityConfig.relativeTo(interactionValues) && RelativeToControl && /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(Divider, null), /* @__PURE__ */ React7.createElement(Grid2, { container: true, spacing: 1.5 }, StartControl && /* @__PURE__ */ React7.createElement(Field, { label: __2("Start", "elementor") }, /* @__PURE__ */ React7.createElement(
924
+ ))), controlVisibilityConfig.relativeTo(interactionValues) && RelativeToControl && /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(Divider, null), /* @__PURE__ */ React7.createElement(Grid2, { container: true, spacing: 1.5 }, StartControl && /* @__PURE__ */ React7.createElement(Field, { label: __3("Start", "elementor") }, /* @__PURE__ */ React7.createElement(
894
925
  StartControl,
895
926
  {
896
927
  value: parseSizeValue(start, ["%"]).size?.toString() ?? "",
897
928
  onChange: (v) => updateInteraction({ start: v })
898
929
  }
899
- )), EndControl && /* @__PURE__ */ React7.createElement(Field, { label: __2("End", "elementor") }, /* @__PURE__ */ React7.createElement(
930
+ )), EndControl && /* @__PURE__ */ React7.createElement(Field, { label: __3("End", "elementor") }, /* @__PURE__ */ React7.createElement(
900
931
  EndControl,
901
932
  {
902
933
  value: parseSizeValue(end, ["%"]).size?.toString() ?? "",
903
934
  onChange: (v) => updateInteraction({ end: v })
904
935
  }
905
- )), /* @__PURE__ */ React7.createElement(Field, { label: __2("Relative To", "elementor") }, /* @__PURE__ */ React7.createElement(
936
+ )), /* @__PURE__ */ React7.createElement(Field, { label: __3("Relative To", "elementor") }, /* @__PURE__ */ React7.createElement(
906
937
  RelativeToControl,
907
938
  {
908
939
  value: relativeTo,
909
940
  onChange: (v) => updateInteraction({ relativeTo: v })
910
941
  }
911
- ))), /* @__PURE__ */ React7.createElement(Divider, null)), EasingControl && /* @__PURE__ */ React7.createElement(Grid2, { container: true, spacing: 1.5 }, /* @__PURE__ */ React7.createElement(Field, { label: __2("Easing", "elementor") }, /* @__PURE__ */ React7.createElement(
942
+ ))), /* @__PURE__ */ React7.createElement(Divider, null)), EasingControl && /* @__PURE__ */ React7.createElement(Grid2, { container: true, spacing: 1.5 }, /* @__PURE__ */ React7.createElement(Field, { label: __3("Easing", "elementor") }, /* @__PURE__ */ React7.createElement(
912
943
  EasingControl,
913
944
  {
914
945
  value: easing,
@@ -923,19 +954,19 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
923
954
  import * as React9 from "react";
924
955
  import { useCallback as useCallback4 } from "react";
925
956
  import { Divider as Divider2, Tab, TabPanel, Tabs, useTabs } from "@elementor/ui";
926
- import { __ as __4 } from "@wordpress/i18n";
957
+ import { __ as __5 } from "@wordpress/i18n";
927
958
 
928
959
  // src/components/interaction-settings.tsx
929
960
  import * as React8 from "react";
930
- import { useCallback as useCallback3, useMemo as useMemo2, useState as useState3 } from "react";
961
+ import { useCallback as useCallback3, useMemo as useMemo3, useState as useState3 } from "react";
931
962
  import { ControlFormLabel as ControlFormLabel2, PopoverContent as PopoverContent2 } from "@elementor/editor-controls";
932
963
  import { useBreakpoints } from "@elementor/editor-responsive";
933
964
  import { Autocomplete, Chip, Grid as Grid3, Stack as Stack2, TextField } from "@elementor/ui";
934
- import { __ as __3 } from "@wordpress/i18n";
965
+ import { __ as __4 } from "@wordpress/i18n";
935
966
  var SIZE = "tiny";
936
967
  var InteractionSettings = ({ interaction, onChange }) => {
937
968
  const breakpoints = useBreakpoints();
938
- const availableBreakpoints = useMemo2(
969
+ const availableBreakpoints = useMemo3(
939
970
  () => breakpoints.map((breakpoint) => ({ label: breakpoint.label, value: String(breakpoint.id) })),
940
971
  [breakpoints]
941
972
  );
@@ -965,7 +996,7 @@ var InteractionSettings = ({ interaction, onChange }) => {
965
996
  },
966
997
  [interaction, availableBreakpoints, onChange]
967
998
  );
968
- return /* @__PURE__ */ React8.createElement(PopoverContent2, { p: 1.5 }, /* @__PURE__ */ React8.createElement(Grid3, { container: true, spacing: 1.5 }, /* @__PURE__ */ React8.createElement(Grid3, { item: true, xs: 12 }, /* @__PURE__ */ React8.createElement(Stack2, { direction: "column", gap: 1 }, /* @__PURE__ */ React8.createElement(ControlFormLabel2, { sx: { width: "100%" } }, __3("Trigger on", "elementor")), /* @__PURE__ */ React8.createElement(
999
+ return /* @__PURE__ */ React8.createElement(PopoverContent2, { p: 1.5 }, /* @__PURE__ */ React8.createElement(Grid3, { container: true, spacing: 1.5 }, /* @__PURE__ */ React8.createElement(Grid3, { item: true, xs: 12 }, /* @__PURE__ */ React8.createElement(Stack2, { direction: "column", gap: 1 }, /* @__PURE__ */ React8.createElement(ControlFormLabel2, { sx: { width: "100%" } }, __4("Trigger on", "elementor")), /* @__PURE__ */ React8.createElement(
969
1000
  Autocomplete,
970
1001
  {
971
1002
  fullWidth: true,
@@ -1009,11 +1040,11 @@ var InteractionsListItem = ({
1009
1040
  {
1010
1041
  size: "small",
1011
1042
  variant: "fullWidth",
1012
- "aria-label": __4("Interaction", "elementor"),
1043
+ "aria-label": __5("Interaction", "elementor"),
1013
1044
  ...getTabsProps()
1014
1045
  },
1015
- /* @__PURE__ */ React9.createElement(Tab, { label: __4("Details", "elementor"), ...getTabProps("details") }),
1016
- /* @__PURE__ */ React9.createElement(Tab, { label: __4("Settings", "elementor"), ...getTabProps("settings") })
1046
+ /* @__PURE__ */ React9.createElement(Tab, { label: __5("Details", "elementor"), ...getTabProps("details") }),
1047
+ /* @__PURE__ */ React9.createElement(Tab, { label: __5("Settings", "elementor"), ...getTabProps("settings") })
1017
1048
  ), /* @__PURE__ */ React9.createElement(Divider2, null), /* @__PURE__ */ React9.createElement(TabPanel, { sx: { p: 0 }, ...getTabPanelProps("details") }, /* @__PURE__ */ React9.createElement(
1018
1049
  InteractionDetails,
1019
1050
  {
@@ -1054,10 +1085,10 @@ function InteractionsList(props) {
1054
1085
  handleUpdateInteractions(newState);
1055
1086
  }
1056
1087
  }, [triggerCreateOnShowEmpty, interactions.items, handleUpdateInteractions]);
1057
- const isMaxNumberOfInteractionsReached = useMemo3(() => {
1088
+ const isMaxNumberOfInteractionsReached = useMemo4(() => {
1058
1089
  return interactions.items?.length >= MAX_NUMBER_OF_INTERACTIONS;
1059
1090
  }, [interactions.items?.length]);
1060
- const infotipContent = isMaxNumberOfInteractionsReached ? /* @__PURE__ */ React10.createElement(Alert, { color: "secondary", icon: /* @__PURE__ */ React10.createElement(InfoCircleFilledIcon, null), size: "small" }, /* @__PURE__ */ React10.createElement(AlertTitle, null, __5("Interactions", "elementor")), /* @__PURE__ */ React10.createElement(Box, { component: "span" }, __5(
1091
+ const infotipContent = isMaxNumberOfInteractionsReached ? /* @__PURE__ */ React10.createElement(Alert, { color: "secondary", icon: /* @__PURE__ */ React10.createElement(InfoCircleFilledIcon, null), size: "small" }, /* @__PURE__ */ React10.createElement(AlertTitle, null, __6("Interactions", "elementor")), /* @__PURE__ */ React10.createElement(Box, { component: "span" }, __6(
1061
1092
  "You've reached the limit of 5 interactions for this element. Please remove an interaction before creating a new one.",
1062
1093
  "elementor"
1063
1094
  ))) : void 0;
@@ -1090,7 +1121,7 @@ function InteractionsList(props) {
1090
1121
  },
1091
1122
  [interactions, handleUpdateInteractions]
1092
1123
  );
1093
- const contextValue = useMemo3(
1124
+ const contextValue = useMemo4(
1094
1125
  () => ({
1095
1126
  onInteractionChange: handleInteractionChange,
1096
1127
  onPlayInteraction
@@ -1102,7 +1133,7 @@ function InteractionsList(props) {
1102
1133
  {
1103
1134
  openOnAdd: true,
1104
1135
  openItem: triggerCreateOnShowEmpty ? 0 : void 0,
1105
- label: __5("Interactions", "elementor"),
1136
+ label: __6("Interactions", "elementor"),
1106
1137
  values: interactions.items,
1107
1138
  setValues: handleRepeaterChange,
1108
1139
  showDuplicate: false,
@@ -1123,10 +1154,10 @@ function InteractionsList(props) {
1123
1154
  syncGridOverlay(trigger, start, end, relativeTo);
1124
1155
  },
1125
1156
  onPopoverClose: () => dispatchScrollInteraction(null),
1126
- actions: (value) => /* @__PURE__ */ React10.createElement(Tooltip, { key: "preview", placement: "top", title: __5("Preview", "elementor") }, /* @__PURE__ */ React10.createElement(
1157
+ actions: (value) => /* @__PURE__ */ React10.createElement(Tooltip, { key: "preview", placement: "top", title: __6("Preview", "elementor") }, /* @__PURE__ */ React10.createElement(
1127
1158
  IconButton,
1128
1159
  {
1129
- "aria-label": __5("Play interaction", "elementor"),
1160
+ "aria-label": __6("Play interaction", "elementor"),
1130
1161
  size: "tiny",
1131
1162
  onClick: () => onPlayInteraction(extractString(value.value.interaction_id))
1132
1163
  },
@@ -1241,7 +1272,7 @@ function createInteractionsProvider({
1241
1272
  }
1242
1273
 
1243
1274
  // src/providers/document-elements-interactions-provider.ts
1244
- import { getCurrentDocumentId, getElementInteractions as getElementInteractions2, getElements } from "@elementor/editor-elements";
1275
+ import { getCurrentDocumentId, getElementInteractions as getElementInteractions3, getElements } from "@elementor/editor-elements";
1245
1276
  import { __privateListenTo as listenTo, windowEvent as windowEvent2 } from "@elementor/editor-v1-adapters";
1246
1277
  var ELEMENTS_INTERACTIONS_PROVIDER_KEY_PREFIX = "document-elements-interactions-";
1247
1278
  var documentElementsInteractionsProvider = createInteractionsProvider({
@@ -1262,14 +1293,14 @@ var documentElementsInteractionsProvider = createInteractionsProvider({
1262
1293
  all: () => {
1263
1294
  const elements = getElements();
1264
1295
  const filtered = elements.filter((element) => {
1265
- const interactions = getElementInteractions2(element.id);
1296
+ const interactions = getElementInteractions3(element.id);
1266
1297
  if (!interactions) {
1267
1298
  return false;
1268
1299
  }
1269
1300
  return interactions?.items?.length > 0;
1270
1301
  });
1271
1302
  return filtered.map((element) => {
1272
- const interactions = getElementInteractions2(element.id);
1303
+ const interactions = getElementInteractions3(element.id);
1273
1304
  return {
1274
1305
  elementId: element.id,
1275
1306
  dataId: element.id,
@@ -1286,17 +1317,17 @@ import { getMCPByDomain } from "@elementor/editor-mcp";
1286
1317
  // src/commands/paste-interactions.ts
1287
1318
  import {
1288
1319
  getContainer,
1289
- getElementInteractions as getElementInteractions3,
1290
- getElementLabel as getElementLabel2,
1320
+ getElementInteractions as getElementInteractions4,
1321
+ getElementLabel as getElementLabel3,
1291
1322
  getWidgetsCache,
1292
1323
  updateElementInteractions as updateElementInteractions2
1293
1324
  } from "@elementor/editor-elements";
1294
1325
  import {
1295
1326
  __privateListenTo as listenTo2,
1296
1327
  commandStartEvent,
1297
- undoable
1328
+ undoable as undoable2
1298
1329
  } from "@elementor/editor-v1-adapters";
1299
- import { __ as __6 } from "@wordpress/i18n";
1330
+ import { __ as __7 } from "@wordpress/i18n";
1300
1331
 
1301
1332
  // src/commands/get-clipboard-elements.ts
1302
1333
  function getClipboardElements(storageKey = "clipboard") {
@@ -1316,7 +1347,7 @@ function isAtomicContainer(container) {
1316
1347
  return Boolean(elementConfig?.atomic_props_schema);
1317
1348
  }
1318
1349
  function getTitleForContainers(containers) {
1319
- return containers.length > 1 ? __6("Elements", "elementor") : getElementLabel2(containers[0].id);
1350
+ return containers.length > 1 ? __7("Elements", "elementor") : getElementLabel3(containers[0].id);
1320
1351
  }
1321
1352
  function normalizeClipboardInteractions(raw) {
1322
1353
  if (!raw) {
@@ -1342,13 +1373,13 @@ function regenerateInteractionIds(interactions) {
1342
1373
  return cloned;
1343
1374
  }
1344
1375
  function initPasteInteractionsCommand() {
1345
- const undoablePasteInteractions = undoable(
1376
+ const undoablePasteInteractions = undoable2(
1346
1377
  {
1347
1378
  do: ({ containers, newInteractions }) => {
1348
1379
  const pasted = regenerateInteractionIds(newInteractions);
1349
1380
  return containers.map((container) => {
1350
1381
  const elementId = container.id;
1351
- const previous = getElementInteractions3(elementId);
1382
+ const previous = getElementInteractions4(elementId);
1352
1383
  updateElementInteractions2({
1353
1384
  elementId,
1354
1385
  interactions: pasted
@@ -1367,7 +1398,7 @@ function initPasteInteractionsCommand() {
1367
1398
  },
1368
1399
  {
1369
1400
  title: ({ containers }) => getTitleForContainers(containers),
1370
- subtitle: __6("Interactions Pasted", "elementor")
1401
+ subtitle: __7("Interactions Pasted", "elementor")
1371
1402
  }
1372
1403
  );
1373
1404
  listenTo2(commandStartEvent("document/elements/paste-interactions"), (e) => {
@@ -1397,11 +1428,11 @@ function initPasteInteractionsCommand() {
1397
1428
 
1398
1429
  // src/components/controls/direction.tsx
1399
1430
  import * as React12 from "react";
1400
- import { useMemo as useMemo4 } from "react";
1431
+ import { useMemo as useMemo5 } from "react";
1401
1432
  import { StyledToggleButton, StyledToggleButtonGroup } from "@elementor/editor-controls";
1402
1433
  import { ArrowDownSmallIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpSmallIcon } from "@elementor/icons";
1403
1434
  import { Tooltip as Tooltip2 } from "@elementor/ui";
1404
- import { __ as __7 } from "@wordpress/i18n";
1435
+ import { __ as __8 } from "@wordpress/i18n";
1405
1436
  var AXIS = {
1406
1437
  top: "vertical",
1407
1438
  bottom: "vertical",
@@ -1428,32 +1459,32 @@ function toggleDirection(current, clicked) {
1428
1459
  }
1429
1460
  function Direction({ value, onChange, interactionType }) {
1430
1461
  const isIn = interactionType === "in";
1431
- const options = useMemo4(
1462
+ const options = useMemo5(
1432
1463
  () => [
1433
1464
  {
1434
1465
  dir: "top",
1435
- label: isIn ? __7("From top", "elementor") : __7("To top", "elementor"),
1466
+ label: isIn ? __8("From top", "elementor") : __8("To top", "elementor"),
1436
1467
  Icon: isIn ? ArrowDownSmallIcon : ArrowUpSmallIcon
1437
1468
  },
1438
1469
  {
1439
1470
  dir: "bottom",
1440
- label: isIn ? __7("From bottom", "elementor") : __7("To bottom", "elementor"),
1471
+ label: isIn ? __8("From bottom", "elementor") : __8("To bottom", "elementor"),
1441
1472
  Icon: isIn ? ArrowUpSmallIcon : ArrowDownSmallIcon
1442
1473
  },
1443
1474
  {
1444
1475
  dir: "left",
1445
- label: isIn ? __7("From left", "elementor") : __7("To left", "elementor"),
1476
+ label: isIn ? __8("From left", "elementor") : __8("To left", "elementor"),
1446
1477
  Icon: isIn ? ArrowRightIcon : ArrowLeftIcon
1447
1478
  },
1448
1479
  {
1449
1480
  dir: "right",
1450
- label: isIn ? __7("From right", "elementor") : __7("To right", "elementor"),
1481
+ label: isIn ? __8("From right", "elementor") : __8("To right", "elementor"),
1451
1482
  Icon: isIn ? ArrowLeftIcon : ArrowRightIcon
1452
1483
  }
1453
1484
  ],
1454
1485
  [isIn]
1455
1486
  );
1456
- const selectedDirections = useMemo4(() => parseValue(value), [value]);
1487
+ const selectedDirections = useMemo5(() => parseValue(value), [value]);
1457
1488
  return /* @__PURE__ */ React12.createElement(
1458
1489
  StyledToggleButtonGroup,
1459
1490
  {
@@ -1485,14 +1516,14 @@ function Direction({ value, onChange, interactionType }) {
1485
1516
 
1486
1517
  // src/components/controls/easing.tsx
1487
1518
  import * as React15 from "react";
1488
- import { __ as __10 } from "@wordpress/i18n";
1519
+ import { __ as __11 } from "@wordpress/i18n";
1489
1520
 
1490
1521
  // src/ui/promotion-select.tsx
1491
1522
  import * as React14 from "react";
1492
1523
  import { useRef as useRef3 } from "react";
1493
1524
  import { MenuListItem } from "@elementor/editor-ui";
1494
1525
  import { MenuSubheader, Select } from "@elementor/ui";
1495
- import { __ as __9 } from "@wordpress/i18n";
1526
+ import { __ as __10 } from "@wordpress/i18n";
1496
1527
 
1497
1528
  // src/ui/interactions-promotion-chip.tsx
1498
1529
  import * as React13 from "react";
@@ -1500,7 +1531,7 @@ import { forwardRef, useCallback as useCallback7, useImperativeHandle, useState
1500
1531
  import { trackUpgradePromotionClick, trackViewPromotion } from "@elementor/editor-controls";
1501
1532
  import { PromotionChip, PromotionPopover, useCanvasClickHandler } from "@elementor/editor-ui";
1502
1533
  import { Box as Box2 } from "@elementor/ui";
1503
- import { __ as __8 } from "@wordpress/i18n";
1534
+ import { __ as __9 } from "@wordpress/i18n";
1504
1535
  var InteractionsPromotionChip = forwardRef(
1505
1536
  ({ content, upgradeUrl, anchorRef, trackingData }, ref) => {
1506
1537
  const [isOpen, setIsOpen] = useState5(false);
@@ -1522,9 +1553,9 @@ var InteractionsPromotionChip = forwardRef(
1522
1553
  PromotionPopover,
1523
1554
  {
1524
1555
  open: isOpen,
1525
- title: __8("Interactions", "elementor"),
1556
+ title: __9("Interactions", "elementor"),
1526
1557
  content,
1527
- ctaText: __8("Upgrade now", "elementor"),
1558
+ ctaText: __9("Upgrade now", "elementor"),
1528
1559
  ctaUrl: upgradeUrl,
1529
1560
  anchorRef,
1530
1561
  placement: anchorRef ? "right-start" : void 0,
@@ -1587,7 +1618,7 @@ function PromotionSelect({
1587
1618
  promotionRef.current?.toggle();
1588
1619
  }
1589
1620
  },
1590
- promotionLabel ?? __9("PRO features", "elementor"),
1621
+ promotionLabel ?? __10("PRO features", "elementor"),
1591
1622
  /* @__PURE__ */ React14.createElement(
1592
1623
  InteractionsPromotionChip,
1593
1624
  {
@@ -1606,13 +1637,13 @@ function PromotionSelect({
1606
1637
  // src/components/controls/easing.tsx
1607
1638
  var TRACKING_DATA = { target_name: "interactions_easing", location_l2: "interactions" };
1608
1639
  var EASING_OPTIONS = {
1609
- easeIn: __10("Ease In", "elementor"),
1610
- easeInOut: __10("Ease In Out", "elementor"),
1611
- easeOut: __10("Ease Out", "elementor"),
1612
- backIn: __10("Back In", "elementor"),
1613
- backInOut: __10("Back In Out", "elementor"),
1614
- backOut: __10("Back Out", "elementor"),
1615
- linear: __10("Linear", "elementor")
1640
+ easeIn: __11("Ease In", "elementor"),
1641
+ easeInOut: __11("Ease In Out", "elementor"),
1642
+ easeOut: __11("Ease Out", "elementor"),
1643
+ backIn: __11("Back In", "elementor"),
1644
+ backInOut: __11("Back In Out", "elementor"),
1645
+ backOut: __11("Back Out", "elementor"),
1646
+ linear: __11("Linear", "elementor")
1616
1647
  };
1617
1648
  var BASE_EASINGS = ["easeIn"];
1618
1649
  function Easing({}) {
@@ -1628,7 +1659,7 @@ function Easing({}) {
1628
1659
  value: DEFAULT_VALUES.easing,
1629
1660
  baseOptions,
1630
1661
  disabledOptions,
1631
- promotionContent: __10("Upgrade to control the smoothness of the interaction.", "elementor"),
1662
+ promotionContent: __11("Upgrade to control the smoothness of the interaction.", "elementor"),
1632
1663
  upgradeUrl: "https://go.elementor.com/go-pro-interactions-easing-modal/",
1633
1664
  trackingData: TRACKING_DATA
1634
1665
  }
@@ -1637,13 +1668,13 @@ function Easing({}) {
1637
1668
 
1638
1669
  // src/components/controls/effect.tsx
1639
1670
  import * as React16 from "react";
1640
- import { __ as __11 } from "@wordpress/i18n";
1671
+ import { __ as __12 } from "@wordpress/i18n";
1641
1672
  var TRACKING_DATA2 = { target_name: "interactions_effect", location_l2: "interactions" };
1642
1673
  var EFFECT_OPTIONS = {
1643
- fade: __11("Fade", "elementor"),
1644
- slide: __11("Slide", "elementor"),
1645
- scale: __11("Scale", "elementor"),
1646
- custom: __11("Custom", "elementor")
1674
+ fade: __12("Fade", "elementor"),
1675
+ slide: __12("Slide", "elementor"),
1676
+ scale: __12("Scale", "elementor"),
1677
+ custom: __12("Custom", "elementor")
1647
1678
  };
1648
1679
  var BASE_EFFECTS = ["fade", "slide", "scale"];
1649
1680
  function Effect({ value, onChange }) {
@@ -1660,8 +1691,8 @@ function Effect({ value, onChange }) {
1660
1691
  onChange,
1661
1692
  baseOptions,
1662
1693
  disabledOptions,
1663
- promotionLabel: __11("PRO effects", "elementor"),
1664
- promotionContent: __11(
1694
+ promotionLabel: __12("PRO effects", "elementor"),
1695
+ promotionContent: __12(
1665
1696
  "Upgrade to further customize your animation with opacity, scale, move, rotate and more.",
1666
1697
  "elementor"
1667
1698
  ),
@@ -1674,19 +1705,19 @@ function Effect({ value, onChange }) {
1674
1705
  // src/components/controls/effect-type.tsx
1675
1706
  import * as React17 from "react";
1676
1707
  import { ToggleButtonGroupUi } from "@elementor/editor-controls";
1677
- import { __ as __12 } from "@wordpress/i18n";
1708
+ import { __ as __13 } from "@wordpress/i18n";
1678
1709
  function EffectType({ value, onChange }) {
1679
1710
  const options = [
1680
1711
  {
1681
1712
  value: "in",
1682
- label: __12("In", "elementor"),
1683
- renderContent: () => __12("In", "elementor"),
1713
+ label: __13("In", "elementor"),
1714
+ renderContent: () => __13("In", "elementor"),
1684
1715
  showTooltip: true
1685
1716
  },
1686
1717
  {
1687
1718
  value: "out",
1688
- label: __12("Out", "elementor"),
1689
- renderContent: () => __12("Out", "elementor"),
1719
+ label: __13("Out", "elementor"),
1720
+ renderContent: () => __13("Out", "elementor"),
1690
1721
  showTooltip: true
1691
1722
  }
1692
1723
  ];
@@ -1698,7 +1729,7 @@ import * as React19 from "react";
1698
1729
  import { useRef as useRef4 } from "react";
1699
1730
  import { ToggleButtonGroupUi as ToggleButtonGroupUi2 } from "@elementor/editor-controls";
1700
1731
  import { Number123Icon, RepeatIcon } from "@elementor/icons";
1701
- import { __ as __13 } from "@wordpress/i18n";
1732
+ import { __ as __14 } from "@wordpress/i18n";
1702
1733
 
1703
1734
  // src/ui/promotion-overlay-layout.tsx
1704
1735
  import * as React18 from "react";
@@ -1713,12 +1744,12 @@ var PromotionOverlayLayout = forwardRef2(
1713
1744
  // src/components/controls/repeat.tsx
1714
1745
  var TRACKING_DATA3 = { target_name: "interactions_repeat", location_l2: "interactions" };
1715
1746
  var REPEAT_OPTIONS = {
1716
- times: __13("times", "elementor"),
1717
- loop: __13("loop", "elementor")
1747
+ times: __14("times", "elementor"),
1748
+ loop: __14("loop", "elementor")
1718
1749
  };
1719
1750
  var REPEAT_TOOLTIPS = {
1720
- times: __13("Enable number", "elementor"),
1721
- loop: __13("Infinite repeat", "elementor")
1751
+ times: __14("Enable number", "elementor"),
1752
+ loop: __14("Infinite repeat", "elementor")
1722
1753
  };
1723
1754
  function Repeat() {
1724
1755
  const repeatContainerRef = useRef4(null);
@@ -1745,7 +1776,7 @@ function Repeat() {
1745
1776
  promotionChip: /* @__PURE__ */ React19.createElement(
1746
1777
  InteractionsPromotionChip,
1747
1778
  {
1748
- content: __13("Upgrade to control how many times the animation repeats.", "elementor"),
1779
+ content: __14("Upgrade to control how many times the animation repeats.", "elementor"),
1749
1780
  upgradeUrl: "https://go.elementor.com/go-pro-interactions-repeat-modal/",
1750
1781
  anchorRef: repeatContainerRef,
1751
1782
  trackingData: TRACKING_DATA3
@@ -1762,11 +1793,11 @@ import * as React20 from "react";
1762
1793
  import { useRef as useRef5 } from "react";
1763
1794
  import { ToggleButtonGroupUi as ToggleButtonGroupUi3 } from "@elementor/editor-controls";
1764
1795
  import { CheckIcon, MinusIcon } from "@elementor/icons";
1765
- import { __ as __14 } from "@wordpress/i18n";
1796
+ import { __ as __15 } from "@wordpress/i18n";
1766
1797
  var TRACKING_DATA4 = { target_name: "interactions_replay", location_l2: "interactions" };
1767
1798
  var REPLAY_OPTIONS = {
1768
- no: __14("No", "elementor"),
1769
- yes: __14("Yes", "elementor")
1799
+ no: __15("No", "elementor"),
1800
+ yes: __15("Yes", "elementor")
1770
1801
  };
1771
1802
  var BASE_REPLAY = ["no"];
1772
1803
  function Replay({ onChange }) {
@@ -1794,7 +1825,7 @@ function Replay({ onChange }) {
1794
1825
  promotionChip: /* @__PURE__ */ React20.createElement(
1795
1826
  InteractionsPromotionChip,
1796
1827
  {
1797
- content: __14("Upgrade to run the animation every time its trigger occurs.", "elementor"),
1828
+ content: __15("Upgrade to run the animation every time its trigger occurs.", "elementor"),
1798
1829
  upgradeUrl: "https://go.elementor.com/go-pro-interactions-replay-modal/",
1799
1830
  anchorRef: replayContainerRef,
1800
1831
  trackingData: TRACKING_DATA4
@@ -1807,14 +1838,14 @@ function Replay({ onChange }) {
1807
1838
 
1808
1839
  // src/components/controls/trigger.tsx
1809
1840
  import * as React21 from "react";
1810
- import { __ as __15 } from "@wordpress/i18n";
1841
+ import { __ as __16 } from "@wordpress/i18n";
1811
1842
  var TRACKING_DATA5 = { target_name: "interactions_trigger", location_l2: "interactions" };
1812
1843
  var TRIGGER_OPTIONS = {
1813
- load: __15("Page load", "elementor"),
1814
- scrollIn: __15("Scroll into view", "elementor"),
1815
- scrollOn: __15("While scrolling", "elementor"),
1816
- hover: __15("On hover", "elementor"),
1817
- click: __15("On click", "elementor")
1844
+ load: __16("Page load", "elementor"),
1845
+ scrollIn: __16("Scroll into view", "elementor"),
1846
+ scrollOn: __16("While scrolling", "elementor"),
1847
+ hover: __16("On hover", "elementor"),
1848
+ click: __16("On click", "elementor")
1818
1849
  };
1819
1850
  var BASE_TRIGGERS = ["load", "scrollIn"];
1820
1851
  function Trigger({ value, onChange }) {
@@ -1831,8 +1862,8 @@ function Trigger({ value, onChange }) {
1831
1862
  onChange,
1832
1863
  baseOptions,
1833
1864
  disabledOptions,
1834
- promotionLabel: __15("PRO triggers", "elementor"),
1835
- promotionContent: __15("Upgrade to unlock more interactions triggers.", "elementor"),
1865
+ promotionLabel: __16("PRO triggers", "elementor"),
1866
+ promotionContent: __16("Upgrade to unlock more interactions triggers.", "elementor"),
1836
1867
  upgradeUrl: "https://go.elementor.com/go-pro-interactions-triggers-modal/",
1837
1868
  trackingData: TRACKING_DATA5
1838
1869
  }