UNPKG

1.38 kBJavaScriptView Raw
1"use strict";
2var __importDefault = (this && this.__importDefault) || function (mod) {
3 return (mod && mod.__esModule) ? mod : { "default": mod };
4};
5Object.defineProperty(exports, "__esModule", { value: true });
6const cli_boxes_1 = __importDefault(require("cli-boxes"));
7const colorize_1 = __importDefault(require("./colorize"));
8exports.default = (x, y, node, output) => {
9 if (typeof node.style.borderStyle === 'string') {
10 const width = node.yogaNode.getComputedWidth();
11 const height = node.yogaNode.getComputedHeight();
12 const color = node.style.borderColor;
13 const box = cli_boxes_1.default[node.style.borderStyle];
14 const topBorder = colorize_1.default(box.topLeft + box.horizontal.repeat(width - 2) + box.topRight, color, 'foreground');
15 const verticalBorder = (colorize_1.default(box.vertical, color, 'foreground') + '\n').repeat(height - 2);
16 const bottomBorder = colorize_1.default(box.bottomLeft + box.horizontal.repeat(width - 2) + box.bottomRight, color, 'foreground');
17 output.write(x, y, topBorder, { transformers: [] });
18 output.write(x, y + 1, verticalBorder, { transformers: [] });
19 output.write(x + width - 1, y + 1, verticalBorder, { transformers: [] });
20 output.write(x, y + height - 1, bottomBorder, { transformers: [] });
21 }
22};
23//# sourceMappingURL=render-border.js.map
\No newline at end of file