@wordpress/block-editor
Version:
79 lines (77 loc) • 2.45 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// packages/block-editor/src/utils/format-font-weight.js
var format_font_weight_exports = {};
__export(format_font_weight_exports, {
formatFontWeight: () => formatFontWeight
});
module.exports = __toCommonJS(format_font_weight_exports);
var import_i18n = require("@wordpress/i18n");
function formatFontWeight(fontWeight) {
if (!fontWeight) {
return {};
}
if (typeof fontWeight === "object") {
return fontWeight;
}
let name;
switch (fontWeight) {
case "normal":
case "400":
name = (0, import_i18n._x)("Regular", "font weight");
break;
case "bold":
case "700":
name = (0, import_i18n._x)("Bold", "font weight");
break;
case "100":
name = (0, import_i18n._x)("Thin", "font weight");
break;
case "200":
name = (0, import_i18n._x)("Extra Light", "font weight");
break;
case "300":
name = (0, import_i18n._x)("Light", "font weight");
break;
case "500":
name = (0, import_i18n._x)("Medium", "font weight");
break;
case "600":
name = (0, import_i18n._x)("Semi Bold", "font weight");
break;
case "800":
name = (0, import_i18n._x)("Extra Bold", "font weight");
break;
case "900":
name = (0, import_i18n._x)("Black", "font weight");
break;
case "1000":
name = (0, import_i18n._x)("Extra Black", "font weight");
break;
default:
name = fontWeight;
break;
}
return { name, value: fontWeight };
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
formatFontWeight
});
//# sourceMappingURL=format-font-weight.cjs.map