3 Object.defineProperty(exports, '__esModule', {
6 exports.printElementAsLeaf = exports.printElement = exports.printComment = exports.printText = exports.printChildren = exports.printProps = undefined;
8 var _escape_html = require('./escape_html');
10 var _escape_html2 = _interopRequireDefault(_escape_html);
12 function _interopRequireDefault(obj) {
13 return obj && obj.__esModule ? obj : {default: obj};
16 // Return empty string if keys is empty.
18 * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
20 * This source code is licensed under the MIT license found in the
21 * LICENSE file in the root directory of this source tree.
26 const printProps = (exports.printProps = (
35 const indentationNext = indentation + config.indent;
36 const colors = config.colors;
39 const value = props[key];
40 let printed = printer(value, config, indentationNext, depth, refs);
42 if (typeof value !== 'string') {
43 if (printed.indexOf('\n') !== -1) {
51 printed = '{' + printed + '}';
69 // Return empty string if children is empty.
70 const printChildren = (exports.printChildren = (
83 (typeof child === 'string'
84 ? printText(child, config)
85 : printer(child, config, indentation, depth, refs))
89 const printText = (exports.printText = (text, config) => {
90 const contentColor = config.colors.content;
92 contentColor.open + (0, _escape_html2.default)(text) + contentColor.close
96 const printComment = (exports.printComment = (comment, config) => {
97 const commentColor = config.colors.comment;
101 (0, _escape_html2.default)(comment) +
107 // Separate the functions to format props, children, and element,
108 // so a plugin could override a particular function, if needed.
109 // Too bad, so sad: the traditional (but unnecessary) space
110 // in a self-closing tagColor requires a second test of printedProps.
111 const printElement = (exports.printElement = (
118 const tagColor = config.colors.tag;
126 config.spacingOuter +
133 config.spacingOuter +
138 : (printedProps && !config.min ? '' : ' ') + '/') +
144 const printElementAsLeaf = (exports.printElementAsLeaf = (type, config) => {
145 const tagColor = config.colors.tag;