@elementor/editor-interactions 4.0.0-683 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -115,6 +115,110 @@ var createSizeValue = (size, unit) => {
115
115
  return { size, unit };
116
116
  };
117
117
 
118
+ // src/utils/custom-effect-to-prop-value.ts
119
+ var CUSTOM_EFFECT_TYPE = "custom-effect";
120
+ var KEYFRAMES_TYPE = "keyframes";
121
+ var KEYFRAME_STOP_TYPE = "keyframe-stop";
122
+ var KEYFRAME_STOP_SETTINGS_TYPE = "keyframe-stop-settings";
123
+ var SIZE_TYPE = "size";
124
+ var NUMBER_TYPE = "number";
125
+ var TRANSFORM_SCALE_TYPE = "transform-scale";
126
+ var TRANSFORM_ROTATE_TYPE = "transform-rotate";
127
+ var TRANSFORM_MOVE_TYPE = "transform-move";
128
+ var TRANSFORM_SKEW_TYPE = "transform-skew";
129
+ var UNIT_PERCENT = "%";
130
+ var UNIT_DEG = "deg";
131
+ var UNIT_PX = "px";
132
+ var isPlainCustomEffect = (v) => typeof v === "object" && v !== null && "keyframes" in v && Array.isArray(v.keyframes) && !("$$type" in v);
133
+ var toSizePropValue = (size, unit = UNIT_PERCENT) => ({
134
+ $$type: SIZE_TYPE,
135
+ value: { size, unit }
136
+ });
137
+ var toNumberPropValue = (n) => ({
138
+ $$type: NUMBER_TYPE,
139
+ value: n
140
+ });
141
+ var toDimensionalNumberPropValue = (type, plain, defaults) => ({
142
+ $$type: type,
143
+ value: {
144
+ x: toNumberPropValue(plain.x ?? defaults.x),
145
+ y: toNumberPropValue(plain.y ?? defaults.y),
146
+ z: toNumberPropValue(plain.z ?? defaults.z)
147
+ }
148
+ });
149
+ var toDimensionalSizePropValue = (type, plain, defaults, unit) => ({
150
+ $$type: type,
151
+ value: {
152
+ x: toSizePropValue(plain.x ?? defaults.x, unit),
153
+ y: toSizePropValue(plain.y ?? defaults.y, unit),
154
+ z: toSizePropValue(plain.z ?? defaults.z, unit)
155
+ }
156
+ });
157
+ var toSkewPropValue = (plain) => ({
158
+ $$type: TRANSFORM_SKEW_TYPE,
159
+ value: {
160
+ x: toSizePropValue(plain.x ?? 0, UNIT_DEG),
161
+ y: toSizePropValue(plain.y ?? 0, UNIT_DEG)
162
+ }
163
+ });
164
+ var toKeyframeStopSettingsPropValue = (plain) => {
165
+ const value = {};
166
+ if (plain.opacity !== void 0) {
167
+ const percent = plain.opacity <= 1 ? Math.round(plain.opacity * 100) : plain.opacity;
168
+ value.opacity = toSizePropValue(percent);
169
+ }
170
+ if (plain.scale !== void 0) {
171
+ value.scale = toDimensionalNumberPropValue(TRANSFORM_SCALE_TYPE, plain.scale, { x: 1, y: 1, z: 1 });
172
+ }
173
+ if (plain.rotate !== void 0) {
174
+ value.rotate = toDimensionalSizePropValue(
175
+ TRANSFORM_ROTATE_TYPE,
176
+ plain.rotate,
177
+ { x: 0, y: 0, z: 0 },
178
+ UNIT_DEG
179
+ );
180
+ }
181
+ if (plain.move !== void 0) {
182
+ value.move = toDimensionalSizePropValue(TRANSFORM_MOVE_TYPE, plain.move, { x: 0, y: 0, z: 0 }, UNIT_PX);
183
+ }
184
+ if (plain.skew !== void 0) {
185
+ value.skew = toSkewPropValue(plain.skew);
186
+ }
187
+ return { $$type: KEYFRAME_STOP_SETTINGS_TYPE, value };
188
+ };
189
+ var isPlainKeyframe = (v) => typeof v === "object" && v !== null && "stop" in v && "value" in v && !("$$type" in v);
190
+ var toKeyframeStopPropValue = (item) => {
191
+ if (!isPlainKeyframe(item)) {
192
+ return item;
193
+ }
194
+ return {
195
+ $$type: KEYFRAME_STOP_TYPE,
196
+ value: {
197
+ stop: toSizePropValue(item.stop),
198
+ settings: toKeyframeStopSettingsPropValue(item.value)
199
+ }
200
+ };
201
+ };
202
+ var toKeyframesPropValue = (keyframes) => ({
203
+ $$type: KEYFRAMES_TYPE,
204
+ value: keyframes.map(toKeyframeStopPropValue)
205
+ });
206
+ var plainCustomEffectToPropValue = (plain) => ({
207
+ $$type: CUSTOM_EFFECT_TYPE,
208
+ value: {
209
+ keyframes: toKeyframesPropValue(plain.keyframes)
210
+ }
211
+ });
212
+ var toCustomEffectPropValue = (customEffects) => {
213
+ if (customEffects === void 0) {
214
+ return void 0;
215
+ }
216
+ if (isPlainCustomEffect(customEffects)) {
217
+ return plainCustomEffectToPropValue(customEffects);
218
+ }
219
+ return customEffects;
220
+ };
221
+
118
222
  // src/utils/get-interactions-config.ts
