@elementor/editor-controls 4.0.0-510 → 4.0.0-511
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.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/hooks/use-font-families.ts +52 -0
- package/src/index.ts +1 -0
package/dist/index.d.mts
CHANGED
|
@@ -673,4 +673,6 @@ declare const useSyncExternalState: <TValue>({ external, setExternal, persistWhe
|
|
|
673
673
|
|
|
674
674
|
declare const useElementCanHaveChildren: () => boolean;
|
|
675
675
|
|
|
676
|
-
|
|
676
|
+
declare const useFontFamilies: () => FontCategory[];
|
|
677
|
+
|
|
678
|
+
export { type AdornmentComponent, type AngleUnit, AspectRatioControl, BackgroundControl, BoxShadowRepeaterControl, ClearIconButton, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent$1 as ControlComponent, ControlFormLabel, type ControlReplacement, ControlReplacementsProvider, ControlToggleButtonGroup, DateTimeControl, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, FilterRepeaterControl, type FontCategory, FontFamilyControl, GapControl, HtmlTagControl, ImageControl, InlineEditingControl, InlineEditor, InlineEditorToolbar, ItemSelector, type ItemsActionPayload, KeyValueControl, type LengthUnit, LinkControl, LinkedDimensionsControl, NumberControl, PopoverContent, PopoverGridContainer, PositionControl, PropKeyProvider, PropProvider, type PropProviderProps, QueryControl, RepeatableControl, Repeater, type RepeaterItem, SelectControl, SelectControlWrapper, type SetRepeaterValuesMeta, type SetValue, type SetValueMeta, SizeControl, StrokeControl, SvgMediaControl, SwitchControl, TextAreaControl, TextControl, type TimeUnit, type ToggleButtonGroupItem, ToggleButtonGroupUi, ToggleControl, type ToggleControlProps, TransformRepeaterControl, TransformSettingsControl, TransitionRepeaterControl, type Unit, UnstableSizeField, UrlControl, createControl, createControlReplacementsRegistry, enqueueFont, injectIntoRepeaterItemActions, injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel, transitionProperties, transitionsItemsList, useBoundProp, useControlActions, useControlReplacement, useElementCanHaveChildren, useFontFamilies, useSyncExternalState };
|
package/dist/index.d.ts
CHANGED
|
@@ -673,4 +673,6 @@ declare const useSyncExternalState: <TValue>({ external, setExternal, persistWhe
|
|
|
673
673
|
|
|
674
674
|
declare const useElementCanHaveChildren: () => boolean;
|
|
675
675
|
|
|
676
|
-
|
|
676
|
+
declare const useFontFamilies: () => FontCategory[];
|
|
677
|
+
|
|
678
|
+
export { type AdornmentComponent, type AngleUnit, AspectRatioControl, BackgroundControl, BoxShadowRepeaterControl, ClearIconButton, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent$1 as ControlComponent, ControlFormLabel, type ControlReplacement, ControlReplacementsProvider, ControlToggleButtonGroup, DateTimeControl, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, FilterRepeaterControl, type FontCategory, FontFamilyControl, GapControl, HtmlTagControl, ImageControl, InlineEditingControl, InlineEditor, InlineEditorToolbar, ItemSelector, type ItemsActionPayload, KeyValueControl, type LengthUnit, LinkControl, LinkedDimensionsControl, NumberControl, PopoverContent, PopoverGridContainer, PositionControl, PropKeyProvider, PropProvider, type PropProviderProps, QueryControl, RepeatableControl, Repeater, type RepeaterItem, SelectControl, SelectControlWrapper, type SetRepeaterValuesMeta, type SetValue, type SetValueMeta, SizeControl, StrokeControl, SvgMediaControl, SwitchControl, TextAreaControl, TextControl, type TimeUnit, type ToggleButtonGroupItem, ToggleButtonGroupUi, ToggleControl, type ToggleControlProps, TransformRepeaterControl, TransformSettingsControl, TransitionRepeaterControl, type Unit, UnstableSizeField, UrlControl, createControl, createControlReplacementsRegistry, enqueueFont, injectIntoRepeaterItemActions, injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel, transitionProperties, transitionsItemsList, useBoundProp, useControlActions, useControlReplacement, useElementCanHaveChildren, useFontFamilies, useSyncExternalState };
|
package/dist/index.js
CHANGED
|
@@ -91,6 +91,7 @@ __export(index_exports, {
|
|
|
91
91
|
useControlActions: () => useControlActions,
|
|
92
92
|
useControlReplacement: () => useControlReplacement,
|
|
93
93
|
useElementCanHaveChildren: () => useElementCanHaveChildren,
|
|
94
|
+
useFontFamilies: () => useFontFamilies,
|
|
94
95
|
useSyncExternalState: () => useSyncExternalState
|
|
95
96
|
});
|
|
96
97
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -7111,6 +7112,44 @@ var UnstableSizeField = ({
|
|
|
7111
7112
|
var hasValue = (value) => {
|
|
7112
7113
|
return value !== null && value !== "";
|
|
7113
7114
|
};
|
|
7115
|
+
|
|
7116
|
+
// src/hooks/use-font-families.ts
|
|
7117
|
+
var import_react60 = require("react");
|
|
7118
|
+
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
7119
|
+
var import_i18n53 = require("@wordpress/i18n");
|
|
7120
|
+
var supportedCategories = {
|
|
7121
|
+
system: (0, import_i18n53.__)("System", "elementor"),
|
|
7122
|
+
custom: (0, import_i18n53.__)("Custom Fonts", "elementor"),
|
|
7123
|
+
googlefonts: (0, import_i18n53.__)("Google Fonts", "elementor")
|
|
7124
|
+
};
|
|
7125
|
+
var getFontFamilies = () => {
|
|
7126
|
+
const { controls } = (0, import_editor_v1_adapters.getElementorConfig)();
|
|
7127
|
+
const options = controls?.font?.options;
|
|
7128
|
+
if (!options) {
|
|
7129
|
+
return null;
|
|
7130
|
+
}
|
|
7131
|
+
return options;
|
|
7132
|
+
};
|
|
7133
|
+
var useFontFamilies = () => {
|
|
7134
|
+
const fontFamilies = getFontFamilies();
|
|
7135
|
+
return (0, import_react60.useMemo)(() => {
|
|
7136
|
+
const categoriesOrder = ["system", "custom", "googlefonts"];
|
|
7137
|
+
return Object.entries(fontFamilies || {}).reduce((acc, [font, category]) => {
|
|
7138
|
+
if (!supportedCategories[category]) {
|
|
7139
|
+
return acc;
|
|
7140
|
+
}
|
|
7141
|
+
const categoryIndex = categoriesOrder.indexOf(category);
|
|
7142
|
+
if (!acc[categoryIndex]) {
|
|
7143
|
+
acc[categoryIndex] = {
|
|
7144
|
+
label: supportedCategories[category],
|
|
7145
|
+
fonts: []
|
|
7146
|
+
};
|
|
7147
|
+
}
|
|
7148
|
+
acc[categoryIndex].fonts.push(font);
|
|
7149
|
+
return acc;
|
|
7150
|
+
}, []).filter(Boolean);
|
|
7151
|
+
}, [fontFamilies]);
|
|
7152
|
+
};
|
|
7114
7153
|
// Annotate the CommonJS export names for ESM import in node:
|
|
7115
7154
|
0 && (module.exports = {
|
|
7116
7155
|
AspectRatioControl,
|
|
@@ -7174,6 +7213,7 @@ var hasValue = (value) => {
|
|
|
7174
7213
|
useControlActions,
|
|
7175
7214
|
useControlReplacement,
|
|
7176
7215
|
useElementCanHaveChildren,
|
|
7216
|
+
useFontFamilies,
|
|
7177
7217
|
useSyncExternalState
|
|
7178
7218
|
});
|
|
7179
7219
|
//# sourceMappingURL=index.js.map
|