@mdxui/terminal 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +571 -0
- package/dist/ansi-css-Sk5mWtdK.d.ts +119 -0
- package/dist/ansi-css-V6JIHGsM.d.ts +119 -0
- package/dist/ansi-css-_3eSEU9d.d.ts +119 -0
- package/dist/chunk-3EFDH7PK.js +5235 -0
- package/dist/chunk-3RG5ZIWI.js +10 -0
- package/dist/chunk-3X5IR6WE.js +884 -0
- package/dist/chunk-4FV5ZDCE.js +5236 -0
- package/dist/chunk-4OVMSF2J.js +243 -0
- package/dist/chunk-63FEETIS.js +4048 -0
- package/dist/chunk-B43KP7XJ.js +884 -0
- package/dist/chunk-BMTJXWUV.js +655 -0
- package/dist/chunk-C3SVH4N7.js +882 -0
- package/dist/chunk-EVWR7Y47.js +874 -0
- package/dist/chunk-F6A5VWUC.js +1285 -0
- package/dist/chunk-FD7KW7GE.js +882 -0
- package/dist/chunk-GBQ6UD6I.js +655 -0
- package/dist/chunk-GMDD3M6U.js +5227 -0
- package/dist/chunk-JBHRXOXM.js +1058 -0
- package/dist/chunk-JFOO3EYO.js +1182 -0
- package/dist/chunk-JQ5H3WXL.js +1291 -0
- package/dist/chunk-JQD5NASE.js +234 -0
- package/dist/chunk-KRHJP5R7.js +592 -0
- package/dist/chunk-KWF6WVJE.js +962 -0
- package/dist/chunk-LHYQVN3H.js +1038 -0
- package/dist/chunk-M3TLQLGC.js +1032 -0
- package/dist/chunk-MVW4Q5OP.js +240 -0
- package/dist/chunk-NXCZSWLU.js +1294 -0
- package/dist/chunk-O25TNRO6.js +607 -0
- package/dist/chunk-PNECDA2I.js +884 -0
- package/dist/chunk-QIHWRLJR.js +962 -0
- package/dist/chunk-QW5YMQ7K.js +882 -0
- package/dist/chunk-R5U7XKVJ.js +16 -0
- package/dist/chunk-RP2MVQLR.js +962 -0
- package/dist/chunk-TP6RXGXA.js +1087 -0
- package/dist/chunk-TQQSTITZ.js +655 -0
- package/dist/chunk-X24GWXQV.js +1281 -0
- package/dist/components/index.d.ts +802 -0
- package/dist/components/index.js +149 -0
- package/dist/data/index.d.ts +2554 -0
- package/dist/data/index.js +51 -0
- package/dist/forms/index.d.ts +1596 -0
- package/dist/forms/index.js +464 -0
- package/dist/index-CQRFZntR.d.ts +867 -0
- package/dist/index.d.ts +579 -0
- package/dist/index.js +786 -0
- package/dist/interactive-D0JkWosD.d.ts +217 -0
- package/dist/keyboard/index.d.ts +2 -0
- package/dist/keyboard/index.js +43 -0
- package/dist/renderers/index.d.ts +546 -0
- package/dist/renderers/index.js +2157 -0
- package/dist/storybook/index.d.ts +396 -0
- package/dist/storybook/index.js +641 -0
- package/dist/theme/index.d.ts +1339 -0
- package/dist/theme/index.js +123 -0
- package/dist/types-Bxu5PAgA.d.ts +710 -0
- package/dist/types-CIlop5Ji.d.ts +701 -0
- package/dist/types-Ca8p_p5X.d.ts +710 -0
- package/package.json +90 -0
- package/src/__tests__/components/data/card.test.ts +458 -0
- package/src/__tests__/components/data/list.test.ts +473 -0
- package/src/__tests__/components/data/metrics.test.ts +541 -0
- package/src/__tests__/components/data/table.test.ts +448 -0
- package/src/__tests__/components/input/field.test.ts +555 -0
- package/src/__tests__/components/input/form.test.ts +870 -0
- package/src/__tests__/components/input/search.test.ts +1238 -0
- package/src/__tests__/components/input/select.test.ts +658 -0
- package/src/__tests__/components/navigation/breadcrumb.test.ts +923 -0
- package/src/__tests__/components/navigation/command-palette.test.ts +1095 -0
- package/src/__tests__/components/navigation/sidebar.test.ts +1018 -0
- package/src/__tests__/components/navigation/tabs.test.ts +995 -0
- package/src/__tests__/components.test.tsx +1197 -0
- package/src/__tests__/core/compiler.test.ts +986 -0
- package/src/__tests__/core/parser.test.ts +785 -0
- package/src/__tests__/core/tier-switcher.test.ts +1103 -0
- package/src/__tests__/core/types.test.ts +1398 -0
- package/src/__tests__/data/collections.test.ts +1337 -0
- package/src/__tests__/data/db.test.ts +1265 -0
- package/src/__tests__/data/reactive.test.ts +1010 -0
- package/src/__tests__/data/sync.test.ts +1614 -0
- package/src/__tests__/errors.test.ts +660 -0
- package/src/__tests__/forms/integration.test.ts +444 -0
- package/src/__tests__/integration.test.ts +905 -0
- package/src/__tests__/keyboard.test.ts +1791 -0
- package/src/__tests__/renderer.test.ts +489 -0
- package/src/__tests__/renderers/ansi-css.test.ts +948 -0
- package/src/__tests__/renderers/ansi.test.ts +1366 -0
- package/src/__tests__/renderers/ascii.test.ts +1360 -0
- package/src/__tests__/renderers/interactive.test.ts +2353 -0
- package/src/__tests__/renderers/markdown.test.ts +1483 -0
- package/src/__tests__/renderers/text.test.ts +1369 -0
- package/src/__tests__/renderers/unicode.test.ts +1307 -0
- package/src/__tests__/theme.test.ts +639 -0
- package/src/__tests__/utils/assertions.ts +685 -0
- package/src/__tests__/utils/index.ts +115 -0
- package/src/__tests__/utils/test-renderer.ts +381 -0
- package/src/__tests__/utils/utils.test.ts +560 -0
- package/src/components/containers/card.ts +56 -0
- package/src/components/containers/dialog.ts +53 -0
- package/src/components/containers/index.ts +9 -0
- package/src/components/containers/panel.ts +59 -0
- package/src/components/feedback/badge.ts +40 -0
- package/src/components/feedback/index.ts +8 -0
- package/src/components/feedback/spinner.ts +23 -0
- package/src/components/helpers.ts +81 -0
- package/src/components/index.ts +153 -0
- package/src/components/layout/breadcrumb.ts +31 -0
- package/src/components/layout/index.ts +10 -0
- package/src/components/layout/list.ts +29 -0
- package/src/components/layout/sidebar.ts +79 -0
- package/src/components/layout/table.ts +62 -0
- package/src/components/primitives/box.ts +95 -0
- package/src/components/primitives/button.ts +54 -0
- package/src/components/primitives/index.ts +11 -0
- package/src/components/primitives/input.ts +88 -0
- package/src/components/primitives/select.ts +97 -0
- package/src/components/primitives/text.ts +60 -0
- package/src/components/render.ts +155 -0
- package/src/components/templates/app.ts +43 -0
- package/src/components/templates/index.ts +8 -0
- package/src/components/templates/site.ts +54 -0
- package/src/components/types.ts +777 -0
- package/src/core/compiler.ts +718 -0
- package/src/core/parser.ts +127 -0
- package/src/core/tier-switcher.ts +607 -0
- package/src/core/types.ts +672 -0
- package/src/data/collection.ts +316 -0
- package/src/data/collections.ts +50 -0
- package/src/data/context.tsx +174 -0
- package/src/data/db.ts +127 -0
- package/src/data/hooks.ts +532 -0
- package/src/data/index.ts +138 -0
- package/src/data/reactive.ts +1225 -0
- package/src/data/saas-collections.ts +375 -0
- package/src/data/sync.ts +1213 -0
- package/src/data/types.ts +660 -0
- package/src/forms/converters.ts +512 -0
- package/src/forms/index.ts +133 -0
- package/src/forms/schemas.ts +403 -0
- package/src/forms/types.ts +476 -0
- package/src/index.ts +542 -0
- package/src/keyboard/focus.ts +748 -0
- package/src/keyboard/index.ts +96 -0
- package/src/keyboard/integration.ts +371 -0
- package/src/keyboard/manager.ts +377 -0
- package/src/keyboard/presets.ts +90 -0
- package/src/renderers/ansi-css.ts +576 -0
- package/src/renderers/ansi.ts +802 -0
- package/src/renderers/ascii.ts +680 -0
- package/src/renderers/breadcrumb.ts +480 -0
- package/src/renderers/command-palette.ts +802 -0
- package/src/renderers/components/field.ts +210 -0
- package/src/renderers/components/form.ts +327 -0
- package/src/renderers/components/index.ts +21 -0
- package/src/renderers/components/search.ts +449 -0
- package/src/renderers/components/select.ts +222 -0
- package/src/renderers/index.ts +101 -0
- package/src/renderers/interactive/component-handlers.ts +622 -0
- package/src/renderers/interactive/cursor-manager.ts +147 -0
- package/src/renderers/interactive/focus-manager.ts +279 -0
- package/src/renderers/interactive/index.ts +661 -0
- package/src/renderers/interactive/input-handler.ts +164 -0
- package/src/renderers/interactive/keyboard-handler.ts +212 -0
- package/src/renderers/interactive/mouse-handler.ts +167 -0
- package/src/renderers/interactive/state-manager.ts +109 -0
- package/src/renderers/interactive/types.ts +338 -0
- package/src/renderers/interactive-string.ts +299 -0
- package/src/renderers/interactive.ts +59 -0
- package/src/renderers/markdown.ts +950 -0
- package/src/renderers/sidebar.ts +549 -0
- package/src/renderers/tabs.ts +682 -0
- package/src/renderers/text.ts +791 -0
- package/src/renderers/unicode.ts +917 -0
- package/src/renderers/utils.ts +942 -0
- package/src/router/adapters.ts +383 -0
- package/src/router/types.ts +140 -0
- package/src/router/utils.ts +452 -0
- package/src/schemas.ts +205 -0
- package/src/storybook/index.ts +91 -0
- package/src/storybook/interactive-decorator.tsx +659 -0
- package/src/storybook/keyboard-simulator.ts +501 -0
- package/src/theme/ansi-codes.ts +80 -0
- package/src/theme/box-drawing.ts +132 -0
- package/src/theme/color-convert.ts +254 -0
- package/src/theme/color-support.ts +321 -0
- package/src/theme/index.ts +134 -0
- package/src/theme/strip-ansi.ts +50 -0
- package/src/theme/tailwind-map.ts +469 -0
- package/src/theme/text-styles.ts +206 -0
- package/src/theme/theme-system.ts +568 -0
- package/src/types.ts +103 -0
|
@@ -0,0 +1,1281 @@
|
|
|
1
|
+
// src/renderers/utils.ts
|
|
2
|
+
function getIndentStr(level) {
|
|
3
|
+
return " ".repeat(Math.max(0, level));
|
|
4
|
+
}
|
|
5
|
+
function getTextWidth(text) {
|
|
6
|
+
return text.length;
|
|
7
|
+
}
|
|
8
|
+
function padText(text, width, align = "left", padChar = " ") {
|
|
9
|
+
const textLen = getTextWidth(text);
|
|
10
|
+
if (textLen >= width) {
|
|
11
|
+
return text.slice(0, width);
|
|
12
|
+
}
|
|
13
|
+
const totalPad = width - textLen;
|
|
14
|
+
const padStr = padChar.repeat(totalPad);
|
|
15
|
+
switch (align) {
|
|
16
|
+
case "center":
|
|
17
|
+
const leftPad = Math.floor(totalPad / 2);
|
|
18
|
+
const rightPad = totalPad - leftPad;
|
|
19
|
+
return padChar.repeat(leftPad) + text + padChar.repeat(rightPad);
|
|
20
|
+
case "right":
|
|
21
|
+
return padStr + text;
|
|
22
|
+
case "left":
|
|
23
|
+
default:
|
|
24
|
+
return text + padStr;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function wrapText(text, maxWidth) {
|
|
28
|
+
if (maxWidth <= 0) {
|
|
29
|
+
return [text];
|
|
30
|
+
}
|
|
31
|
+
const normalized = text.replace(/[ \t]+/g, " ");
|
|
32
|
+
const lines = [];
|
|
33
|
+
const paragraphs = normalized.split("\n");
|
|
34
|
+
for (const paragraph of paragraphs) {
|
|
35
|
+
if (paragraph.length === 0) {
|
|
36
|
+
lines.push("");
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
const words = paragraph.split(" ").filter((w) => w.length > 0);
|
|
40
|
+
let currentLine = "";
|
|
41
|
+
for (const word of words) {
|
|
42
|
+
if (word.length > maxWidth) {
|
|
43
|
+
if (currentLine.length > 0) {
|
|
44
|
+
lines.push(currentLine);
|
|
45
|
+
currentLine = "";
|
|
46
|
+
}
|
|
47
|
+
let remaining = word;
|
|
48
|
+
while (remaining.length > maxWidth) {
|
|
49
|
+
lines.push(remaining.slice(0, maxWidth));
|
|
50
|
+
remaining = remaining.slice(maxWidth);
|
|
51
|
+
}
|
|
52
|
+
if (remaining.length > 0) {
|
|
53
|
+
currentLine = remaining;
|
|
54
|
+
}
|
|
55
|
+
} else if (currentLine.length === 0) {
|
|
56
|
+
currentLine = word;
|
|
57
|
+
} else if (currentLine.length + 1 + word.length <= maxWidth) {
|
|
58
|
+
currentLine += " " + word;
|
|
59
|
+
} else {
|
|
60
|
+
lines.push(currentLine);
|
|
61
|
+
currentLine = word;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (currentLine.length > 0 || paragraph.length === 0) {
|
|
65
|
+
lines.push(currentLine);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return lines;
|
|
69
|
+
}
|
|
70
|
+
function sanitizeToASCII(text) {
|
|
71
|
+
let result = "";
|
|
72
|
+
for (const char of text) {
|
|
73
|
+
const code = char.codePointAt(0) ?? 0;
|
|
74
|
+
if (code <= 127) {
|
|
75
|
+
result += char;
|
|
76
|
+
} else if (char === "\u2022" || char === "\u25CF" || char === "\u25CB" || char === "\u25A0") {
|
|
77
|
+
result += "*";
|
|
78
|
+
} else if (code >= 9472 && code <= 9599) {
|
|
79
|
+
result += boxDrawingToASCII(char);
|
|
80
|
+
} else if (code >= 128512 && code <= 128591 || code > 65536) {
|
|
81
|
+
result += "";
|
|
82
|
+
} else {
|
|
83
|
+
result += "";
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return result;
|
|
87
|
+
}
|
|
88
|
+
function boxDrawingToASCII(char) {
|
|
89
|
+
const code = char.codePointAt(0) ?? 0;
|
|
90
|
+
if ([9472, 9473, 9476, 9477, 9480, 9481, 9548, 9549].includes(code)) {
|
|
91
|
+
return "-";
|
|
92
|
+
}
|
|
93
|
+
if ([9474, 9475, 9478, 9479, 9482, 9483, 9550, 9551].includes(code)) {
|
|
94
|
+
return "|";
|
|
95
|
+
}
|
|
96
|
+
return "+";
|
|
97
|
+
}
|
|
98
|
+
function buildBox(chars, contentLines, width) {
|
|
99
|
+
if (width <= 0) return [];
|
|
100
|
+
if (width <= 2) return [chars.topLeft + chars.topRight];
|
|
101
|
+
const innerWidth = width - 2;
|
|
102
|
+
const lines = [];
|
|
103
|
+
lines.push(chars.topLeft + chars.horizontal.repeat(innerWidth) + chars.topRight);
|
|
104
|
+
for (const lineContent of contentLines) {
|
|
105
|
+
const paddedContent = padText(lineContent, innerWidth, "left");
|
|
106
|
+
lines.push(chars.vertical + paddedContent.slice(0, innerWidth) + chars.vertical);
|
|
107
|
+
}
|
|
108
|
+
lines.push(chars.bottomLeft + chars.horizontal.repeat(innerWidth) + chars.bottomRight);
|
|
109
|
+
return lines;
|
|
110
|
+
}
|
|
111
|
+
function extractStringArray(items) {
|
|
112
|
+
if (!Array.isArray(items)) return [];
|
|
113
|
+
return items.map((item) => {
|
|
114
|
+
if (typeof item === "string") {
|
|
115
|
+
return item;
|
|
116
|
+
}
|
|
117
|
+
if (typeof item === "object" && item !== null && "text" in item) {
|
|
118
|
+
return String(item.text);
|
|
119
|
+
}
|
|
120
|
+
return String(item);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function extractHeaders(columns) {
|
|
124
|
+
if (!Array.isArray(columns)) return [];
|
|
125
|
+
return columns.map((col) => col.header || col.key || "");
|
|
126
|
+
}
|
|
127
|
+
function extractRowValues(row, columns) {
|
|
128
|
+
if (!Array.isArray(columns)) return [];
|
|
129
|
+
return columns.map((col) => {
|
|
130
|
+
const val = row[col.key];
|
|
131
|
+
return val != null ? String(val) : "";
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
function joinParts(parts, separator = "\n\n") {
|
|
135
|
+
return parts.filter((p) => p.length > 0).join(separator);
|
|
136
|
+
}
|
|
137
|
+
function getProp(obj, key, defaultValue) {
|
|
138
|
+
const val = obj[key];
|
|
139
|
+
return val === void 0 ? defaultValue : val;
|
|
140
|
+
}
|
|
141
|
+
var DEFAULT_THEME_TOKENS = {
|
|
142
|
+
primary: "",
|
|
143
|
+
secondary: "",
|
|
144
|
+
muted: "",
|
|
145
|
+
foreground: "",
|
|
146
|
+
background: "",
|
|
147
|
+
border: "",
|
|
148
|
+
success: "",
|
|
149
|
+
warning: "",
|
|
150
|
+
error: "",
|
|
151
|
+
info: ""
|
|
152
|
+
};
|
|
153
|
+
var DEFAULT_RENDER_CONTEXT = {
|
|
154
|
+
width: 80,
|
|
155
|
+
height: 24,
|
|
156
|
+
depth: 0
|
|
157
|
+
};
|
|
158
|
+
var ASCII_BOX_CHARS = {
|
|
159
|
+
topLeft: "+",
|
|
160
|
+
topRight: "+",
|
|
161
|
+
bottomLeft: "+",
|
|
162
|
+
bottomRight: "+",
|
|
163
|
+
horizontal: "-",
|
|
164
|
+
vertical: "|"
|
|
165
|
+
};
|
|
166
|
+
var ASCII_DOUBLE_BOX_CHARS = {
|
|
167
|
+
topLeft: "+",
|
|
168
|
+
topRight: "+",
|
|
169
|
+
bottomLeft: "+",
|
|
170
|
+
bottomRight: "+",
|
|
171
|
+
horizontal: "=",
|
|
172
|
+
vertical: "|"
|
|
173
|
+
};
|
|
174
|
+
var UNICODE_SINGLE_BOX_CHARS = {
|
|
175
|
+
topLeft: "\u250C",
|
|
176
|
+
topRight: "\u2510",
|
|
177
|
+
bottomLeft: "\u2514",
|
|
178
|
+
bottomRight: "\u2518",
|
|
179
|
+
horizontal: "\u2500",
|
|
180
|
+
vertical: "\u2502"
|
|
181
|
+
};
|
|
182
|
+
var UNICODE_DOUBLE_BOX_CHARS = {
|
|
183
|
+
topLeft: "\u2554",
|
|
184
|
+
topRight: "\u2557",
|
|
185
|
+
bottomLeft: "\u255A",
|
|
186
|
+
bottomRight: "\u255D",
|
|
187
|
+
horizontal: "\u2550",
|
|
188
|
+
vertical: "\u2551"
|
|
189
|
+
};
|
|
190
|
+
var UNICODE_ROUNDED_BOX_CHARS = {
|
|
191
|
+
topLeft: "\u256D",
|
|
192
|
+
topRight: "\u256E",
|
|
193
|
+
bottomLeft: "\u2570",
|
|
194
|
+
bottomRight: "\u256F",
|
|
195
|
+
horizontal: "\u2500",
|
|
196
|
+
vertical: "\u2502"
|
|
197
|
+
};
|
|
198
|
+
function getASCIIBoxChars(style) {
|
|
199
|
+
if (style === "double") {
|
|
200
|
+
return ASCII_DOUBLE_BOX_CHARS;
|
|
201
|
+
}
|
|
202
|
+
return ASCII_BOX_CHARS;
|
|
203
|
+
}
|
|
204
|
+
function getUnicodeBoxChars(style) {
|
|
205
|
+
switch (style) {
|
|
206
|
+
case "double":
|
|
207
|
+
return UNICODE_DOUBLE_BOX_CHARS;
|
|
208
|
+
case "rounded":
|
|
209
|
+
return UNICODE_ROUNDED_BOX_CHARS;
|
|
210
|
+
case "single":
|
|
211
|
+
default:
|
|
212
|
+
return UNICODE_SINGLE_BOX_CHARS;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
var UNICODE_SYMBOLS = {
|
|
216
|
+
// Bullets and list markers
|
|
217
|
+
bullet: "\u2022",
|
|
218
|
+
hollowBullet: "\u25E6",
|
|
219
|
+
squareBullet: "\u25AA",
|
|
220
|
+
triangleRight: "\u25B8",
|
|
221
|
+
triangleDown: "\u25BE",
|
|
222
|
+
checkmark: "\u2713",
|
|
223
|
+
crossMark: "\u2717",
|
|
224
|
+
unchecked: "\u2610",
|
|
225
|
+
arrowRight: "\u2192",
|
|
226
|
+
arrowDown: "\u2193",
|
|
227
|
+
// Progress bar characters
|
|
228
|
+
progressFull: "\u2593",
|
|
229
|
+
progressEmpty: "\u2591",
|
|
230
|
+
progressHalf: "\u2592",
|
|
231
|
+
// Dividers
|
|
232
|
+
ellipsis: "\u2026",
|
|
233
|
+
middleDot: "\xB7",
|
|
234
|
+
// Table junction characters
|
|
235
|
+
teeLeft: "\u251C",
|
|
236
|
+
teeRight: "\u2524",
|
|
237
|
+
teeTop: "\u252C",
|
|
238
|
+
teeBottom: "\u2534",
|
|
239
|
+
crossJunction: "\u253C"
|
|
240
|
+
};
|
|
241
|
+
var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
242
|
+
function calculateColumnWidths(headers, rows, maxTableWidth) {
|
|
243
|
+
const columnCount = Math.max(headers.length, ...rows.map((r) => r.length));
|
|
244
|
+
const colWidths = [];
|
|
245
|
+
for (let i = 0; i < columnCount; i++) {
|
|
246
|
+
let maxWidth = headers[i]?.length ?? 0;
|
|
247
|
+
for (const row of rows) {
|
|
248
|
+
const cellLen = (row[i] ?? "").length;
|
|
249
|
+
maxWidth = Math.max(maxWidth, cellLen);
|
|
250
|
+
}
|
|
251
|
+
colWidths.push(maxWidth);
|
|
252
|
+
}
|
|
253
|
+
if (maxTableWidth && maxTableWidth > 0 && columnCount > 0) {
|
|
254
|
+
const totalWidth = colWidths.reduce((a, b) => a + b, 0) + columnCount + 1;
|
|
255
|
+
if (totalWidth > maxTableWidth) {
|
|
256
|
+
const availableForContent = maxTableWidth - columnCount - 1;
|
|
257
|
+
const maxPerColumn = Math.max(1, Math.floor(availableForContent / columnCount));
|
|
258
|
+
for (let i = 0; i < colWidths.length; i++) {
|
|
259
|
+
colWidths[i] = Math.min(colWidths[i], maxPerColumn);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
return colWidths;
|
|
264
|
+
}
|
|
265
|
+
function buildTableSeparator(colWidths, chars) {
|
|
266
|
+
return chars.left + colWidths.map((w) => chars.horizontal.repeat(w)).join(chars.middle) + chars.right;
|
|
267
|
+
}
|
|
268
|
+
function buildTableRow(cells, colWidths, vertical) {
|
|
269
|
+
const parts = colWidths.map((w, i) => {
|
|
270
|
+
const cell = cells[i] ?? "";
|
|
271
|
+
const truncated = cell.length > w ? cell.slice(0, w) : cell;
|
|
272
|
+
return truncated.padEnd(w);
|
|
273
|
+
});
|
|
274
|
+
return vertical + parts.join(vertical) + vertical;
|
|
275
|
+
}
|
|
276
|
+
function createCallbackRouterAdapter(config) {
|
|
277
|
+
return {
|
|
278
|
+
getCurrentPath: () => config.currentPath || "/",
|
|
279
|
+
navigate: (path) => config.onNavigate?.(path),
|
|
280
|
+
isActive: (path, mode = "exact") => {
|
|
281
|
+
const current = config.currentPath || "/";
|
|
282
|
+
return matchPath(current, path, mode);
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
function matchPath(currentPath, targetPath, mode = "exact") {
|
|
287
|
+
const normCurrent = normalizePath(currentPath);
|
|
288
|
+
const normTarget = normalizePath(targetPath);
|
|
289
|
+
switch (mode) {
|
|
290
|
+
case "exact":
|
|
291
|
+
return normCurrent === normTarget;
|
|
292
|
+
case "prefix":
|
|
293
|
+
if (normTarget === "/") {
|
|
294
|
+
return normCurrent === "/";
|
|
295
|
+
}
|
|
296
|
+
return normCurrent === normTarget || normCurrent.startsWith(normTarget + "/");
|
|
297
|
+
case "pattern":
|
|
298
|
+
return matchPathPattern(normCurrent, normTarget);
|
|
299
|
+
default:
|
|
300
|
+
return normCurrent === normTarget;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
function normalizePath(path) {
|
|
304
|
+
if (!path || path === "/") return "/";
|
|
305
|
+
const normalized = path.endsWith("/") ? path.slice(0, -1) : path;
|
|
306
|
+
return normalized.startsWith("/") ? normalized : "/" + normalized;
|
|
307
|
+
}
|
|
308
|
+
function matchPathPattern(path, pattern) {
|
|
309
|
+
if (pattern.endsWith("*")) {
|
|
310
|
+
const prefix = pattern.slice(0, -1);
|
|
311
|
+
return path.startsWith(prefix);
|
|
312
|
+
}
|
|
313
|
+
const pathSegments = path.split("/").filter(Boolean);
|
|
314
|
+
const patternSegments = pattern.split("/").filter(Boolean);
|
|
315
|
+
if (pathSegments.length !== patternSegments.length) {
|
|
316
|
+
return false;
|
|
317
|
+
}
|
|
318
|
+
for (let i = 0; i < patternSegments.length; i++) {
|
|
319
|
+
const patternSeg = patternSegments[i];
|
|
320
|
+
const pathSeg = pathSegments[i];
|
|
321
|
+
if (patternSeg.startsWith(":")) {
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
if (patternSeg !== pathSeg) {
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
return true;
|
|
329
|
+
}
|
|
330
|
+
function generateBreadcrumbSegments(path, options) {
|
|
331
|
+
const {
|
|
332
|
+
labels = {},
|
|
333
|
+
labelGenerator = (s) => formatSegmentLabel(s),
|
|
334
|
+
includeHome = true,
|
|
335
|
+
homeLabel = "Home"
|
|
336
|
+
} = options || {};
|
|
337
|
+
const segments = [];
|
|
338
|
+
if (includeHome) {
|
|
339
|
+
segments.push({ label: labels["/"] || homeLabel, path: "/" });
|
|
340
|
+
}
|
|
341
|
+
const parts = path.split("/").filter(Boolean);
|
|
342
|
+
let cumulativePath = "";
|
|
343
|
+
for (const part of parts) {
|
|
344
|
+
cumulativePath += "/" + part;
|
|
345
|
+
const label = labels[cumulativePath] || labelGenerator(part, cumulativePath);
|
|
346
|
+
segments.push({ label, path: cumulativePath });
|
|
347
|
+
}
|
|
348
|
+
return segments;
|
|
349
|
+
}
|
|
350
|
+
function formatSegmentLabel(segment) {
|
|
351
|
+
return segment.replace(/[-_]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
|
|
352
|
+
}
|
|
353
|
+
function findActiveItemByPath(items, currentPath, mode = "prefix") {
|
|
354
|
+
const exactMatch = items.find((item) => item.path && matchPath(currentPath, item.path, "exact"));
|
|
355
|
+
if (exactMatch) return exactMatch.id;
|
|
356
|
+
if (mode === "prefix") {
|
|
357
|
+
const sortedItems = [...items].filter((item) => item.path).sort((a, b) => (b.path?.length ?? 0) - (a.path?.length ?? 0));
|
|
358
|
+
for (const item of sortedItems) {
|
|
359
|
+
if (item.path && matchPath(currentPath, item.path, "prefix")) {
|
|
360
|
+
return item.id;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
return void 0;
|
|
365
|
+
}
|
|
366
|
+
function findActiveItemInSections(sections, currentPath, mode = "prefix") {
|
|
367
|
+
const allItems = sections.flatMap((s) => s.items);
|
|
368
|
+
return findActiveItemByPath(allItems, currentPath, mode);
|
|
369
|
+
}
|
|
370
|
+
function joinPath(...segments) {
|
|
371
|
+
const joined = segments.map((s) => s.replace(/^\/+|\/+$/g, "")).filter(Boolean).join("/");
|
|
372
|
+
return "/" + joined;
|
|
373
|
+
}
|
|
374
|
+
function extractPathParams(path, pattern) {
|
|
375
|
+
const pathSegments = path.split("/").filter(Boolean);
|
|
376
|
+
const patternSegments = pattern.split("/").filter(Boolean);
|
|
377
|
+
if (pathSegments.length !== patternSegments.length) {
|
|
378
|
+
return null;
|
|
379
|
+
}
|
|
380
|
+
const params = {};
|
|
381
|
+
for (let i = 0; i < patternSegments.length; i++) {
|
|
382
|
+
const patternSeg = patternSegments[i];
|
|
383
|
+
const pathSeg = pathSegments[i];
|
|
384
|
+
if (patternSeg.startsWith(":")) {
|
|
385
|
+
const paramName = patternSeg.slice(1);
|
|
386
|
+
params[paramName] = pathSeg;
|
|
387
|
+
} else if (patternSeg !== pathSeg) {
|
|
388
|
+
return null;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
return params;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// src/renderers/text.ts
|
|
395
|
+
function renderText(node, options = {}) {
|
|
396
|
+
const indent = options.indent ?? 0;
|
|
397
|
+
const indentStr = getIndentStr(indent);
|
|
398
|
+
const type = node.type;
|
|
399
|
+
const props = node.props || {};
|
|
400
|
+
const children = node.children || [];
|
|
401
|
+
switch (type) {
|
|
402
|
+
case "text":
|
|
403
|
+
return renderTextNode(props);
|
|
404
|
+
case "header":
|
|
405
|
+
return renderHeader(props);
|
|
406
|
+
case "list":
|
|
407
|
+
return renderList(props, children, indent);
|
|
408
|
+
case "table":
|
|
409
|
+
return renderTable(props, node.data);
|
|
410
|
+
case "code":
|
|
411
|
+
return renderCode(props);
|
|
412
|
+
case "link":
|
|
413
|
+
return renderLink(props);
|
|
414
|
+
case "button":
|
|
415
|
+
return renderButton(props);
|
|
416
|
+
case "box":
|
|
417
|
+
return renderBox(props, children, indent);
|
|
418
|
+
case "panel":
|
|
419
|
+
return renderPanel(props, children, indent);
|
|
420
|
+
case "card":
|
|
421
|
+
return renderCard(props, children, indent);
|
|
422
|
+
case "metrics":
|
|
423
|
+
return renderMetrics(props);
|
|
424
|
+
case "metric":
|
|
425
|
+
return renderSingleMetric(props);
|
|
426
|
+
case "sidebar":
|
|
427
|
+
return renderSidebar(props, indent);
|
|
428
|
+
case "breadcrumb":
|
|
429
|
+
return renderBreadcrumb(props);
|
|
430
|
+
case "badge":
|
|
431
|
+
return renderBadge(props);
|
|
432
|
+
case "dialog":
|
|
433
|
+
return renderDialog(props, children, indent);
|
|
434
|
+
case "spinner":
|
|
435
|
+
return renderSpinner(props);
|
|
436
|
+
case "dashboard":
|
|
437
|
+
return renderDashboard(props, children, indent);
|
|
438
|
+
case "settings":
|
|
439
|
+
return renderSettings(props, children, indent);
|
|
440
|
+
case "input":
|
|
441
|
+
return renderInput(props);
|
|
442
|
+
case "select":
|
|
443
|
+
return renderSelect(props);
|
|
444
|
+
case "hero":
|
|
445
|
+
return renderHero(props);
|
|
446
|
+
case "features":
|
|
447
|
+
return renderFeatures(props);
|
|
448
|
+
case "pricing":
|
|
449
|
+
return renderPricing(props);
|
|
450
|
+
case "faq":
|
|
451
|
+
return renderFAQ(props);
|
|
452
|
+
case "footer":
|
|
453
|
+
return renderFooter(props);
|
|
454
|
+
default:
|
|
455
|
+
return renderChildren(children, indent);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
function renderTextNode(props) {
|
|
459
|
+
const content = props.content;
|
|
460
|
+
if (content == null) return "";
|
|
461
|
+
return String(content);
|
|
462
|
+
}
|
|
463
|
+
function renderHeader(props) {
|
|
464
|
+
const content = props.content;
|
|
465
|
+
const nav = props.nav;
|
|
466
|
+
const callToAction = props.callToAction;
|
|
467
|
+
const breadcrumbs = props.breadcrumbs;
|
|
468
|
+
if (content != null) {
|
|
469
|
+
return String(content);
|
|
470
|
+
}
|
|
471
|
+
const parts = [];
|
|
472
|
+
if (nav && Array.isArray(nav) && nav.length > 0) {
|
|
473
|
+
const navLabels = nav.map((item) => item.label).join(" | ");
|
|
474
|
+
parts.push(navLabels);
|
|
475
|
+
}
|
|
476
|
+
if (breadcrumbs && Array.isArray(breadcrumbs) && breadcrumbs.length > 0) {
|
|
477
|
+
const crumbLabels = breadcrumbs.map((item) => item.label).join(" > ");
|
|
478
|
+
parts.push(crumbLabels);
|
|
479
|
+
}
|
|
480
|
+
if (callToAction) {
|
|
481
|
+
parts.push(callToAction);
|
|
482
|
+
}
|
|
483
|
+
return parts.join("\n");
|
|
484
|
+
}
|
|
485
|
+
function renderList(props, children, indent) {
|
|
486
|
+
const items = props.items;
|
|
487
|
+
const numbered = getProp(props, "numbered", false);
|
|
488
|
+
const taskList = getProp(props, "taskList", false);
|
|
489
|
+
const indentStr = getIndentStr(indent);
|
|
490
|
+
const lines = [];
|
|
491
|
+
if (items && Array.isArray(items)) {
|
|
492
|
+
items.forEach((item, index) => {
|
|
493
|
+
let text;
|
|
494
|
+
let prefix;
|
|
495
|
+
if (typeof item === "string") {
|
|
496
|
+
text = item;
|
|
497
|
+
prefix = numbered ? `${index + 1}. ` : "- ";
|
|
498
|
+
} else if (typeof item === "object" && item !== null) {
|
|
499
|
+
const itemObj = item;
|
|
500
|
+
text = itemObj.text ?? String(item);
|
|
501
|
+
if (taskList && "checked" in itemObj) {
|
|
502
|
+
prefix = itemObj.checked ? "[x] " : "[ ] ";
|
|
503
|
+
} else {
|
|
504
|
+
prefix = numbered ? `${index + 1}. ` : "- ";
|
|
505
|
+
}
|
|
506
|
+
} else {
|
|
507
|
+
text = String(item);
|
|
508
|
+
prefix = numbered ? `${index + 1}. ` : "- ";
|
|
509
|
+
}
|
|
510
|
+
lines.push(`${indentStr}${prefix}${text}`);
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
const nestedChildren = children && children.length > 0 ? children : props.children;
|
|
514
|
+
if (nestedChildren && nestedChildren.length > 0) {
|
|
515
|
+
nestedChildren.forEach((child, index) => {
|
|
516
|
+
if (child.type === "list-item") {
|
|
517
|
+
const content = child.props?.content ?? "";
|
|
518
|
+
const prefix = numbered ? `${index + 1}. ` : "- ";
|
|
519
|
+
lines.push(`${indentStr}${prefix}${content}`);
|
|
520
|
+
if (child.children && child.children.length > 0) {
|
|
521
|
+
child.children.forEach((nestedChild) => {
|
|
522
|
+
const nestedOutput = renderText(nestedChild, { indent: indent + 1 });
|
|
523
|
+
if (nestedOutput) {
|
|
524
|
+
lines.push(nestedOutput);
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
} else {
|
|
529
|
+
const childOutput = renderText(child, { indent: indent + 1 });
|
|
530
|
+
if (childOutput) {
|
|
531
|
+
lines.push(childOutput);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
return lines.join("\n");
|
|
537
|
+
}
|
|
538
|
+
function renderTable(props, nodeData) {
|
|
539
|
+
const columns = props.columns;
|
|
540
|
+
const data = nodeData ?? props.data;
|
|
541
|
+
const lines = [];
|
|
542
|
+
if (!columns || !Array.isArray(columns)) return "";
|
|
543
|
+
const headers = extractHeaders(columns);
|
|
544
|
+
lines.push(headers.join(", "));
|
|
545
|
+
if (data && Array.isArray(data)) {
|
|
546
|
+
data.forEach((row) => {
|
|
547
|
+
const values = extractRowValues(row, columns);
|
|
548
|
+
lines.push(values.join(", "));
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
return lines.join("\n");
|
|
552
|
+
}
|
|
553
|
+
function renderCode(props) {
|
|
554
|
+
const code = props.code;
|
|
555
|
+
if (code == null) return "";
|
|
556
|
+
return String(code);
|
|
557
|
+
}
|
|
558
|
+
function renderLink(props) {
|
|
559
|
+
const text = props.text;
|
|
560
|
+
if (text == null) return "";
|
|
561
|
+
return String(text);
|
|
562
|
+
}
|
|
563
|
+
function renderButton(props) {
|
|
564
|
+
const label = props.label;
|
|
565
|
+
const hotkey = props.hotkey;
|
|
566
|
+
if (!label) return "";
|
|
567
|
+
if (hotkey) {
|
|
568
|
+
return `${label} (${hotkey})`;
|
|
569
|
+
}
|
|
570
|
+
return label;
|
|
571
|
+
}
|
|
572
|
+
function renderBox(props, children, indent) {
|
|
573
|
+
const title = props.title;
|
|
574
|
+
const parts = [];
|
|
575
|
+
if (title) {
|
|
576
|
+
parts.push(title);
|
|
577
|
+
}
|
|
578
|
+
const childOutput = renderChildren(children, indent);
|
|
579
|
+
if (childOutput) {
|
|
580
|
+
parts.push(childOutput);
|
|
581
|
+
}
|
|
582
|
+
return parts.join("\n\n");
|
|
583
|
+
}
|
|
584
|
+
function renderPanel(props, children, indent) {
|
|
585
|
+
const title = props.title;
|
|
586
|
+
const collapsed = props.collapsed;
|
|
587
|
+
const parts = [];
|
|
588
|
+
if (title) {
|
|
589
|
+
parts.push(title);
|
|
590
|
+
}
|
|
591
|
+
const childOutput = renderChildren(children, indent);
|
|
592
|
+
if (childOutput) {
|
|
593
|
+
parts.push(childOutput);
|
|
594
|
+
}
|
|
595
|
+
return parts.join("\n\n");
|
|
596
|
+
}
|
|
597
|
+
function renderCard(props, children, indent) {
|
|
598
|
+
const title = props.title;
|
|
599
|
+
const subtitle = props.subtitle;
|
|
600
|
+
const badge = props.badge;
|
|
601
|
+
const titleAction = props.titleAction;
|
|
602
|
+
const pairs = props.pairs;
|
|
603
|
+
const actions = props.actions;
|
|
604
|
+
const parts = [];
|
|
605
|
+
if (title) {
|
|
606
|
+
let titleLine = title;
|
|
607
|
+
if (badge) {
|
|
608
|
+
titleLine += ` ${badge.content}`;
|
|
609
|
+
}
|
|
610
|
+
if (titleAction) {
|
|
611
|
+
titleLine += ` ${titleAction.label}`;
|
|
612
|
+
}
|
|
613
|
+
parts.push(titleLine);
|
|
614
|
+
}
|
|
615
|
+
if (subtitle) {
|
|
616
|
+
parts.push(subtitle);
|
|
617
|
+
}
|
|
618
|
+
if (pairs && Array.isArray(pairs)) {
|
|
619
|
+
const pairLines = pairs.map((p) => {
|
|
620
|
+
const val = p.value != null ? String(p.value) : "";
|
|
621
|
+
return `${p.key}: ${val}`;
|
|
622
|
+
});
|
|
623
|
+
if (pairLines.length > 0) {
|
|
624
|
+
parts.push(pairLines.join("\n"));
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
const childOutput = renderChildren(children, indent);
|
|
628
|
+
if (childOutput) {
|
|
629
|
+
parts.push(childOutput);
|
|
630
|
+
}
|
|
631
|
+
if (actions && Array.isArray(actions)) {
|
|
632
|
+
const actionLabels = actions.map((a) => a.label).join(" | ");
|
|
633
|
+
if (actionLabels) {
|
|
634
|
+
parts.push(actionLabels);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
return parts.join("\n\n");
|
|
638
|
+
}
|
|
639
|
+
function renderMetrics(props) {
|
|
640
|
+
const metrics = props.metrics;
|
|
641
|
+
if (!metrics || !Array.isArray(metrics) || metrics.length === 0) {
|
|
642
|
+
return "";
|
|
643
|
+
}
|
|
644
|
+
return metrics.map((m) => {
|
|
645
|
+
const val = m.value != null ? String(m.value) : "";
|
|
646
|
+
let formatted = val;
|
|
647
|
+
if (m.format === "percentage" && !val.includes("%")) {
|
|
648
|
+
formatted = `${val}%`;
|
|
649
|
+
}
|
|
650
|
+
if (m.unit) {
|
|
651
|
+
formatted = `${formatted} ${m.unit}`;
|
|
652
|
+
}
|
|
653
|
+
return `${m.label}: ${formatted}`;
|
|
654
|
+
}).join("\n");
|
|
655
|
+
}
|
|
656
|
+
function renderSingleMetric(props) {
|
|
657
|
+
const label = props.label;
|
|
658
|
+
const value = props.value;
|
|
659
|
+
const format = props.format;
|
|
660
|
+
const unit = props.unit;
|
|
661
|
+
if (!label) return "";
|
|
662
|
+
const val = value != null ? String(value) : "";
|
|
663
|
+
let formatted = val;
|
|
664
|
+
if (format === "percentage" && !val.includes("%")) {
|
|
665
|
+
formatted = `${val}%`;
|
|
666
|
+
}
|
|
667
|
+
if (unit) {
|
|
668
|
+
formatted = `${formatted} ${unit}`;
|
|
669
|
+
}
|
|
670
|
+
return `${label}: ${formatted}`;
|
|
671
|
+
}
|
|
672
|
+
function renderSidebar(props, indent) {
|
|
673
|
+
const nav = props.nav;
|
|
674
|
+
const sections = props.sections;
|
|
675
|
+
const lines = [];
|
|
676
|
+
const indentStr = getIndentStr(indent);
|
|
677
|
+
if (nav && Array.isArray(nav)) {
|
|
678
|
+
nav.forEach((item) => {
|
|
679
|
+
lines.push(`${indentStr}- ${item.label}`);
|
|
680
|
+
if (item.children && Array.isArray(item.children)) {
|
|
681
|
+
item.children.forEach((child) => {
|
|
682
|
+
lines.push(`${indentStr} - ${child.label}`);
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
if (sections && Array.isArray(sections)) {
|
|
688
|
+
sections.forEach((section) => {
|
|
689
|
+
lines.push(`${indentStr}${section.title}`);
|
|
690
|
+
if (section.items && Array.isArray(section.items)) {
|
|
691
|
+
section.items.forEach((item) => {
|
|
692
|
+
lines.push(`${indentStr} - ${item.label}`);
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
return lines.join("\n");
|
|
698
|
+
}
|
|
699
|
+
function renderBreadcrumb(props) {
|
|
700
|
+
const items = props.items;
|
|
701
|
+
const separator = props.separator || ">";
|
|
702
|
+
if (!items || !Array.isArray(items)) return "";
|
|
703
|
+
return items.map((item) => item.label).join(` ${separator} `);
|
|
704
|
+
}
|
|
705
|
+
function renderBadge(props) {
|
|
706
|
+
const children = props.children;
|
|
707
|
+
if (children == null) return "";
|
|
708
|
+
return String(children);
|
|
709
|
+
}
|
|
710
|
+
function renderDialog(props, children, indent) {
|
|
711
|
+
const open = props.open;
|
|
712
|
+
const title = props.title;
|
|
713
|
+
const actions = props.actions;
|
|
714
|
+
if (open === false) return "";
|
|
715
|
+
const parts = [];
|
|
716
|
+
if (title) {
|
|
717
|
+
parts.push(title);
|
|
718
|
+
}
|
|
719
|
+
const childOutput = renderChildren(children, indent);
|
|
720
|
+
if (childOutput) {
|
|
721
|
+
parts.push(childOutput);
|
|
722
|
+
}
|
|
723
|
+
if (actions && Array.isArray(actions)) {
|
|
724
|
+
const actionLabels = actions.map((a) => a.label).join(" | ");
|
|
725
|
+
parts.push(actionLabels);
|
|
726
|
+
}
|
|
727
|
+
return parts.join("\n\n");
|
|
728
|
+
}
|
|
729
|
+
function renderSpinner(props) {
|
|
730
|
+
const label = props.label;
|
|
731
|
+
return label || "Loading...";
|
|
732
|
+
}
|
|
733
|
+
function renderDashboard(props, children, indent) {
|
|
734
|
+
const title = props.title;
|
|
735
|
+
const metrics = props.metrics;
|
|
736
|
+
const parts = [];
|
|
737
|
+
if (title) {
|
|
738
|
+
parts.push(title);
|
|
739
|
+
}
|
|
740
|
+
if (metrics && Array.isArray(metrics) && metrics.length > 0) {
|
|
741
|
+
const metricsOutput = metrics.map((m) => `${m.label}: ${m.value}`).join("\n");
|
|
742
|
+
parts.push(metricsOutput);
|
|
743
|
+
}
|
|
744
|
+
const childOutput = renderChildren(children, indent);
|
|
745
|
+
if (childOutput) {
|
|
746
|
+
parts.push(childOutput);
|
|
747
|
+
}
|
|
748
|
+
return parts.join("\n\n");
|
|
749
|
+
}
|
|
750
|
+
function renderSettings(props, children, indent) {
|
|
751
|
+
const sections = props.sections;
|
|
752
|
+
const parts = [];
|
|
753
|
+
if (sections && Array.isArray(sections)) {
|
|
754
|
+
sections.forEach((section) => {
|
|
755
|
+
parts.push(section);
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
const childOutput = renderChildren(children, indent);
|
|
759
|
+
if (childOutput) {
|
|
760
|
+
parts.push(childOutput);
|
|
761
|
+
}
|
|
762
|
+
return parts.join("\n");
|
|
763
|
+
}
|
|
764
|
+
function renderInput(props) {
|
|
765
|
+
const label = props.label;
|
|
766
|
+
const value = props.value;
|
|
767
|
+
const placeholder = props.placeholder;
|
|
768
|
+
const parts = [];
|
|
769
|
+
if (label) {
|
|
770
|
+
parts.push(label);
|
|
771
|
+
}
|
|
772
|
+
if (value != null) {
|
|
773
|
+
parts.push(String(value));
|
|
774
|
+
} else if (placeholder) {
|
|
775
|
+
parts.push(placeholder);
|
|
776
|
+
}
|
|
777
|
+
return parts.join(": ");
|
|
778
|
+
}
|
|
779
|
+
function renderSelect(props) {
|
|
780
|
+
const label = props.label;
|
|
781
|
+
const value = props.value;
|
|
782
|
+
const options = props.options;
|
|
783
|
+
const parts = [];
|
|
784
|
+
if (label) {
|
|
785
|
+
parts.push(label);
|
|
786
|
+
}
|
|
787
|
+
if (value && options) {
|
|
788
|
+
const selected = options.find((o) => o.value === value);
|
|
789
|
+
if (selected) {
|
|
790
|
+
parts.push(`Selected: ${selected.label}`);
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
if (options && Array.isArray(options)) {
|
|
794
|
+
options.forEach((opt) => {
|
|
795
|
+
parts.push(`- ${opt.label}`);
|
|
796
|
+
});
|
|
797
|
+
}
|
|
798
|
+
return parts.join("\n");
|
|
799
|
+
}
|
|
800
|
+
function renderHero(props) {
|
|
801
|
+
const title = props.title;
|
|
802
|
+
const subtitle = props.subtitle;
|
|
803
|
+
const callToAction = props.callToAction;
|
|
804
|
+
const secondaryCallToAction = props.secondaryCallToAction;
|
|
805
|
+
const badge = props.badge;
|
|
806
|
+
const parts = [];
|
|
807
|
+
if (badge) {
|
|
808
|
+
parts.push(badge);
|
|
809
|
+
}
|
|
810
|
+
if (title) {
|
|
811
|
+
parts.push(title);
|
|
812
|
+
}
|
|
813
|
+
if (subtitle) {
|
|
814
|
+
parts.push(subtitle);
|
|
815
|
+
}
|
|
816
|
+
const ctas = [];
|
|
817
|
+
if (callToAction) {
|
|
818
|
+
ctas.push(callToAction);
|
|
819
|
+
}
|
|
820
|
+
if (secondaryCallToAction) {
|
|
821
|
+
ctas.push(secondaryCallToAction);
|
|
822
|
+
}
|
|
823
|
+
if (ctas.length > 0) {
|
|
824
|
+
parts.push(ctas.join(" | "));
|
|
825
|
+
}
|
|
826
|
+
return parts.join("\n\n");
|
|
827
|
+
}
|
|
828
|
+
function renderFeatures(props) {
|
|
829
|
+
const title = props.title;
|
|
830
|
+
const features = props.features;
|
|
831
|
+
const parts = [];
|
|
832
|
+
if (title) {
|
|
833
|
+
parts.push(title);
|
|
834
|
+
}
|
|
835
|
+
if (features && Array.isArray(features)) {
|
|
836
|
+
features.forEach((feature) => {
|
|
837
|
+
if (feature.description) {
|
|
838
|
+
parts.push(`${feature.title}: ${feature.description}`);
|
|
839
|
+
} else {
|
|
840
|
+
parts.push(feature.title);
|
|
841
|
+
}
|
|
842
|
+
});
|
|
843
|
+
}
|
|
844
|
+
return parts.join("\n\n");
|
|
845
|
+
}
|
|
846
|
+
function renderPricing(props) {
|
|
847
|
+
const tiers = props.tiers;
|
|
848
|
+
if (!tiers || !Array.isArray(tiers)) return "";
|
|
849
|
+
const parts = [];
|
|
850
|
+
tiers.forEach((tier) => {
|
|
851
|
+
const tierParts = [];
|
|
852
|
+
tierParts.push(`${tier.name} - ${tier.price}`);
|
|
853
|
+
if (tier.features && Array.isArray(tier.features)) {
|
|
854
|
+
tier.features.forEach((feature) => {
|
|
855
|
+
tierParts.push(` - ${feature}`);
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
if (tier.callToAction) {
|
|
859
|
+
tierParts.push(` ${tier.callToAction}`);
|
|
860
|
+
}
|
|
861
|
+
parts.push(tierParts.join("\n"));
|
|
862
|
+
});
|
|
863
|
+
return parts.join("\n\n");
|
|
864
|
+
}
|
|
865
|
+
function renderFAQ(props) {
|
|
866
|
+
const title = props.title;
|
|
867
|
+
const items = props.items;
|
|
868
|
+
const parts = [];
|
|
869
|
+
if (title) {
|
|
870
|
+
parts.push(title);
|
|
871
|
+
}
|
|
872
|
+
if (items && Array.isArray(items)) {
|
|
873
|
+
items.forEach((item) => {
|
|
874
|
+
parts.push(`Q: ${item.question}`);
|
|
875
|
+
parts.push(`A: ${item.answer}`);
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
return parts.join("\n\n");
|
|
879
|
+
}
|
|
880
|
+
function renderFooter(props) {
|
|
881
|
+
const links = props.links;
|
|
882
|
+
const copyright = props.copyright;
|
|
883
|
+
const social = props.social;
|
|
884
|
+
const parts = [];
|
|
885
|
+
if (links && Array.isArray(links)) {
|
|
886
|
+
links.forEach((section) => {
|
|
887
|
+
parts.push(section.title);
|
|
888
|
+
if (section.links && Array.isArray(section.links)) {
|
|
889
|
+
section.links.forEach((link) => {
|
|
890
|
+
parts.push(` - ${link.label}`);
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
});
|
|
894
|
+
}
|
|
895
|
+
if (social && Array.isArray(social)) {
|
|
896
|
+
const socialParts = social.map((s) => s.platform).join(" | ");
|
|
897
|
+
parts.push(socialParts);
|
|
898
|
+
}
|
|
899
|
+
if (copyright) {
|
|
900
|
+
parts.push(copyright);
|
|
901
|
+
}
|
|
902
|
+
return parts.join("\n");
|
|
903
|
+
}
|
|
904
|
+
function renderChildren(children, indent) {
|
|
905
|
+
if (!children || children.length === 0) return "";
|
|
906
|
+
const parts = [];
|
|
907
|
+
children.forEach((child) => {
|
|
908
|
+
const output = renderText(child, { indent });
|
|
909
|
+
if (output) {
|
|
910
|
+
parts.push(output);
|
|
911
|
+
}
|
|
912
|
+
});
|
|
913
|
+
return parts.join("\n\n");
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
// src/renderers/ansi-css.ts
|
|
917
|
+
var FG_16_COLORS = {
|
|
918
|
+
30: "black",
|
|
919
|
+
31: "red",
|
|
920
|
+
32: "green",
|
|
921
|
+
33: "yellow",
|
|
922
|
+
34: "blue",
|
|
923
|
+
35: "magenta",
|
|
924
|
+
36: "cyan",
|
|
925
|
+
37: "white"
|
|
926
|
+
};
|
|
927
|
+
var FG_BRIGHT_COLORS = {
|
|
928
|
+
90: "gray",
|
|
929
|
+
91: "#ff5555",
|
|
930
|
+
92: "#55ff55",
|
|
931
|
+
93: "#ffff55",
|
|
932
|
+
94: "#5555ff",
|
|
933
|
+
95: "#ff55ff",
|
|
934
|
+
96: "#55ffff",
|
|
935
|
+
97: "#ffffff"
|
|
936
|
+
};
|
|
937
|
+
var BG_16_COLORS = {
|
|
938
|
+
40: "black",
|
|
939
|
+
41: "red",
|
|
940
|
+
42: "green",
|
|
941
|
+
43: "yellow",
|
|
942
|
+
44: "blue",
|
|
943
|
+
45: "magenta",
|
|
944
|
+
46: "cyan",
|
|
945
|
+
47: "white"
|
|
946
|
+
};
|
|
947
|
+
var STANDARD_16_HEX = [
|
|
948
|
+
"#000000",
|
|
949
|
+
// 0 - black
|
|
950
|
+
"#800000",
|
|
951
|
+
// 1 - maroon
|
|
952
|
+
"#008000",
|
|
953
|
+
// 2 - green
|
|
954
|
+
"#808000",
|
|
955
|
+
// 3 - olive
|
|
956
|
+
"#000080",
|
|
957
|
+
// 4 - navy
|
|
958
|
+
"#800080",
|
|
959
|
+
// 5 - purple
|
|
960
|
+
"#008080",
|
|
961
|
+
// 6 - teal
|
|
962
|
+
"#c0c0c0",
|
|
963
|
+
// 7 - silver
|
|
964
|
+
"#808080",
|
|
965
|
+
// 8 - gray
|
|
966
|
+
"#ff0000",
|
|
967
|
+
// 9 - red
|
|
968
|
+
"#00ff00",
|
|
969
|
+
// 10 - lime
|
|
970
|
+
"#ffff00",
|
|
971
|
+
// 11 - yellow
|
|
972
|
+
"#0000ff",
|
|
973
|
+
// 12 - blue
|
|
974
|
+
"#ff00ff",
|
|
975
|
+
// 13 - fuchsia
|
|
976
|
+
"#00ffff",
|
|
977
|
+
// 14 - aqua
|
|
978
|
+
"#ffffff"
|
|
979
|
+
// 15 - white
|
|
980
|
+
];
|
|
981
|
+
function ansi256ToHex(code) {
|
|
982
|
+
if (code < 16) {
|
|
983
|
+
return STANDARD_16_HEX[code];
|
|
984
|
+
}
|
|
985
|
+
if (code >= 232) {
|
|
986
|
+
const gray = (code - 232) * 10 + 8;
|
|
987
|
+
const hex = gray.toString(16).padStart(2, "0");
|
|
988
|
+
return `#${hex}${hex}${hex}`;
|
|
989
|
+
}
|
|
990
|
+
const cubeIndex = code - 16;
|
|
991
|
+
const r = Math.floor(cubeIndex / 36);
|
|
992
|
+
const g = Math.floor(cubeIndex % 36 / 6);
|
|
993
|
+
const b = cubeIndex % 6;
|
|
994
|
+
const toValue = (n) => n === 0 ? 0 : 55 + n * 40;
|
|
995
|
+
const rVal = toValue(r).toString(16).padStart(2, "0");
|
|
996
|
+
const gVal = toValue(g).toString(16).padStart(2, "0");
|
|
997
|
+
const bVal = toValue(b).toString(16).padStart(2, "0");
|
|
998
|
+
return `#${rVal}${gVal}${bVal}`;
|
|
999
|
+
}
|
|
1000
|
+
function processSGRCode(code, params, index, state) {
|
|
1001
|
+
if (code === 0) {
|
|
1002
|
+
state.color = void 0;
|
|
1003
|
+
state.backgroundColor = void 0;
|
|
1004
|
+
state.bold = void 0;
|
|
1005
|
+
state.dim = void 0;
|
|
1006
|
+
state.italic = void 0;
|
|
1007
|
+
state.underline = void 0;
|
|
1008
|
+
state.strikethrough = void 0;
|
|
1009
|
+
state.inverse = void 0;
|
|
1010
|
+
return index;
|
|
1011
|
+
}
|
|
1012
|
+
if (code === 1) {
|
|
1013
|
+
state.bold = true;
|
|
1014
|
+
return index;
|
|
1015
|
+
}
|
|
1016
|
+
if (code === 2) {
|
|
1017
|
+
state.dim = true;
|
|
1018
|
+
return index;
|
|
1019
|
+
}
|
|
1020
|
+
if (code === 3) {
|
|
1021
|
+
state.italic = true;
|
|
1022
|
+
return index;
|
|
1023
|
+
}
|
|
1024
|
+
if (code === 4) {
|
|
1025
|
+
state.underline = true;
|
|
1026
|
+
return index;
|
|
1027
|
+
}
|
|
1028
|
+
if (code === 7) {
|
|
1029
|
+
state.inverse = true;
|
|
1030
|
+
return index;
|
|
1031
|
+
}
|
|
1032
|
+
if (code === 9) {
|
|
1033
|
+
state.strikethrough = true;
|
|
1034
|
+
return index;
|
|
1035
|
+
}
|
|
1036
|
+
if (code === 22) {
|
|
1037
|
+
state.bold = false;
|
|
1038
|
+
state.dim = false;
|
|
1039
|
+
return index;
|
|
1040
|
+
}
|
|
1041
|
+
if (code === 23) {
|
|
1042
|
+
state.italic = false;
|
|
1043
|
+
return index;
|
|
1044
|
+
}
|
|
1045
|
+
if (code === 24) {
|
|
1046
|
+
state.underline = false;
|
|
1047
|
+
return index;
|
|
1048
|
+
}
|
|
1049
|
+
if (code >= 30 && code <= 37) {
|
|
1050
|
+
state.color = FG_16_COLORS[code];
|
|
1051
|
+
return index;
|
|
1052
|
+
}
|
|
1053
|
+
if (code === 39) {
|
|
1054
|
+
state.color = void 0;
|
|
1055
|
+
return index;
|
|
1056
|
+
}
|
|
1057
|
+
if (code >= 40 && code <= 47) {
|
|
1058
|
+
state.backgroundColor = BG_16_COLORS[code];
|
|
1059
|
+
return index;
|
|
1060
|
+
}
|
|
1061
|
+
if (code === 49) {
|
|
1062
|
+
state.backgroundColor = void 0;
|
|
1063
|
+
return index;
|
|
1064
|
+
}
|
|
1065
|
+
if (code >= 90 && code <= 97) {
|
|
1066
|
+
state.color = FG_BRIGHT_COLORS[code];
|
|
1067
|
+
return index;
|
|
1068
|
+
}
|
|
1069
|
+
if (code === 38 || code === 48) {
|
|
1070
|
+
const isForeground = code === 38;
|
|
1071
|
+
if (params[index + 1] === 5 && params[index + 2] !== void 0) {
|
|
1072
|
+
const colorCode = params[index + 2];
|
|
1073
|
+
const hexColor = ansi256ToHex(colorCode);
|
|
1074
|
+
if (isForeground) {
|
|
1075
|
+
state.color = hexColor;
|
|
1076
|
+
} else {
|
|
1077
|
+
state.backgroundColor = hexColor;
|
|
1078
|
+
}
|
|
1079
|
+
return index + 2;
|
|
1080
|
+
}
|
|
1081
|
+
if (params[index + 1] === 2 && params[index + 2] !== void 0 && params[index + 3] !== void 0 && params[index + 4] !== void 0) {
|
|
1082
|
+
const r = params[index + 2];
|
|
1083
|
+
const g = params[index + 3];
|
|
1084
|
+
const b = params[index + 4];
|
|
1085
|
+
const rgbColor = `rgb(${r}, ${g}, ${b})`;
|
|
1086
|
+
if (isForeground) {
|
|
1087
|
+
state.color = rgbColor;
|
|
1088
|
+
} else {
|
|
1089
|
+
state.backgroundColor = rgbColor;
|
|
1090
|
+
}
|
|
1091
|
+
return index + 4;
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
return index;
|
|
1095
|
+
}
|
|
1096
|
+
function stateToCSS(state) {
|
|
1097
|
+
const css = {};
|
|
1098
|
+
let fg = state.color;
|
|
1099
|
+
let bg = state.backgroundColor;
|
|
1100
|
+
if (state.inverse) {
|
|
1101
|
+
const tempFg = fg;
|
|
1102
|
+
fg = bg || "inherit";
|
|
1103
|
+
bg = tempFg;
|
|
1104
|
+
}
|
|
1105
|
+
if (fg) {
|
|
1106
|
+
css.color = fg;
|
|
1107
|
+
}
|
|
1108
|
+
if (bg) {
|
|
1109
|
+
css.backgroundColor = bg;
|
|
1110
|
+
}
|
|
1111
|
+
if (state.bold) {
|
|
1112
|
+
css.fontWeight = "bold";
|
|
1113
|
+
} else if (state.bold === false) {
|
|
1114
|
+
css.fontWeight = "normal";
|
|
1115
|
+
}
|
|
1116
|
+
if (state.dim) {
|
|
1117
|
+
css.opacity = 0.5;
|
|
1118
|
+
}
|
|
1119
|
+
if (state.italic) {
|
|
1120
|
+
css.fontStyle = "italic";
|
|
1121
|
+
} else if (state.italic === false) {
|
|
1122
|
+
css.fontStyle = "normal";
|
|
1123
|
+
}
|
|
1124
|
+
if (state.underline) {
|
|
1125
|
+
css.textDecoration = "underline";
|
|
1126
|
+
} else if (state.underline === false) {
|
|
1127
|
+
css.textDecoration = "none";
|
|
1128
|
+
}
|
|
1129
|
+
if (state.strikethrough) {
|
|
1130
|
+
css.textDecoration = "line-through";
|
|
1131
|
+
}
|
|
1132
|
+
return css;
|
|
1133
|
+
}
|
|
1134
|
+
function cloneState(state) {
|
|
1135
|
+
return { ...state };
|
|
1136
|
+
}
|
|
1137
|
+
var ANSI_REGEX = /\x1b(?:\[([0-9;]*)([A-Za-z])|\].*?(?:\x1b\\|\x07)|\[[^m]*)/g;
|
|
1138
|
+
function parseAnsi(ansiString) {
|
|
1139
|
+
if (!ansiString) {
|
|
1140
|
+
return [];
|
|
1141
|
+
}
|
|
1142
|
+
const spans = [];
|
|
1143
|
+
const state = {};
|
|
1144
|
+
let lastIndex = 0;
|
|
1145
|
+
let match;
|
|
1146
|
+
ANSI_REGEX.lastIndex = 0;
|
|
1147
|
+
while ((match = ANSI_REGEX.exec(ansiString)) !== null) {
|
|
1148
|
+
const textBefore = ansiString.slice(lastIndex, match.index);
|
|
1149
|
+
if (textBefore) {
|
|
1150
|
+
spans.push({
|
|
1151
|
+
text: textBefore,
|
|
1152
|
+
style: stateToCSS(cloneState(state))
|
|
1153
|
+
});
|
|
1154
|
+
}
|
|
1155
|
+
const params = match[1];
|
|
1156
|
+
const terminator = match[2];
|
|
1157
|
+
if (terminator === "m" && params !== void 0) {
|
|
1158
|
+
const codes = params.split(";").filter((p) => p !== "").map((p) => parseInt(p, 10));
|
|
1159
|
+
if (codes.length === 0) {
|
|
1160
|
+
codes.push(0);
|
|
1161
|
+
}
|
|
1162
|
+
let i = 0;
|
|
1163
|
+
while (i < codes.length) {
|
|
1164
|
+
i = processSGRCode(codes[i], codes, i, state) + 1;
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
lastIndex = match.index + match[0].length;
|
|
1168
|
+
}
|
|
1169
|
+
const remainingText = ansiString.slice(lastIndex);
|
|
1170
|
+
if (remainingText) {
|
|
1171
|
+
spans.push({
|
|
1172
|
+
text: remainingText,
|
|
1173
|
+
style: stateToCSS(cloneState(state))
|
|
1174
|
+
});
|
|
1175
|
+
}
|
|
1176
|
+
return spans;
|
|
1177
|
+
}
|
|
1178
|
+
function ansiToCSS(ansiString) {
|
|
1179
|
+
const spans = parseAnsi(ansiString);
|
|
1180
|
+
const plainText = spans.map((s) => s.text).join("");
|
|
1181
|
+
return {
|
|
1182
|
+
spans,
|
|
1183
|
+
plainText
|
|
1184
|
+
};
|
|
1185
|
+
}
|
|
1186
|
+
function spanToInlineStyle(span) {
|
|
1187
|
+
const parts = [];
|
|
1188
|
+
if (span.style.color) {
|
|
1189
|
+
parts.push(`color: ${span.style.color}`);
|
|
1190
|
+
}
|
|
1191
|
+
if (span.style.backgroundColor) {
|
|
1192
|
+
parts.push(`background-color: ${span.style.backgroundColor}`);
|
|
1193
|
+
}
|
|
1194
|
+
if (span.style.fontWeight) {
|
|
1195
|
+
parts.push(`font-weight: ${span.style.fontWeight}`);
|
|
1196
|
+
}
|
|
1197
|
+
if (span.style.fontStyle) {
|
|
1198
|
+
parts.push(`font-style: ${span.style.fontStyle}`);
|
|
1199
|
+
}
|
|
1200
|
+
if (span.style.textDecoration) {
|
|
1201
|
+
parts.push(`text-decoration: ${span.style.textDecoration}`);
|
|
1202
|
+
}
|
|
1203
|
+
if (span.style.opacity !== void 0) {
|
|
1204
|
+
parts.push(`opacity: ${span.style.opacity}`);
|
|
1205
|
+
}
|
|
1206
|
+
return parts.join("; ");
|
|
1207
|
+
}
|
|
1208
|
+
function escapeHTML(text) {
|
|
1209
|
+
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1210
|
+
}
|
|
1211
|
+
function ansiToHTML(ansiString) {
|
|
1212
|
+
if (!ansiString) {
|
|
1213
|
+
return "";
|
|
1214
|
+
}
|
|
1215
|
+
const { spans } = ansiToCSS(ansiString);
|
|
1216
|
+
if (spans.length === 0) {
|
|
1217
|
+
return "";
|
|
1218
|
+
}
|
|
1219
|
+
if (spans.length === 1 && Object.keys(spans[0].style).length === 0) {
|
|
1220
|
+
const text = escapeHTML(spans[0].text);
|
|
1221
|
+
return text.replace(/\n/g, "<br>");
|
|
1222
|
+
}
|
|
1223
|
+
const htmlParts = [];
|
|
1224
|
+
for (const span of spans) {
|
|
1225
|
+
const escapedText = escapeHTML(span.text).replace(/\n/g, "<br>");
|
|
1226
|
+
const styleString = spanToInlineStyle(span);
|
|
1227
|
+
if (styleString) {
|
|
1228
|
+
htmlParts.push(`<span style="${styleString}">${escapedText}</span>`);
|
|
1229
|
+
} else {
|
|
1230
|
+
htmlParts.push(escapedText);
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
return htmlParts.join("");
|
|
1234
|
+
}
|
|
1235
|
+
function parseAnsiToSpans(ansiString) {
|
|
1236
|
+
return parseAnsi(ansiString);
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
export {
|
|
1240
|
+
getIndentStr,
|
|
1241
|
+
getTextWidth,
|
|
1242
|
+
padText,
|
|
1243
|
+
wrapText,
|
|
1244
|
+
sanitizeToASCII,
|
|
1245
|
+
boxDrawingToASCII,
|
|
1246
|
+
buildBox,
|
|
1247
|
+
extractStringArray,
|
|
1248
|
+
extractHeaders,
|
|
1249
|
+
extractRowValues,
|
|
1250
|
+
joinParts,
|
|
1251
|
+
getProp,
|
|
1252
|
+
DEFAULT_THEME_TOKENS,
|
|
1253
|
+
DEFAULT_RENDER_CONTEXT,
|
|
1254
|
+
ASCII_BOX_CHARS,
|
|
1255
|
+
ASCII_DOUBLE_BOX_CHARS,
|
|
1256
|
+
UNICODE_SINGLE_BOX_CHARS,
|
|
1257
|
+
UNICODE_DOUBLE_BOX_CHARS,
|
|
1258
|
+
UNICODE_ROUNDED_BOX_CHARS,
|
|
1259
|
+
getASCIIBoxChars,
|
|
1260
|
+
getUnicodeBoxChars,
|
|
1261
|
+
UNICODE_SYMBOLS,
|
|
1262
|
+
SPINNER_FRAMES,
|
|
1263
|
+
calculateColumnWidths,
|
|
1264
|
+
buildTableSeparator,
|
|
1265
|
+
buildTableRow,
|
|
1266
|
+
createCallbackRouterAdapter,
|
|
1267
|
+
matchPath,
|
|
1268
|
+
normalizePath,
|
|
1269
|
+
matchPathPattern,
|
|
1270
|
+
generateBreadcrumbSegments,
|
|
1271
|
+
formatSegmentLabel,
|
|
1272
|
+
findActiveItemByPath,
|
|
1273
|
+
findActiveItemInSections,
|
|
1274
|
+
joinPath,
|
|
1275
|
+
extractPathParams,
|
|
1276
|
+
renderText,
|
|
1277
|
+
ansiToCSS,
|
|
1278
|
+
spanToInlineStyle,
|
|
1279
|
+
ansiToHTML,
|
|
1280
|
+
parseAnsiToSpans
|
|
1281
|
+
};
|