@elementor/editor-interactions 4.0.0-619 → 4.0.0-manual

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
@@ -198,16 +198,16 @@ var createConfig = ({
198
198
  replay,
199
199
  easing = "easeIn",
200
200
  relativeTo = "",
201
- offsetTop = 0,
202
- offsetBottom = 85
201
+ start = 85,
202
+ end = 15
203
203
  }) => ({
204
204
  $$type: "config",
205
205
  value: {
206
206
  replay: createBoolean(replay),
207
207
  easing: createString(easing),
208
208
  relativeTo: createString(relativeTo),
209
- offsetTop: createSize(offsetTop, "%"),
210
- offsetBottom: createSize(offsetBottom, "%")
209
+ start: createSize(start, "%"),
210
+ end: createSize(end, "%")
211
211
  }
212
212
  });
213
213
  var createSize = (value, defaultUnit, defaultValue) => {
@@ -241,8 +241,8 @@ var createAnimationPreset = ({
241
241
  replay = false,
242
242
  easing = "easeIn",
243
243
  relativeTo,
244
- offsetTop,
245
- offsetBottom,
244
+ start,
245
+ end,
246
246
  customEffects
247
247
  }) => ({
248
248
  $$type: "animation-preset-props",
@@ -256,8 +256,8 @@ var createAnimationPreset = ({
256
256
  replay,
257
257
  easing,
258
258
  relativeTo,
259
- offsetTop,
260
- offsetBottom
259
+ start,
260
+ end
261
261
  })
262
262
  }
263
263
  });
