@elementor/editor-controls 4.0.0-510 → 4.0.0-512
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 +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +48 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/control-replacements.tsx +2 -0
- package/src/hooks/use-font-families.ts +52 -0
- package/src/index.ts +3 -0
package/dist/index.mjs
CHANGED
|
@@ -264,14 +264,15 @@ var useControlReplacement = (OriginalComponent) => {
|
|
|
264
264
|
};
|
|
265
265
|
var createControlReplacementsRegistry = () => {
|
|
266
266
|
const controlReplacements = [];
|
|
267
|
-
function
|
|
267
|
+
function registerControlReplacement2(replacement) {
|
|
268
268
|
controlReplacements.push(replacement);
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function getControlReplacements2() {
|
|
271
271
|
return controlReplacements;
|
|
272
272
|
}
|
|
273
|
-
return { registerControlReplacement, getControlReplacements };
|
|
273
|
+
return { registerControlReplacement: registerControlReplacement2, getControlReplacements: getControlReplacements2 };
|
|
274
274
|
};
|
|
275
|
+
var { registerControlReplacement, getControlReplacements } = createControlReplacementsRegistry();
|
|
275
276
|
|
|
276
277
|
// src/create-control.tsx
|
|
277
278
|
var brandSymbol = Symbol("control");
|
|
@@ -7134,6 +7135,44 @@ var UnstableSizeField = ({
|
|
|
7134
7135
|
var hasValue = (value) => {
|
|
7135
7136
|
return value !== null && value !== "";
|
|
7136
7137
|
};
|
|
7138
|
+
|
|
7139
|
+
// src/hooks/use-font-families.ts
|
|
7140
|
+
import { useMemo as useMemo16 } from "react";
|
|
7141
|
+
import { getElementorConfig } from "@elementor/editor-v1-adapters";
|
|
7142
|
+
import { __ as __53 } from "@wordpress/i18n";
|
|
7143
|
+
var supportedCategories = {
|
|
7144
|
+
system: __53("System", "elementor"),
|
|
7145
|
+
custom: __53("Custom Fonts", "elementor"),
|
|
7146
|
+
googlefonts: __53("Google Fonts", "elementor")
|
|
7147
|
+
};
|
|
7148
|
+
var getFontFamilies = () => {
|
|
7149
|
+
const { controls } = getElementorConfig();
|
|
7150
|
+
const options = controls?.font?.options;
|
|
7151
|
+
if (!options) {
|
|
7152
|
+
return null;
|
|
7153
|
+
}
|
|
7154
|
+
return options;
|
|
7155
|
+
};
|
|
7156
|
+
var useFontFamilies = () => {
|
|
7157
|
+
const fontFamilies = getFontFamilies();
|
|
7158
|
+
return useMemo16(() => {
|
|
7159
|
+
const categoriesOrder = ["system", "custom", "googlefonts"];
|
|
7160
|
+
return Object.entries(fontFamilies || {}).reduce((acc, [font, category]) => {
|
|
7161
|
+
if (!supportedCategories[category]) {
|
|
7162
|
+
return acc;
|
|
7163
|
+
}
|
|
7164
|
+
const categoryIndex = categoriesOrder.indexOf(category);
|
|
7165
|
+
if (!acc[categoryIndex]) {
|
|
7166
|
+
acc[categoryIndex] = {
|
|
7167
|
+
label: supportedCategories[category],
|
|
7168
|
+
fonts: []
|
|
7169
|
+
};
|
|
7170
|
+
}
|
|
7171
|
+
acc[categoryIndex].fonts.push(font);
|
|
7172
|
+
return acc;
|
|
7173
|
+
}, []).filter(Boolean);
|
|
7174
|
+
}, [fontFamilies]);
|
|
7175
|
+
};
|
|
7137
7176
|
export {
|
|
7138
7177
|
AspectRatioControl,
|
|
7139
7178
|
BackgroundControl,
|
|
@@ -7187,15 +7226,18 @@ export {
|
|
|
7187
7226
|
createControl,
|
|
7188
7227
|
createControlReplacementsRegistry,
|
|
7189
7228
|
enqueueFont,
|
|
7229
|
+
getControlReplacements,
|
|
7190
7230
|
injectIntoRepeaterItemActions,
|
|
7191
7231
|
injectIntoRepeaterItemIcon,
|
|
7192
7232
|
injectIntoRepeaterItemLabel,
|
|
7233
|
+
registerControlReplacement,
|
|
7193
7234
|
transitionProperties,
|
|
7194
7235
|
transitionsItemsList,
|
|
7195
7236
|
useBoundProp,
|
|
7196
7237
|
useControlActions,
|
|
7197
7238
|
useControlReplacement,
|
|
7198
7239
|
useElementCanHaveChildren,
|
|
7240
|
+
useFontFamilies,
|
|
7199
7241
|
useSyncExternalState
|
|
7200
7242
|
};
|
|
7201
7243
|
//# sourceMappingURL=index.mjs.map
|