@elementor/editor-variables 4.2.0-883 → 4.2.0-885

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
@@ -3793,6 +3793,11 @@ var trackOpenVariablePopover = (path, variableType) => {
3793
3793
  var import_schema3 = require("@elementor/schema");
3794
3794
  var import_utils4 = require("@elementor/utils");
3795
3795
 
3796
+ // src/sync/get-font-configs.ts
3797
+ var getFontConfigs = () => {
3798
+ return window.elementor?.config?.controls?.font?.options ?? {};
3799
+ };
3800
+
3796
3801
  // src/mcp/variable-tool-prompt.ts
3797
3802
  var import_editor_mcp = require("@elementor/editor-mcp");
3798
3803
  var import_utils3 = require("@elementor/utils");
@@ -3929,8 +3934,16 @@ function validateValueForType(type, value) {
3929
3934
  if (type === VARIABLE_TYPES.SIZE && !LENGTH_UNIT_PATTERN.test(value.trim())) {
3930
3935
  return `Size variable value should include a CSS unit (e.g. "16px") or be "auto", got "${value}".`;
3931
3936
  }
3937
+ if (type === VARIABLE_TYPES.FONT && !isFontAvailable(value)) {
3938
+ return `Font "${value}" is not supported in WordPress. Please choose one of the available font families.`;
3939
+ }
3932
3940
  return null;
3933
3941
  }
3942
+ function isFontAvailable(font) {
3943
+ const fonts = getFontConfigs();
3944
+ const key = font.trim();
3945
+ return !!fonts?.[key];
3946
+ }
3934
3947
  var initManageVariableTool = (reg) => {
3935
3948
  const { addTool, resource } = reg;
3936
3949
  resource(