@elementor/editor-canvas 4.1.0-828 → 4.1.0-830
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 +16 -14
- package/dist/index.mjs +16 -14
- package/package.json +18 -18
- package/src/composition-builder/composition-builder.ts +5 -5
- package/src/form-structure/utils.ts +2 -0
- package/src/mcp/tools/build-composition/prompt.ts +1 -1
- package/src/mcp/tools/configure-element/prompt.ts +6 -6
- package/src/mcp/tools/configure-element/schema.ts +1 -1
- package/src/mcp/utils/do-update-element-property.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -1300,7 +1300,9 @@ var FORM_FIELD_ELEMENT_TYPES = /* @__PURE__ */ new Set([
|
|
|
1300
1300
|
"e-form-checkbox",
|
|
1301
1301
|
"e-form-submit-button",
|
|
1302
1302
|
"e-form-select",
|
|
1303
|
-
"e-form-radio-button"
|
|
1303
|
+
"e-form-radio-button",
|
|
1304
|
+
"e-form-file-upload",
|
|
1305
|
+
"e-form-date-picker"
|
|
1304
1306
|
]);
|
|
1305
1307
|
function getArgsElementType(args) {
|
|
1306
1308
|
return args.model?.widgetType || args.model?.elType;
|
|
@@ -4074,7 +4076,7 @@ var validateInput = {
|
|
|
4074
4076
|
var CompositionBuilder = class _CompositionBuilder {
|
|
4075
4077
|
elementConfig = {};
|
|
4076
4078
|
elementStylesConfig = {};
|
|
4077
|
-
|
|
4079
|
+
elementCustomCSS = {};
|
|
4078
4080
|
rootContainers = [];
|
|
4079
4081
|
api = {
|
|
4080
4082
|
createElement: import_editor_elements13.createElement,
|
|
@@ -4111,7 +4113,7 @@ var CompositionBuilder = class _CompositionBuilder {
|
|
|
4111
4113
|
this.elementStylesConfig = config;
|
|
4112
4114
|
}
|
|
4113
4115
|
setCustomCSS(config) {
|
|
4114
|
-
this.
|
|
4116
|
+
this.elementCustomCSS = config;
|
|
4115
4117
|
}
|
|
4116
4118
|
getXML() {
|
|
4117
4119
|
return this.xml;
|
|
@@ -4191,7 +4193,7 @@ var CompositionBuilder = class _CompositionBuilder {
|
|
|
4191
4193
|
const allConfigIds = /* @__PURE__ */ new Set([
|
|
4192
4194
|
...Object.keys(this.elementConfig),
|
|
4193
4195
|
...Object.keys(this.elementStylesConfig),
|
|
4194
|
-
...Object.keys(this.
|
|
4196
|
+
...Object.keys(this.elementCustomCSS)
|
|
4195
4197
|
]);
|
|
4196
4198
|
for (const configId of allConfigIds) {
|
|
4197
4199
|
let element, node;
|
|
@@ -4202,7 +4204,7 @@ var CompositionBuilder = class _CompositionBuilder {
|
|
|
4202
4204
|
if (this.elementConfig[configId]) {
|
|
4203
4205
|
configErrors.push(msg);
|
|
4204
4206
|
}
|
|
4205
|
-
if (this.elementStylesConfig[configId] || this.
|
|
4207
|
+
if (this.elementStylesConfig[configId] || this.elementCustomCSS[configId]) {
|
|
4206
4208
|
styleErrors.push(msg);
|
|
4207
4209
|
}
|
|
4208
4210
|
continue;
|
|
@@ -4252,7 +4254,7 @@ var CompositionBuilder = class _CompositionBuilder {
|
|
|
4252
4254
|
}
|
|
4253
4255
|
}
|
|
4254
4256
|
}
|
|
4255
|
-
const customCSS = this.
|
|
4257
|
+
const customCSS = this.elementCustomCSS[configId];
|
|
4256
4258
|
if (customCSS) {
|
|
4257
4259
|
try {
|
|
4258
4260
|
this.api.doUpdateElementProperty({
|
|
@@ -4325,7 +4327,7 @@ var generatePrompt = () => {
|
|
|
4325
4327
|
- [elementor://global-variables] - ONLY use variables defined here
|
|
4326
4328
|
- [${AVAILABLE_WIDGETS_URI}/v4]
|
|
4327
4329
|
|
|
4328
|
-
# TOOL
|
|
4330
|
+
# TOOL SUPPORT
|
|
4329
4331
|
This tool support v4 elements only
|
|
4330
4332
|
|
|
4331
4333
|
# WORKFLOW
|
|
@@ -4640,11 +4642,11 @@ var configureElementToolPrompt = `Configure an existing element on the page.
|
|
|
4640
4642
|
2. [${STYLE_SCHEMA_URI}]
|
|
4641
4643
|
Required to understand the styles schema for the widgets. All widgets share the same styles schema, grouped by categories.
|
|
4642
4644
|
Use this resource to understand which style properties are available for each element, and how to structure the "stylePropertiesToChange" parameter.
|
|
4643
|
-
3. If not sure about the PropValues schema, you can use the "get-element-configuration-values" tool to
|
|
4645
|
+
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.
|
|
4644
4646
|
|
|
4645
4647
|
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}
|
|
4646
4648
|
All widgets share a common _style property for styling, which uses the common styles schema.
|
|
4647
|
-
|
|
4649
|
+
Retrieve and check the common styles schema at the resource list "styles-schema" at editor-canvas__elementor://styles/schema/{category}
|
|
4648
4650
|
|
|
4649
4651
|
# Parameters
|
|
4650
4652
|
- propertiesToChange: An object containing the properties to change, with their new values. MANDATORY. When updating a style only, provide an empty object.
|
|
@@ -4673,19 +4675,19 @@ PropValue structure:
|
|
|
4673
4675
|
}
|
|
4674
4676
|
|
|
4675
4677
|
<IMPORTANT>
|
|
4676
|
-
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,
|
|
4678
|
+
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.
|
|
4677
4679
|
</IMPORTANT>
|
|
4678
4680
|
|
|
4679
4681
|
You can use multiple property changes at once by providing multiple entries in the propertiesToChange object, including _style alongside non-style props.
|
|
4680
4682
|
Some properties are nested, use the root property name, then objects with nested values inside, as the complete schema suggests.
|
|
4681
4683
|
|
|
4682
|
-
Make sure you have the "widget-schema-by-type" resource available to
|
|
4683
|
-
Make sure you have to "styles-schema" resources available to
|
|
4684
|
+
Make sure you have the "widget-schema-by-type" resource available to retrieve the PropType schema for the element type you are configuring.
|
|
4685
|
+
Make sure you have to "styles-schema" resources available to retrieve the common styles schema.
|
|
4684
4686
|
|
|
4685
4687
|
# How to configure elements
|
|
4686
4688
|
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.
|
|
4687
4689
|
For styleProperties, use the style schema provided, as it also uses the PropType format.
|
|
4688
|
-
For all non-primitive types, provide the key property as defined in the schema as $$type in the generated
|
|
4690
|
+
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.
|
|
4689
4691
|
|
|
4690
4692
|
Use the EXACT "PROP-TYPE" Schema given, and ALWAYS include the "key" property from the original configuration for every property you are changing.
|
|
4691
4693
|
|
|
@@ -4741,7 +4743,7 @@ var inputSchema2 = {
|
|
|
4741
4743
|
import_schema3.z.any().describe(`The style PropValue, refer to [${STYLE_SCHEMA_URI}] how to generate values`),
|
|
4742
4744
|
import_schema3.z.any()
|
|
4743
4745
|
).describe("An object record containing style property names and their new values to be set on the element").default({}),
|
|
4744
|
-
elementType: import_schema3.z.string().describe("The type of the element to
|
|
4746
|
+
elementType: import_schema3.z.string().describe("The type of the element to retrieve the schema"),
|
|
4745
4747
|
elementId: import_schema3.z.string().describe("The unique id of the element to configure")
|
|
4746
4748
|
};
|
|
4747
4749
|
var outputSchema2 = {
|
package/dist/index.mjs
CHANGED
|
@@ -1264,7 +1264,9 @@ var FORM_FIELD_ELEMENT_TYPES = /* @__PURE__ */ new Set([
|
|
|
1264
1264
|
"e-form-checkbox",
|
|
1265
1265
|
"e-form-submit-button",
|
|
1266
1266
|
"e-form-select",
|
|
1267
|
-
"e-form-radio-button"
|
|
1267
|
+
"e-form-radio-button",
|
|
1268
|
+
"e-form-file-upload",
|
|
1269
|
+
"e-form-date-picker"
|
|
1268
1270
|
]);
|
|
1269
1271
|
function getArgsElementType(args) {
|
|
1270
1272
|
return args.model?.widgetType || args.model?.elType;
|
|
@@ -4068,7 +4070,7 @@ var validateInput = {
|
|
|
4068
4070
|
var CompositionBuilder = class _CompositionBuilder {
|
|
4069
4071
|
elementConfig = {};
|
|
4070
4072
|
elementStylesConfig = {};
|
|
4071
|
-
|
|
4073
|
+
elementCustomCSS = {};
|
|
4072
4074
|
rootContainers = [];
|
|
4073
4075
|
api = {
|
|
4074
4076
|
createElement: createElement7,
|
|
@@ -4105,7 +4107,7 @@ var CompositionBuilder = class _CompositionBuilder {
|
|
|
4105
4107
|
this.elementStylesConfig = config;
|
|
4106
4108
|
}
|
|
4107
4109
|
setCustomCSS(config) {
|
|
4108
|
-
this.
|
|
4110
|
+
this.elementCustomCSS = config;
|
|
4109
4111
|
}
|
|
4110
4112
|
getXML() {
|
|
4111
4113
|
return this.xml;
|
|
@@ -4185,7 +4187,7 @@ var CompositionBuilder = class _CompositionBuilder {
|
|
|
4185
4187
|
const allConfigIds = /* @__PURE__ */ new Set([
|
|
4186
4188
|
...Object.keys(this.elementConfig),
|
|
4187
4189
|
...Object.keys(this.elementStylesConfig),
|
|
4188
|
-
...Object.keys(this.
|
|
4190
|
+
...Object.keys(this.elementCustomCSS)
|
|
4189
4191
|
]);
|
|
4190
4192
|
for (const configId of allConfigIds) {
|
|
4191
4193
|
let element, node;
|
|
@@ -4196,7 +4198,7 @@ var CompositionBuilder = class _CompositionBuilder {
|
|
|
4196
4198
|
if (this.elementConfig[configId]) {
|
|
4197
4199
|
configErrors.push(msg);
|
|
4198
4200
|
}
|
|
4199
|
-
if (this.elementStylesConfig[configId] || this.
|
|
4201
|
+
if (this.elementStylesConfig[configId] || this.elementCustomCSS[configId]) {
|
|
4200
4202
|
styleErrors.push(msg);
|
|
4201
4203
|
}
|
|
4202
4204
|
continue;
|
|
@@ -4246,7 +4248,7 @@ var CompositionBuilder = class _CompositionBuilder {
|
|
|
4246
4248
|
}
|
|
4247
4249
|
}
|
|
4248
4250
|
}
|
|
4249
|
-
const customCSS = this.
|
|
4251
|
+
const customCSS = this.elementCustomCSS[configId];
|
|
4250
4252
|
if (customCSS) {
|
|
4251
4253
|
try {
|
|
4252
4254
|
this.api.doUpdateElementProperty({
|
|
@@ -4319,7 +4321,7 @@ var generatePrompt = () => {
|
|
|
4319
4321
|
- [elementor://global-variables] - ONLY use variables defined here
|
|
4320
4322
|
- [${AVAILABLE_WIDGETS_URI}/v4]
|
|
4321
4323
|
|
|
4322
|
-
# TOOL
|
|
4324
|
+
# TOOL SUPPORT
|
|
4323
4325
|
This tool support v4 elements only
|
|
4324
4326
|
|
|
4325
4327
|
# WORKFLOW
|
|
@@ -4634,11 +4636,11 @@ var configureElementToolPrompt = `Configure an existing element on the page.
|
|
|
4634
4636
|
2. [${STYLE_SCHEMA_URI}]
|
|
4635
4637
|
Required to understand the styles schema for the widgets. All widgets share the same styles schema, grouped by categories.
|
|
4636
4638
|
Use this resource to understand which style properties are available for each element, and how to structure the "stylePropertiesToChange" parameter.
|
|
4637
|
-
3. If not sure about the PropValues schema, you can use the "get-element-configuration-values" tool to
|
|
4639
|
+
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.
|
|
4638
4640
|
|
|
4639
4641
|
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}
|
|
4640
4642
|
All widgets share a common _style property for styling, which uses the common styles schema.
|
|
4641
|
-
|
|
4643
|
+
Retrieve and check the common styles schema at the resource list "styles-schema" at editor-canvas__elementor://styles/schema/{category}
|
|
4642
4644
|
|
|
4643
4645
|
# Parameters
|
|
4644
4646
|
- propertiesToChange: An object containing the properties to change, with their new values. MANDATORY. When updating a style only, provide an empty object.
|
|
@@ -4667,19 +4669,19 @@ PropValue structure:
|
|
|
4667
4669
|
}
|
|
4668
4670
|
|
|
4669
4671
|
<IMPORTANT>
|
|
4670
|
-
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,
|
|
4672
|
+
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.
|
|
4671
4673
|
</IMPORTANT>
|
|
4672
4674
|
|
|
4673
4675
|
You can use multiple property changes at once by providing multiple entries in the propertiesToChange object, including _style alongside non-style props.
|
|
4674
4676
|
Some properties are nested, use the root property name, then objects with nested values inside, as the complete schema suggests.
|
|
4675
4677
|
|
|
4676
|
-
Make sure you have the "widget-schema-by-type" resource available to
|
|
4677
|
-
Make sure you have to "styles-schema" resources available to
|
|
4678
|
+
Make sure you have the "widget-schema-by-type" resource available to retrieve the PropType schema for the element type you are configuring.
|
|
4679
|
+
Make sure you have to "styles-schema" resources available to retrieve the common styles schema.
|
|
4678
4680
|
|
|
4679
4681
|
# How to configure elements
|
|
4680
4682
|
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.
|
|
4681
4683
|
For styleProperties, use the style schema provided, as it also uses the PropType format.
|
|
4682
|
-
For all non-primitive types, provide the key property as defined in the schema as $$type in the generated
|
|
4684
|
+
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.
|
|
4683
4685
|
|
|
4684
4686
|
Use the EXACT "PROP-TYPE" Schema given, and ALWAYS include the "key" property from the original configuration for every property you are changing.
|
|
4685
4687
|
|
|
@@ -4735,7 +4737,7 @@ var inputSchema2 = {
|
|
|
4735
4737
|
z2.any().describe(`The style PropValue, refer to [${STYLE_SCHEMA_URI}] how to generate values`),
|
|
4736
4738
|
z2.any()
|
|
4737
4739
|
).describe("An object record containing style property names and their new values to be set on the element").default({}),
|
|
4738
|
-
elementType: z2.string().describe("The type of the element to
|
|
4740
|
+
elementType: z2.string().describe("The type of the element to retrieve the schema"),
|
|
4739
4741
|
elementId: z2.string().describe("The unique id of the element to configure")
|
|
4740
4742
|
};
|
|
4741
4743
|
var outputSchema2 = {
|
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.1.0-
|
|
4
|
+
"version": "4.1.0-830",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -37,25 +37,25 @@
|
|
|
37
37
|
"react-dom": "^18.3.1"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@elementor/editor": "4.1.0-
|
|
40
|
+
"@elementor/editor": "4.1.0-830",
|
|
41
41
|
"dompurify": "^3.2.6",
|
|
42
|
-
"@elementor/editor-controls": "4.1.0-
|
|
43
|
-
"@elementor/editor-documents": "4.1.0-
|
|
44
|
-
"@elementor/editor-elements": "4.1.0-
|
|
45
|
-
"@elementor/editor-interactions": "4.1.0-
|
|
46
|
-
"@elementor/editor-mcp": "4.1.0-
|
|
47
|
-
"@elementor/editor-notifications": "4.1.0-
|
|
48
|
-
"@elementor/editor-props": "4.1.0-
|
|
49
|
-
"@elementor/editor-responsive": "4.1.0-
|
|
50
|
-
"@elementor/editor-styles": "4.1.0-
|
|
51
|
-
"@elementor/editor-styles-repository": "4.1.0-
|
|
52
|
-
"@elementor/editor-ui": "4.1.0-
|
|
53
|
-
"@elementor/editor-v1-adapters": "4.1.0-
|
|
54
|
-
"@elementor/schema": "4.1.0-
|
|
55
|
-
"@elementor/twing": "4.1.0-
|
|
42
|
+
"@elementor/editor-controls": "4.1.0-830",
|
|
43
|
+
"@elementor/editor-documents": "4.1.0-830",
|
|
44
|
+
"@elementor/editor-elements": "4.1.0-830",
|
|
45
|
+
"@elementor/editor-interactions": "4.1.0-830",
|
|
46
|
+
"@elementor/editor-mcp": "4.1.0-830",
|
|
47
|
+
"@elementor/editor-notifications": "4.1.0-830",
|
|
48
|
+
"@elementor/editor-props": "4.1.0-830",
|
|
49
|
+
"@elementor/editor-responsive": "4.1.0-830",
|
|
50
|
+
"@elementor/editor-styles": "4.1.0-830",
|
|
51
|
+
"@elementor/editor-styles-repository": "4.1.0-830",
|
|
52
|
+
"@elementor/editor-ui": "4.1.0-830",
|
|
53
|
+
"@elementor/editor-v1-adapters": "4.1.0-830",
|
|
54
|
+
"@elementor/schema": "4.1.0-830",
|
|
55
|
+
"@elementor/twing": "4.1.0-830",
|
|
56
56
|
"@elementor/ui": "1.37.5",
|
|
57
|
-
"@elementor/utils": "4.1.0-
|
|
58
|
-
"@elementor/wp-media": "4.1.0-
|
|
57
|
+
"@elementor/utils": "4.1.0-830",
|
|
58
|
+
"@elementor/wp-media": "4.1.0-830",
|
|
59
59
|
"@floating-ui/react": "^0.27.5",
|
|
60
60
|
"@wordpress/i18n": "^5.13.0"
|
|
61
61
|
},
|
|
@@ -34,7 +34,7 @@ type CtorOptions = {
|
|
|
34
34
|
export class CompositionBuilder {
|
|
35
35
|
private elementConfig: Record< string, Record< string, AnyValue > > = {};
|
|
36
36
|
private elementStylesConfig: Record< string, Record< string, AnyValue > > = {};
|
|
37
|
-
private
|
|
37
|
+
private elementCustomCSS: Record< string, string > = {};
|
|
38
38
|
private rootContainers: V1Element[] = [];
|
|
39
39
|
private api: API = {
|
|
40
40
|
createElement,
|
|
@@ -76,7 +76,7 @@ export class CompositionBuilder {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
setCustomCSS( config: Record< string, string > ) {
|
|
79
|
-
this.
|
|
79
|
+
this.elementCustomCSS = config;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
getXML() {
|
|
@@ -176,7 +176,7 @@ export class CompositionBuilder {
|
|
|
176
176
|
const allConfigIds = new Set( [
|
|
177
177
|
...Object.keys( this.elementConfig ),
|
|
178
178
|
...Object.keys( this.elementStylesConfig ),
|
|
179
|
-
...Object.keys( this.
|
|
179
|
+
...Object.keys( this.elementCustomCSS ),
|
|
180
180
|
] );
|
|
181
181
|
|
|
182
182
|
for ( const configId of allConfigIds ) {
|
|
@@ -188,7 +188,7 @@ export class CompositionBuilder {
|
|
|
188
188
|
if ( this.elementConfig[ configId ] ) {
|
|
189
189
|
configErrors.push( msg );
|
|
190
190
|
}
|
|
191
|
-
if ( this.elementStylesConfig[ configId ] || this.
|
|
191
|
+
if ( this.elementStylesConfig[ configId ] || this.elementCustomCSS[ configId ] ) {
|
|
192
192
|
styleErrors.push( msg );
|
|
193
193
|
}
|
|
194
194
|
continue;
|
|
@@ -241,7 +241,7 @@ export class CompositionBuilder {
|
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
-
const customCSS = this.
|
|
244
|
+
const customCSS = this.elementCustomCSS[ configId ];
|
|
245
245
|
if ( customCSS ) {
|
|
246
246
|
try {
|
|
247
247
|
this.api.doUpdateElementProperty( {
|
|
@@ -42,6 +42,8 @@ export const FORM_FIELD_ELEMENT_TYPES = new Set( [
|
|
|
42
42
|
'e-form-submit-button',
|
|
43
43
|
'e-form-select',
|
|
44
44
|
'e-form-radio-button',
|
|
45
|
+
'e-form-file-upload',
|
|
46
|
+
'e-form-date-picker',
|
|
45
47
|
] );
|
|
46
48
|
|
|
47
49
|
export function getArgsElementType( args: CreateArgs ): string | undefined {
|
|
@@ -9,11 +9,11 @@ export const configureElementToolPrompt = `Configure an existing element on the
|
|
|
9
9
|
2. [${ STYLE_SCHEMA_URI }]
|
|
10
10
|
Required to understand the styles schema for the widgets. All widgets share the same styles schema, grouped by categories.
|
|
11
11
|
Use this resource to understand which style properties are available for each element, and how to structure the "stylePropertiesToChange" parameter.
|
|
12
|
-
3. If not sure about the PropValues schema, you can use the "get-element-configuration-values" tool to
|
|
12
|
+
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.
|
|
13
13
|
|
|
14
14
|
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}
|
|
15
15
|
All widgets share a common _style property for styling, which uses the common styles schema.
|
|
16
|
-
|
|
16
|
+
Retrieve and check the common styles schema at the resource list "styles-schema" at editor-canvas__elementor://styles/schema/{category}
|
|
17
17
|
|
|
18
18
|
# Parameters
|
|
19
19
|
- propertiesToChange: An object containing the properties to change, with their new values. MANDATORY. When updating a style only, provide an empty object.
|
|
@@ -42,19 +42,19 @@ PropValue structure:
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
<IMPORTANT>
|
|
45
|
-
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,
|
|
45
|
+
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.
|
|
46
46
|
</IMPORTANT>
|
|
47
47
|
|
|
48
48
|
You can use multiple property changes at once by providing multiple entries in the propertiesToChange object, including _style alongside non-style props.
|
|
49
49
|
Some properties are nested, use the root property name, then objects with nested values inside, as the complete schema suggests.
|
|
50
50
|
|
|
51
|
-
Make sure you have the "widget-schema-by-type" resource available to
|
|
52
|
-
Make sure you have to "styles-schema" resources available to
|
|
51
|
+
Make sure you have the "widget-schema-by-type" resource available to retrieve the PropType schema for the element type you are configuring.
|
|
52
|
+
Make sure you have to "styles-schema" resources available to retrieve the common styles schema.
|
|
53
53
|
|
|
54
54
|
# How to configure elements
|
|
55
55
|
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.
|
|
56
56
|
For styleProperties, use the style schema provided, as it also uses the PropType format.
|
|
57
|
-
For all non-primitive types, provide the key property as defined in the schema as $$type in the generated
|
|
57
|
+
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.
|
|
58
58
|
|
|
59
59
|
Use the EXACT "PROP-TYPE" Schema given, and ALWAYS include the "key" property from the original configuration for every property you are changing.
|
|
60
60
|
|
|
@@ -20,7 +20,7 @@ export const inputSchema = {
|
|
|
20
20
|
)
|
|
21
21
|
.describe( 'An object record containing style property names and their new values to be set on the element' )
|
|
22
22
|
.default( {} ),
|
|
23
|
-
elementType: z.string().describe( 'The type of the element to
|
|
23
|
+
elementType: z.string().describe( 'The type of the element to retrieve the schema' ),
|
|
24
24
|
elementId: z.string().describe( 'The unique id of the element to configure' ),
|
|
25
25
|
};
|
|
26
26
|
|
|
@@ -30,7 +30,7 @@ export function resolvePropValue( value: unknown, forceKey?: string ): PropValue
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/*
|
|
33
|
-
* This function expects a PropValue bag for
|
|
33
|
+
* This function expects a PropValue bag for updating an element.
|
|
34
34
|
* Also, it supports updating styles "on-the-way" by checking for "_styles" property with PropValue bag that fits the common style schema.
|
|
35
35
|
*/
|
|
36
36
|
export const doUpdateElementProperty = ( params: OwnParams ) => {
|