@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elementor/editor-interactions",
3
- "version": "4.1.0-732",
3
+ "version": "4.1.0-734",
4
4
  "private": false,
5
5
  "author": "Elementor Team",
6
6
  "homepage": "https://elementor.com/",
@@ -39,19 +39,19 @@
39
39
  "dev": "tsup --config=../../tsup.dev.ts"
40
40
  },
41
41
  "dependencies": {
42
- "@elementor/editor-controls": "4.1.0-732",
43
- "@elementor/editor-elements": "4.1.0-732",
44
- "@elementor/editor-mcp": "4.1.0-732",
45
- "@elementor/editor-props": "4.1.0-732",
46
- "@elementor/editor-responsive": "4.1.0-732",
47
- "@elementor/editor-ui": "4.1.0-732",
48
- "@elementor/editor-v1-adapters": "4.1.0-732",
42
+ "@elementor/editor-controls": "4.1.0-734",
43
+ "@elementor/editor-elements": "4.1.0-734",
44
+ "@elementor/editor-mcp": "4.1.0-734",
45
+ "@elementor/editor-props": "4.1.0-734",
46
+ "@elementor/editor-responsive": "4.1.0-734",
47
+ "@elementor/editor-ui": "4.1.0-734",
48
+ "@elementor/editor-v1-adapters": "4.1.0-734",
49
49
  "@elementor/icons": "^1.68.0",
50
- "@elementor/schema": "4.1.0-732",
51
- "@elementor/session": "4.1.0-732",
50
+ "@elementor/schema": "4.1.0-734",
51
+ "@elementor/session": "4.1.0-734",
52
52
  "@elementor/ui": "1.36.17",
53
- "@elementor/utils": "4.1.0-732",
54
- "@elementor/events": "4.1.0-732",
53
+ "@elementor/utils": "4.1.0-734",
54
+ "@elementor/events": "4.1.0-734",
55
55
  "@wordpress/i18n": "^5.13.0"
56
56
  },
57
57
  "peerDependencies": {
@@ -15,6 +15,7 @@ import {
15
15
  extractString,
16
16
  } from '../utils/prop-value-utils';
17
17
  import { resolveDirection } from '../utils/resolve-direction';
18
+ import { syncGridOverlay } from '../utils/scroll-interaction-event';
18
19
  import { parseSizeValue } from '../utils/size-transform-utils';
19
20
  import { TimeFrameIndicator } from './controls/time-frame-indicator';
20
21
  import { Field } from './field';
@@ -231,6 +232,13 @@ export const InteractionDetails = ( { interaction, onChange, onPlayInteraction }
231
232
 
232
233
  onChange( updatedInteraction );
233
234
 
235
+ syncGridOverlay(
236
+ updates.trigger ?? trigger,
237
+ updates.start ?? start,
238
+ updates.end ?? end,
239
+ updates.relativeTo ?? relativeTo
240
+ );
241
+
234
242
  const interactionId = extractString( updatedInteraction.interaction_id );
235
243
 
236
244
  setTimeout( () => {
@@ -9,7 +9,13 @@ import { useInteractionsContext } from '../contexts/interactions-context';
9
9
  import { InteractionItemContextProvider } from '../contexts/interactions-item-context';
10
10
  import type { ElementInteractions, InteractionItemPropValue, InteractionItemValue } from '../types';
11
11
  import { buildDisplayLabel, createDefaultInteractionItem, extractString } from '../utils/prop-value-utils';
12
+ import {
13
+ dispatchScrollInteraction,
14
+ extractScrollOverlayParams,
15
+ syncGridOverlay,
16
+ } from '../utils/scroll-interaction-event';
12
17
  import { trackInteractionCreated } from '../utils/tracking';
18
+ import { DEFAULT_VALUES } from './interaction-details';
13
19
  import { InteractionsListItem } from './interactions-list-item';
14
20
  export const MAX_NUMBER_OF_INTERACTIONS = 5;
15
21
 
@@ -125,6 +131,14 @@ export function InteractionsList( props: InteractionListProps ) {
125
131
  Label: ( { value }: { value: InteractionItemPropValue } ) => buildDisplayLabel( value.value ),
126
132
  Icon: () => null,
127
133
  Content: InteractionsListItem,
134
+ onPopoverOpen: ( value: InteractionItemPropValue ) => {
135
+ const { trigger, start, end, relativeTo } = extractScrollOverlayParams(
136
+ value.value,
137
+ DEFAULT_VALUES
138
+ );
139
+ syncGridOverlay( trigger, start, end, relativeTo );
140
+ },
141
+ onPopoverClose: () => dispatchScrollInteraction( null ),
128
142
  actions: ( value: InteractionItemPropValue ) => (
129
143
  <Tooltip key="preview" placement="top" title={ __( 'Preview', 'elementor' ) }>
130
144
  <IconButton
package/src/index.ts CHANGED
@@ -43,3 +43,10 @@ export { resolveDirection } from './utils/resolve-direction';
43
43
  export { convertTimeUnit } from './utils/time-conversion';
44
44
  export { parseSizeValue, formatSizeValue } from './utils/size-transform-utils';
45
45
  export { useElementInteractions } from './hooks/use-element-interactions';
46
+ export {
47
+ SCROLL_INTERACTION_EVENT,
48
+ dispatchScrollInteraction,
49
+ syncGridOverlay,
50
+ extractScrollOverlayParams,
51
+ type ActiveScrollInteraction,
52
+ } from './utils/scroll-interaction-event';
@@ -0,0 +1,34 @@
1
+ import { type InteractionItemValue, type SizeStringValue } from '../types';
2
+ import { extractSize, extractString } from './prop-value-utils';
3
+
4
+ export type ActiveScrollInteraction = {
5
+ start: SizeStringValue;
6
+ end: SizeStringValue;
7
+ relativeTo: string;
8
+ };
9
+
10
+ export const SCROLL_INTERACTION_EVENT = 'elementor/interactions/scroll-change';
11
+
12
+ export function dispatchScrollInteraction( data: ActiveScrollInteraction | null ) {
13
+ window.dispatchEvent( new CustomEvent( SCROLL_INTERACTION_EVENT, { detail: data } ) );
14
+ }
15
+
16
+ export function extractScrollOverlayParams(
17
+ interaction: InteractionItemValue,
18
+ defaults: { trigger: string; start: number; end: number; relativeTo: string }
19
+ ) {
20
+ return {
21
+ trigger: extractString( interaction.trigger, defaults.trigger ),
22
+ start: extractSize( interaction.animation.value.config?.value.start, defaults.start ),
23
+ end: extractSize( interaction.animation.value.config?.value.end, defaults.end ),
24
+ relativeTo: extractString( interaction.animation.value.config?.value.relativeTo, defaults.relativeTo ),
25
+ };
26
+ }
27
+
28
+ export function syncGridOverlay( trigger: string, start: SizeStringValue, end: SizeStringValue, relativeTo: string ) {
29
+ if ( trigger === 'scrollOn' ) {
30
+ dispatchScrollInteraction( { start, end, relativeTo } );
31
+ } else {
32
+ dispatchScrollInteraction( null );
33
+ }
34
+ }