@@ -272,26 +272,26 @@ var createInteractionItem = ({
272
272
  replay = false,
273
273
  easing = "easeIn",
274
274
  relativeTo,
275
- offsetTop,
276
- offsetBottom,
275
+ start,
276
+ end,
277
277
  excludedBreakpoints,
278
278
  customEffects
279
279
  }) => ({
280
280
  $$type: "interaction-item",
281
281
  value: {
282
282
  ...interactionId && { interaction_id: createString(interactionId) },
283
- trigger: createString(trigger),
283
+ trigger: createString(trigger ?? ""),
284
284
  animation: createAnimationPreset({
285
- effect,
286
- type,
285
+ effect: effect ?? "",
286
+ type: type ?? "",
287
287
  direction,
288
- duration,
289
- delay,
288
+ duration: duration ?? 0,
289
+ delay: delay ?? 0,
290
290
  replay,
291
291
  easing,
292
292
  relativeTo,
293
- offsetTop,
294
- offsetBottom,
293
+ start,
294
+ end,
295
295
  customEffects
296
296
  }),
297
297
  ...excludedBreakpoints && excludedBreakpoints.length > 0 && {
@@ -457,8 +457,8 @@ var DEFAULT_VALUES = {
457
457
  replay: false,
458
458
  easing: "easeIn",
459
459
  relativeTo: "viewport",
460
- offsetTop: 15,
461
- offsetBottom: 85
460
+ start: 85,
461
+ end: 15
462
462
  };
463
463
  var TRIGGERS_WITHOUT_REPLAY = ["load", "scrollOn", "hover", "click"];
464
464
  var controlVisibilityConfig = {
@@ -467,8 +467,8 @@ var controlVisibilityConfig = {
467
467
  effectType: (values) => values.effect !== "custom",
468
468
  direction: (values) => values.effect !== "custom",
469
469
  relativeTo: (values) => values.trigger === "scrollOn",
470
- offsetTop: (values) => values.trigger === "scrollOn",
471
- offsetBottom: (values) => values.trigger === "scrollOn",
470
+ start: (values) => values.trigger === "scrollOn",
471
+ end: (values) => values.trigger === "scrollOn",
472
472
  duration: (values) => {
473
473
  const isRelativeToVisible = values.trigger === "scrollOn";
474
474
  return !isRelativeToVisible;
@@ -497,11 +497,8 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
497
497
  const replay = extractBoolean(interaction.animation.value.config?.value.replay, DEFAULT_VALUES.replay);
498
498
  const easing = extractString(interaction.animation.value.config?.value.easing, DEFAULT_VALUES.easing);
499
499
  const relativeTo = extractString(interaction.animation.value.config?.value.relativeTo, DEFAULT_VALUES.relativeTo);
500
- const offsetTop = extractSize(interaction.animation.value.config?.value.offsetTop, DEFAULT_VALUES.offsetTop);
501
- const offsetBottom = extractSize(
502
- interaction.animation.value.config?.value.offsetBottom,
503
- DEFAULT_VALUES.offsetBottom
504
- );
500
+ const start = extractSize(interaction.animation.value.config?.value.start, DEFAULT_VALUES.start);
501
+ const end = extractSize(interaction.animation.value.config?.value.end, DEFAULT_VALUES.end);
505
502
  const interactionValues = {
506
503
  trigger,
507
504
  effect,
@@ -512,8 +509,8 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
512
509
  easing,
513
510
  replay,
514
511
  relativeTo,
515
- offsetTop,
516
- offsetBottom,
512
+ start,
513
+ end,
517
514
  customEffects
518
515
  };
519
516
  const TriggerControl = useControlComponent("trigger", true);
@@ -523,11 +520,8 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
523
520
  "relativeTo",
524
521
  controlVisibilityConfig.relativeTo(interactionValues)
525
522
  );
526
- const OffsetTopControl = useControlComponent("offsetTop", controlVisibilityConfig.offsetTop(interactionValues));
527
- const OffsetBottomControl = useControlComponent(
528
- "offsetBottom",
529
- controlVisibilityConfig.offsetBottom(interactionValues)
530
- );
523
+ const StartControl = useControlComponent("start", controlVisibilityConfig.start(interactionValues));
524
+ const EndControl = useControlComponent("end", controlVisibilityConfig.end(interactionValues));
531
525
  const CustomEffectControl = useControlComponent(
532
526
  "customEffects",
533
527
  controlVisibilityConfig.custom(interactionValues)
@@ -560,8 +554,8 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
560
554
  replay: updates.replay ?? replay,
561
555
  easing: updates.easing ?? easing,
562
556
  relativeTo: updates.relativeTo ?? relativeTo,
563
- offsetTop: updates.offsetTop ?? offsetTop,
564
- offsetBottom: updates.offsetBottom ?? offsetBottom,
557
+ start: updates.start ?? start,
558
+ end: updates.end ?? end,
565
559
  customEffects: updates.customEffects ?? customEffects
566
560
  })
567
561
  };
@@ -612,23 +606,23 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
612
606
  onChange: (v) => updateInteraction({ delay: v }),
613
607
  defaultValue: DEFAULT_VALUES.delay
614
608
  }
615
- ))), controlVisibilityConfig.relativeTo(interactionValues) && RelativeToControl && /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(Divider, null), /* @__PURE__ */ React7.createElement(Grid2, { container: true, spacing: 1.5 }, /* @__PURE__ */ React7.createElement(Field, { label: __2("Relative To", "elementor") }, /* @__PURE__ */ React7.createElement(
616
- RelativeToControl,
609
+ ))), controlVisibilityConfig.relativeTo(interactionValues) && RelativeToControl && /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(Divider, null), /* @__PURE__ */ React7.createElement(Grid2, { container: true, spacing: 1.5 }, StartControl && /* @__PURE__ */ React7.createElement(Field, { label: __2("Start", "elementor") }, /* @__PURE__ */ React7.createElement(
610
+ StartControl,
617
611
  {
618
- value: relativeTo,
619
- onChange: (v) => updateInteraction({ relativeTo: v })
612
+ value: parseSizeValue(start, ["%"]).size?.toString() ?? "",
613
+ onChange: (v) => updateInteraction({ start: v })
620
614
  }
621
- )), OffsetTopControl && /* @__PURE__ */ React7.createElement(Field, { label: __2("Offset Top", "elementor") }, /* @__PURE__ */ React7.createElement(
622
- OffsetTopControl,
615
+ )), EndControl && /* @__PURE__ */ React7.createElement(Field, { label: __2("End", "elementor") }, /* @__PURE__ */ React7.createElement(
616
+ EndControl,
623
617
  {
624
- value: String(parseSizeValue(offsetTop, ["%"]).size),
625
- onChange: (v) => updateInteraction({ offsetTop: v })
618
+ value: parseSizeValue(end, ["%"]).size?.toString() ?? "",
619
+ onChange: (v) => updateInteraction({ end: v })
626
620
  }
627
- )), OffsetBottomControl && /* @__PURE__ */ React7.createElement(Field, { label: __2("Offset Bottom", "elementor") }, /* @__PURE__ */ React7.createElement(
628
- OffsetBottomControl,
621
+ )), /* @__PURE__ */ React7.createElement(Field, { label: __2("Relative To", "elementor") }, /* @__PURE__ */ React7.createElement(
622
+ RelativeToControl,
629
623
  {
630
- value: String(parseSizeValue(offsetBottom, ["%"]).size),
631
- onChange: (v) => updateInteraction({ offsetBottom: v })
624
+ value: relativeTo,
625
+ onChange: (v) => updateInteraction({ relativeTo: v })
632
626
  }
633
627
  ))), /* @__PURE__ */ React7.createElement(Divider, null)), EasingControl && /* @__PURE__ */ React7.createElement(Grid2, { container: true, spacing: 1.5 }, /* @__PURE__ */ React7.createElement(Field, { label: __2("Easing", "elementor") }, /* @__PURE__ */ React7.createElement(
634
628
  EasingControl,
@@ -1346,53 +1340,73 @@ import { getMCPByDomain } from "@elementor/editor-mcp";
1346
1340
  var MAX_INTERACTIONS_PER_ELEMENT = 5;
1347
1341
 
1348
1342
  // src/mcp/resources/interactions-schema-resource.ts
1349
- var INTERACTIONS_SCHEMA_URI = "elementor://interactions/schema";
1350
- var schema = {
1351
- triggers: BASE_TRIGGERS.map((key) => ({
1352
- value: key,
1353
- label: TRIGGER_OPTIONS[key] ?? key
1354
- })),
1355
- effects: [
1356
- { value: "fade", label: "Fade" },
1357
- { value: "slide", label: "Slide" },
1358
- { value: "scale", label: "Scale" }
1359
- ],
1360
- effectTypes: [
1361
- { value: "in", label: "In" },
1362
- { value: "out", label: "Out" }
1363
- ],
1364
- directions: [
1365
- { value: "top", label: "Top", note: "" },
1366
- { value: "bottom", label: "Bottom", note: "" },
1367
- { value: "left", label: "Left", note: "" },
1368
- { value: "right", label: "Right", note: "" },
1369
- { value: "", label: "None", note: "Slide animation must have a direction" }
1370
- ],
1371
- easings: Object.entries(EASING_OPTIONS).map(([value, label]) => ({ value, label })),
1372
- timing: {
1373
- duration: { min: 0, max: 1e4, unit: "ms", description: "Animation duration in milliseconds" },
1374
- delay: { min: 0, max: 1e4, unit: "ms", description: "Animation delay in milliseconds" }
1375
- },
1376
- excludedBreakpoints: {
1377
- type: "string[]",
1378
- description: "List of breakpoint IDs on which this interaction is disabled. Omit to enable on all breakpoints."
1379
- },
1380
- maxInteractionsPerElement: MAX_INTERACTIONS_PER_ELEMENT
1343
+ import { isProActive } from "@elementor/utils";
1344
+
1345
+ // src/mcp/tools/schema.ts
1346
+ import { z } from "@elementor/schema";
1347
+ var baseSchema = {
1348
+ trigger: z.enum(["load", "scrollIn"]).optional().describe("Event that triggers the animation"),
1349
+ effect: z.enum(["fade", "slide", "scale"]).optional().describe("Animation effect type"),
1350
+ effectType: z.enum(["in", "out"]).optional().describe("Whether the animation plays in or out"),
1351
+ direction: z.enum(["top", "bottom", "left", "right", ""]).optional().describe("Direction for slide effect. Use empty string for fade/scale."),
1352
+ duration: z.number().min(0).max(1e4).optional().describe("Animation duration in milliseconds"),
1353
+ delay: z.number().min(0).max(1e4).optional().describe("Animation delay in milliseconds"),
1354
+ easing: z.string().optional().describe("Easing function. See interactions schema for options."),
1355
+ excludedBreakpoints: z.array(z.string()).optional().describe(
1356
+ 'Breakpoint IDs on which this interaction is disabled (e.g. ["mobile", "tablet"]). Omit to enable on all breakpoints.'
1357
+ )
1381
1358
  };
1359
+ var proSchema = {
1360
+ trigger: z.enum(["load", "scrollIn", "scrollOut", "scrollOn", "hover", "click"]).optional().describe("Event that triggers the animation"),
1361
+ effect: z.enum(["fade", "slide", "scale", "custom"]).optional().describe("Animation effect type"),
1362
+ customEffect: z.object({
1363
+ keyframes: z.array(
1364
+ z.object({
1365
+ stop: z.number().describe("The stop of the keyframe in percent, can be either 0 or 100"),
1366
+ value: z.object({
1367
+ opacity: z.number().min(0).max(1).describe("The opacity of the keyframe"),
1368
+ scale: z.object({
1369
+ x: z.number().min(0).max(1).describe("The x scale of the keyframe"),
1370
+ y: z.number().min(0).max(1).describe("The y scale of the keyframe")
1371
+ }).optional().describe("The scale of the keyframe"),
1372
+ rotate: z.object({
1373
+ x: z.number().min(0).max(360).describe("The x rotate of the keyframe"),
1374
+ y: z.number().min(0).max(360).describe("The y rotate of the keyframe"),
1375
+ z: z.number().min(0).max(360).describe("The z rotate of the keyframe")
1376
+ }).optional().describe("The rotate of the keyframe"),
1377
+ move: z.object({
1378
+ x: z.number().min(0).max(1).describe("The x move of the keyframe"),
1379
+ y: z.number().min(0).max(1).describe("The y move of the keyframe"),
1380
+ z: z.number().min(0).max(1).describe("The z move of the keyframe")
1381
+ }).optional().describe("The move of the keyframe"),
1382
+ skew: z.object({
1383
+ x: z.number().min(0).max(360).describe("The x skew of the keyframe"),
1384
+ y: z.number().min(0).max(360).describe("The y skew of the keyframe")
1385
+ }).optional().describe("The skew of the keyframe")
1386
+ })
1387
+ })
1388
+ ).describe("The keyframes of the custom effect")
1389
+ }).optional().describe("The custom effect to use for the animation")
1390
+ };
1391
+
1392
+ // src/mcp/resources/interactions-schema-resource.ts
1393
+ var INTERACTIONS_SCHEMA_URI = "elementor://interactions/schema";
1382
1394
  var initInteractionsSchemaResource = (reg) => {
1383
1395
  const { resource } = reg;
1396
+ const schema = isProActive() ? { ...baseSchema, ...proSchema } : baseSchema;
1384
1397
  resource(
1385
1398
  "interactions-schema",
1386
1399
  INTERACTIONS_SCHEMA_URI,
1387
1400
  {
1388
- description: "Schema describing all available options for element interactions (triggers, effects, easings, timing, breakpoints, etc.)."
1401
+ description: "Schema describing all available options for element interactions."
1389
1402
  },
1390
1403
  async () => {
1391
1404
  return {
1392
1405
  contents: [
1393
1406
  {
1394
1407
  uri: INTERACTIONS_SCHEMA_URI,
1395
- text: JSON.stringify(schema, null, 2)
1408
+ mimeType: "application/json",
1409
+ text: JSON.stringify(schema)
1396
1410
  }
1397
1411
  ]
1398
1412
  };
@@ -1402,85 +1416,49 @@ var initInteractionsSchemaResource = (reg) => {
1402
1416
 
1403
1417
  // src/mcp/tools/manage-element-interaction-tool.ts
1404
1418
  import { updateElementInteractions as updateElementInteractions2 } from "@elementor/editor-elements";
1405
- import { z } from "@elementor/schema";
1419
+ import { z as z2 } from "@elementor/schema";
1420
+ import { isProActive as isProActive2 } from "@elementor/utils";
1406
1421
  var EMPTY_INTERACTIONS = {
1407
1422
  version: 1,
1408
1423
  items: []
1409
1424
  };
1410
1425
  var initManageElementInteractionTool = (reg) => {
1411
1426
  const { addTool } = reg;
1427
+ const extendedSchema = isProActive2() ? { ...baseSchema, ...proSchema } : baseSchema;
1428
+ const schema = {
1429
+ elementId: z2.string().describe("The ID of the element to read or modify interactions on"),
1430
+ action: z2.enum(["get", "add", "update", "delete", "clear"]).describe('Operation to perform. Use "get" first to inspect existing interactions.'),
1431
+ interactionId: z2.string().optional().describe('Interaction ID \u2014 required for update and delete. Obtain from a prior "get" call.'),
1432
+ ...extendedSchema
1433
+ };
1412
1434
  addTool({
1413
1435
  name: "manage-element-interaction",
1414
- description: `Read or manage interactions (animations) on an element. Always call with action=get first to see existing interactions before making changes.
1415
-
1416
- Actions:
1417
- - get: Read the current interactions on the element.
1418
- - add: Add a new interaction (max ${MAX_INTERACTIONS_PER_ELEMENT} per element).
1419
- - update: Update an existing interaction by its interactionId.
1420
- - delete: Remove a specific interaction by its interactionId.
1421
- - clear: Remove all interactions from the element.
1422
-
1423
- For add/update, provide: trigger, effect, effectType, direction (empty string for non-slide effects), duration, delay, easing.
1424
- Use excludedBreakpoints to disable the animation on specific responsive breakpoints (e.g. ["mobile", "tablet"]).`,
1425
- schema: {
1426
- elementId: z.string().describe("The ID of the element to read or modify interactions on"),
1427
- action: z.enum(["get", "add", "update", "delete", "clear"]).describe('Operation to perform. Use "get" first to inspect existing interactions.'),
1428
- interactionId: z.string().optional().describe('Interaction ID \u2014 required for update and delete. Obtain from a prior "get" call.'),
1429
- trigger: z.enum(["load", "scrollIn"]).optional().describe("Event that triggers the animation"),
1430
- effect: z.enum(["fade", "slide", "scale"]).optional().describe("Animation effect type"),
1431
- effectType: z.enum(["in", "out"]).optional().describe("Whether the animation plays in or out"),
1432
- direction: z.enum(["top", "bottom", "left", "right", ""]).optional().describe("Direction for slide effect. Use empty string for fade/scale."),
1433
- duration: z.number().min(0).max(1e4).optional().describe("Animation duration in milliseconds"),
1434
- delay: z.number().min(0).max(1e4).optional().describe("Animation delay in milliseconds"),
1435
- easing: z.string().optional().describe("Easing function. See interactions schema for options."),
1436
- excludedBreakpoints: z.array(z.string()).optional().describe(
1437
- 'Breakpoint IDs on which this interaction is disabled (e.g. ["mobile", "tablet"]). Omit to enable on all breakpoints.'
1438
- )
1439
- },
1436
+ description: `Manage the element interaction.`,
1437
+ schema,
1440
1438
  requiredResources: [
1441
1439
  { uri: INTERACTIONS_SCHEMA_URI, description: "Interactions schema with all available options" }
1442
1440
  ],
1443
1441
  isDestructive: true,
1442
+ outputSchema: {
1443
+ success: z2.boolean().describe("Whether the action was successful"),
1444
+ action: z2.enum(["get", "add", "update", "delete", "clear"]).describe('Operation to perform. Use "get" first to inspect existing interactions.'),
1445
+ elementId: z2.string().optional().describe("The ID of the element to read or modify interactions on"),
1446
+ interactions: z2.array(z2.any()).optional().describe("The interactions on the element"),
1447
+ count: z2.number().optional().describe("The number of interactions on the element")
1448
+ },
1444
1449
  handler: (input) => {
1445
- const {
1446
- elementId,
1447
- action,
1448
- interactionId,
1449
- trigger,
1450
- effect,
1451
- effectType,
1452
- direction,
1453
- duration,
1454
- delay,
1455
- easing,
1456
- excludedBreakpoints
1457
- } = input;
1450
+ const { elementId, action, interactionId, ...animationData } = input;
1458
1451
  const allInteractions = interactionsRepository.all();
1459
1452
  const elementData = allInteractions.find((data) => data.elementId === elementId);
1460
1453
  const currentInteractions = elementData?.interactions ?? EMPTY_INTERACTIONS;
1461
1454
  if (action === "get") {
1462
- const summary = currentInteractions.items.map((item) => {
1463
- const { value } = item;
1464
- const animValue = value.animation.value;
1465
- const timingValue = animValue.timing_config.value;
1466
- const configValue = animValue.config.value;
1467
- return {
1468
- id: extractString(value.interaction_id),
1469
- trigger: extractString(value.trigger),
1470
- effect: extractString(animValue.effect),
1471
- effectType: extractString(animValue.type),
1472
- direction: extractString(animValue.direction),
1473
- duration: extractSize(timingValue.duration),
1474
- delay: extractSize(timingValue.delay),
1475
- easing: extractString(configValue.easing),
1476
- excludedBreakpoints: extractExcludedBreakpoints(value.breakpoints)
1477
- };
1478
- });
1479
- return JSON.stringify({
1455
+ return {
1456
+ success: true,
1480
1457
  elementId,
1481
- interactions: summary,
1482
- count: summary.length
1483
- });
1458
+ action,
1459
+ interactions: currentInteractions.items,
1460
+ count: currentInteractions.items.length
1461
+ };
1484
1462
  }
1485
1463
  let updatedItems = [...currentInteractions.items];
1486
1464
  switch (action) {
@@ -1492,15 +1470,7 @@ Use excludedBreakpoints to disable the animation on specific responsive breakpoi
1492
1470
  }
1493
1471
  const newItem = createInteractionItem({
1494
1472
  interactionId: generateTempInteractionId(),
1495
- trigger: trigger ?? DEFAULT_VALUES.trigger,
1496
- effect: effect ?? DEFAULT_VALUES.effect,
1497
- type: effectType ?? DEFAULT_VALUES.type,
1498
- direction: direction ?? DEFAULT_VALUES.direction,
1499
- duration: duration ?? DEFAULT_VALUES.duration,
1500
- delay: delay ?? DEFAULT_VALUES.delay,
1501
- replay: DEFAULT_VALUES.replay,
1502
- easing: easing ?? DEFAULT_VALUES.easing,
1503
- excludedBreakpoints
1473
+ ...animationData
1504
1474
  });
1505
1475
  updatedItems = [...updatedItems, newItem];
1506
1476
  break;
@@ -1517,23 +1487,9 @@ Use excludedBreakpoints to disable the animation on specific responsive breakpoi
1517
1487
  `Interaction with ID "${interactionId}" not found on element "${elementId}".`
1518
1488
  );
1519
1489
  }
1520
- const existingItem = updatedItems[itemIndex];
1521
- const existingValue = existingItem.value;
1522
- const existingAnimation = existingValue.animation.value;
1523
- const existingTiming = existingAnimation.timing_config.value;
1524
- const existingConfig = existingAnimation.config.value;
1525
- const existingExcludedBreakpoints = extractExcludedBreakpoints(existingValue.breakpoints);
1526
1490
  const updatedItem = createInteractionItem({
1527
1491
  interactionId,
1528
- trigger: trigger ?? extractString(existingValue.trigger),
1529
- effect: effect ?? extractString(existingAnimation.effect),
1530
- type: effectType ?? extractString(existingAnimation.type),
1531
- direction: direction !== void 0 ? direction : extractString(existingAnimation.direction),
1532
- duration: duration !== void 0 ? duration : extractSize(existingTiming.duration),
1533
- delay: delay !== void 0 ? delay : extractSize(existingTiming.delay),
1534
- replay: existingConfig.replay?.value ?? DEFAULT_VALUES.replay,
1535
- easing: easing ?? extractString(existingConfig.easing),
1536
- excludedBreakpoints: excludedBreakpoints !== void 0 ? excludedBreakpoints : existingExcludedBreakpoints
1492
+ ...animationData
1537
1493
  });
1538
1494
  updatedItems = [
1539
1495
  ...updatedItems.slice(0, itemIndex),
@@ -1573,12 +1529,12 @@ Use excludedBreakpoints to disable the animation on specific responsive breakpoi
1573
1529
  `Failed to update interactions for element "${elementId}": ${error instanceof Error ? error.message : "Unknown error"}`
1574
1530
  );
1575
1531
  }
1576
- return JSON.stringify({
1532
+ return {
1577
1533
  success: true,
1578
1534
  action,
1579
1535
  elementId,
1580
- interactionCount: updatedItems.length
1581
- });
1536
+ count: updatedItems.length
1537
+ };
1582
1538
  }
1583
1539
  });
1584
1540
  };
@@ -1586,10 +1542,71 @@ Use excludedBreakpoints to disable the animation on specific responsive breakpoi
1586
1542
  // src/mcp/index.ts
1587
1543
  var initMcpInteractions = () => {
1588
1544
  const reg = getMCPByDomain("interactions", {
1589
- 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."
1545
+ instructions: `
1546
+ 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.
1547
+ ** IMPORTANT **
1548
+ Use the "interactions-schema" resource to get the schema of the interactions.
1549
+ Actions:
1550
+ - get: Read the current interactions on the element.
1551
+ - add: Add a new interaction (max ${MAX_INTERACTIONS_PER_ELEMENT} per element).
1552
+ - update: Update an existing interaction by its interactionId.
1553
+ - delete: Remove a specific interaction by its interactionId.
1554
+ - clear: Remove all interactions from the element.
1555
+
1556
+ For add/update, provide: trigger, effect, effectType, direction (required for slide effect), duration, delay, easing.
1557
+ Use excludedBreakpoints to disable the animation on specific responsive breakpoints (e.g. ["mobile", "tablet"]).
1558
+ Example Get Request:
1559
+ {
1560
+ "elementId": "123",
1561
+ "action": "get",
1562
+ "interactionId": "123",
1563
+ "animationData": {
1564
+ "trigger": "click",
1565
+ "effect": "fade",
1566
+ }
1567
+ }
1568
+ Example Add Request:
1569
+ {
1570
+ "elementId": "123",
1571
+ "action": "add",
1572
+ "animationData": {
1573
+ "effectType": "in",
1574
+ "direction": "top",
1575
+ "trigger": "click",
1576
+ "effect": "fade",
1577
+ "duration": 1000,
1578
+ "delay": 0,
1579
+ "easing": "easeIn",
1580
+ "excludedBreakpoints": ["mobile", "tablet"],
1581
+ }
1582
+ }
1583
+ Example Update Request:
1584
+ {
1585
+ "elementId": "123",
1586
+ "action": "update",
1587
+ "interactionId": "123",
1588
+ "animationData": {
1589
+ "trigger": "click",
1590
+ "effect": "fade",
1591
+ }
1592
+ }
1593
+ Example Delete Request:
1594
+ {
1595
+ "elementId": "123",
1596
+ "action": "delete",
1597
+ "interactionId": "123",
1598
+ }
1599
+ Example Clear Request:
1600
+ {
1601
+ "elementId": "123",
1602
+ "action": "clear",
1603
+ }
1604
+ `
1605
+ });
1606
+ reg.waitForReady().then(() => {
1607
+ initInteractionsSchemaResource(reg);
1608
+ initManageElementInteractionTool(reg);
1590
1609
  });
1591
- initInteractionsSchemaResource(reg);
1592
- initManageElementInteractionTool(reg);
1593
1610
  };
1594
1611
 
1595
1612
  // src/init.ts