@elementor/editor-interactions 4.1.0-721 → 4.1.0-722
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.js +79 -74
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +79 -74
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -12
- package/src/init.ts +4 -2
- package/src/mcp/constants.ts +58 -0
- package/src/mcp/index.ts +15 -69
package/dist/index.mjs
CHANGED
|
@@ -1245,6 +1245,9 @@ var documentElementsInteractionsProvider = createInteractionsProvider({
|
|
|
1245
1245
|
}
|
|
1246
1246
|
});
|
|
1247
1247
|
|
|
1248
|
+
// src/init.ts
|
|
1249
|
+
import { getMCPByDomain } from "@elementor/editor-mcp";
|
|
1250
|
+
|
|
1248
1251
|
// src/commands/paste-interactions.ts
|
|
1249
1252
|
import {
|
|
1250
1253
|
getContainer,
|
|
@@ -1839,12 +1842,6 @@ function cleanInteractionIds(elementId) {
|
|
|
1839
1842
|
container.model.set("interactions", updatedInteractions);
|
|
1840
1843
|
}
|
|
1841
1844
|
|
|
1842
|
-
// src/mcp/index.ts
|
|
1843
|
-
import { getMCPByDomain } from "@elementor/editor-mcp";
|
|
1844
|
-
|
|
1845
|
-
// src/mcp/constants.ts
|
|
1846
|
-
var MAX_INTERACTIONS_PER_ELEMENT = 5;
|
|
1847
|
-
|
|
1848
1845
|
// src/mcp/resources/interactions-schema-resource.ts
|
|
1849
1846
|
import { isProActive } from "@elementor/utils";
|
|
1850
1847
|
|
|
@@ -1926,6 +1923,69 @@ var initInteractionsSchemaResource = (reg) => {
|
|
|
1926
1923
|
import { updateElementInteractions as updateElementInteractions3 } from "@elementor/editor-elements";
|
|
1927
1924
|
import { z as z2 } from "@elementor/schema";
|
|
1928
1925
|
import { isProActive as isProActive2 } from "@elementor/utils";
|
|
1926
|
+
|
|
1927
|
+
// src/mcp/constants.ts
|
|
1928
|
+
var MAX_INTERACTIONS_PER_ELEMENT = 5;
|
|
1929
|
+
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.
|
|
1930
|
+
** IMPORTANT **
|
|
1931
|
+
Use the "interactions-schema" resource to get the schema of the interactions.
|
|
1932
|
+
Actions:
|
|
1933
|
+
- get: Read the current interactions on the element.
|
|
1934
|
+
- add: Add a new interaction (max ${MAX_INTERACTIONS_PER_ELEMENT} per element).
|
|
1935
|
+
- update: Update an existing interaction by its interactionId.
|
|
1936
|
+
- delete: Remove a specific interaction by its interactionId.
|
|
1937
|
+
- clear: Remove all interactions from the element.
|
|
1938
|
+
|
|
1939
|
+
For add/update, provide: trigger, effect, effectType, direction (required for slide effect), duration, delay, easing.
|
|
1940
|
+
Use excludedBreakpoints to disable the animation on specific responsive breakpoints (e.g. ["mobile", "tablet"]).
|
|
1941
|
+
Example Get Request:
|
|
1942
|
+
{
|
|
1943
|
+
"elementId": "123",
|
|
1944
|
+
"action": "get",
|
|
1945
|
+
"interactionId": "123",
|
|
1946
|
+
"animationData": {
|
|
1947
|
+
"trigger": "click",
|
|
1948
|
+
"effect": "fade",
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
Example Add Request:
|
|
1952
|
+
{
|
|
1953
|
+
"elementId": "123",
|
|
1954
|
+
"action": "add",
|
|
1955
|
+
"animationData": {
|
|
1956
|
+
"effectType": "in",
|
|
1957
|
+
"direction": "top",
|
|
1958
|
+
"trigger": "click",
|
|
1959
|
+
"effect": "fade",
|
|
1960
|
+
"duration": 1000,
|
|
1961
|
+
"delay": 0,
|
|
1962
|
+
"easing": "easeIn",
|
|
1963
|
+
"excludedBreakpoints": ["mobile", "tablet"],
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
Example Update Request:
|
|
1967
|
+
{
|
|
1968
|
+
"elementId": "123",
|
|
1969
|
+
"action": "update",
|
|
1970
|
+
"interactionId": "123",
|
|
1971
|
+
"animationData": {
|
|
1972
|
+
"trigger": "click",
|
|
1973
|
+
"effect": "fade",
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
Example Delete Request:
|
|
1977
|
+
{
|
|
1978
|
+
"elementId": "123",
|
|
1979
|
+
"action": "delete",
|
|
1980
|
+
"interactionId": "123",
|
|
1981
|
+
}
|
|
1982
|
+
Example Clear Request:
|
|
1983
|
+
{
|
|
1984
|
+
"elementId": "123",
|
|
1985
|
+
"action": "clear",
|
|
1986
|
+
}`;
|
|
1987
|
+
|
|
1988
|
+
// src/mcp/tools/manage-element-interaction-tool.ts
|
|
1929
1989
|
var EMPTY_INTERACTIONS = {
|
|
1930
1990
|
version: 1,
|
|
1931
1991
|
items: []
|
|
@@ -2071,73 +2131,18 @@ var initManageElementInteractionTool = (reg) => {
|
|
|
2071
2131
|
};
|
|
2072
2132
|
|
|
2073
2133
|
// src/mcp/index.ts
|
|
2074
|
-
var initMcpInteractions = () => {
|
|
2075
|
-
const
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
For add/update, provide: trigger, effect, effectType, direction (required for slide effect), duration, delay, easing.
|
|
2088
|
-
Use excludedBreakpoints to disable the animation on specific responsive breakpoints (e.g. ["mobile", "tablet"]).
|
|
2089
|
-
Example Get Request:
|
|
2090
|
-
{
|
|
2091
|
-
"elementId": "123",
|
|
2092
|
-
"action": "get",
|
|
2093
|
-
"interactionId": "123",
|
|
2094
|
-
"animationData": {
|
|
2095
|
-
"trigger": "click",
|
|
2096
|
-
"effect": "fade",
|
|
2097
|
-
}
|
|
2098
|
-
}
|
|
2099
|
-
Example Add Request:
|
|
2100
|
-
{
|
|
2101
|
-
"elementId": "123",
|
|
2102
|
-
"action": "add",
|
|
2103
|
-
"animationData": {
|
|
2104
|
-
"effectType": "in",
|
|
2105
|
-
"direction": "top",
|
|
2106
|
-
"trigger": "click",
|
|
2107
|
-
"effect": "fade",
|
|
2108
|
-
"duration": 1000,
|
|
2109
|
-
"delay": 0,
|
|
2110
|
-
"easing": "easeIn",
|
|
2111
|
-
"excludedBreakpoints": ["mobile", "tablet"],
|
|
2112
|
-
}
|
|
2113
|
-
}
|
|
2114
|
-
Example Update Request:
|
|
2115
|
-
{
|
|
2116
|
-
"elementId": "123",
|
|
2117
|
-
"action": "update",
|
|
2118
|
-
"interactionId": "123",
|
|
2119
|
-
"animationData": {
|
|
2120
|
-
"trigger": "click",
|
|
2121
|
-
"effect": "fade",
|
|
2122
|
-
}
|
|
2123
|
-
}
|
|
2124
|
-
Example Delete Request:
|
|
2125
|
-
{
|
|
2126
|
-
"elementId": "123",
|
|
2127
|
-
"action": "delete",
|
|
2128
|
-
"interactionId": "123",
|
|
2129
|
-
}
|
|
2130
|
-
Example Clear Request:
|
|
2131
|
-
{
|
|
2132
|
-
"elementId": "123",
|
|
2133
|
-
"action": "clear",
|
|
2134
|
-
}
|
|
2135
|
-
`
|
|
2136
|
-
});
|
|
2137
|
-
reg.waitForReady().then(() => {
|
|
2138
|
-
initInteractionsSchemaResource(reg);
|
|
2139
|
-
initManageElementInteractionTool(reg);
|
|
2140
|
-
});
|
|
2134
|
+
var initMcpInteractions = (reg) => {
|
|
2135
|
+
const { setMCPDescription } = reg;
|
|
2136
|
+
setMCPDescription(
|
|
2137
|
+
`Everything related to V4 ( Atomic ) interactions.
|
|
2138
|
+
# Interactions
|
|
2139
|
+
- Create/update/delete interactions
|
|
2140
|
+
- Get list of interactions
|
|
2141
|
+
- Get details of an interaction
|
|
2142
|
+
`
|
|
2143
|
+
);
|
|
2144
|
+
initInteractionsSchemaResource(reg);
|
|
2145
|
+
initManageElementInteractionTool(reg);
|
|
2141
2146
|
};
|
|
2142
2147
|
|
|
2143
2148
|
// src/init.ts
|
|
@@ -2180,7 +2185,7 @@ function init() {
|
|
|
2180
2185
|
type: "repeat",
|
|
2181
2186
|
component: Repeat
|
|
2182
2187
|
});
|
|
2183
|
-
initMcpInteractions();
|
|
2188
|
+
initMcpInteractions(getMCPByDomain("interactions", { instructions: EDITOR_INTERACTIONS_MCP_INSTRUCTIONS }));
|
|
2184
2189
|
} catch (error) {
|
|
2185
2190
|
throw error;
|
|
2186
2191
|
}
|