@elementor/editor-canvas 4.0.0-manual → 4.1.0-685

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.d.mts CHANGED
@@ -183,13 +183,18 @@ type ContextMenuGroup = {
183
183
  name: string;
184
184
  actions: ContextMenuAction[];
185
185
  };
186
+ type ContextMenuEventData = {
187
+ location: string;
188
+ secondaryLocation: string;
189
+ trigger: string;
190
+ };
186
191
  type ContextMenuAction = {
187
192
  name: string;
188
193
  icon: string;
189
194
  title: string | (() => string);
190
195
  shortcut?: string;
191
196
  isEnabled: () => boolean;
192
- callback: (_: unknown, eventData: unknown) => void;
197
+ callback: (_: unknown, eventData: ContextMenuEventData) => void;
193
198
  };
194
199
  type ReplacementSettings = {
195
200
  getSetting: (key: string) => unknown;
@@ -336,4 +341,4 @@ declare const UnknownStyleStateError: {
336
341
  isError(error: unknown): error is Error;
337
342
  };
338
343
 
339
- export { type AnyTransformer, BREAKPOINTS_SCHEMA_URI, type BackboneModel, type BackboneModelConstructor, type ContextMenuAction, type CreateNestedTemplatedElementTypeOptions, type CreateTemplatedElementTypeOptions, DOCUMENT_STRUCTURE_URI, type ElementModel, ElementType, ElementView, type LegacyWindow, type NamespacedRenderContext, type NestedTemplatedElementConfig, type PropsResolver, type RenderContext, type ReplacementSettings, STYLE_SCHEMA_URI, type TransformerOptions, UnknownStyleStateError, UnknownStyleTypeError, WIDGET_SCHEMA_URI, canBeNestedTemplated, createNestedTemplatedElementType, createNestedTemplatedElementView, createPropsResolver, createTemplatedElementView, createTransformer, createTransformersRegistry, endDragElementFromPanel, init, isAtomicWidget, registerElementType, registerModelExtensions, settingsTransformersRegistry, startDragElementFromPanel, styleTransformersRegistry, stylesInheritanceTransformersRegistry };
344
+ export { type AnyTransformer, BREAKPOINTS_SCHEMA_URI, type BackboneModel, type BackboneModelConstructor, type ContextMenuAction, type ContextMenuEventData, type CreateNestedTemplatedElementTypeOptions, type CreateTemplatedElementTypeOptions, DOCUMENT_STRUCTURE_URI, type ElementModel, ElementType, ElementView, type LegacyWindow, type NamespacedRenderContext, type NestedTemplatedElementConfig, type PropsResolver, type RenderContext, type ReplacementSettings, STYLE_SCHEMA_URI, type TransformerOptions, UnknownStyleStateError, UnknownStyleTypeError, WIDGET_SCHEMA_URI, canBeNestedTemplated, createNestedTemplatedElementType, createNestedTemplatedElementView, createPropsResolver, createTemplatedElementView, createTransformer, createTransformersRegistry, endDragElementFromPanel, init, isAtomicWidget, registerElementType, registerModelExtensions, settingsTransformersRegistry, startDragElementFromPanel, styleTransformersRegistry, stylesInheritanceTransformersRegistry };
package/dist/index.d.ts CHANGED
@@ -183,13 +183,18 @@ type ContextMenuGroup = {
183
183
  name: string;
184
184
  actions: ContextMenuAction[];
185
185
  };
186
+ type ContextMenuEventData = {
187
+ location: string;
188
+ secondaryLocation: string;
189
+ trigger: string;
190
+ };
186
191
  type ContextMenuAction = {
187
192
  name: string;
188
193
  icon: string;
189
194
  title: string | (() => string);
190
195
  shortcut?: string;
191
196
  isEnabled: () => boolean;
192
- callback: (_: unknown, eventData: unknown) => void;
197
+ callback: (_: unknown, eventData: ContextMenuEventData) => void;
193
198
  };
194
199
  type ReplacementSettings = {
195
200
  getSetting: (key: string) => unknown;
@@ -336,4 +341,4 @@ declare const UnknownStyleStateError: {
336
341
  isError(error: unknown): error is Error;
337
342
  };
338
343
 
339
- export { type AnyTransformer, BREAKPOINTS_SCHEMA_URI, type BackboneModel, type BackboneModelConstructor, type ContextMenuAction, type CreateNestedTemplatedElementTypeOptions, type CreateTemplatedElementTypeOptions, DOCUMENT_STRUCTURE_URI, type ElementModel, ElementType, ElementView, type LegacyWindow, type NamespacedRenderContext, type NestedTemplatedElementConfig, type PropsResolver, type RenderContext, type ReplacementSettings, STYLE_SCHEMA_URI, type TransformerOptions, UnknownStyleStateError, UnknownStyleTypeError, WIDGET_SCHEMA_URI, canBeNestedTemplated, createNestedTemplatedElementType, createNestedTemplatedElementView, createPropsResolver, createTemplatedElementView, createTransformer, createTransformersRegistry, endDragElementFromPanel, init, isAtomicWidget, registerElementType, registerModelExtensions, settingsTransformersRegistry, startDragElementFromPanel, styleTransformersRegistry, stylesInheritanceTransformersRegistry };
344
+ export { type AnyTransformer, BREAKPOINTS_SCHEMA_URI, type BackboneModel, type BackboneModelConstructor, type ContextMenuAction, type ContextMenuEventData, type CreateNestedTemplatedElementTypeOptions, type CreateTemplatedElementTypeOptions, DOCUMENT_STRUCTURE_URI, type ElementModel, ElementType, ElementView, type LegacyWindow, type NamespacedRenderContext, type NestedTemplatedElementConfig, type PropsResolver, type RenderContext, type ReplacementSettings, STYLE_SCHEMA_URI, type TransformerOptions, UnknownStyleStateError, UnknownStyleTypeError, WIDGET_SCHEMA_URI, canBeNestedTemplated, createNestedTemplatedElementType, createNestedTemplatedElementView, createPropsResolver, createTemplatedElementView, createTransformer, createTransformersRegistry, endDragElementFromPanel, init, isAtomicWidget, registerElementType, registerModelExtensions, settingsTransformersRegistry, startDragElementFromPanel, styleTransformersRegistry, stylesInheritanceTransformersRegistry };
package/dist/index.js CHANGED
@@ -234,7 +234,7 @@ Variables from the user context ARE NOT SUPPORTED AND WILL RESOLVE IN ERROR.
234
234
 
235
235
  // src/init.tsx
236
236
  var import_editor = require("@elementor/editor");
237
- var import_editor_mcp4 = require("@elementor/editor-mcp");
237
+ var import_editor_mcp3 = require("@elementor/editor-mcp");
238
238
 
239
239
  // src/components/classes-rename.tsx
240
240
  var import_react = require("react");
@@ -1017,7 +1017,7 @@ function createProviderSubscriber2({ provider, renderStyles, setStyleItems, cach
1017
1017
  }
1018
1018
  async function createItems(signal) {
1019
1019
  const allStyles = provider.actions.all();
1020
- const styles = allStyles.reverse().map((style) => {
1020
+ const styles = [...allStyles].reverse().map((style) => {
1021
1021
  return {
1022
1022
  ...style,
1023
1023
  cssName: provider.actions.resolveCssName(style.id)
@@ -3562,36 +3562,36 @@ Note: No height/width specified on any element - flexbox handles layout automati
3562
3562
  };
3563
3563
 
3564
3564
  // src/mcp/tools/build-composition/schema.ts
3565
- var import_editor_mcp3 = require("@elementor/editor-mcp");
3565
+ var import_schema = require("@elementor/schema");
3566
3566
  var inputSchema = {
3567
- xmlStructure: import_editor_mcp3.zod.string().describe("The XML structure representing the composition to be built"),
3568
- elementConfig: import_editor_mcp3.zod.record(
3569
- import_editor_mcp3.zod.string().describe("The configuration id"),
3570
- import_editor_mcp3.zod.record(
3571
- import_editor_mcp3.zod.string().describe("property name"),
3572
- import_editor_mcp3.zod.any().describe(`The PropValue for the property, refer to ${WIDGET_SCHEMA_URI}`)
3567
+ xmlStructure: import_schema.z.string().describe("The XML structure representing the composition to be built"),
3568
+ elementConfig: import_schema.z.record(
3569
+ import_schema.z.string().describe("The configuration id"),
3570
+ import_schema.z.record(
3571
+ import_schema.z.string().describe("property name"),
3572
+ import_schema.z.any().describe(`The PropValue for the property, refer to ${WIDGET_SCHEMA_URI}`)
3573
3573
  )
3574
3574
  ).describe("A record mapping element IDs to their configuration objects. REQUIRED"),
3575
- stylesConfig: import_editor_mcp3.zod.record(
3576
- import_editor_mcp3.zod.string().describe("The configuration id"),
3577
- import_editor_mcp3.zod.record(
3578
- import_editor_mcp3.zod.string().describe("StyleSchema property name"),
3579
- import_editor_mcp3.zod.any().describe(`The PropValue for the style property. MANDATORY, refer to [${STYLE_SCHEMA_URI}]`)
3575
+ stylesConfig: import_schema.z.record(
3576
+ import_schema.z.string().describe("The configuration id"),
3577
+ import_schema.z.record(
3578
+ import_schema.z.string().describe("StyleSchema property name"),
3579
+ import_schema.z.any().describe(`The PropValue for the style property. MANDATORY, refer to [${STYLE_SCHEMA_URI}]`)
3580
3580
  )
3581
3581
  ).describe(
3582
3582
  `A record mapping element IDs to their styles configuration objects. Use the actual styles schema from [${STYLE_SCHEMA_URI}].`
3583
3583
  ).default({}),
3584
- customCSS: import_editor_mcp3.zod.record(
3585
- import_editor_mcp3.zod.string().describe("The configuration id"),
3586
- import_editor_mcp3.zod.string().describe("The custom CSS for the element. MANDATORY")
3584
+ customCSS: import_schema.z.record(
3585
+ import_schema.z.string().describe("The configuration id"),
3586
+ import_schema.z.string().describe("The custom CSS for the element. MANDATORY")
3587
3587
  ).describe("A record mapping element IDs to their custom CSS.").default({})
3588
3588
  };
3589
3589
  var outputSchema = {
3590
- errors: import_editor_mcp3.zod.string().describe("Error message if the composition building failed").optional(),
3591
- xmlStructure: import_editor_mcp3.zod.string().describe(
3590
+ errors: import_schema.z.string().describe("Error message if the composition building failed").optional(),
3591
+ xmlStructure: import_schema.z.string().describe(
3592
3592
  "The built XML structure as a string. Must use this XML after completion of building the composition, it contains real IDs."
3593
3593
  ).optional(),
3594
- llm_instructions: import_editor_mcp3.zod.string().describe("Instructions what to do next, Important to follow these instructions!").optional()
3594
+ llm_instructions: import_schema.z.string().describe("Instructions what to do next, Important to follow these instructions!").optional()
3595
3595
  };
3596
3596
 
3597
3597
  // src/mcp/tools/build-composition/tool.ts
@@ -3806,23 +3806,23 @@ The $$type property is MANDATORY for every value, it is required to parse the va
3806
3806
  `;
3807
3807
 
3808
3808
  // src/mcp/tools/configure-element/schema.ts
3809
- var import_schema2 = require("@elementor/schema");
3809
+ var import_schema3 = require("@elementor/schema");
3810
3810
  var inputSchema2 = {
3811
- propertiesToChange: import_schema2.z.record(
3812
- import_schema2.z.string().describe("The property name."),
3813
- import_schema2.z.any().describe(`PropValue, refer to [${WIDGET_SCHEMA_URI}] by correct type, as appears in elementType`),
3814
- import_schema2.z.any()
3811
+ propertiesToChange: import_schema3.z.record(
3812
+ import_schema3.z.string().describe("The property name."),
3813
+ import_schema3.z.any().describe(`PropValue, refer to [${WIDGET_SCHEMA_URI}] by correct type, as appears in elementType`),
3814
+ import_schema3.z.any()
3815
3815
  ).describe("An object record containing property names and their new values to be set on the element"),
3816
- stylePropertiesToChange: import_schema2.z.record(
3817
- import_schema2.z.string().describe("The style property name"),
3818
- import_schema2.z.any().describe(`The style PropValue, refer to [${STYLE_SCHEMA_URI}] how to generate values`),
3819
- import_schema2.z.any()
3816
+ stylePropertiesToChange: import_schema3.z.record(
3817
+ import_schema3.z.string().describe("The style property name"),
3818
+ import_schema3.z.any().describe(`The style PropValue, refer to [${STYLE_SCHEMA_URI}] how to generate values`),
3819
+ import_schema3.z.any()
3820
3820
  ).describe("An object record containing style property names and their new values to be set on the element").default({}),
3821
- elementType: import_schema2.z.string().describe("The type of the element to retreive the schema"),
3822
- elementId: import_schema2.z.string().describe("The unique id of the element to configure")
3821
+ elementType: import_schema3.z.string().describe("The type of the element to retreive the schema"),
3822
+ elementId: import_schema3.z.string().describe("The unique id of the element to configure")
3823
3823
  };
3824
3824
  var outputSchema2 = {
3825
- success: import_schema2.z.boolean().describe(
3825
+ success: import_schema3.z.boolean().describe(
3826
3826
  "Whether the configuration change was successful, only if propertyName and propertyValue are provided"
3827
3827
  )
3828
3828
  };
@@ -3928,18 +3928,18 @@ Check the styles schema at the resource [${STYLE_SCHEMA_URI.replace(
3928
3928
  // src/mcp/tools/get-element-config/tool.ts
3929
3929
  var import_editor_elements11 = require("@elementor/editor-elements");
3930
3930
  var import_editor_props8 = require("@elementor/editor-props");
3931
- var import_schema4 = require("@elementor/schema");
3931
+ var import_schema5 = require("@elementor/schema");
3932
3932
  var schema = {
3933
- elementId: import_schema4.z.string()
3933
+ elementId: import_schema5.z.string()
3934
3934
  };
3935
3935
  var outputSchema3 = {
3936
- properties: import_schema4.z.record(import_schema4.z.string(), import_schema4.z.any()).describe("A record mapping PropTypes to their corresponding PropValues"),
3937
- style: import_schema4.z.record(import_schema4.z.string(), import_schema4.z.any()).describe("A record mapping StyleSchema properties to their corresponding PropValues"),
3938
- childElements: import_schema4.z.array(
3939
- import_schema4.z.object({
3940
- id: import_schema4.z.string(),
3941
- elementType: import_schema4.z.string(),
3942
- childElements: import_schema4.z.array(import_schema4.z.any()).describe("An array of child element IDs, when applicable, same structure recursively")
3936
+ properties: import_schema5.z.record(import_schema5.z.string(), import_schema5.z.any()).describe("A record mapping PropTypes to their corresponding PropValues"),
3937
+ style: import_schema5.z.record(import_schema5.z.string(), import_schema5.z.any()).describe("A record mapping StyleSchema properties to their corresponding PropValues"),
3938
+ childElements: import_schema5.z.array(
3939
+ import_schema5.z.object({
3940
+ id: import_schema5.z.string(),
3941
+ elementType: import_schema5.z.string(),
3942
+ childElements: import_schema5.z.array(import_schema5.z.any()).describe("An array of child element IDs, when applicable, same structure recursively")
3943
3943
  })
3944
3944
  ).describe("An array of child element IDs, when applicable, with recursive structure")
3945
3945
  };
@@ -4231,13 +4231,7 @@ var import_editor_elements15 = require("@elementor/editor-elements");
4231
4231
  var import_editor_props10 = require("@elementor/editor-props");
4232
4232
  var import_editor_v1_adapters16 = require("@elementor/editor-v1-adapters");
4233
4233
 
4234
- // src/style-commands/undoable-actions/paste-element-style.ts
4235
- var import_editor_elements14 = require("@elementor/editor-elements");
4236
- var import_editor_styles_repository4 = require("@elementor/editor-styles-repository");
4237
- var import_editor_v1_adapters15 = require("@elementor/editor-v1-adapters");
4238
- var import_i18n6 = require("@wordpress/i18n");
4239
-
4240
- // src/style-commands/utils.ts
4234
+ // src/utils/command-utils.ts
4241
4235
  var import_editor_elements13 = require("@elementor/editor-elements");
4242
4236
  var import_editor_props9 = require("@elementor/editor-props");
4243
4237
  var import_i18n5 = require("@wordpress/i18n");
@@ -4280,6 +4274,10 @@ function getTitleForContainers(containers) {
4280
4274
  }
4281
4275
 
4282
4276
  // src/style-commands/undoable-actions/paste-element-style.ts
4277
+ var import_editor_elements14 = require("@elementor/editor-elements");
4278
+ var import_editor_styles_repository4 = require("@elementor/editor-styles-repository");
4279
+ var import_editor_v1_adapters15 = require("@elementor/editor-v1-adapters");
4280
+ var import_i18n6 = require("@wordpress/i18n");
4283
4281
  var undoablePasteElementStyle = () => (0, import_editor_v1_adapters15.undoable)(
4284
4282
  {
4285
4283
  do: ({ containers, newStyle }) => {
@@ -4514,7 +4512,7 @@ function init() {
4514
4512
  component: ClassesRename
4515
4513
  });
4516
4514
  initCanvasMcp(
4517
- (0, import_editor_mcp4.getMCPByDomain)("canvas", {
4515
+ (0, import_editor_mcp3.getMCPByDomain)("canvas", {
4518
4516
  instructions: mcpDescription
4519
4517
  })
4520
4518
  );
package/dist/index.mjs CHANGED
@@ -983,7 +983,7 @@ function createProviderSubscriber2({ provider, renderStyles, setStyleItems, cach
983
983
  }
984
984
  async function createItems(signal) {
985
985
  const allStyles = provider.actions.all();
986
- const styles = allStyles.reverse().map((style) => {
986
+ const styles = [...allStyles].reverse().map((style) => {
987
987
  return {
988
988
  ...style,
989
989
  cssName: provider.actions.resolveCssName(style.id)
@@ -3548,7 +3548,7 @@ Note: No height/width specified on any element - flexbox handles layout automati
3548
3548
  };
3549
3549
 
3550
3550
  // src/mcp/tools/build-composition/schema.ts
3551
- import { zod as z } from "@elementor/editor-mcp";
3551
+ import { z } from "@elementor/schema";
3552
3552
  var inputSchema = {
3553
3553
  xmlStructure: z.string().describe("The XML structure representing the composition to be built"),
3554
3554
  elementConfig: z.record(
@@ -4225,18 +4225,7 @@ import {
4225
4225
  commandStartEvent
4226
4226
  } from "@elementor/editor-v1-adapters";
4227
4227
 
4228
- // src/style-commands/undoable-actions/paste-element-style.ts
4229
- import {
4230
- createElementStyle as createElementStyle2,
4231
- deleteElementStyle,
4232
- getElementStyles as getElementStyles3,
4233
- updateElementStyle as updateElementStyle2
4234
- } from "@elementor/editor-elements";
4235
- import { ELEMENTS_STYLES_RESERVED_LABEL } from "@elementor/editor-styles-repository";
4236
- import { undoable as undoable2 } from "@elementor/editor-v1-adapters";
4237
- import { __ as __6 } from "@wordpress/i18n";
4238
-
4239
- // src/style-commands/utils.ts
4228
+ // src/utils/command-utils.ts
4240
4229
  import { getElementLabel as getElementLabel2, getWidgetsCache as getWidgetsCache8 } from "@elementor/editor-elements";
4241
4230
  import { CLASSES_PROP_KEY } from "@elementor/editor-props";
4242
4231
  import { __ as __5 } from "@wordpress/i18n";
@@ -4279,6 +4268,15 @@ function getTitleForContainers(containers) {
4279
4268
  }
4280
4269
 
4281
4270
  // src/style-commands/undoable-actions/paste-element-style.ts
4271
+ import {
4272
+ createElementStyle as createElementStyle2,
4273
+ deleteElementStyle,
4274
+ getElementStyles as getElementStyles3,
4275
+ updateElementStyle as updateElementStyle2
4276
+ } from "@elementor/editor-elements";
4277
+ import { ELEMENTS_STYLES_RESERVED_LABEL } from "@elementor/editor-styles-repository";
4278
+ import { undoable as undoable2 } from "@elementor/editor-v1-adapters";
4279
+ import { __ as __6 } from "@wordpress/i18n";
4282
4280
  var undoablePasteElementStyle = () => undoable2(
4283
4281
  {
4284
4282
  do: ({ containers, newStyle }) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elementor/editor-canvas",
3
3
  "description": "Elementor Editor Canvas",
4
- "version": "4.0.0-manual",
4
+ "version": "4.1.0-685",
5
5
  "private": false,
6
6
  "author": "Elementor Team",
7
7
  "homepage": "https://elementor.com/",
@@ -37,24 +37,24 @@
37
37
  "react-dom": "^18.3.1"
38
38
  },
39
39
  "dependencies": {
40
- "@elementor/editor": "4.0.0-manual",
41
- "@elementor/editor-controls": "4.0.0-manual",
42
- "@elementor/editor-documents": "4.0.0-manual",
43
- "@elementor/editor-elements": "4.0.0-manual",
44
- "@elementor/editor-interactions": "4.0.0-manual",
45
- "@elementor/editor-mcp": "4.0.0-manual",
46
- "@elementor/editor-notifications": "4.0.0-manual",
47
- "@elementor/editor-props": "4.0.0-manual",
48
- "@elementor/editor-responsive": "4.0.0-manual",
49
- "@elementor/editor-styles": "4.0.0-manual",
50
- "@elementor/editor-styles-repository": "4.0.0-manual",
51
- "@elementor/editor-ui": "4.0.0-manual",
52
- "@elementor/editor-v1-adapters": "4.0.0-manual",
53
- "@elementor/schema": "4.0.0-manual",
54
- "@elementor/twing": "4.0.0-manual",
40
+ "@elementor/editor": "4.1.0-685",
41
+ "@elementor/editor-controls": "4.1.0-685",
42
+ "@elementor/editor-documents": "4.1.0-685",
43
+ "@elementor/editor-elements": "4.1.0-685",
44
+ "@elementor/editor-interactions": "4.1.0-685",
45
+ "@elementor/editor-mcp": "4.1.0-685",
46
+ "@elementor/editor-notifications": "4.1.0-685",
47
+ "@elementor/editor-props": "4.1.0-685",
48
+ "@elementor/editor-responsive": "4.1.0-685",
49
+ "@elementor/editor-styles": "4.1.0-685",
50
+ "@elementor/editor-styles-repository": "4.1.0-685",
51
+ "@elementor/editor-ui": "4.1.0-685",
52
+ "@elementor/editor-v1-adapters": "4.1.0-685",
53
+ "@elementor/schema": "4.1.0-685",
54
+ "@elementor/twing": "4.1.0-685",
55
55
  "@elementor/ui": "1.36.17",
56
- "@elementor/utils": "4.0.0-manual",
57
- "@elementor/wp-media": "4.0.0-manual",
56
+ "@elementor/utils": "4.1.0-685",
57
+ "@elementor/wp-media": "4.1.0-685",
58
58
  "@floating-ui/react": "^0.27.5",
59
59
  "@wordpress/i18n": "^5.13.0"
60
60
  },
@@ -128,6 +128,9 @@ describe( 'useStyleItems', () => {
128
128
 
129
129
  jest.mocked( stylesRepository ).getProviders.mockReturnValue( [ mockProvider1, mockProvider2 ] );
130
130
 
131
+ const provider1OriginalOrder = mockProvider1.actions.all().map( ( s ) => s.id );
132
+ const provider2OriginalOrder = mockProvider2.actions.all().map( ( s ) => s.id );
133
+
131
134
  let attachPreviewCallback: () => Promise< void >;
132
135
 
133
136
  jest.mocked( registerDataHook ).mockImplementation( ( position, command, callback ) => {
@@ -156,6 +159,9 @@ describe( 'useStyleItems', () => {
156
159
  { id: 'style2', breakpoint: 'desktop' },
157
160
  { id: 'style1', breakpoint: 'desktop' },
158
161
  ] );
162
+
163
+ expect( mockProvider1.actions.all().map( ( s ) => s.id ) ).toEqual( provider1OriginalOrder );
164
+ expect( mockProvider2.actions.all().map( ( s ) => s.id ) ).toEqual( provider2OriginalOrder );
159
165
  } );
160
166
 
161
167
  it( 'should return style items ordered by provider priority and breakpoint', async () => {
@@ -181,7 +181,7 @@ function createProviderSubscriber( { provider, renderStyles, setStyleItems, cach
181
181
  async function createItems( signal: AbortSignal ) {
182
182
  const allStyles = provider.actions.all();
183
183
 
184
- const styles = allStyles.reverse().map( ( style ) => {
184
+ const styles = [ ...allStyles ].reverse().map( ( style ) => {
185
185
  return {
186
186
  ...style,
187
187
  cssName: provider.actions.resolveCssName( style.id ),
package/src/index.ts CHANGED
@@ -2,7 +2,7 @@ export { BREAKPOINTS_SCHEMA_URI } from './mcp/resources/breakpoints-resource';
2
2
  export { STYLE_SCHEMA_URI } from './mcp/resources/widgets-schema-resource';
3
3
 
4
4
  export { init } from './init';
5
- export { isAtomicWidget } from './style-commands/utils';
5
+ export { isAtomicWidget } from './utils/command-utils';
6
6
 
7
7
  export {
8
8
  createTemplatedElementView,
@@ -223,13 +223,14 @@ type ContextMenuGroup = {
223
223
  actions: ContextMenuAction[];
224
224
  };
225
225
 
226
+ export type ContextMenuEventData = { location: string; secondaryLocation: string; trigger: string };
226
227
  export type ContextMenuAction = {
227
228
  name: string;
228
229
  icon: string;
229
230
  title: string | ( () => string );
230
231
  shortcut?: string;
231
232
  isEnabled: () => boolean;
232
- callback: ( _: unknown, eventData: unknown ) => void;
233
+ callback: ( _: unknown, eventData: ContextMenuEventData ) => void;
233
234
  };
234
235
 
235
236
  export type ReplacementSettings = {
@@ -1,4 +1,4 @@
1
- import { zod as z } from '@elementor/editor-mcp';
1
+ import { z } from '@elementor/schema';
2
2
 
3
3
  import { STYLE_SCHEMA_URI, WIDGET_SCHEMA_URI } from '../../resources/widgets-schema-resource';
4
4
 
@@ -19,14 +19,16 @@ import { classesPropTypeUtil } from '@elementor/editor-props';
19
19
  import { type StyleDefinition } from '@elementor/editor-styles';
20
20
  import { ELEMENTS_STYLES_RESERVED_LABEL } from '@elementor/editor-styles-repository';
21
21
 
22
+ import { getClipboardElements } from '../../utils/command-utils';
22
23
  import { initPasteStyleCommand } from '../paste-style';
23
- import { getClipboardElements } from '../utils';
24
24
 
25
25
  jest.mock( '@elementor/editor-elements' );
26
- jest.mock( '../utils', () => ( {
27
- ...jest.requireActual( '../utils' ),
26
+
27
+ jest.mock( '../../utils/command-utils', () => ( {
28
+ ...jest.requireActual( '../../utils/command-utils' ),
28
29
  getClipboardElements: jest.fn(),
29
30
  } ) );
31
+
30
32
  jest.mock( '@elementor/editor-v1-adapters', () => ( {
31
33
  ...jest.requireActual( '@elementor/editor-v1-adapters' ),
32
34
  blockCommand: jest.fn(),
@@ -7,13 +7,13 @@ import {
7
7
  import { createElementStyle, deleteElementStyle, getElementStyles } from '@elementor/editor-elements';
8
8
  import { ELEMENTS_STYLES_RESERVED_LABEL } from '@elementor/editor-styles-repository';
9
9
 
10
+ import { getClassesProp, hasAtomicWidgets, isAtomicWidget } from '../../utils/command-utils';
10
11
  import { initResetStyleCommand } from '../reset-style';
11
- import { getClassesProp, hasAtomicWidgets, isAtomicWidget } from '../utils';
12
12
 
13
13
  jest.mock( '@elementor/editor-elements' );
14
14
 
15
- jest.mock( '../utils', () => ( {
16
- ...jest.requireActual( '../utils' ),
15
+ jest.mock( '../../utils/command-utils', () => ( {
16
+ ...jest.requireActual( '../../utils/command-utils' ),
17
17
  getClassesProp: jest.fn(),
18
18
  hasAtomicWidgets: jest.fn(),
19
19
  isAtomicWidget: jest.fn(),
@@ -8,8 +8,14 @@ import {
8
8
  commandStartEvent,
9
9
  } from '@elementor/editor-v1-adapters';
10
10
 
11
+ import {
12
+ type ContainerArgs,
13
+ getClassesProp,
14
+ getClipboardElements,
15
+ hasAtomicWidgets,
16
+ isAtomicWidget,
17
+ } from '../utils/command-utils';
11
18
  import { undoablePasteElementStyle } from './undoable-actions/paste-element-style';
12
- import { type ContainerArgs, getClassesProp, getClipboardElements, hasAtomicWidgets, isAtomicWidget } from './utils';
13
19
 
14
20
  type PasteStylesCommandArgs = ContainerArgs & {
15
21
  storageKey?: string;
@@ -6,8 +6,8 @@ import {
6
6
  commandStartEvent,
7
7
  } from '@elementor/editor-v1-adapters';
8
8
 
9
+ import { type ContainerArgs, hasAtomicWidgets, isAtomicWidget } from '../utils/command-utils';
9
10
  import { undoableResetElementStyle } from './undoable-actions/reset-element-style';
10
- import { type ContainerArgs, hasAtomicWidgets, isAtomicWidget } from './utils';
11
11
 
12
12
  export function initResetStyleCommand() {
13
13
  const resetElementStyles = undoableResetElementStyle();
@@ -10,7 +10,7 @@ import { ELEMENTS_STYLES_RESERVED_LABEL } from '@elementor/editor-styles-reposit
10
10
  import { undoable } from '@elementor/editor-v1-adapters';
11
11
  import { __ } from '@wordpress/i18n';
12
12
 
13
- import { getClassesProp, getTitleForContainers } from '../utils';
13
+ import { getClassesProp, getTitleForContainers } from '../../utils/command-utils';
14
14
 
15
15
  type PasteElementStyleArgs = {
16
16
  containers: V1Element[];
@@ -3,7 +3,7 @@ import { ELEMENTS_STYLES_RESERVED_LABEL } from '@elementor/editor-styles-reposit
3
3
  import { undoable } from '@elementor/editor-v1-adapters';
4
4
  import { __ } from '@wordpress/i18n';
5
5
 
6
- import { getClassesProp, getTitleForContainers } from '../utils';
6
+ import { getClassesProp, getTitleForContainers } from '../../utils/command-utils';
7
7
 
8
8
  type ResetElementStyleArgs = {
9
9
  containers: V1Element[];