@elementor/editor-interactions 4.1.0-721 → 4.1.0-723
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 +80 -75
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +80 -75
- 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/src/utils/resolve-direction.ts +2 -2
package/dist/index.js
CHANGED
|
@@ -682,7 +682,7 @@ var resolveDirection = (hasDirection, newEffect, newDirection, currentDirection,
|
|
|
682
682
|
return "top";
|
|
683
683
|
}
|
|
684
684
|
if (currentEffect === "slide" && hasDirection) {
|
|
685
|
-
return newDirection
|
|
685
|
+
return newDirection || "top";
|
|
686
686
|
}
|
|
687
687
|
if (hasDirection) {
|
|
688
688
|
return newDirection;
|
|
@@ -1319,6 +1319,9 @@ var documentElementsInteractionsProvider = createInteractionsProvider({
|
|
|
1319
1319
|
}
|
|
1320
1320
|
});
|
|
1321
1321
|
|
|
1322
|
+
// src/init.ts
|
|
1323
|
+
var import_editor_mcp = require("@elementor/editor-mcp");
|
|
1324
|
+
|
|
1322
1325
|
// src/commands/paste-interactions.ts
|
|
1323
1326
|
var import_editor_elements5 = require("@elementor/editor-elements");
|
|
1324
1327
|
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
@@ -1903,12 +1906,6 @@ function cleanInteractionIds(elementId) {
|
|
|
1903
1906
|
container.model.set("interactions", updatedInteractions);
|
|
1904
1907
|
}
|
|
1905
1908
|
|
|
1906
|
-
// src/mcp/index.ts
|
|
1907
|
-
var import_editor_mcp = require("@elementor/editor-mcp");
|
|
1908
|
-
|
|
1909
|
-
// src/mcp/constants.ts
|
|
1910
|
-
var MAX_INTERACTIONS_PER_ELEMENT = 5;
|
|
1911
|
-
|
|
1912
1909
|
// src/mcp/resources/interactions-schema-resource.ts
|
|
1913
1910
|
var import_utils = require("@elementor/utils");
|
|
1914
1911
|
|
|
@@ -1990,6 +1987,69 @@ var initInteractionsSchemaResource = (reg) => {
|
|
|
1990
1987
|
var import_editor_elements7 = require("@elementor/editor-elements");
|
|
1991
1988
|
var import_schema3 = require("@elementor/schema");
|
|
1992
1989
|
var import_utils2 = require("@elementor/utils");
|
|
1990
|
+
|
|
1991
|
+
// src/mcp/constants.ts
|
|
1992
|
+
var MAX_INTERACTIONS_PER_ELEMENT = 5;
|
|
1993
|
+
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.
|
|
1994
|
+
** IMPORTANT **
|
|
1995
|
+
Use the "interactions-schema" resource to get the schema of the interactions.
|
|
1996
|
+
Actions:
|
|
1997
|
+
- get: Read the current interactions on the element.
|
|
1998
|
+
- add: Add a new interaction (max ${MAX_INTERACTIONS_PER_ELEMENT} per element).
|
|
1999
|
+
- update: Update an existing interaction by its interactionId.
|
|
2000
|
+
- delete: Remove a specific interaction by its interactionId.
|
|
2001
|
+
- clear: Remove all interactions from the element.
|
|
2002
|
+
|
|
2003
|
+
For add/update, provide: trigger, effect, effectType, direction (required for slide effect), duration, delay, easing.
|
|
2004
|
+
Use excludedBreakpoints to disable the animation on specific responsive breakpoints (e.g. ["mobile", "tablet"]).
|
|
2005
|
+
Example Get Request:
|
|
2006
|
+
{
|
|
2007
|
+
"elementId": "123",
|
|
2008
|
+
"action": "get",
|
|
2009
|
+
"interactionId": "123",
|
|
2010
|
+
"animationData": {
|
|
2011
|
+
"trigger": "click",
|
|
2012
|
+
"effect": "fade",
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
2015
|
+
Example Add Request:
|
|
2016
|
+
{
|
|
2017
|
+
"elementId": "123",
|
|
2018
|
+
"action": "add",
|
|
2019
|
+
"animationData": {
|
|
2020
|
+
"effectType": "in",
|
|
2021
|
+
"direction": "top",
|
|
2022
|
+
"trigger": "click",
|
|
2023
|
+
"effect": "fade",
|
|
2024
|
+
"duration": 1000,
|
|
2025
|
+
"delay": 0,
|
|
2026
|
+
"easing": "easeIn",
|
|
2027
|
+
"excludedBreakpoints": ["mobile", "tablet"],
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
Example Update Request:
|
|
2031
|
+
{
|
|
2032
|
+
"elementId": "123",
|
|
2033
|
+
"action": "update",
|
|
2034
|
+
"interactionId": "123",
|
|
2035
|
+
"animationData": {
|
|
2036
|
+
"trigger": "click",
|
|
2037
|
+
"effect": "fade",
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
Example Delete Request:
|
|
2041
|
+
{
|
|
2042
|
+
"elementId": "123",
|
|
2043
|
+
"action": "delete",
|
|
2044
|
+
"interactionId": "123",
|
|
2045
|
+
}
|
|
2046
|
+
Example Clear Request:
|
|
2047
|
+
{
|
|
2048
|
+
"elementId": "123",
|
|
2049
|
+
"action": "clear",
|
|
2050
|
+
}`;
|
|
2051
|
+
|
|
2052
|
+
// src/mcp/tools/manage-element-interaction-tool.ts
|
|
1993
2053
|
var EMPTY_INTERACTIONS = {
|
|
1994
2054
|
version: 1,
|
|
1995
2055
|
items: []
|
|
@@ -2135,73 +2195,18 @@ var initManageElementInteractionTool = (reg) => {
|
|
|
2135
2195
|
};
|
|
2136
2196
|
|
|
2137
2197
|
// src/mcp/index.ts
|
|
2138
|
-
var initMcpInteractions = () => {
|
|
2139
|
-
const
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
For add/update, provide: trigger, effect, effectType, direction (required for slide effect), duration, delay, easing.
|
|
2152
|
-
Use excludedBreakpoints to disable the animation on specific responsive breakpoints (e.g. ["mobile", "tablet"]).
|
|
2153
|
-
Example Get Request:
|
|
2154
|
-
{
|
|
2155
|
-
"elementId": "123",
|
|
2156
|
-
"action": "get",
|
|
2157
|
-
"interactionId": "123",
|
|
2158
|
-
"animationData": {
|
|
2159
|
-
"trigger": "click",
|
|
2160
|
-
"effect": "fade",
|
|
2161
|
-
}
|
|
2162
|
-
}
|
|
2163
|
-
Example Add Request:
|
|
2164
|
-
{
|
|
2165
|
-
"elementId": "123",
|
|
2166
|
-
"action": "add",
|
|
2167
|
-
"animationData": {
|
|
2168
|
-
"effectType": "in",
|
|
2169
|
-
"direction": "top",
|
|
2170
|
-
"trigger": "click",
|
|
2171
|
-
"effect": "fade",
|
|
2172
|
-
"duration": 1000,
|
|
2173
|
-
"delay": 0,
|
|
2174
|
-
"easing": "easeIn",
|
|
2175
|
-
"excludedBreakpoints": ["mobile", "tablet"],
|
|
2176
|
-
}
|
|
2177
|
-
}
|
|
2178
|
-
Example Update Request:
|
|
2179
|
-
{
|
|
2180
|
-
"elementId": "123",
|
|
2181
|
-
"action": "update",
|
|
2182
|
-
"interactionId": "123",
|
|
2183
|
-
"animationData": {
|
|
2184
|
-
"trigger": "click",
|
|
2185
|
-
"effect": "fade",
|
|
2186
|
-
}
|
|
2187
|
-
}
|
|
2188
|
-
Example Delete Request:
|
|
2189
|
-
{
|
|
2190
|
-
"elementId": "123",
|
|
2191
|
-
"action": "delete",
|
|
2192
|
-
"interactionId": "123",
|
|
2193
|
-
}
|
|
2194
|
-
Example Clear Request:
|
|
2195
|
-
{
|
|
2196
|
-
"elementId": "123",
|
|
2197
|
-
"action": "clear",
|
|
2198
|
-
}
|
|
2199
|
-
`
|
|
2200
|
-
});
|
|
2201
|
-
reg.waitForReady().then(() => {
|
|
2202
|
-
initInteractionsSchemaResource(reg);
|
|
2203
|
-
initManageElementInteractionTool(reg);
|
|
2204
|
-
});
|
|
2198
|
+
var initMcpInteractions = (reg) => {
|
|
2199
|
+
const { setMCPDescription } = reg;
|
|
2200
|
+
setMCPDescription(
|
|
2201
|
+
`Everything related to V4 ( Atomic ) interactions.
|
|
2202
|
+
# Interactions
|
|
2203
|
+
- Create/update/delete interactions
|
|
2204
|
+
- Get list of interactions
|
|
2205
|
+
- Get details of an interaction
|
|
2206
|
+
`
|
|
2207
|
+
);
|
|
2208
|
+
initInteractionsSchemaResource(reg);
|
|
2209
|
+
initManageElementInteractionTool(reg);
|
|
2205
2210
|
};
|
|
2206
2211
|
|
|
2207
2212
|
// src/init.ts
|
|
@@ -2244,7 +2249,7 @@ function init() {
|
|
|
2244
2249
|
type: "repeat",
|
|
2245
2250
|
component: Repeat
|
|
2246
2251
|
});
|
|
2247
|
-
initMcpInteractions();
|
|
2252
|
+
initMcpInteractions((0, import_editor_mcp.getMCPByDomain)("interactions", { instructions: EDITOR_INTERACTIONS_MCP_INSTRUCTIONS }));
|
|
2248
2253
|
} catch (error) {
|
|
2249
2254
|
throw error;
|
|
2250
2255
|
}
|