@elementor/editor-controls 4.0.0-669 → 4.0.0-671

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.mjs CHANGED
@@ -7480,39 +7480,33 @@ var hasValue = (value) => {
7480
7480
  // src/hooks/use-font-families.ts
7481
7481
  import { useMemo as useMemo16 } from "react";
7482
7482
  import { getElementorConfig } from "@elementor/editor-v1-adapters";
7483
- import { __ as __57 } from "@wordpress/i18n";
7484
- var supportedCategories = {
7485
- system: __57("System", "elementor"),
7486
- custom: __57("Custom Fonts", "elementor"),
7487
- googlefonts: __57("Google Fonts", "elementor")
7488
- };
7489
- var getFontFamilies = () => {
7483
+ var getFontControlConfig = () => {
7490
7484
  const { controls } = getElementorConfig();
7491
- const options = controls?.font?.options;
7492
- if (!options) {
7493
- return null;
7494
- }
7495
- return options;
7485
+ return controls?.font ?? {};
7496
7486
  };
7497
7487
  var useFontFamilies = () => {
7498
- const fontFamilies = getFontFamilies();
7488
+ const { groups, options } = getFontControlConfig();
7499
7489
  return useMemo16(() => {
7500
- const categoriesOrder = ["system", "custom", "googlefonts"];
7501
- return Object.entries(fontFamilies || {}).reduce((acc, [font, category]) => {
7502
- if (!supportedCategories[category]) {
7490
+ if (!groups || !options) {
7491
+ return [];
7492
+ }
7493
+ const groupKeys = Object.keys(groups);
7494
+ const groupIndexMap = new Map(groupKeys.map((key, index) => [key, index]));
7495
+ return Object.entries(options).reduce((acc, [font, category]) => {
7496
+ const groupIndex = groupIndexMap.get(category);
7497
+ if (groupIndex === void 0) {
7503
7498
  return acc;
7504
7499
  }
7505
- const categoryIndex = categoriesOrder.indexOf(category);
7506
- if (!acc[categoryIndex]) {
7507
- acc[categoryIndex] = {
7508
- label: supportedCategories[category],
7500
+ if (!acc[groupIndex]) {
7501
+ acc[groupIndex] = {
7502
+ label: groups[category],
7509
7503
  fonts: []
7510
7504
  };
7511
7505
  }
7512
- acc[categoryIndex].fonts.push(font);
7506
+ acc[groupIndex].fonts.push(font);
7513
7507
  return acc;
7514
7508
  }, []).filter(Boolean);
7515
- }, [fontFamilies]);
7509
+ }, [groups, options]);
7516
7510
  };
7517
7511
  export {
7518
7512
  AspectRatioControl,