@elementor/editor-interactions 4.1.0-732 → 4.1.0-734

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
@@ -589,11 +589,26 @@ function useInteractionItemContext() {
589
589
  return context;
590
590
  }
591
591
 
592
- // src/components/interactions-list-item.tsx
593
- import * as React9 from "react";
594
- import { useCallback as useCallback4 } from "react";
595
- import { Divider as Divider2, Tab, TabPanel, Tabs, useTabs } from "@elementor/ui";
596
- import { __ as __4 } from "@wordpress/i18n";
592
+ // src/utils/scroll-interaction-event.ts
593
+ var SCROLL_INTERACTION_EVENT = "elementor/interactions/scroll-change";
594
+ function dispatchScrollInteraction(data) {
595
+ window.dispatchEvent(new CustomEvent(SCROLL_INTERACTION_EVENT, { detail: data }));
596
+ }
597
+ function extractScrollOverlayParams(interaction, defaults) {
598
+ return {
599
+ trigger: extractString(interaction.trigger, defaults.trigger),
600
+ start: extractSize(interaction.animation.value.config?.value.start, defaults.start),
601
+ end: extractSize(interaction.animation.value.config?.value.end, defaults.end),
602
+ relativeTo: extractString(interaction.animation.value.config?.value.relativeTo, defaults.relativeTo)
603
+ };
604
+ }
605
+ function syncGridOverlay(trigger, start, end, relativeTo) {
606
+ if (trigger === "scrollOn") {
607
+ dispatchScrollInteraction({ start, end, relativeTo });
608
+ } else {
609
+ dispatchScrollInteraction(null);
610
+ }
611
+ }
597
612
 
598
613
  // src/components/interaction-details.tsx
599
614
  import * as React7 from "react";
@@ -822,6 +837,12 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
822
837
  })
823
838
  };
824
839
  onChange(updatedInteraction);
840
+ syncGridOverlay(
841
+ updates.trigger ?? trigger,
842
+ updates.start ?? start,
843
+ updates.end ?? end,
844
+ updates.relativeTo ?? relativeTo
845
+ );
825
846
  const interactionId = extractString(updatedInteraction.interaction_id);
826
847
  setTimeout(() => {
827
848
  onPlayInteraction(interactionId);
@@ -898,6 +919,12 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
898
919
  ))));
899
920
  };
900
921
 
922
+ // src/components/interactions-list-item.tsx
923
+ import * as React9 from "react";
924
+ import { useCallback as useCallback4 } from "react";
925
+ import { Divider as Divider2, Tab, TabPanel, Tabs, useTabs } from "@elementor/ui";
926
+ import { __ as __4 } from "@wordpress/i18n";
927
+
901
928
  // src/components/interaction-settings.tsx
902
929
  import * as React8 from "react";
903
930
  import { useCallback as useCallback3, useMemo as useMemo2, useState as useState3 } from "react";
@@ -1088,6 +1115,14 @@ function InteractionsList(props) {
1088
1115
  Label: ({ value }) => buildDisplayLabel(value.value),
1089
1116
  Icon: () => null,
1090
1117
  Content: InteractionsListItem,
1118
+ onPopoverOpen: (value) => {
1119
+ const { trigger, start, end, relativeTo } = extractScrollOverlayParams(
1120
+ value.value,
1121
+ DEFAULT_VALUES
1122
+ );
1123
+ syncGridOverlay(trigger, start, end, relativeTo);
1124
+ },
1125
+ onPopoverClose: () => dispatchScrollInteraction(null),
1091
1126
  actions: (value) => /* @__PURE__ */ React10.createElement(Tooltip, { key: "preview", placement: "top", title: __5("Preview", "elementor") }, /* @__PURE__ */ React10.createElement(
1092
1127
  IconButton,
1093
1128
  {
@@ -2204,6 +2239,7 @@ export {
2204
2239
  REPEAT_OPTIONS,
2205
2240
  REPEAT_TOOLTIPS,
2206
2241
  REPLAY_OPTIONS,
2242
+ SCROLL_INTERACTION_EVENT,
2207
2243
  TRIGGER_OPTIONS,
2208
2244
  buildDisplayLabel,
2209
2245
  convertTimeUnit,
@@ -2219,8 +2255,10 @@ export {
2219
2255
  createNumber,
2220
2256
  createString,
2221
2257
  createTimingConfig,
2258
+ dispatchScrollInteraction,
2222
2259
  extractBoolean,
2223
2260
  extractExcludedBreakpoints,
2261
+ extractScrollOverlayParams,
2224
2262
  extractSize,
2225
2263
  extractString,
2226
2264
  formatSizeValue,
@@ -2232,6 +2270,7 @@ export {
2232
2270
  parseSizeValue,
2233
2271
  registerInteractionsControl,
2234
2272
  resolveDirection,
2273
+ syncGridOverlay,
2235
2274
  useElementInteractions
2236
2275
  };
2237
2276
  //# sourceMappingURL=index.mjs.map