@elementor/editor-interactions 4.0.0-635 → 4.0.0-637

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.0.0-635",
3
+ "version": "4.0.0-637",
4
4
  "private": false,
5
5
  "author": "Elementor Team",
6
6
  "homepage": "https://elementor.com/",
@@ -39,18 +39,18 @@
39
39
  "dev": "tsup --config=../../tsup.dev.ts"
40
40
  },
41
41
  "dependencies": {
42
- "@elementor/editor-controls": "4.0.0-635",
43
- "@elementor/editor-elements": "4.0.0-635",
44
- "@elementor/editor-mcp": "4.0.0-635",
45
- "@elementor/editor-props": "4.0.0-635",
46
- "@elementor/editor-responsive": "4.0.0-635",
47
- "@elementor/editor-ui": "4.0.0-635",
48
- "@elementor/editor-v1-adapters": "4.0.0-635",
42
+ "@elementor/editor-controls": "4.0.0-637",
43
+ "@elementor/editor-elements": "4.0.0-637",
44
+ "@elementor/editor-mcp": "4.0.0-637",
45
+ "@elementor/editor-props": "4.0.0-637",
46
+ "@elementor/editor-responsive": "4.0.0-637",
47
+ "@elementor/editor-ui": "4.0.0-637",
48
+ "@elementor/editor-v1-adapters": "4.0.0-637",
49
49
  "@elementor/icons": "^1.68.0",
50
- "@elementor/schema": "4.0.0-635",
51
- "@elementor/session": "4.0.0-635",
50
+ "@elementor/schema": "4.0.0-637",
51
+ "@elementor/session": "4.0.0-637",
52
52
  "@elementor/ui": "1.36.17",
53
- "@elementor/utils": "4.0.0-635",
53
+ "@elementor/utils": "4.0.0-637",
54
54
  "@wordpress/i18n": "^5.13.0"
55
55
  },