119
223
  function getInteractionsConfig() {
120
224
  return window.ElementorInteractionsConfig ?? {};
@@ -153,7 +257,7 @@ var createBoolean = (value) => ({
153
257
  var createConfig = ({
154
258
  replay,
155
259
  easing = "easeIn",
156
- relativeTo = "",
260
+ relativeTo = "viewport",
157
261
  repeat = "",
158
262
  times = 1,
159
263
  start = 85,
@@ -206,25 +310,28 @@ var createAnimationPreset = ({
206
310
  start,
207
311
  end,
208
312
  customEffects
209
- }) => ({
210
- $$type: "animation-preset-props",
211
- value: {
212
- effect: createString(effect),
213
- custom_effect: customEffects,
214
- type: createString(type),
215
- direction: createString(direction ?? ""),
216
- timing_config: createTimingConfig(duration, delay),
217
- config: createConfig({
218
- replay,
219
- easing,
220
- relativeTo,
221
- repeat,
222
- times,
223
- start,
224
- end
225
- })
226
- }
227
- });
313
+ }) => {
314
+ const customEffectProp = toCustomEffectPropValue(customEffects);
315
+ return {
316
+ $$type: "animation-preset-props",
317
+ value: {
318
+ effect: createString(effect),
319
+ ...customEffectProp !== void 0 && { custom_effect: customEffectProp },
320
+ type: createString(type),
321
+ direction: createString(direction ?? ""),
322
+ timing_config: createTimingConfig(duration, delay),
323
+ config: createConfig({
324
+ replay,
325
+ easing,
326
+ relativeTo,
327
+ repeat,
328
+ times,
329
+ start,
330
+ end
331
+ })
332
+ }
333
+ };
334
+ };
228
335
  var createInteractionItem = ({
229
336
  trigger,
230
337
  effect,
@@ -458,10 +565,10 @@ var trackInteractionCreated = (elementId, item) => {
458
565
 
459
566
  // src/components/interactions-list.tsx
460
567
  import * as React10 from "react";
461
- import { useCallback as useCallback5, useEffect as useEffect2, useMemo as useMemo3, useRef as useRef3 } from "react";
568
+ import { useCallback as useCallback5, useEffect as useEffect2, useMemo as useMemo3, useRef as useRef2 } from "react";
462
569
  import { Repeater } from "@elementor/editor-controls";
463
570
  import { InfoCircleFilledIcon, PlayerPlayIcon } from "@elementor/icons";
464
- import { Alert, AlertTitle, Box as Box2, IconButton, Tooltip } from "@elementor/ui";
571
+ import { Alert, AlertTitle, Box, IconButton, Tooltip } from "@elementor/ui";
465
572
  import { __ as __5 } from "@wordpress/i18n";
466
573
 
467
574
  // src/contexts/interactions-item-context.tsx
@@ -490,9 +597,9 @@ import { __ as __4 } from "@wordpress/i18n";
490
597
 
491
598
  // src/components/interaction-details.tsx
492
599
  import * as React7 from "react";
493
- import { useMemo, useRef as useRef2 } from "react";
600
+ import { useMemo } from "react";
494
601
  import { PopoverContent } from "@elementor/editor-controls";
495
- import { Box, Divider, Grid as Grid2 } from "@elementor/ui";
602
+ import { Divider, Grid as Grid2 } from "@elementor/ui";
496
603
  import { __ as __2 } from "@wordpress/i18n";
497
604
 
498
605
  // src/utils/resolve-direction.ts
@@ -686,7 +793,6 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
686
793
  controlVisibilityConfig.times(interactionValues)
687
794
  );
688
795
  const EasingControl = useControlComponent("easing");
689
- const containerRef = useRef2(null);
690
796
  const updateInteraction = (updates) => {
691
797
  const resolvedDirectionValue = resolveDirection(
692
798
  "direction" in updates,
@@ -721,19 +827,12 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
721
827
  onPlayInteraction(interactionId);
722
828
  }, 0);
723
829
  };
724
- return /* @__PURE__ */ React7.createElement(Box, { ref: containerRef }, /* @__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(
725
- TriggerControl,
726
- {
727
- value: trigger,
728
- onChange: (v) => updateInteraction({ trigger: v })
729
- }
730
- )), ReplayControl && /* @__PURE__ */ React7.createElement(Field, { label: __2("Replay", "elementor") }, /* @__PURE__ */ React7.createElement(
830
+ 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(
731
831
  ReplayControl,
732
832
  {
733
833
  value: replay,
734
834
  onChange: (v) => updateInteraction({ replay: v }),
735
- disabled: true,
736
- anchorRef: containerRef
835
+ disabled: true
737
836
  }
738
837
  ))), /* @__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(
739
838
  CustomEffectControl,
@@ -796,7 +895,7 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
796
895
  updateInteraction({ easing: v });
797
896
  }
798
897
  }
799
- )))));
898
+ ))));
800
899
  };
801
900
 
802
901
  // src/components/interaction-settings.tsx
@@ -911,7 +1010,7 @@ var MAX_NUMBER_OF_INTERACTIONS = 5;
911
1010
  function InteractionsList(props) {
912
1011
  const { interactions, onSelectInteractions, onPlayInteraction, triggerCreateOnShowEmpty } = props;
913
1012
  const { elementId } = useInteractionsContext();
914
- const hasInitializedRef = useRef3(false);
1013
+ const hasInitializedRef = useRef2(false);
915
1014
  const handleUpdateInteractions = useCallback5(
916
1015
  (newInteractions) => {
917
1016
  onSelectInteractions(newInteractions);
@@ -931,7 +1030,7 @@ function InteractionsList(props) {
931
1030
  const isMaxNumberOfInteractionsReached = useMemo3(() => {
932
1031
  return interactions.items?.length >= MAX_NUMBER_OF_INTERACTIONS;
933
1032
  }, [interactions.items?.length]);
934
- 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(Box2, { component: "span" }, __5(
1033
+ 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(
935
1034
  "You've reached the limit of 5 interactions for this element. Please remove an interaction before creating a new one.",
936
1035
  "elementor"
937
1036
  ))) : void 0;
@@ -1146,6 +1245,9 @@ var documentElementsInteractionsProvider = createInteractionsProvider({
1146
1245
  }
1147
1246
  });
1148
1247
 
1248
+ // src/init.ts
1249
+ import { getMCPByDomain } from "@elementor/editor-mcp";
1250
+
1149
1251
  // src/commands/paste-interactions.ts
1150
1252
  import {
1151
1253
  getContainer,
@@ -1299,7 +1401,7 @@ import { __ as __10 } from "@wordpress/i18n";
1299
1401
 
1300
1402
  // src/ui/promotion-select.tsx
1301
1403
  import * as React14 from "react";
1302
- import { useRef as useRef4 } from "react";
1404
+ import { useRef as useRef3 } from "react";
1303
1405
  import { MenuListItem } from "@elementor/editor-ui";
1304
1406
  import { MenuSubheader, Select } from "@elementor/ui";
1305
1407
  import { __ as __9 } from "@wordpress/i18n";
@@ -1309,7 +1411,7 @@ import * as React13 from "react";
1309
1411
  import { forwardRef, useCallback as useCallback7, useImperativeHandle, useState as useState5 } from "react";
1310
1412
  import { trackUpgradePromotionClick, trackViewPromotion } from "@elementor/editor-controls";
1311
1413
  import { PromotionChip, PromotionPopover, useCanvasClickHandler } from "@elementor/editor-ui";
1312
- import { Box as Box3 } from "@elementor/ui";
1414
+ import { Box as Box2 } from "@elementor/ui";
1313
1415
  import { __ as __8 } from "@wordpress/i18n";
1314
1416
  var InteractionsPromotionChip = forwardRef(
1315
1417
  ({ content, upgradeUrl, anchorRef, trackingData }, ref) => {
@@ -1345,7 +1447,7 @@ var InteractionsPromotionChip = forwardRef(
1345
1447
  onCtaClick: () => trackUpgradePromotionClick(trackingData)
1346
1448
  },
1347
1449
  /* @__PURE__ */ React13.createElement(
1348
- Box3,
1450
+ Box2,
1349
1451
  {
1350
1452
  onMouseDown: (e) => e.stopPropagation(),
1351
1453
  onClick: handleToggle,
@@ -1356,7 +1458,6 @@ var InteractionsPromotionChip = forwardRef(
1356
1458
  );
1357
1459
  }
1358
1460
  );
1359
- InteractionsPromotionChip.displayName = "InteractionsPromotionChip";
1360
1461
 
1361
1462
  // src/ui/promotion-select.tsx
1362
1463
  function PromotionSelect({
@@ -1369,8 +1470,8 @@ function PromotionSelect({
1369
1470
  upgradeUrl,
1370
1471
  trackingData
1371
1472
  }) {
1372
- const promotionRef = useRef4(null);
1373
- const anchorRef = useRef4(null);
1473
+ const promotionRef = useRef3(null);
1474
+ const anchorRef = useRef3(null);
1374
1475
  return /* @__PURE__ */ React14.createElement(
1375
1476
  Select,
1376
1477
  {
@@ -1504,58 +1605,128 @@ function EffectType({ value, onChange }) {
1504
1605
  return /* @__PURE__ */ React17.createElement(ToggleButtonGroupUi2, { items: options, exclusive: true, onChange, value });
1505
1606
  }
1506
1607
 
1507
- // src/components/controls/replay.tsx
1508
- import * as React18 from "react";
1608
+ // src/components/controls/repeat.tsx
1609
+ import * as React19 from "react";
1610
+ import { useRef as useRef4 } from "react";
1509
1611
  import { ToggleButtonGroupUi as ToggleButtonGroupUi3 } from "@elementor/editor-controls";
1510
- import { CheckIcon, MinusIcon } from "@elementor/icons";
1511
- import { Box as Box4 } from "@elementor/ui";
1612
+ import { Number123Icon, RepeatIcon } from "@elementor/icons";
1512
1613
  import { __ as __13 } from "@wordpress/i18n";
1513
- var TRACKING_DATA3 = { target_name: "interactions_replay", location_l2: "interactions" };
1614
+
1615
+ // src/ui/promotion-overlay-layout.tsx
1616
+ import * as React18 from "react";
1617
+ import { forwardRef as forwardRef2 } from "react";
1618
+ import { Box as Box3 } from "@elementor/ui";
1619
+ var OVERLAY_GRID = "1 / 1";
1620
+ var CHIP_OFFSET = "50%";
1621
+ var PromotionOverlayLayout = forwardRef2(
1622
+ ({ children, promotionChip }, ref) => /* @__PURE__ */ React18.createElement(Box3, { ref, sx: { display: "grid", alignItems: "center" } }, /* @__PURE__ */ React18.createElement(Box3, { sx: { gridArea: OVERLAY_GRID } }, children), /* @__PURE__ */ React18.createElement(Box3, { sx: { gridArea: OVERLAY_GRID, marginInlineEnd: CHIP_OFFSET, justifySelf: "end" } }, promotionChip))
1623
+ );
1624
+
1625
+ // src/components/controls/repeat.tsx
1626
+ var TRACKING_DATA3 = { target_name: "interactions_repeat", location_l2: "interactions" };
1627
+ var REPEAT_OPTIONS = {
1628
+ times: __13("times", "elementor"),
1629
+ loop: __13("loop", "elementor")
1630
+ };
1631
+ var REPEAT_TOOLTIPS = {
1632
+ times: __13("Enable number", "elementor"),
1633
+ loop: __13("Infinite repeat", "elementor")
1634
+ };
1635
+ function Repeat() {
1636
+ const repeatContainerRef = useRef4(null);
1637
+ const options = [
1638
+ {
1639
+ value: REPEAT_OPTIONS.times,
1640
+ disabled: true,
1641
+ label: REPEAT_TOOLTIPS.times,
1642
+ renderContent: ({ size }) => /* @__PURE__ */ React19.createElement(Number123Icon, { fontSize: size }),
1643
+ showTooltip: true
1644
+ },
1645
+ {
1646
+ value: REPEAT_OPTIONS.loop,
1647
+ disabled: true,
1648
+ label: REPEAT_TOOLTIPS.loop,
1649
+ renderContent: ({ size }) => /* @__PURE__ */ React19.createElement(RepeatIcon, { fontSize: size }),
1650
+ showTooltip: true
1651
+ }
1652
+ ];
1653
+ return /* @__PURE__ */ React19.createElement(
1654
+ PromotionOverlayLayout,
1655
+ {
1656
+ ref: repeatContainerRef,
1657
+ promotionChip: /* @__PURE__ */ React19.createElement(
1658
+ InteractionsPromotionChip,
1659
+ {
1660
+ content: __13("Upgrade to control how many times the animation repeats.", "elementor"),
1661
+ upgradeUrl: "https://go.elementor.com/go-pro-interactions-repeat-modal/",
1662
+ anchorRef: repeatContainerRef,
1663
+ trackingData: TRACKING_DATA3
1664
+ }
1665
+ )
1666
+ },
1667
+ /* @__PURE__ */ React19.createElement(ToggleButtonGroupUi3, { items: options, exclusive: true, onChange: () => {
1668
+ }, value: "" })
1669
+ );
1670
+ }
1671
+
1672
+ // src/components/controls/replay.tsx
1673
+ import * as React20 from "react";
1674
+ import { useRef as useRef5 } from "react";
1675
+ import { ToggleButtonGroupUi as ToggleButtonGroupUi4 } from "@elementor/editor-controls";
1676
+ import { CheckIcon, MinusIcon } from "@elementor/icons";
1677
+ import { __ as __14 } from "@wordpress/i18n";
1678
+ var TRACKING_DATA4 = { target_name: "interactions_replay", location_l2: "interactions" };
1514
1679
  var REPLAY_OPTIONS = {
1515
- no: __13("No", "elementor"),
1516
- yes: __13("Yes", "elementor")
1680
+ no: __14("No", "elementor"),
1681
+ yes: __14("Yes", "elementor")
1517
1682
  };
1518
1683
  var BASE_REPLAY = ["no"];
1519
- var OVERLAY_GRID = "1 / 1";
1520
- var CHIP_OFFSET = "50%";
1521
- function Replay({ onChange, anchorRef }) {
1684
+ function Replay({ onChange }) {
1685
+ const replayContainerRef = useRef5(null);
1522
1686
  const options = [
1523
1687
  {
1524
1688
  value: false,
1525
1689
  disabled: false,
1526
1690
  label: REPLAY_OPTIONS.no,
1527
- renderContent: ({ size }) => /* @__PURE__ */ React18.createElement(MinusIcon, { fontSize: size }),
1691
+ renderContent: ({ size }) => /* @__PURE__ */ React20.createElement(MinusIcon, { fontSize: size }),
1528
1692
  showTooltip: true
1529
1693
  },
1530
1694
  {
1531
1695
  value: true,
1532
1696
  disabled: true,
1533
1697
  label: REPLAY_OPTIONS.yes,
1534
- renderContent: ({ size }) => /* @__PURE__ */ React18.createElement(CheckIcon, { fontSize: size }),
1698
+ renderContent: ({ size }) => /* @__PURE__ */ React20.createElement(CheckIcon, { fontSize: size }),
1535
1699
  showTooltip: true
1536
1700
  }
1537
1701
  ];
1538
- return /* @__PURE__ */ React18.createElement(Box4, { sx: { display: "grid", alignItems: "center" } }, /* @__PURE__ */ React18.createElement(Box4, { sx: { gridArea: OVERLAY_GRID } }, /* @__PURE__ */ React18.createElement(ToggleButtonGroupUi3, { items: options, exclusive: true, onChange, value: false })), /* @__PURE__ */ React18.createElement(Box4, { sx: { gridArea: OVERLAY_GRID, marginInlineEnd: CHIP_OFFSET, justifySelf: "end" } }, /* @__PURE__ */ React18.createElement(
1539
- InteractionsPromotionChip,
1702
+ return /* @__PURE__ */ React20.createElement(
1703
+ PromotionOverlayLayout,
1540
1704
  {
1541
- content: __13("Upgrade to run the animation every time its trigger occurs.", "elementor"),
1542
- upgradeUrl: "https://go.elementor.com/go-pro-interactions-replay-modal/",
1543
- anchorRef,
1544
- trackingData: TRACKING_DATA3
1545
- }
1546
- )));
1705
+ ref: replayContainerRef,
1706
+ promotionChip: /* @__PURE__ */ React20.createElement(
1707
+ InteractionsPromotionChip,
1708
+ {
1709
+ content: __14("Upgrade to run the animation every time its trigger occurs.", "elementor"),
1710
+ upgradeUrl: "https://go.elementor.com/go-pro-interactions-replay-modal/",
1711
+ anchorRef: replayContainerRef,
1712
+ trackingData: TRACKING_DATA4
1713
+ }
1714
+ )
1715
+ },
1716
+ /* @__PURE__ */ React20.createElement(ToggleButtonGroupUi4, { items: options, exclusive: true, onChange, value: false })
1717
+ );
1547
1718
  }
1548
1719
 
1549
1720
  // src/components/controls/trigger.tsx
1550
- import * as React19 from "react";
1551
- import { __ as __14 } from "@wordpress/i18n";
1552
- var TRACKING_DATA4 = { target_name: "interactions_trigger", location_l2: "interactions" };
1721
+ import * as React21 from "react";
1722
+ import { __ as __15 } from "@wordpress/i18n";
1723
+ var TRACKING_DATA5 = { target_name: "interactions_trigger", location_l2: "interactions" };
1553
1724
  var TRIGGER_OPTIONS = {
1554
- load: __14("Page load", "elementor"),
1555
- scrollIn: __14("Scroll into view", "elementor"),
1556
- scrollOn: __14("While scrolling", "elementor"),
1557
- hover: __14("On hover", "elementor"),
1558
- click: __14("On click", "elementor")
1725
+ load: __15("Page load", "elementor"),
1726
+ scrollIn: __15("Scroll into view", "elementor"),
1727
+ scrollOn: __15("While scrolling", "elementor"),
1728
+ hover: __15("On hover", "elementor"),
1729
+ click: __15("On click", "elementor")
1559
1730
  };
1560
1731
  var BASE_TRIGGERS = ["load", "scrollIn"];
1561
1732
  function Trigger({ value, onChange }) {
@@ -1565,17 +1736,17 @@ function Trigger({ value, onChange }) {
1565
1736
  const disabledOptions = Object.fromEntries(
1566
1737
  Object.entries(TRIGGER_OPTIONS).filter(([key]) => !BASE_TRIGGERS.includes(key))
1567
1738
  );
1568
- return /* @__PURE__ */ React19.createElement(
1739
+ return /* @__PURE__ */ React21.createElement(
1569
1740
  PromotionSelect,
1570
1741
  {
1571
1742
  value: value in baseOptions ? value : DEFAULT_VALUES.trigger,
1572
1743
  onChange,
1573
1744
  baseOptions,
1574
1745
  disabledOptions,
1575
- promotionLabel: __14("PRO triggers", "elementor"),
1576
- promotionContent: __14("Upgrade to unlock more interactions triggers.", "elementor"),
1746
+ promotionLabel: __15("PRO triggers", "elementor"),
1747
+ promotionContent: __15("Upgrade to unlock more interactions triggers.", "elementor"),
1577
1748
  upgradeUrl: "https://go.elementor.com/go-pro-interactions-triggers-modal/",
1578
- trackingData: TRACKING_DATA4
1749
+ trackingData: TRACKING_DATA5
1579
1750
  }
1580
1751
  );
1581
1752
  }
@@ -1618,12 +1789,6 @@ function cleanInteractionIds(elementId) {
1618
1789
  container.model.set("interactions", updatedInteractions);
1619
1790
  }
1620
1791
 
1621
- // src/mcp/index.ts
1622
- import { getMCPByDomain } from "@elementor/editor-mcp";
1623
-
1624
- // src/mcp/constants.ts
1625
- var MAX_INTERACTIONS_PER_ELEMENT = 5;
1626
-
1627
1792
  // src/mcp/resources/interactions-schema-resource.ts
1628
1793
  import { isProActive } from "@elementor/utils";
1629
1794
 
@@ -1644,7 +1809,7 @@ var baseSchema = {
1644
1809
  var proSchema = {
1645
1810
  trigger: z.enum(["load", "scrollIn", "scrollOut", "scrollOn", "hover", "click"]).optional().describe("Event that triggers the animation"),
1646
1811
  effect: z.enum(["fade", "slide", "scale", "custom"]).optional().describe("Animation effect type"),
1647
- customEffect: z.object({
1812
+ customEffects: z.object({
1648
1813
  keyframes: z.array(
1649
1814
  z.object({
1650
1815
  stop: z.number().describe("The stop of the keyframe in percent, can be either 0 or 100"),
@@ -1703,6 +1868,69 @@ var initInteractionsSchemaResource = (reg) => {
1703
1868
  import { updateElementInteractions as updateElementInteractions3 } from "@elementor/editor-elements";
1704
1869
  import { z as z2 } from "@elementor/schema";
1705
1870
  import { isProActive as isProActive2 } from "@elementor/utils";
1871
+
1872
+ // src/mcp/constants.ts
1873
+ var MAX_INTERACTIONS_PER_ELEMENT = 5;
1874
+ var EDITOR_INTERACTIONS_MCP_INSTRUCTIONS = `MCP server for managing element interactions and animations. Use this to add, modify, or remove animations and motion effects triggered by user events such as page load or scroll-into-view.
1875
+ ** IMPORTANT **
1876
+ Use the "interactions-schema" resource to get the schema of the interactions.
1877
+ Actions:
1878
+ - get: Read the current interactions on the element.
1879
+ - add: Add a new interaction (max ${MAX_INTERACTIONS_PER_ELEMENT} per element).
1880
+ - update: Update an existing interaction by its interactionId.
1881
+ - delete: Remove a specific interaction by its interactionId.
1882
+ - clear: Remove all interactions from the element.
1883
+
1884
+ For add/update, provide: trigger, effect, effectType, direction (required for slide effect), duration, delay, easing.
1885
+ Use excludedBreakpoints to disable the animation on specific responsive breakpoints (e.g. ["mobile", "tablet"]).
1886
+ Example Get Request:
1887
+ {
1888
+ "elementId": "123",
1889
+ "action": "get",
1890
+ "interactionId": "123",
1891
+ "animationData": {
1892
+ "trigger": "click",
1893
+ "effect": "fade",
1894
+ }
1895
+ }
1896
+ Example Add Request:
1897
+ {
1898
+ "elementId": "123",
1899
+ "action": "add",
1900
+ "animationData": {
1901
+ "effectType": "in",
1902
+ "direction": "top",
1903
+ "trigger": "click",
1904
+ "effect": "fade",
1905
+ "duration": 1000,
1906
+ "delay": 0,
1907
+ "easing": "easeIn",
1908
+ "excludedBreakpoints": ["mobile", "tablet"],
1909
+ }
1910
+ }
1911
+ Example Update Request:
1912
+ {
1913
+ "elementId": "123",
1914
+ "action": "update",
1915
+ "interactionId": "123",
1916
+ "animationData": {
1917
+ "trigger": "click",
1918
+ "effect": "fade",
1919
+ }
1920
+ }
1921
+ Example Delete Request:
1922
+ {
1923
+ "elementId": "123",
1924
+ "action": "delete",
1925
+ "interactionId": "123",
1926
+ }
1927
+ Example Clear Request:
1928
+ {
1929
+ "elementId": "123",
1930
+ "action": "clear",
1931
+ }`;
1932
+
1933
+ // src/mcp/tools/manage-element-interaction-tool.ts
1706
1934
  var EMPTY_INTERACTIONS = {
1707
1935
  version: 1,
1708
1936
  items: []
@@ -1848,73 +2076,18 @@ var initManageElementInteractionTool = (reg) => {
1848
2076
  };
1849
2077
 
1850
2078
  // src/mcp/index.ts
1851
- var initMcpInteractions = () => {
1852
- const reg = getMCPByDomain("interactions", {
1853
- instructions: `
1854
- MCP server for managing element interactions and animations. Use this to add, modify, or remove animations and motion effects triggered by user events such as page load or scroll-into-view.
1855
- ** IMPORTANT **
1856
- Use the "interactions-schema" resource to get the schema of the interactions.
1857
- Actions:
1858
- - get: Read the current interactions on the element.
1859
- - add: Add a new interaction (max ${MAX_INTERACTIONS_PER_ELEMENT} per element).
1860
- - update: Update an existing interaction by its interactionId.
1861
- - delete: Remove a specific interaction by its interactionId.
1862
- - clear: Remove all interactions from the element.
1863
-
1864
- For add/update, provide: trigger, effect, effectType, direction (required for slide effect), duration, delay, easing.
1865
- Use excludedBreakpoints to disable the animation on specific responsive breakpoints (e.g. ["mobile", "tablet"]).
1866
- Example Get Request:
1867
- {
1868
- "elementId": "123",
1869
- "action": "get",
1870
- "interactionId": "123",
1871
- "animationData": {
1872
- "trigger": "click",
1873
- "effect": "fade",
1874
- }
1875
- }
1876
- Example Add Request:
1877
- {
1878
- "elementId": "123",
1879
- "action": "add",
1880
- "animationData": {
1881
- "effectType": "in",
1882
- "direction": "top",
1883
- "trigger": "click",
1884
- "effect": "fade",
1885
- "duration": 1000,
1886
- "delay": 0,
1887
- "easing": "easeIn",
1888
- "excludedBreakpoints": ["mobile", "tablet"],
1889
- }
1890
- }
1891
- Example Update Request:
1892
- {
1893
- "elementId": "123",
1894
- "action": "update",
1895
- "interactionId": "123",
1896
- "animationData": {
1897
- "trigger": "click",
1898
- "effect": "fade",
1899
- }
1900
- }
1901
- Example Delete Request:
1902
- {
1903
- "elementId": "123",
1904
- "action": "delete",
1905
- "interactionId": "123",
1906
- }
1907
- Example Clear Request:
1908
- {
1909
- "elementId": "123",
1910
- "action": "clear",
1911
- }
1912
- `
1913
- });
1914
- reg.waitForReady().then(() => {
1915
- initInteractionsSchemaResource(reg);
1916
- initManageElementInteractionTool(reg);
1917
- });
2079
+ var initMcpInteractions = (reg) => {
2080
+ const { setMCPDescription } = reg;
2081
+ setMCPDescription(
2082
+ `Everything related to V4 ( Atomic ) interactions.
2083
+ # Interactions
2084
+ - Create/update/delete interactions
2085
+ - Get list of interactions
2086
+ - Get details of an interaction
2087
+ `
2088
+ );
2089
+ initInteractionsSchemaResource(reg);
2090
+ initManageElementInteractionTool(reg);
1918
2091
  };
1919
2092
 
1920
2093
  // src/init.ts
@@ -1953,7 +2126,11 @@ function init() {
1953
2126
  component: Effect,
1954
2127
  options: ["fade", "slide", "scale"]
1955
2128
  });
1956
- initMcpInteractions();
2129
+ registerInteractionsControl({
2130
+ type: "repeat",
2131
+ component: Repeat
2132
+ });
2133
+ initMcpInteractions(getMCPByDomain("interactions", { instructions: EDITOR_INTERACTIONS_MCP_INSTRUCTIONS }));
1957
2134
  } catch (error) {
1958
2135
  throw error;
1959
2136
  }
@@ -1968,6 +2145,8 @@ export {
1968
2145
  ELEMENTS_INTERACTIONS_PROVIDER_KEY_PREFIX,
1969
2146
  EmptyState,
1970
2147
  InteractionsTab,
2148
+ REPEAT_OPTIONS,
2149
+ REPEAT_TOOLTIPS,
1971
2150
  REPLAY_OPTIONS,
1972
2151
  TRIGGER_OPTIONS,
1973
2152
  buildDisplayLabel,