@elementor/editor-canvas 4.2.0-931 → 4.2.0-932

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 CHANGED
@@ -34,14 +34,14 @@ __export(index_exports, {
34
34
  BREAKPOINTS_SCHEMA_URI: () => BREAKPOINTS_SCHEMA_URI,
35
35
  DOCUMENT_STRUCTURE_URI: () => DOCUMENT_STRUCTURE_URI,
36
36
  GLOBAL_STYLES_IMPORTED_EVENT: () => GLOBAL_STYLES_IMPORTED_EVENT,
37
- STYLE_SCHEMA_FULL_URI: () => STYLE_SCHEMA_FULL_URI,
38
- STYLE_SCHEMA_URI: () => STYLE_SCHEMA_URI,
39
37
  SpotlightBackdrop: () => SpotlightBackdrop,
40
38
  UnknownStyleStateError: () => UnknownStyleStateError,
41
39
  UnknownStyleTypeError: () => UnknownStyleTypeError,
42
40
  WIDGET_SCHEMA_FULL_URI: () => WIDGET_SCHEMA_FULL_URI,
43
41
  WIDGET_SCHEMA_URI: () => WIDGET_SCHEMA_URI,
44
42
  canBeNestedTemplated: () => canBeNestedTemplated,
43
+ convertCssToAtomic: () => convertCssToAtomic,
44
+ convertStyleBlocksToAtomic: () => convertStyleBlocksToAtomic,
45
45
  createNestedTemplatedElementType: () => createNestedTemplatedElementType,
46
46
  createNestedTemplatedElementView: () => createNestedTemplatedElementView,
47
47
  createPropsResolver: () => createPropsResolver,
@@ -73,7 +73,6 @@ var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
73
73
  var import_editor_elements2 = require("@elementor/editor-elements");
74
74
  var import_editor_mcp = require("@elementor/editor-mcp");
75
75
  var import_editor_props = require("@elementor/editor-props");
76
- var import_editor_styles = require("@elementor/editor-styles");
77
76
 
78
77
  // src/composition-builder/utils/required-default-child-tags.ts
79
78
  function getRequiredDefaultChildTemplates(elementConfig) {
@@ -162,7 +161,6 @@ var CANVAS_SERVER_NAME = "editor-canvas";
162
161
  var WIDGET_SCHEMA_URI = "elementor://widgets/schema/{widgetType}";
163
162
  var WIDGET_SCHEMA_FULL_URI = `${CANVAS_SERVER_NAME}_${WIDGET_SCHEMA_URI}`;
164
163
  var STYLE_SCHEMA_URI = "elementor://styles/schema/{category}";
165
- var STYLE_SCHEMA_FULL_URI = `${CANVAS_SERVER_NAME}_${STYLE_SCHEMA_URI}`;
166
164
  var BEST_PRACTICES_URI = "elementor://styles/best-practices";
167
165
  var BEST_PRACTICES_FULL_URI = `${CANVAS_SERVER_NAME}_${BEST_PRACTICES_URI}`;
168
166
  var initWidgetsSchemaResource = (reg) => {
@@ -182,8 +180,7 @@ var initWidgetsSchemaResource = (reg) => {
182
180
  Prefer using "em" and "rem" values for text-related sizes, padding and spacing. Use percentages for dynamic sizing relative to parent containers.
183
181
  This flexboxes are by default "flex" with "stretch" alignment. To ensure proper layout, define the "justify-content" and "align-items" as in the schema.
184
182
 
185
- When applicable for styles, apply style PropValues using the ${STYLE_SCHEMA_URI}.
186
- The css string must follow standard CSS syntax, with properties and values separated by semicolons, no selectors, or nesting rules allowed.
183
+ Styling is provided as raw CSS. The css string must follow standard CSS syntax, with properties and values separated by semicolons, no selectors, or nesting rules allowed.
187
184
 
188
185
  ** CRITICAL - VARIABLES **
189
186
  When using global variables, ensure that the variables are defined in the ${"elementor://global-variables"} resource.
@@ -195,42 +192,6 @@ Variables from the user context ARE NOT SUPPORTED AND WILL RESOLVE IN ERROR.
195
192
  };
196
193
  }
197
194
  );
198
- resource(
199
- "styles-schema",
200
- new import_editor_mcp.ResourceTemplate(STYLE_SCHEMA_URI, {
201
- list: () => {
202
- const categories = [...Object.keys((0, import_editor_styles.getStylesSchema)())].filter((category) => category !== "all");
203
- return {
204
- resources: categories.map((category) => ({
205
- uri: `elementor://styles/schema/${category}`,
206
- name: "Style schema for " + category
207
- }))
208
- };
209
- }
210
- }),
211
- {
212
- description: "Common styles schema for the specified category (applicable for V4 elements only)"
213
- },
214
- async (uri, variables) => {
215
- const category = typeof variables.category === "string" ? variables.category : variables.category?.[0];
216
- const stylesSchema = (0, import_editor_styles.getStylesSchema)()[category];
217
- if (!stylesSchema) {
218
- throw new Error(`No styles schema found for category: ${category}`);
219
- }
220
- const asJson = import_editor_props.Schema.propTypeToJsonSchema(stylesSchema);
221
- return {
222
- contents: [
223
- {
224
- uri: uri.toString(),
225
- mimeType: "application/json",
226
- text: JSON.stringify(
227
- import_editor_props.Schema.enrichWithIntention(asJson, 'Desired CSS in format "property: value;"')
228
- )
229
- }
230
- ]
231
- };
232
- }
233
- );
234
195
  resource(
235
196
  "widget-schema-by-type",
236
197
  new import_editor_mcp.ResourceTemplate(WIDGET_SCHEMA_URI, {
@@ -375,6 +336,23 @@ var initBreakpointsResource = (reg) => {
375
336
  });
376
337
  };
377
338
 
339
+ // src/mcp/utils/convert-css-to-atomic.ts
340
+ var import_http_client = require("@elementor/http-client");
341
+ var CSS_TO_ATOMIC_URL = "elementor/v1/css-to-atomic";
342
+ var SINGLE_BLOCK_KEY = "default";
343
+ var convertBlocks = async (blocks) => {
344
+ const { data } = await (0, import_http_client.httpService)().post(
345
+ CSS_TO_ATOMIC_URL,
346
+ { blocks }
347
+ );
348
+ return data.data;
349
+ };
350
+ var convertStyleBlocksToAtomic = async (styleByName) => convertBlocks(styleByName);
351
+ var convertCssToAtomic = async (style) => {
352
+ const results = await convertStyleBlocksToAtomic({ [SINGLE_BLOCK_KEY]: style });
353
+ return results[SINGLE_BLOCK_KEY];
354
+ };
355
+
378
356
  // src/init.tsx
379
357
  var import_editor = require("@elementor/editor");
380
358
  var import_editor_mcp4 = require("@elementor/editor-mcp");
@@ -1333,7 +1311,7 @@ function getLinkAttrs(el) {
1333
1311
  // src/hooks/use-style-items.ts
1334
1312
  var import_react15 = require("react");
1335
1313
  var import_editor_responsive2 = require("@elementor/editor-responsive");
1336
- var import_editor_styles4 = require("@elementor/editor-styles");
1314
+ var import_editor_styles3 = require("@elementor/editor-styles");
1337
1315
  var import_editor_styles_repository2 = require("@elementor/editor-styles-repository");
1338
1316
  var import_editor_v1_adapters9 = require("@elementor/editor-v1-adapters");
1339
1317
 
@@ -1394,7 +1372,7 @@ function signalizedProcess(signal, steps = []) {
1394
1372
 
1395
1373
  // src/hooks/use-style-prop-resolver.ts
1396
1374
  var import_react13 = require("react");
1397
- var import_editor_styles2 = require("@elementor/editor-styles");
1375
+ var import_editor_styles = require("@elementor/editor-styles");
1398
1376
  var import_editor_v1_adapters8 = require("@elementor/editor-v1-adapters");
1399
1377
 
1400
1378
  // src/renderers/create-props-resolver.ts
@@ -1524,7 +1502,7 @@ function useStylePropResolver() {
1524
1502
  return (0, import_react13.useMemo)(() => {
1525
1503
  return createPropsResolver({
1526
1504
  transformers: styleTransformersRegistry,
1527
- schema: (0, import_editor_styles2.getStylesSchema)(),
1505
+ schema: (0, import_editor_styles.getStylesSchema)(),
1528
1506
  onPropResolve: ({ key, value }) => {
1529
1507
  if (key !== "font-family" || typeof value !== "string") {
1530
1508
  return;
@@ -1540,7 +1518,7 @@ var import_react14 = require("react");
1540
1518
  var import_editor_responsive = require("@elementor/editor-responsive");
1541
1519
 
1542
1520
  // src/renderers/create-styles-renderer.ts
1543
- var import_editor_styles3 = require("@elementor/editor-styles");
1521
+ var import_editor_styles2 = require("@elementor/editor-styles");
1544
1522
  var import_utils4 = require("@elementor/utils");
1545
1523
 
1546
1524
  // src/renderers/errors.ts
@@ -1604,7 +1582,7 @@ function createStyleWrapper(value = "", wrapper) {
1604
1582
  },
1605
1583
  withPrefix: (prefix) => createStyleWrapper([prefix, value].filter(Boolean).join(" "), wrapper),
1606
1584
  withState: (state) => {
1607
- const selector = (0, import_editor_styles3.getSelectorWithState)(value, state);
1585
+ const selector = (0, import_editor_styles2.getSelectorWithState)(value, state);
1608
1586
  return createStyleWrapper(selector, wrapper);
1609
1587
  },
1610
1588
  withMediaQuery: (breakpoint) => {
@@ -1715,10 +1693,10 @@ function prioritySorter({ provider: providerA }, { provider: providerB }) {
1715
1693
  return providerA.priority - providerB.priority;
1716
1694
  }
1717
1695
  function stateSorter({ state: stateA }, { state: stateB }) {
1718
- if ((0, import_editor_styles4.isClassState)(stateA) && !(0, import_editor_styles4.isClassState)(stateB)) {
1696
+ if ((0, import_editor_styles3.isClassState)(stateA) && !(0, import_editor_styles3.isClassState)(stateB)) {
1719
1697
  return -1;
1720
1698
  }
1721
- if (!(0, import_editor_styles4.isClassState)(stateA) && (0, import_editor_styles4.isClassState)(stateB)) {
1699
+ if (!(0, import_editor_styles3.isClassState)(stateA) && (0, import_editor_styles3.isClassState)(stateB)) {
1722
1700
  return 1;
1723
1701
  }
1724
1702
  return 0;
@@ -4606,15 +4584,15 @@ function getElementDisplayName(container) {
4606
4584
 
4607
4585
  // src/mcp/tools/build-composition/tool.ts
4608
4586
  var import_editor_documents3 = require("@elementor/editor-documents");
4609
- var import_editor_elements16 = require("@elementor/editor-elements");
4587
+ var import_editor_elements15 = require("@elementor/editor-elements");
4610
4588
 
4611
4589
  // src/composition-builder/composition-builder.ts
4612
- var import_editor_elements15 = require("@elementor/editor-elements");
4590
+ var import_editor_elements14 = require("@elementor/editor-elements");
4613
4591
 
4614
4592
  // src/mcp/utils/do-update-element-property.ts
4615
4593
  var import_editor_elements13 = require("@elementor/editor-elements");
4616
4594
  var import_editor_props8 = require("@elementor/editor-props");
4617
- var import_editor_styles5 = require("@elementor/editor-styles");
4595
+ var import_editor_styles4 = require("@elementor/editor-styles");
4618
4596
  var import_editor_v1_adapters21 = require("@elementor/editor-v1-adapters");
4619
4597
 
4620
4598
  // src/mcp/utils/merge-custom-css.ts
@@ -4651,7 +4629,7 @@ var doUpdateElementProperty = (params) => {
4651
4629
  if (propertyName === "_styles") {
4652
4630
  const elementStyles = (0, import_editor_elements13.getElementStyles)(elementId) || {};
4653
4631
  const propertyMapValue = propertyValue;
4654
- const styleSchema = (0, import_editor_styles5.getStylesSchema)();
4632
+ const styleSchema = (0, import_editor_styles4.getStylesSchema)();
4655
4633
  const transformedStyleValues = Object.fromEntries(
4656
4634
  Object.entries(propertyMapValue).map(([key, val]) => {
4657
4635
  if (key === "custom_css") {
@@ -4661,11 +4639,14 @@ var doUpdateElementProperty = (params) => {
4661
4639
  if (!propKey2 && kind !== "union") {
4662
4640
  throw new Error(`_styles property ${key} is not supported.`);
4663
4641
  }
4642
+ if (val === null) {
4643
+ return [key, null];
4644
+ }
4664
4645
  return [key, resolvePropValue(val, propKey2)];
4665
4646
  })
4666
4647
  );
4667
4648
  const localStyle = Object.values(elementStyles).find((style) => style.label === "local");
4668
- const existingCustomCssText = localStyle ? readStoredCustomCssText((0, import_editor_styles5.getVariantByMeta)(localStyle, LOCAL_STYLE_META)?.custom_css?.raw) : "";
4649
+ const existingCustomCssText = localStyle ? readStoredCustomCssText((0, import_editor_styles4.getVariantByMeta)(localStyle, LOCAL_STYLE_META)?.custom_css?.raw) : "";
4669
4650
  let customCss;
4670
4651
  Object.keys(propertyMapValue).forEach((stylePropName) => {
4671
4652
  const propertyRawSchema = styleSchema[stylePropName];
@@ -4765,91 +4746,6 @@ Expected Schema: ${jsonSchema}`
4765
4746
  (0, import_editor_v1_adapters21.__privateRunCommandSync)("document/save/set-is-modified", { status: true }, { internal: true });
4766
4747
  };
4767
4748
 
4768
- // src/mcp/utils/validate-input.ts
4769
- var import_editor_elements14 = require("@elementor/editor-elements");
4770
- var import_editor_props9 = require("@elementor/editor-props");
4771
- var import_editor_styles6 = require("@elementor/editor-styles");
4772
- var _widgetsSchema = null;
4773
- var validateInput = {
4774
- get widgetsSchema() {
4775
- if (!_widgetsSchema) {
4776
- const schema2 = {};
4777
- const cache = (0, import_editor_elements14.getWidgetsCache)();
4778
- if (!cache) {
4779
- return {};
4780
- }
4781
- Object.entries(cache).forEach(([widgetType, widgetData]) => {
4782
- if (widgetData.atomic_props_schema) {
4783
- schema2[widgetType] = structuredClone(widgetData.atomic_props_schema);
4784
- }
4785
- });
4786
- _widgetsSchema = schema2;
4787
- }
4788
- return _widgetsSchema;
4789
- },
4790
- validateProps(schema2, values, ignore = []) {
4791
- if (!schema2) {
4792
- throw new Error("No schema provided for validation.");
4793
- }
4794
- const errors = [];
4795
- let hasInvalidKey = false;
4796
- Object.entries(values).forEach(([propName, propValue]) => {
4797
- if (ignore.includes(propName)) {
4798
- return;
4799
- }
4800
- const propSchema = schema2[propName];
4801
- if (!propSchema) {
4802
- errors.push(`Property "${propName}" is not defined in the schema.`);
4803
- hasInvalidKey = true;
4804
- } else if (!import_editor_props9.Schema.isPropKeyConfigurable(propName, propSchema)) {
4805
- errors.push(`Property "${propName}" is not configurable.`);
4806
- } else {
4807
- const { valid } = import_editor_props9.Schema.validatePropValue(propSchema, propValue);
4808
- if (!valid) {
4809
- errors.push(
4810
- `Invalid property "${propName}". Validate input with resource [${STYLE_SCHEMA_URI.replace(
4811
- "{category}",
4812
- propName
4813
- )}]`
4814
- );
4815
- }
4816
- }
4817
- });
4818
- if (hasInvalidKey) {
4819
- errors.push("Available properties: " + Object.keys(schema2).join(", "));
4820
- }
4821
- return {
4822
- errors,
4823
- valid: errors.length === 0
4824
- };
4825
- },
4826
- validateStyles(values) {
4827
- const styleSchema = (0, import_editor_styles6.getStylesSchema)();
4828
- const customCssValue = values.custom_css;
4829
- const result = this.validateProps(styleSchema, values, ["custom_css", "$intention"]);
4830
- const appendInvalidCustomCssErr = () => {
4831
- result.valid = false;
4832
- result.errors = result.errors || [];
4833
- result.errors.push('Invalid property "custom_css". Expected a string value.');
4834
- };
4835
- if (customCssValue && typeof customCssValue === "object") {
4836
- if (typeof customCssValue.value !== "string") {
4837
- appendInvalidCustomCssErr();
4838
- }
4839
- } else if (typeof customCssValue !== "string" && typeof customCssValue !== "undefined" && customCssValue !== null) {
4840
- appendInvalidCustomCssErr();
4841
- }
4842
- return result;
4843
- },
4844
- validatePropSchema(widgetType, values, ignore = []) {
4845
- const schema2 = this.widgetsSchema[widgetType];
4846
- if (!schema2) {
4847
- return { valid: false, errors: [`No schema found for widget type "${widgetType}".`] };
4848
- }
4849
- return this.validateProps(schema2, values, ignore);
4850
- }
4851
- };
4852
-
4853
4749
  // src/composition-builder/utils/required-children-enforcer.ts
4854
4750
  var REQUIRED_CHILD_SCHEMA_HINT = "Use the widget schema resource; under llm_guidance.required_direct_children for V4 widgets.";
4855
4751
  var RequiredChildrenEnforcer = class {
@@ -4898,11 +4794,11 @@ var CompositionBuilder = class _CompositionBuilder {
4898
4794
  elementCustomCSS = {};
4899
4795
  rootContainers = [];
4900
4796
  api = {
4901
- createElement: import_editor_elements15.createElement,
4902
- deleteElement: import_editor_elements15.deleteElement,
4903
- getWidgetsCache: import_editor_elements15.getWidgetsCache,
4904
- generateElementId: import_editor_elements15.generateElementId,
4905
- getContainer: import_editor_elements15.getContainer,
4797
+ createElement: import_editor_elements14.createElement,
4798
+ deleteElement: import_editor_elements14.deleteElement,
4799
+ getWidgetsCache: import_editor_elements14.getWidgetsCache,
4800
+ generateElementId: import_editor_elements14.generateElementId,
4801
+ getContainer: import_editor_elements14.getContainer,
4906
4802
  doUpdateElementProperty
4907
4803
  };
4908
4804
  xml;
@@ -5039,19 +4935,12 @@ var CompositionBuilder = class _CompositionBuilder {
5039
4935
  }
5040
4936
  }
5041
4937
  const styleConfig = this.elementStylesConfig[configId];
5042
- let hasInvalidStyles = false;
4938
+ const hasInvalidStyles = false;
5043
4939
  if (styleConfig) {
5044
4940
  const validStylesPropValues = {};
5045
4941
  for (const [styleName, stylePropValue] of Object.entries(styleConfig)) {
5046
4942
  if (styleName === "$intention") {
5047
4943
  continue;
5048
- }
5049
- const { valid, errors: validationErrors } = validateInput.validateStyles({
5050
- [styleName]: stylePropValue
5051
- });
5052
- if (!valid) {
5053
- hasInvalidStyles = true;
5054
- styleErrors.push(...validationErrors || []);
5055
4944
  } else {
5056
4945
  validStylesPropValues[styleName] = stylePropValue;
5057
4946
  }
@@ -5165,7 +5054,7 @@ var generatePrompt = () => {
5165
5054
  This tool support v4 elements only
5166
5055
 
5167
5056
  # WORKFLOW
5168
- 1. Check/create global classes via "create-global-class" tool
5057
+ 1. Check/create global classes via "manage-global-classes" tool
5169
5058
  2. Build composition (THIS TOOL) - minimal inline styles
5170
5059
  3. Apply classes via "apply-global-class" tool
5171
5060
 
@@ -5183,8 +5072,9 @@ Some elements have internal tree structures (nesting). When using these elements
5183
5072
  - \`allowed_parents\` lists which element types this element can be placed inside
5184
5073
 
5185
5074
  # CONFIGURATION
5186
- - Map configuration-id \u2192 elementConfig (props) + stylesConfig (layout only)
5187
- - All PropValues require \`$$type\` matching schema
5075
+ - Map configuration-id \u2192 elementConfig (props) + style (raw CSS declarations)
5076
+ - elementConfig PropValues require \`$$type\` matching schema
5077
+ - style is raw CSS (property \u2192 value strings); the server converts it to native styles and stores any unconvertible declarations as the element custom CSS
5188
5078
  - NO LINKS in configuration
5189
5079
  - Retry on errors up to 10x
5190
5080
 
@@ -5270,8 +5160,7 @@ BAD: \`<e-flexbox style="height:100vh"><e-div-block style="height:100vh">overflo
5270
5160
  # PARAMETERS
5271
5161
  - **xmlStructure**: Valid XML with configuration-id attributes
5272
5162
  - **elementConfig**: configuration-id \u2192 widget PropValues
5273
- - **stylesConfig**: configuration-id \u2192 style PropValues (layout only)
5274
- - **customCSS**: configuration-id \u2192 CSS rules (no selectors, semicolon-separated)
5163
+ - **style**: configuration-id \u2192 raw CSS declarations (property \u2192 value strings; no selectors)
5275
5164
  `);
5276
5165
  buildCompositionsToolPrompt.example(`
5277
5166
  Section with heading + button (NO explicit heights - content sizes naturally):
@@ -5280,13 +5169,12 @@ Section with heading + button (NO explicit heights - content sizes naturally):
5280
5169
  elementConfig: {
5281
5170
  "section1": { "tag": { "$$type": "string", "value": "section" } }
5282
5171
  },
5283
- customCSS: {
5284
- "Section Title": "padding: 6rem 4rem; background: linear-gradient(135deg, #faf8f5 0%, #f0ebe4 100%);"
5285
- },
5286
- stylesConfig: {
5172
+ style: {
5287
5173
  "Section Title": {
5288
- "font-size": { "$$type": "size", "value": { "size": { "$$type": "number", "value": 3.5 }, "unit": { "$$type": "string", "value": "rem" } } },
5289
- "color": { "$$type": "color", "value": { "$$type": "string", "value": "#2d2a26" } }
5174
+ "padding": "6rem 4rem",
5175
+ "background": "linear-gradient(135deg, #faf8f5 0%, #f0ebe4 100%)",
5176
+ "font-size": "3.5rem",
5177
+ "color": "#2d2a26"
5290
5178
  }
5291
5179
  }
5292
5180
  }
@@ -5298,8 +5186,8 @@ Note: No height/width specified on any element - flexbox handles layout automati
5298
5186
  );
5299
5187
  buildCompositionsToolPrompt.parameter("elementConfig", `Record mapping configuration IDs to widget PropValues.`);
5300
5188
  buildCompositionsToolPrompt.parameter(
5301
- "stylesConfig",
5302
- `Record mapping configuration IDs to style PropValues (layout/positioning only).`
5189
+ "style",
5190
+ `Record mapping configuration IDs to raw CSS declarations (property \u2192 value strings).`
5303
5191
  );
5304
5192
  buildCompositionsToolPrompt.instruction(
5305
5193
  `Element IDs in the returned XML represent actual widgets. Use these IDs for subsequent styling or configuration changes.`
@@ -5318,19 +5206,15 @@ var inputSchema = {
5318
5206
  import_schema.z.any().describe(`The PropValue for the property, refer to ${WIDGET_SCHEMA_URI}`)
5319
5207
  )
5320
5208
  ).describe("A record mapping element IDs to their configuration objects. REQUIRED"),
5321
- stylesConfig: import_schema.z.record(
5209
+ style: import_schema.z.record(
5322
5210
  import_schema.z.string().describe("The configuration id"),
5323
5211
  import_schema.z.record(
5324
- import_schema.z.string().describe("StyleSchema property name"),
5325
- import_schema.z.any().describe(`The PropValue for the style property. MANDATORY, refer to [${STYLE_SCHEMA_URI}]`)
5212
+ import_schema.z.string().describe('A CSS property name, e.g. "color", "padding".'),
5213
+ import_schema.z.string().describe('A CSS value, e.g. "6rem 4rem", "#2d2a26".')
5326
5214
  )
5327
5215
  ).describe(
5328
- `A record mapping element IDs to their styles configuration objects. Use the actual styles schema from [${STYLE_SCHEMA_URI}].`
5329
- ).default({}),
5330
- customCSS: import_schema.z.record(
5331
- import_schema.z.string().describe("The configuration id"),
5332
- import_schema.z.string().describe("The custom CSS for the element. MANDATORY")
5333
- ).describe("A record mapping element IDs to their custom CSS.").default({})
5216
+ "A record mapping element configuration IDs to their raw CSS declarations (property\u2192value). Converted to native styles server-side; any declaration that cannot be converted is stored as the element custom CSS."
5217
+ ).default({})
5334
5218
  };
5335
5219
  var outputSchema = {
5336
5220
  errors: import_schema.z.string().describe("Error message if the composition building failed").optional(),
@@ -5412,7 +5296,6 @@ var initBuildCompositionsTool = (reg) => {
5412
5296
  requiredResources: [
5413
5297
  { description: "Build compositions guide", uri: BUILD_COMPOSITIONS_GUIDE_URI },
5414
5298
  { description: "Widgets schema", uri: WIDGET_SCHEMA_URI },
5415
- { description: "Styles schema", uri: STYLE_SCHEMA_URI },
5416
5299
  { description: "Global Classes", uri: "elementor://global-classes" },
5417
5300
  { description: "Global Variables", uri: "elementor://global-variables" },
5418
5301
  { description: "Styles best practices", uri: BEST_PRACTICES_URI },
@@ -5422,21 +5305,23 @@ var initBuildCompositionsTool = (reg) => {
5422
5305
  outputSchema,
5423
5306
  handler: async (rawParams) => {
5424
5307
  assertCompositionXmlUsesV4WidgetsOnly(rawParams.xmlStructure);
5425
- const { xmlStructure, elementConfig, stylesConfig, customCSS } = adaptLeafRootParams({
5308
+ const { stylesConfig: convertedStyles, customCSS } = await convertCompositionStyles(rawParams.style);
5309
+ const { xmlStructure, elementConfig, stylesConfig } = adaptLeafRootParams({
5426
5310
  ...rawParams,
5427
- widgetsCache: (0, import_editor_elements16.getWidgetsCache)() ?? {}
5311
+ stylesConfig: convertedStyles,
5312
+ widgetsCache: (0, import_editor_elements15.getWidgetsCache)() ?? {}
5428
5313
  });
5429
5314
  let generatedXML = "";
5430
5315
  const errors = [];
5431
5316
  const rootContainers = [];
5432
- const documentContainer = (0, import_editor_elements16.getContainer)("document");
5317
+ const documentContainer = (0, import_editor_elements15.getContainer)("document");
5433
5318
  const currentDocument = (0, import_editor_documents3.getCurrentDocument)();
5434
5319
  const targetContainer = getCompositionTargetContainer(documentContainer, currentDocument?.type.value);
5435
5320
  try {
5436
5321
  const compositionBuilder = CompositionBuilder.fromXMLString(xmlStructure, {
5437
- createElement: import_editor_elements16.createElement,
5438
- deleteElement: import_editor_elements16.deleteElement,
5439
- getWidgetsCache: import_editor_elements16.getWidgetsCache
5322
+ createElement: import_editor_elements15.createElement,
5323
+ deleteElement: import_editor_elements15.deleteElement,
5324
+ getWidgetsCache: import_editor_elements15.getWidgetsCache
5440
5325
  });
5441
5326
  compositionBuilder.setElementConfig(elementConfig);
5442
5327
  compositionBuilder.setStylesConfig(stylesConfig);
@@ -5452,7 +5337,7 @@ var initBuildCompositionsTool = (reg) => {
5452
5337
  }
5453
5338
  if (errors.length) {
5454
5339
  rootContainers.forEach((rootContainer) => {
5455
- (0, import_editor_elements16.deleteElement)({
5340
+ (0, import_editor_elements15.deleteElement)({
5456
5341
  container: rootContainer,
5457
5342
  options: { useHistory: false }
5458
5343
  });
@@ -5501,12 +5386,27 @@ Remember: Global classes ensure design consistency and reusability. Don't skip a
5501
5386
  }
5502
5387
  });
5503
5388
  };
5389
+ async function convertCompositionStyles(style) {
5390
+ const stylesConfig = {};
5391
+ const customCSS = {};
5392
+ if (!style || Object.keys(style).length === 0) {
5393
+ return { stylesConfig, customCSS };
5394
+ }
5395
+ const results = await convertStyleBlocksToAtomic(style);
5396
+ for (const [configId, { props, customCss }] of Object.entries(results)) {
5397
+ stylesConfig[configId] = props;
5398
+ if (customCss) {
5399
+ customCSS[configId] = customCss;
5400
+ }
5401
+ }
5402
+ return { stylesConfig, customCSS };
5403
+ }
5504
5404
  function assertCompositionXmlUsesV4WidgetsOnly(xmlStructure) {
5505
5405
  const doc = new DOMParser().parseFromString(xmlStructure, "application/xml");
5506
5406
  if (doc.querySelector("parsererror")) {
5507
5407
  throw new Error("Failed to parse XML string: " + doc);
5508
5408
  }
5509
- const widgetsCache = (0, import_editor_elements16.getWidgetsCache)() ?? {};
5409
+ const widgetsCache = (0, import_editor_elements15.getWidgetsCache)() ?? {};
5510
5410
  for (const node of doc.querySelectorAll("*")) {
5511
5411
  const type = node.tagName;
5512
5412
  const widgetData = widgetsCache[type];
@@ -5525,6 +5425,91 @@ function assertCompositionXmlUsesV4WidgetsOnly(xmlStructure) {
5525
5425
  // src/mcp/tools/configure-element/tool.ts
5526
5426
  var import_editor_elements17 = require("@elementor/editor-elements");
5527
5427
 
5428
+ // src/mcp/utils/validate-input.ts
5429
+ var import_editor_elements16 = require("@elementor/editor-elements");
5430
+ var import_editor_props9 = require("@elementor/editor-props");
5431
+ var import_editor_styles5 = require("@elementor/editor-styles");
5432
+ var _widgetsSchema = null;
5433
+ var validateInput = {
5434
+ get widgetsSchema() {
5435
+ if (!_widgetsSchema) {
5436
+ const schema2 = {};
5437
+ const cache = (0, import_editor_elements16.getWidgetsCache)();
5438
+ if (!cache) {
5439
+ return {};
5440
+ }
5441
+ Object.entries(cache).forEach(([widgetType, widgetData]) => {
5442
+ if (widgetData.atomic_props_schema) {
5443
+ schema2[widgetType] = structuredClone(widgetData.atomic_props_schema);
5444
+ }
5445
+ });
5446
+ _widgetsSchema = schema2;
5447
+ }
5448
+ return _widgetsSchema;
5449
+ },
5450
+ validateProps(schema2, values, ignore = []) {
5451
+ if (!schema2) {
5452
+ throw new Error("No schema provided for validation.");
5453
+ }
5454
+ const errors = [];
5455
+ let hasInvalidKey = false;
5456
+ Object.entries(values).forEach(([propName, propValue]) => {
5457
+ if (ignore.includes(propName)) {
5458
+ return;
5459
+ }
5460
+ const propSchema = schema2[propName];
5461
+ if (!propSchema) {
5462
+ errors.push(`Property "${propName}" is not defined in the schema.`);
5463
+ hasInvalidKey = true;
5464
+ } else if (!import_editor_props9.Schema.isPropKeyConfigurable(propName, propSchema)) {
5465
+ errors.push(`Property "${propName}" is not configurable.`);
5466
+ } else {
5467
+ const { valid } = import_editor_props9.Schema.validatePropValue(propSchema, propValue);
5468
+ if (!valid) {
5469
+ errors.push(
5470
+ `Invalid property "${propName}". Validate input with resource [${STYLE_SCHEMA_URI.replace(
5471
+ "{category}",
5472
+ propName
5473
+ )}]`
5474
+ );
5475
+ }
5476
+ }
5477
+ });
5478
+ if (hasInvalidKey) {
5479
+ errors.push("Available properties: " + Object.keys(schema2).join(", "));
5480
+ }
5481
+ return {
5482
+ errors,
5483
+ valid: errors.length === 0
5484
+ };
5485
+ },
5486
+ validateStyles(values) {
5487
+ const styleSchema = (0, import_editor_styles5.getStylesSchema)();
5488
+ const customCssValue = values.custom_css;
5489
+ const result = this.validateProps(styleSchema, values, ["custom_css", "$intention"]);
5490
+ const appendInvalidCustomCssErr = () => {
5491
+ result.valid = false;
5492
+ result.errors = result.errors || [];
5493
+ result.errors.push('Invalid property "custom_css". Expected a string value.');
5494
+ };
5495
+ if (customCssValue && typeof customCssValue === "object") {
5496
+ if (typeof customCssValue.value !== "string") {
5497
+ appendInvalidCustomCssErr();
5498
+ }
5499
+ } else if (typeof customCssValue !== "string" && typeof customCssValue !== "undefined" && customCssValue !== null) {
5500
+ appendInvalidCustomCssErr();
5501
+ }
5502
+ return result;
5503
+ },
5504
+ validatePropSchema(widgetType, values, ignore = []) {
5505
+ const schema2 = this.widgetsSchema[widgetType];
5506
+ if (!schema2) {
5507
+ return { valid: false, errors: [`No schema found for widget type "${widgetType}".`] };
5508
+ }
5509
+ return this.validateProps(schema2, values, ignore);
5510
+ }
5511
+ };
5512
+
5528
5513
  // src/mcp/tools/configure-element/prompt.ts
5529
5514
  var import_editor_mcp3 = require("@elementor/editor-mcp");
5530
5515
  var CONFIGURE_ELEMENT_GUIDE_URI = "elementor://canvas/tools/configure-element-guide";
@@ -5534,54 +5519,43 @@ var generatePrompt2 = () => {
5534
5519
  Configure an existing element on the page.
5535
5520
 
5536
5521
  # **CRITICAL - REQUIRED INFORMATION (Must read before using this tool)**
5537
- 1. [${WIDGET_SCHEMA_URI}]
5538
- Required to understand which widgets are available, and what are their configuration schemas.
5539
- Every widgetType (i.e. e-heading, e-button) that is supported has it's own property schema, that you must follow in order to apply parameter values correctly.
5540
- 2. [${STYLE_SCHEMA_URI}]
5541
- Required to understand the styles schema for the widgets. All widgets share the same styles schema, grouped by categories.
5542
- Use this resource to understand which style properties are available for each element, and how to structure the "stylePropertiesToChange" parameter.
5543
- 3. If not sure about the PropValues schema, you can use the "get-element-configuration-values" tool to retrieve the current PropValues configuration of the element.
5544
-
5545
- Before using this tool, check the definitions of the elements PropTypes at the resource "widget-schema-by-type" at editor-canvas__elementor://widgets/schema/{widgetType}
5546
- All widgets share a common _style property for styling, which uses the common styles schema.
5547
- Retrieve and check the common styles schema at the resource list "styles-schema" at editor-canvas__elementor://styles/schema/{category}
5522
+ 1. [${WIDGET_SCHEMA_URI}] \u2014 **Widget properties** (\`propertiesToChange\`): each widgetType (e.g. e-heading, e-button) has its own PropType schema; values must be PropValues with \`$$type\`.
5523
+ 2. [elementor://global-variables] \u2014 **Design tokens for styling**: use labels in CSS as \`var(--label)\` or \`var(--label, fallback)\`; only variables listed here are valid.
5524
+ 3. **Styling** (\`style\` parameter): flat map of CSS property \u2192 value strings \u2014 **not** PropValues. The server converts to native styles; unconvertible declarations become custom CSS.
5525
+ 4. **Current state**: \`get-element-configuration-values\` returns \`properties\` as PropValues and \`style\` in stored form; when writing, send raw CSS in \`style\`, not copied PropValues.
5526
+
5527
+ Before using this tool, read the widget PropType schema at editor-canvas__elementor://widgets/schema/{widgetType}
5548
5528
 
5549
5529
  # When to use this tool
5550
5530
  When a user requires to change anything in an element, such as updating text, colors, sizes, or other configurable properties.
5551
5531
  This tool handles elements of type "widget".
5552
- This tool handles styling elements, using the "stylePropertiesToChange" parameter.
5532
+ This tool handles styling elements, using the "style" parameter (raw CSS as a property \u2192 value map).
5553
5533
 
5554
- To CLEAR a property (i.e., set it to default or none), provide null as a value.
5534
+ To CLEAR a property (i.e., set it to default or none), provide null as a value - example: \`background-color: null\`.
5555
5535
 
5556
5536
  The element's schema must be known before using this tool.
5557
- The style schema must be known before using this tool.
5558
-
5559
- Attached resource link describing how PropType schema should be parsed as PropValue for this tool.
5560
5537
 
5561
- Read carefully the PropType Schema of the element and it's styles, then apply correct PropValue according to the schema.
5562
-
5563
- PropValue structure:
5538
+ **PropValue structure (for \`propertiesToChange\` only \u2014 not for \`style\`):**
5564
5539
  {
5565
5540
  "$$type": string, // MANDATORY as defined in the PropType schema under the "key" property
5566
5541
  value: unknown // The value according to the PropType schema for kinds of "array", use array with PropValues items inside. For "object", read the shape property of the PropType schema. For "plain", use strings.
5567
5542
  }
5568
5543
 
5569
5544
  <IMPORTANT>
5570
- ALWAYS MAKE SURE you have the PropType schemas for the element you are configuring, and the common-styles schema for styling. If you are not sure, retrieve the schema from the resources mentioned above.
5545
+ ALWAYS MAKE SURE you have the PropType schemas for the element you are configuring. If you are not sure, retrieve the schema from the resources mentioned above.
5571
5546
  </IMPORTANT>
5572
5547
 
5573
- You can use multiple property changes at once by providing multiple entries in the propertiesToChange object, including _style alongside non-style props.
5548
+ You can use multiple property changes at once by providing multiple entries in the propertiesToChange object.
5574
5549
  Some properties are nested, use the root property name, then objects with nested values inside, as the complete schema suggests.
5575
5550
 
5576
5551
  Make sure you have the "widget-schema-by-type" resource available to retrieve the PropType schema for the element type you are configuring.
5577
- Make sure you have the "styles-schema" resources available to retrieve the common styles schema.
5578
5552
 
5579
5553
  # How to configure elements
5580
- We use a dedicated PropType Schema for configuring elements, including styles. When you configure an element, you must use the EXACT PropType Value as defined in the schema.
5581
- For styleProperties, use the style schema provided, as it also uses the PropType format.
5582
- For all non-primitive types, provide the key property as defined in the schema as $$type in the generated object, as it is MANDATORY for parsing.
5554
+ We use a dedicated PropType Schema for configuring element properties (propertiesToChange). When you configure an element property, you must use the EXACT PropType Value as defined in the schema.
5555
+ For styling, use the "style" parameter with raw CSS declarations (property \u2192 value strings) - e.g. \`color: var(--primary-text, #000); height: 4rem;\`;
5556
+ For all non-primitive entries in \`propertiesToChange\`, provide the schema \`key\` as \`$$type\` in the generated object, as it is MANDATORY for parsing.
5583
5557
 
5584
- Use the EXACT "PROP-TYPE" Schema given, and ALWAYS include the "key" property from the original configuration for every property you are changing.
5558
+ Use the EXACT PropType schema given, and ALWAYS include the \`key\` from the schema for every property you are changing in \`propertiesToChange\`.
5585
5559
 
5586
5560
  # Dynamic tags
5587
5561
  A value can be made dynamic wherever its schema exposes a variant with "$$type": "dynamic". This may be the property root OR a NESTED field: for example an image is made dynamic on its "src" (the root stays "image"), NOT on the whole "image" value.
@@ -5608,8 +5582,8 @@ Do NOT send "group" (it is resolved automatically). Use { "settings": {} } only
5608
5582
  "An object containing the properties to change, with their new values. MANDATORY. When updating a style only, provide an empty object."
5609
5583
  );
5610
5584
  configureElementToolPrompt.parameter(
5611
- "stylePropertiesToChange",
5612
- "An object containing the style properties to change, with their new values. OPTIONAL."
5585
+ "style",
5586
+ 'A flat map of raw CSS declarations (property \u2192 value), e.g. { "line-height": "1.25rem", "color": "var(--primary-text, #000)" }. Set a value to null to reset that property to its default. OPTIONAL.'
5613
5587
  );
5614
5588
  configureElementToolPrompt.example(`
5615
5589
  \`\`\`json
@@ -5625,20 +5599,9 @@ Do NOT send "group" (it is resolved automatically). Use { "settings": {} } only
5625
5599
  value: false
5626
5600
  },
5627
5601
  },
5628
- stylePropertiesToChange: {
5629
- 'line-height': {
5630
- $$type: 'size',
5631
- value: {
5632
- size: {
5633
- $$type: 'number',
5634
- value: 20
5635
- },
5636
- unit: {
5637
- $$type: 'string',
5638
- value: 'px'
5639
- }
5640
- }
5641
- }
5602
+ style: {
5603
+ 'line-height': '1.25rem',
5604
+ 'color': 'var(--primary-text, #000)'
5642
5605
  },
5643
5606
  elementId: 'element-id',
5644
5607
  elementType: 'element-type'
@@ -5646,7 +5609,7 @@ Do NOT send "group" (it is resolved automatically). Use { "settings": {} } only
5646
5609
  \`\`\`
5647
5610
  `);
5648
5611
  configureElementToolPrompt.instruction(
5649
- "The $$type property is MANDATORY for every value; it is required to parse the value and apply application-level effects."
5612
+ "The $$type property is MANDATORY for every value in propertiesToChange; it is not used in the style parameter (raw CSS only)."
5650
5613
  );
5651
5614
  configureElementToolPrompt.instruction(`
5652
5615
  V4 only: If MCP fails, give manual steps using V4 UI.
@@ -5667,11 +5630,14 @@ var inputSchema2 = {
5667
5630
  import_schema3.z.any().describe(`PropValue, refer to [${WIDGET_SCHEMA_URI}] by correct type, as appears in elementType`),
5668
5631
  import_schema3.z.any()
5669
5632
  ).describe("An object record containing property names and their new values to be set on the element"),
5670
- stylePropertiesToChange: import_schema3.z.record(
5671
- import_schema3.z.string().describe("The style property name"),
5672
- import_schema3.z.any().describe(`The style PropValue, refer to [${STYLE_SCHEMA_URI}] how to generate values`),
5673
- import_schema3.z.any()
5674
- ).describe("An object record containing style property names and their new values to be set on the element").default({}),
5633
+ style: import_schema3.z.record(
5634
+ import_schema3.z.string().describe('A CSS property name, e.g. "color", "margin-top".'),
5635
+ import_schema3.z.string().nullable().describe(
5636
+ 'A CSS value, e.g. "red", "10px", "1px solid #000". Use null to reset the property to its default.'
5637
+ )
5638
+ ).describe(
5639
+ "Raw CSS declarations as a flat property\u2192value map. Converted to native styles server-side; any declaration that cannot be converted is stored as the element custom CSS. A null value resets that property to its default."
5640
+ ).default({}),
5675
5641
  elementType: import_schema3.z.string().describe("The type of the element to retrieve the schema"),
5676
5642
  elementId: import_schema3.z.string().describe("The unique id of the element to configure")
5677
5643
  };
@@ -5703,11 +5669,10 @@ var initConfigureElementTool = (reg) => {
5703
5669
  outputSchema: outputSchema2,
5704
5670
  requiredResources: [
5705
5671
  { description: "Widgets schema", uri: WIDGET_SCHEMA_URI },
5706
- { description: "Styles schema", uri: STYLE_SCHEMA_URI },
5707
5672
  { description: "Configure element guide", uri: CONFIGURE_ELEMENT_GUIDE_URI },
5708
5673
  { description: "Dynamic tags catalog", uri: DYNAMIC_TAGS_URI }
5709
5674
  ],
5710
- handler: ({ elementId, propertiesToChange, elementType, stylePropertiesToChange }) => {
5675
+ handler: async ({ elementId, propertiesToChange, elementType, style }) => {
5711
5676
  const widgetData = (0, import_editor_elements17.getWidgetsCache)()?.[elementType];
5712
5677
  if (!widgetData) {
5713
5678
  throw new Error(
@@ -5721,21 +5686,12 @@ var initConfigureElementTool = (reg) => {
5721
5686
  }
5722
5687
  const toUpdate = Object.entries(propertiesToChange);
5723
5688
  const { valid, errors } = validateInput.validatePropSchema(elementType, propertiesToChange);
5724
- const { valid: stylesValid, errors: stylesErrors } = validateInput.validateStyles(
5725
- stylePropertiesToChange || {}
5726
- );
5727
5689
  if (!valid) {
5728
5690
  const errorMessage = `Failed to configure element "${elementId}" due to invalid properties: ${errors?.join(
5729
5691
  "\n- "
5730
5692
  )}`;
5731
5693
  throw new Error(errorMessage);
5732
5694
  }
5733
- if (!stylesValid) {
5734
- const errorMessage = `Failed to configure element "${elementId}" due to invalid style properties: ${stylesErrors?.join(
5735
- "\n- "
5736
- )}`;
5737
- throw new Error(errorMessage);
5738
- }
5739
5695
  for (const [propertyName, propertyValue] of toUpdate) {
5740
5696
  try {
5741
5697
  doUpdateElementProperty({
@@ -5755,33 +5711,46 @@ var initConfigureElementTool = (reg) => {
5755
5711
  throw new Error(errorMessage);
5756
5712
  }
5757
5713
  }
5758
- for (const [stylePropertyName, stylePropertyValue] of Object.entries(stylePropertiesToChange || {})) {
5759
- try {
5760
- doUpdateElementProperty({
5761
- elementId,
5762
- elementType,
5763
- propertyName: "_styles",
5764
- propertyValue: {
5765
- [stylePropertyName]: stylePropertyValue
5766
- }
5767
- });
5768
- } catch (error) {
5769
- const errorMessage = createUpdateErrorMessage({
5770
- propertyName: `(style) ${stylePropertyName}`,
5771
- elementId,
5772
- elementType,
5773
- propertyType: "style",
5774
- error
5775
- });
5776
- throw new Error(errorMessage);
5777
- }
5778
- }
5714
+ await applyStyleFromCss({ elementId, elementType, style });
5779
5715
  return {
5780
5716
  success: true
5781
5717
  };
5782
5718
  }
5783
5719
  });
5784
5720
  };
5721
+ async function applyStyleFromCss(opts) {
5722
+ const { elementId, elementType, style } = opts;
5723
+ if (!style || Object.keys(style).length === 0) {
5724
+ return;
5725
+ }
5726
+ const { props, customCss } = await convertCssToAtomic(style);
5727
+ const styleValue = { ...props };
5728
+ if (customCss) {
5729
+ styleValue.custom_css = customCss;
5730
+ }
5731
+ if (Object.keys(styleValue).length === 0) {
5732
+ return;
5733
+ }
5734
+ try {
5735
+ doUpdateElementProperty({
5736
+ elementId,
5737
+ elementType,
5738
+ propertyName: "_styles",
5739
+ propertyValue: styleValue,
5740
+ customCssWriteMode: "merge-with-stored"
5741
+ });
5742
+ } catch (error) {
5743
+ throw new Error(
5744
+ createUpdateErrorMessage({
5745
+ propertyName: "(style)",
5746
+ elementId,
5747
+ elementType,
5748
+ propertyType: "style",
5749
+ error
5750
+ })
5751
+ );
5752
+ }
5753
+ }
5785
5754
  function createUpdateErrorMessage(opts) {
5786
5755
  const { propertyName, elementId, elementType, error, propertyType } = opts;
5787
5756
  return `Failed to update property "${propertyName}" on element "${elementId}": ${error.message}.
@@ -5791,11 +5760,7 @@ Check the element's PropType schema at the resource [${WIDGET_SCHEMA_URI.replace
5791
5760
  elementType
5792
5761
  )}] for type "${elementType}" to ensure the property exists and the value matches the expected PropType.
5793
5762
  Now that you have this information, ensure you have the schema and try again.` : `
5794
- Check the styles schema at the resource [${STYLE_SCHEMA_URI.replace(
5795
- "{category}",
5796
- propertyName
5797
- )}] at editor-canvas__elementor://styles/schema/{category} to ensure the style property exists and the value matches the expected PropType.
5798
- `};
5763
+ Provide styling as raw CSS via the "style" parameter (a flat map of CSS property \u2192 value). Declarations that cannot be converted are stored as the element custom CSS.`};
5799
5764
  }`;
5800
5765
  }
5801
5766
 
@@ -5929,7 +5894,6 @@ The \`$$type\` defines how Elementor interprets the value. Providing the correct
5929
5894
  - **Global Variables**: Reusable colors, sizes, and fonts (\`elementor://global-variables\`)
5930
5895
  - **Global Classes**: Reusable style sets that can be applied to elements (\`elementor://global-classes\`)
5931
5896
  - **Widget Schemas**: Configuration options for each widget type (\`${WIDGET_SCHEMA_URI}\`)
5932
- - **Style Schema**: Common styles shared across all widgets and containers (\`${STYLE_SCHEMA_URI}\`)
5933
5897
 
5934
5898
  # Building Compositions with build_composition
5935
5899
 
@@ -5978,28 +5942,25 @@ Map each configuration-id to its widget properties using PropValues:
5978
5942
  }
5979
5943
  \`\`\`
5980
5944
 
5981
- ### 6. Create stylesConfig
5982
- Map each configuration-id to style PropValues from \`${STYLE_SCHEMA_URI}\`:
5983
- - Use global variables for colors, sizes, and fonts
5984
- - Example using global variable:
5945
+ ### 6. Create style
5946
+ Map each configuration-id to raw CSS declarations (property \u2192 value strings). The server converts them to native styles and stores any unconvertible declarations as the element custom CSS.
5947
+ - Example:
5985
5948
  \`\`\`json
5986
5949
  {
5987
- "heading-1": {
5988
- "color": { "$$type": "global-color-variable", "value": "primary-color-id" },
5989
- "font-size": { "$$type": "size", "value": "2rem" }
5950
+ "heading-1": "color: #1a1a1a; font-size: 2rem;"
5990
5951
  }
5991
5952
  }
5992
5953
  \`\`\`
5993
5954
 
5994
5955
  ### 7. Execute build_composition
5995
- Call the tool with your XML structure, elementConfig, and stylesConfig. The response will contain the created element IDs.
5956
+ Call the tool with your XML structure, elementConfig, and style. The response will contain the created element IDs.
5996
5957
  At the response you will also find llm_instructions for you to do afterwards, read and follow them!
5997
5958
 
5998
5959
  ## Key Points
5999
5960
 
6000
5961
  - **PropValue Types**: Arrays that accept union types are typed as mixed arrays
6001
- - **Visual Sizing**: Widget sizes MUST be defined in stylesConfig. Widget properties like image "size" control resolution, not visual appearance
6002
- - **Global Variables**: Reference by ID in PropValues (e.g., \`{ "$$type": "global-color-variable", "value": "variable-id" }\`)
5962
+ - **Visual Sizing**: Widget sizes MUST be defined via the style parameter (raw CSS). Widget properties like image "size" control resolution, not visual appearance
5963
+ - **Global Variables**: Reference by label/name: (e.g. var(--card-background-color)
6003
5964
  - **Naming Conventions**: Use meaningful, purpose-based names (e.g., "primary-button", "heading-large"), not value-based names (e.g., "blue-style", "20px-padding")
6004
5965
 
6005
5966
  ## Example: e-image PropValue Structure
@@ -6017,7 +5978,7 @@ At the response you will also find llm_instructions for you to do afterwards, re
6017
5978
  }
6018
5979
  }
6019
5980
  \`\`\`
6020
- Note: The "size" property controls image resolution/loading, not visual size. Set visual dimensions in stylesConfig.
5981
+ Note: The "size" property controls image resolution/loading, not visual size. Set visual dimensions via the style parameter (raw CSS).
6021
5982
  `;
6022
5983
 
6023
5984
  // src/prevent-link-in-link-commands.ts
@@ -6541,14 +6502,14 @@ function hasDoAfterRender(view) {
6541
6502
  BREAKPOINTS_SCHEMA_URI,
6542
6503
  DOCUMENT_STRUCTURE_URI,
6543
6504
  GLOBAL_STYLES_IMPORTED_EVENT,
6544
- STYLE_SCHEMA_FULL_URI,
6545
- STYLE_SCHEMA_URI,
6546
6505
  SpotlightBackdrop,
6547
6506
  UnknownStyleStateError,
6548
6507
  UnknownStyleTypeError,
6549
6508
  WIDGET_SCHEMA_FULL_URI,
6550
6509
  WIDGET_SCHEMA_URI,
6551
6510
  canBeNestedTemplated,
6511
+ convertCssToAtomic,
6512
+ convertStyleBlocksToAtomic,
6552
6513
  createNestedTemplatedElementType,
6553
6514
  createNestedTemplatedElementView,
6554
6515
  createPropsResolver,