56
56
  "peerDependencies": {
package/src/index.ts CHANGED
@@ -16,3 +16,27 @@ export { TRIGGER_OPTIONS, BASE_TRIGGERS } from './components/controls/trigger';
16
16
  export { EASING_OPTIONS, BASE_EASINGS } from './components/controls/easing';
17
17
  export { REPLAY_OPTIONS, BASE_REPLAY } from './components/controls/replay';
18
18
  export { EFFECT_OPTIONS, BASE_EFFECTS } from './components/controls/effect';
19
+
20
+ export {
21
+ createString,
22
+ createNumber,
23
+ createBoolean,
24
+ createTimingConfig,
25
+ createConfig,
26
+ createExcludedBreakpoints,
27
+ createInteractionBreakpoints,
28
+ createAnimationPreset,
29
+ createInteractionItem,
30
+ createDefaultInteractionItem,
31
+ createDefaultInteractions,
32
+ extractString,
33
+ extractBoolean,
34
+ extractSize,
35
+ extractExcludedBreakpoints,
36
+ buildDisplayLabel,
37
+ } from './utils/prop-value-utils';
38
+
39
+ export { generateTempInteractionId, isTempId } from './utils/temp-id-utils';
40
+ export { resolveDirection } from './utils/resolve-direction';
41
+ export { convertTimeUnit } from './utils/time-conversion';
42
+ export { parseSizeValue, formatSizeValue } from './utils/size-transform-utils';
@@ -5,7 +5,12 @@ import { isProActive } from '@elementor/utils';
5
5
 
6
6
  import { interactionsRepository } from '../../interactions-repository';
7
7
  import { type ElementInteractions } from '../../types';
8
- import { createInteractionItem, extractString } from '../../utils/prop-value-utils';
8
+ import {
9
+ createInteractionItem,
10
+ extractExcludedBreakpoints,
11
+ extractSize,
12
+ extractString,
13
+ } from '../../utils/prop-value-utils';
9
14
  import { generateTempInteractionId } from '../../utils/temp-id-utils';
10
15
  import { MAX_INTERACTIONS_PER_ELEMENT } from '../constants';
11
16
  import { INTERACTIONS_SCHEMA_URI } from '../resources/interactions-schema-resource';
@@ -61,12 +66,31 @@ export const initManageElementInteractionTool = ( reg: MCPRegistryEntry ) => {
61
66
  const currentInteractions: ElementInteractions = elementData?.interactions ?? EMPTY_INTERACTIONS;
62
67
 
63
68
  if ( action === 'get' ) {
69
+ const summary = currentInteractions.items.map( ( item ) => {
70
+ const { value } = item;
71
+ const animValue = value.animation.value;
72
+ const timingValue = animValue.timing_config.value;
73
+ const configValue = animValue.config.value;
74
+
75
+ return {
76
+ id: extractString( value.interaction_id ),
77
+ trigger: extractString( value.trigger ),
78
+ effect: extractString( animValue.effect ),
79
+ effectType: extractString( animValue.type ),
80
+ direction: extractString( animValue.direction ),
81
+ duration: extractSize( timingValue.duration ),
82
+ delay: extractSize( timingValue.delay ),
83
+ easing: extractString( configValue.easing ),
84
+ excludedBreakpoints: extractExcludedBreakpoints( value.breakpoints ),
85
+ };
86
+ } );
87
+
64
88
  return {
65
89
  success: true,
66
90
  elementId,
67
91
  action,
68
- interactions: currentInteractions.items,
69
- count: currentInteractions.items.length,
92
+ interactions: summary,
93
+ count: summary.length,
70
94
  };
71
95
  }
72
96
 
package/src/types.ts CHANGED
@@ -31,7 +31,10 @@ export type InteractionConstants = {
31
31
  defaultDelay: number;
32
32
  slideDistance: number;
33
33
  scaleStart: number;
34
- easing: string;
34
+ defaultEasing: string;
35
+ relativeTo: string;
36
+ start: number;
37
+ end: number;
35
38
  };
36
39
 
37
40
  export type InteractionsConfig = {
@@ -2,11 +2,14 @@ import { type InteractionsConfig } from '../types';
2
2
 
3
3
  const DEFAULT_CONFIG: InteractionsConfig = {
4
4
  constants: {
5
- defaultDuration: 300,
5
+ defaultDuration: 600,
6
6
  defaultDelay: 0,
7
7
  slideDistance: 100,
8
- scaleStart: 0.5,
9
- easing: 'linear',
8
+ scaleStart: 0,
9
+ defaultEasing: 'easeIn',
10
+ relativeTo: 'viewport',
11
+ end: 15,
12
+ start: 85,
10
13
  },
11
14
  };
12
15
 
@@ -17,6 +17,7 @@ import {
17
17
  type TimingConfigPropValue,
18
18
  } from '../types';
19
19
  import { formatSizeValue, parseSizeValue } from '../utils/size-transform-utils';
20
+ import { getInteractionsConfig } from './get-interactions-config';
20
21
  import { generateTempInteractionId } from './temp-id-utils';
21
22
 
22
23
  export const createString = ( value: string ): StringPropValue => ( {
@@ -191,14 +192,15 @@ export const createInteractionItem = ( {
191
192
  } );
192
193
 
193
194
  export const createDefaultInteractionItem = (): InteractionItemPropValue => {
195
+ const { constants } = getInteractionsConfig();
194
196
  return createInteractionItem( {
195
197
  trigger: 'load',
196
198
  effect: 'fade',
197
199
  type: 'in',
198
- duration: 600,
199
- delay: 0,
200
+ duration: constants.defaultDuration,
201
+ delay: constants.defaultDelay,
200
202
  replay: false,
201
- easing: 'easeIn',
203
+ easing: constants.defaultEasing,
202
204
  interactionId: generateTempInteractionId(),
203
205
  } );
204
206
  };