declare const _default: "\n## Working with text views\n\nText views in Discovery.js adhere to the same underlying principles as standard web-based views but are simplified due to the constraints of textual representation (e.g., lack of interactivity and styling).\n\nText views are managed through the `Model#textView` interface, enabling text rendering for any model type (`Model`, `ViewModel`, `ScriptModel`, etc.):\n\n```js\nmodel.textView.define('text-view-name', render);\n// ...\nconst renderTree = model.textView.render(null, 'text-view-name:...', data, context);\nconst { text } = model.textView.serialize(renderTree);\n\nconsole.log(text);\n```\n\nEach text view supports a limited set of properties compared to regular views, but these retain the same semantics:\n\n- `view` (required) \u2014 Specifies the view type.\n- `when` \u2014 Controls whether the view should be rendered. Evaluated before `data` transformation.\n- `context` \u2014 Transforms the input context for the view and its nested views.\n- `data` \u2014 Transforms the input data for the view and its nested views.\n- `whenData` \u2014 Controls rendering based on the computed `data`. Evaluated after `context` and `data` are set.\n\n## Layout model\n\nThe text renderer builds a render tree composed of **box nodes** and **text nodes**.\n\n- **Text nodes**: Represent direct text strings. Their values can include newline characters.\n- **Box nodes**: Define the layout of their content and can optionally render a \"border\" around it. The content is generated by rendering child nodes, which can be a mix of box and text nodes. Box nodes support several display types:\n - `inline` \u2014 Inserts its content lines as-is.\n - `inline-block` \u2014 Ensures that whitespace is added before and after its content to prevent merging with adjacent boxes. If the content spans multiple lines, subsequent lines align with the first line.\n - `line` \u2014 Places the box's content on a new line within its parent box.\n - `block` \u2014 Similar to `line`, but also adds an extra empty line before and after the content when needed.\n\n```render:text\n[\n 'text:\"\u2026text\u2026\"',\n 'inline:\"\"',\n 'text:\"\u2026text\u2026\"',\n 'inline-block:\"\"',\n 'text:\"\u2026text\u2026\"',\n 'line:\"\"',\n 'text:\"\u2026text\u2026\"',\n 'block:\"\"',\n 'text:\"\u2026text\u2026\"'\n]\n```\n\n## Box border\n\nA box border is an optional decorative frame that can be drawn around a box node\u2019s content. Although termed a \"border\", its appearance is highly customizable and might not resemble a traditional border. A border can consist of up to four sides \u2013 top, right, bottom, and left \u2013 and by default, boxes have no border.\n\nThere are slight differences in how vertical (left and right) and horizontal (top and bottom) borders are defined, though the corresponding pairs behave similarly.\n\n### Vertical sides (left and right)\n\nLeft and right borders specify the characters to be prepended or appended to each line of the box\u2019s content, effectively drawing vertical lines along the sides. The value for these borders can be defined in several ways:\n\n- **Falsy value:** A falsy value (e.g., `null`, empty string) means no border is drawn.\n- **String:** A static string that is added to the beginning (for `left`) or end (for `right`) of each line. For the `right` border, lines are padded with spaces to ensure consistent line lengths.\n- **Function:** A function with the signature `(index, total) => string | undefined` for fine-tuned control. This allows different characters for the first, middle, and last lines. For example:\n \n ```js\n const leftBorder = (index, total) =>\n total === 1 ? '[' :\n index === 0 ? '\u23A1' :\n index + 1 === total ? '\u23A3' : '\u23A2';\n ```\n \n If the function returns strings of varying lengths, they are padded with spaces (from the start for `left` and from the end for `right`) to equalize their lengths.\n- **Array of strings:** An array of 1 to 4 strings representing `start`, `middle`, `end`, and `single` cases, respectively. For example:\n \n ```js\n const leftBorder = ['\u23A1', '\u23A2', '\u23A3', '['];\n ```\n\n This form is equivalent to a function that selects the appropriate border based on the line index and total number of lines:\n\n ```ts\n function borderLR(start: string, mid = start, end = mid, single = start) {\n return (idx: number, total: number) =>\n total === 1 ? single : idx === 0 ? start : idx + 1 === total ? end : mid;\n }\n ```\n\n### Horizontal Sides (top and bottom)\n\nTop and bottom borders define the first and last lines of the box after the left and right borders have been applied. Their value can be set in one of the following ways:\n\n- **Falsy value:** No border is drawn if the value is falsy.\n- **String:** A static string that is repeated to achieve the required total length (`midLen + leftLen + rightLen`).\n- **Function:** A function with the signature `(midLen, leftLen, rightLen) => string | undefined` that returns a string. If the returned string is non-empty, it is truncated to match the total length. For example:\n\n ```js\n const topBorder = (midLength, leftLen, rightLen) =>\n `${<}${''.padEnd(midLength + leftLen + rightLen, '-')}${>}`;\n ```\n\n- **Array of strings:** An array of 1 to 3 strings representing `start`, `middle`, and `end` segments. This is equivalent to a function that constructs the border by concatenating the start, a repeated middle, and the end string. For example:\n \n ```js\n const topBorder = ['<', '-', '>'];\n ```\n\n This form is equivalent to a call the function:\n\n ```ts\n function borderTB(start: string, mid = start, end = mid) {\n return (m: number, l: number, r: number) =>\n `${start}${''.padStart(m + l + r - start.length - end.length, mid)}${end}`;\n }\n ```\n\n### Using borders in views\n\nMost view definitions include a preset border that cannot be modified. However, any content can be wrapped in a basic box view (`inline`, `inline-block`, `line`, or `block`) to add a border.\n\nFor example, a full border definition using array notation for sides:\n\n```render:text\n{\n view: 'inline-list',\n data: [1, 2, 3, 4, 5],\n item: {\n view: 'inline-block',\n data: '$seq:=>?[...$ - 1 | $seq(), \"line \" + $]:[];$seq().join(\"\\\\n\")',\n border: {\n top: ['\u2190', '-', '\u2192'],\n left: ['\u2191 ', '|', '\u2193', '[ '],\n right: [' \u2191', '|', '\u2193', ' ]'],\n bottom: ['\u2190', '-', '\u2192']\n }\n }\n}\n```\n\nBorders can also be specified in a compact array notation following the TRBL (top, right, bottom, left) order, similar to CSS:\n\n```render:text\n{\n view: 'block',\n border: ['T', 'R', 'B', 'L'],\n content: 'text:\" \\\\n \"'\n}\n```\n\nIf the bottom border element is undefined, it inherits the top border value (if defined). Similarly, if the left border is undefined while the right border is specified, the left border adopts the right border value. This mechanism allows you to define vertical and horizontal borders with just two elements.\n\n```render:text\n{\n view: 'block',\n border: ['-', '|'],\n content: 'text:\" \\\\n \"'\n}\n```\n\nThe following example demonstrates the difference between `undefined` and a falsy value (such as `null`):\n\n```render:text\n{\n view: 'block',\n border: [['+', '-', '+'], '|', undefined, null],\n content: 'text:\" \\\\n \"'\n}\n```\n\nEach element in the concise notation accepts any value applicable for a side in object notation, i.e. a string, a function or array of strings.\n"; export default _default;