@elementor/editor-global-classes 3.35.0-342 → 3.35.0-343
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 +18 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -20
- package/src/store.ts +18 -5
package/dist/index.js
CHANGED
|
@@ -76,7 +76,6 @@ var GlobalClassTrackingError = (0, import_utils.createError)({
|
|
|
76
76
|
});
|
|
77
77
|
|
|
78
78
|
// src/store.ts
|
|
79
|
-
var import_editor_props = require("@elementor/editor-props");
|
|
80
79
|
var import_editor_styles = require("@elementor/editor-styles");
|
|
81
80
|
var import_store = require("@elementor/store");
|
|
82
81
|
|
|
@@ -211,9 +210,7 @@ var slice = (0, import_store.__createSlice)({
|
|
|
211
210
|
let customCss = ("custom_css" in payload ? payload.custom_css : variant?.custom_css) ?? null;
|
|
212
211
|
customCss = customCss?.raw ? customCss : null;
|
|
213
212
|
if (variant) {
|
|
214
|
-
|
|
215
|
-
const payloadProps = JSON.parse(JSON.stringify(payload.props));
|
|
216
|
-
variant.props = (0, import_editor_props.mergeProps)(variantProps, payloadProps);
|
|
213
|
+
variant.props = mergeProps(variant.props, payload.props);
|
|
217
214
|
variant.custom_css = customCss;
|
|
218
215
|
style.variants = getNonEmptyVariants(style);
|
|
219
216
|
} else {
|
|
@@ -258,6 +255,17 @@ var slice = (0, import_store.__createSlice)({
|
|
|
258
255
|
}
|
|
259
256
|
}
|
|
260
257
|
});
|
|
258
|
+
var mergeProps = (current, updates) => {
|
|
259
|
+
const props = Array.isArray(current) ? {} : current;
|
|
260
|
+
Object.entries(updates).forEach(([key, value]) => {
|
|
261
|
+
if (value === null || value === void 0) {
|
|
262
|
+
delete props[key];
|
|
263
|
+
} else {
|
|
264
|
+
props[key] = value;
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
return props;
|
|
268
|
+
};
|
|
261
269
|
var getNonEmptyVariants = (style) => {
|
|
262
270
|
return style.variants.filter(
|
|
263
271
|
({ props, custom_css: customCss }) => Object.keys(props).length || customCss?.raw
|
|
@@ -2364,7 +2372,7 @@ If the user want to unapply a class by it's name and not ID, retreive the id fro
|
|
|
2364
2372
|
|
|
2365
2373
|
// src/mcp-integration/mcp-create-global-class.ts
|
|
2366
2374
|
var import_editor_canvas = require("@elementor/editor-canvas");
|
|
2367
|
-
var
|
|
2375
|
+
var import_editor_props = require("@elementor/editor-props");
|
|
2368
2376
|
var import_editor_styles3 = require("@elementor/editor-styles");
|
|
2369
2377
|
var import_editor_variables = require("@elementor/editor-variables");
|
|
2370
2378
|
var import_schema2 = require("@elementor/schema");
|
|
@@ -2398,7 +2406,7 @@ var handler = async (input) => {
|
|
|
2398
2406
|
errors.push(`Property "${key}" does not exist in styles schema.`);
|
|
2399
2407
|
return;
|
|
2400
2408
|
}
|
|
2401
|
-
const { valid, jsonSchema } =
|
|
2409
|
+
const { valid, jsonSchema } = import_editor_props.Schema.validatePropValue(propType, input.props[key]);
|
|
2402
2410
|
if (!valid) {
|
|
2403
2411
|
errors.push(
|
|
2404
2412
|
`- Property "${key}" has invalid value
|
|
@@ -2419,7 +2427,7 @@ Now that you have this information, update your input and try again`
|
|
|
2419
2427
|
);
|
|
2420
2428
|
}
|
|
2421
2429
|
Object.keys(input.props).forEach((key) => {
|
|
2422
|
-
input.props[key] =
|
|
2430
|
+
input.props[key] = import_editor_props.Schema.adjustLlmPropValueSchema(input.props[key], {
|
|
2423
2431
|
transformers: import_editor_variables.Utils.globalVariablesLLMResolvers
|
|
2424
2432
|
});
|
|
2425
2433
|
});
|
|
@@ -2573,7 +2581,7 @@ function initMcpApplyGetGlobalClassUsages(reg) {
|
|
|
2573
2581
|
|
|
2574
2582
|
// src/mcp-integration/mcp-modify-global-class.ts
|
|
2575
2583
|
var import_editor_canvas2 = require("@elementor/editor-canvas");
|
|
2576
|
-
var
|
|
2584
|
+
var import_editor_props2 = require("@elementor/editor-props");
|
|
2577
2585
|
var import_editor_styles4 = require("@elementor/editor-styles");
|
|
2578
2586
|
var import_editor_variables2 = require("@elementor/editor-variables");
|
|
2579
2587
|
var import_schema4 = require("@elementor/schema");
|
|
@@ -2600,7 +2608,7 @@ var handler2 = async (params) => {
|
|
|
2600
2608
|
errors.push(`Property "${key}" does not exist in styles schema.`);
|
|
2601
2609
|
return;
|
|
2602
2610
|
}
|
|
2603
|
-
const { valid, jsonSchema } =
|
|
2611
|
+
const { valid, jsonSchema } = import_editor_props2.Schema.validatePropValue(propType, props[key]);
|
|
2604
2612
|
if (!valid) {
|
|
2605
2613
|
errors.push(`- Property "${key}" has invalid value:
|
|
2606
2614
|
expected Schema: ${jsonSchema}
|
|
@@ -2618,7 +2626,7 @@ Now that you have this information, update your input and try again`
|
|
|
2618
2626
|
);
|
|
2619
2627
|
}
|
|
2620
2628
|
Object.keys(props).forEach((key) => {
|
|
2621
|
-
props[key] =
|
|
2629
|
+
props[key] = import_editor_props2.Schema.adjustLlmPropValueSchema(props[key], {
|
|
2622
2630
|
transformers: import_editor_variables2.Utils.globalVariablesLLMResolvers
|
|
2623
2631
|
});
|
|
2624
2632
|
});
|