@elementor/editor-variables 4.2.0-943 → 4.2.0-945
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 +14 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/mcp/index.ts +8 -2
- package/src/mcp/manage-variable-tool.ts +9 -13
package/dist/index.mjs
CHANGED
|
@@ -3931,6 +3931,7 @@ function isFontAvailable(font) {
|
|
|
3931
3931
|
}
|
|
3932
3932
|
var initManageVariableTool = (reg) => {
|
|
3933
3933
|
const { addTool, resource } = reg;
|
|
3934
|
+
const RUNTIME_ALLOWED_VARIABLE_TYPES = isProActive2() ? [VARIABLE_TYPES.COLOR, VARIABLE_TYPES.FONT, VARIABLE_TYPES.SIZE, VARIABLE_TYPES.CUSTOM_SIZE] : [VARIABLE_TYPES.COLOR, VARIABLE_TYPES.FONT];
|
|
3934
3935
|
resource(
|
|
3935
3936
|
"manage-global-variable-guide",
|
|
3936
3937
|
MANAGE_VARIABLES_GUIDE_URI,
|
|
@@ -3945,16 +3946,14 @@ var initManageVariableTool = (reg) => {
|
|
|
3945
3946
|
);
|
|
3946
3947
|
addTool({
|
|
3947
3948
|
name: "manage-global-variable",
|
|
3948
|
-
description: "Manage V4 global variables (color, font, size). Read the guide resource before use.",
|
|
3949
|
+
description: "Manage V4 global variables (color, font, size, custom-size). Read the guide resource before use. font = font-famliy, size = measured unit, custom-size = calculated values",
|
|
3949
3950
|
schema: {
|
|
3950
|
-
action: z3.enum(["create", "update", "delete"])
|
|
3951
|
+
action: z3.enum(["create", "update", "delete"]),
|
|
3951
3952
|
id: z3.string().optional().describe("Variable id \u2014 required for update/delete. Get from the global-variables resource."),
|
|
3952
|
-
type: z3.
|
|
3953
|
-
|
|
3954
|
-
),
|
|
3955
|
-
label: z3.string().optional().describe("Variable label (lowercase, dash-separated) \u2014 required for create/update."),
|
|
3953
|
+
type: z3.enum(RUNTIME_ALLOWED_VARIABLE_TYPES),
|
|
3954
|
+
label: z3.string().describe("Variable label (lowercase, dash-separated) \u2014 required for create/update."),
|
|
3956
3955
|
value: z3.string().optional().describe(
|
|
3957
|
-
'Plain CSS value \u2014 required for create/update. Color: hex/rgba/hsl. Font: family name only
|
|
3956
|
+
'Plain CSS value \u2014 required for create/update. Color: hex/rgba/hsl. Font: family name only. Size: value with unit e.g. "16px", or "auto" (Pro). Do NOT pass JSON.'
|
|
3958
3957
|
)
|
|
3959
3958
|
},
|
|
3960
3959
|
outputSchema: {
|
|
@@ -4027,8 +4026,14 @@ function getServiceActions(svc) {
|
|
|
4027
4026
|
|
|
4028
4027
|
// src/mcp/index.ts
|
|
4029
4028
|
function initMcp(reg, canvasMcpEntry) {
|
|
4030
|
-
|
|
4031
|
-
|
|
4029
|
+
window.addEventListener(
|
|
4030
|
+
"elementor/init",
|
|
4031
|
+
() => {
|
|
4032
|
+
initManageVariableTool(reg);
|
|
4033
|
+
initVariablesResource(reg, canvasMcpEntry);
|
|
4034
|
+
},
|
|
4035
|
+
{ once: true }
|
|
4036
|
+
);
|
|
4032
4037
|
}
|
|
4033
4038
|
|
|
4034
4039
|
// src/register-variable-types.tsx
|