@elementor/editor-variables 4.2.0-883 → 4.2.0-884
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 +13 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/mcp/manage-variable-tool.ts +12 -0
- package/src/sync/get-font-configs.ts +3 -0
package/dist/index.mjs
CHANGED
|
@@ -3774,6 +3774,11 @@ var trackOpenVariablePopover = (path, variableType) => {
|
|
|
3774
3774
|
import { z as z3 } from "@elementor/schema";
|
|
3775
3775
|
import { isProActive as isProActive2 } from "@elementor/utils";
|
|
3776
3776
|
|
|
3777
|
+
// src/sync/get-font-configs.ts
|
|
3778
|
+
var getFontConfigs = () => {
|
|
3779
|
+
return window.elementor?.config?.controls?.font?.options ?? {};
|
|
3780
|
+
};
|
|
3781
|
+
|
|
3777
3782
|
// src/mcp/variable-tool-prompt.ts
|
|
3778
3783
|
import { toolPrompts } from "@elementor/editor-mcp";
|
|
3779
3784
|
import { isProActive } from "@elementor/utils";
|
|
@@ -3910,8 +3915,16 @@ function validateValueForType(type, value) {
|
|
|
3910
3915
|
if (type === VARIABLE_TYPES.SIZE && !LENGTH_UNIT_PATTERN.test(value.trim())) {
|
|
3911
3916
|
return `Size variable value should include a CSS unit (e.g. "16px") or be "auto", got "${value}".`;
|
|
3912
3917
|
}
|
|
3918
|
+
if (type === VARIABLE_TYPES.FONT && !isFontAvailable(value)) {
|
|
3919
|
+
return `Font "${value}" is not supported in WordPress. Please choose one of the available font families.`;
|
|
3920
|
+
}
|
|
3913
3921
|
return null;
|
|
3914
3922
|
}
|
|
3923
|
+
function isFontAvailable(font) {
|
|
3924
|
+
const fonts = getFontConfigs();
|
|
3925
|
+
const key = font.trim();
|
|
3926
|
+
return !!fonts?.[key];
|
|
3927
|
+
}
|
|
3915
3928
|
var initManageVariableTool = (reg) => {
|
|
3916
3929
|
const { addTool, resource } = reg;
|
|
3917
3930
|
resource(
|