🎉 initiate project *astro_rewrite*
This commit is contained in:
parent
ffd4d5e86c
commit
2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions
38
node_modules/suf-log/dist/transformStyles.js
generated
vendored
Normal file
38
node_modules/suf-log/dist/transformStyles.js
generated
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.transformToBrowserStyle = exports.transformToNodeStyle = void 0;
|
||||
var utils_1 = require("./utils");
|
||||
function transformToNodeStyle(style) {
|
||||
if (typeof style === 'string') {
|
||||
return "\u001B[" + handleUndefined(utils_1.stringColorToAnsiColor('color', style)).replace(/;$/, '') + "m";
|
||||
}
|
||||
else {
|
||||
var codes = "" + addBoldStyle(style) + handleUndefined(utils_1.stringColorToAnsiColor('color', style.color)) + handleUndefined(utils_1.stringColorToAnsiColor('background', style.background));
|
||||
return "\u001B[" + codes.replace(/;$/, '') + "m";
|
||||
}
|
||||
}
|
||||
exports.transformToNodeStyle = transformToNodeStyle;
|
||||
function addBoldStyle(style) {
|
||||
return style['font-weight'] === 'bold' ? utils_1.ANSICodes('bold') + ";" : '';
|
||||
}
|
||||
function handleUndefined(input) {
|
||||
return input ? input : '';
|
||||
}
|
||||
function transformToBrowserStyle(style) {
|
||||
if (style == undefined)
|
||||
return '';
|
||||
if (typeof style === 'string') {
|
||||
return "color: " + style + ";";
|
||||
}
|
||||
var out = '';
|
||||
if (!('display' in style)) {
|
||||
out += "display: inline-block; ";
|
||||
}
|
||||
for (var key in style) {
|
||||
if (Object.prototype.hasOwnProperty.call(style, key)) {
|
||||
out += key + ": " + style[key] + "; ";
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
exports.transformToBrowserStyle = transformToBrowserStyle;
|
||||
Loading…
Add table
Add a link
Reference in a new issue