UNPKG

@wordpress/block-editor

Version:
68 lines (66 loc) 1.57 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.formatFontWeight = formatFontWeight; var _i18n = require("@wordpress/i18n"); /** * WordPress dependencies */ /** * Formats font weights to human readable names. * * @param {string} fontWeight font weight string * @return {Object} new object with formatted font weight */ function formatFontWeight(fontWeight) { if (!fontWeight) { return {}; } if (typeof fontWeight === 'object') { return fontWeight; } let name; switch (fontWeight) { case 'normal': case '400': name = (0, _i18n._x)('Regular', 'font weight'); break; case 'bold': case '700': name = (0, _i18n._x)('Bold', 'font weight'); break; case '100': name = (0, _i18n._x)('Thin', 'font weight'); break; case '200': name = (0, _i18n._x)('Extra Light', 'font weight'); break; case '300': name = (0, _i18n._x)('Light', 'font weight'); break; case '500': name = (0, _i18n._x)('Medium', 'font weight'); break; case '600': name = (0, _i18n._x)('Semi Bold', 'font weight'); break; case '800': name = (0, _i18n._x)('Extra Bold', 'font weight'); break; case '900': name = (0, _i18n._x)('Black', 'font weight'); break; case '1000': name = (0, _i18n._x)('Extra Black', 'font weight'); break; default: name = fontWeight; break; } return { name, value: fontWeight }; } //# sourceMappingURL=format-font-weight.js.map