@shell-shock/plugin-console 0.2.3 → 0.2.4

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.
@@ -813,14 +813,14 @@ function MessageFunctionDeclaration(props) {
813
813
 
814
814
  ${!theme.labels.message.footer[variant] && timestamp ? `const timestamp = \`\${textColors.message.footer.${color}(new Date().toLocaleDateString())} \${borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottom}")} \${textColors.message.footer.${color}(new Date().toLocaleTimeString())}\`; ` : ""}
815
815
 
816
- writeLine(borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].topLeft}") + ${theme.labels.message.header[variant] || theme.icons.message.header[variant] ? `borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].top}".repeat(4)) + " " + ${theme.icons.message.header[variant] ? `borderColors.message.outline.${color}("${theme.icons.message.header[variant]}") + " " +` : ""} bold(textColors.message.header.${color}(header || "${theme.labels.message.header[variant]}")) + " " + borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].top}".repeat(Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.message.outline[variant].topLeft.length + 4 + (theme.icons.message.header[variant] ? 2 + (theme.labels.message.header[variant] ? 0 : 1) : 0) + (theme.labels.message.header[variant] ? theme.labels.message.header[variant].length + 2 : 0) + theme.borderStyles.message.outline[variant].topRight.length}, 0)))` : `borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].top}".repeat(Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.message.outline[variant].topLeft.length + theme.borderStyles.message.outline[variant].topRight.length}, 0)))`} + borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].topRight}"), { consoleFn: console.${consoleFnName} });
816
+ writeLine(borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].topLeft}") + ${theme.labels.message.header[variant] || theme.icons.message.header[variant] ? `borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].top}".repeat(4)) + " " + ${theme.icons.message.header[variant] ? `borderColors.message.outline.${color}("${theme.icons.message.header[variant]}") + " " +` : ""} bold(textColors.message.header.${color}(header || "${theme.labels.message.header[variant]}")) + " " + borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].top}".repeat(Math.max(getTerminalSize().columns - ${Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.message.outline[variant].topLeft.length + 4 + (theme.icons.message.header[variant] ? 2 + (theme.labels.message.header[variant] ? 0 : 1) : 0) + (theme.labels.message.header[variant] ? theme.labels.message.header[variant].length + 2 : 0) + theme.borderStyles.message.outline[variant].topRight.length}, 0)))` : `borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].top}".repeat(Math.max(getTerminalSize().columns - ${Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.message.outline[variant].topLeft.length + theme.borderStyles.message.outline[variant].topRight.length}, 0)))`} + borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].topRight}"), { consoleFn: console.${consoleFnName} });
817
817
  splitText(
818
818
  message,
819
- Math.max(process.stdout.columns - ${(Math.max(theme.padding.app, 0) + Math.max(theme.padding.message, 0)) * 2 + theme.borderStyles.message.outline[variant].left.length + theme.borderStyles.message.outline[variant].right.length}, 0)
819
+ Math.max(getTerminalSize().columns - ${(Math.max(theme.padding.app, 0) + Math.max(theme.padding.message, 0)) * 2 + theme.borderStyles.message.outline[variant].left.length + theme.borderStyles.message.outline[variant].right.length}, 0)
820
820
  ).forEach((line) => {
821
- writeLine(borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].left + " ".repeat(Math.max(theme.padding.message, 0))}") + textColors.message.description.${color}(line) + " ".repeat(Math.max(process.stdout.columns - (stripAnsi(line).length + ${Math.max(theme.padding.app, 0) * 2 + Math.max(theme.padding.message, 0) + theme.borderStyles.message.outline[variant].left.length + theme.borderStyles.message.outline[variant].right.length}), 0)) + borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
821
+ writeLine(borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].left + " ".repeat(Math.max(theme.padding.message, 0))}") + textColors.message.description.${color}(line) + " ".repeat(Math.max(getTerminalSize().columns - (stripAnsi(line).length + ${Math.max(theme.padding.app, 0) * 2 + Math.max(theme.padding.message, 0) + theme.borderStyles.message.outline[variant].left.length + theme.borderStyles.message.outline[variant].right.length}), 0)) + borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
822
822
  });
823
- writeLine(borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottomLeft}") + ${theme.labels.message.footer[variant] || timestamp ? `borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottom}".repeat(Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2 + 4 + (theme.labels.message.footer[variant] ? theme.labels.message.footer[variant].length + 2 : 0) + theme.borderStyles.message.outline[variant].bottomLeft.length + theme.borderStyles.message.outline[variant].bottomRight.length}${!theme.labels.message.footer[variant] && timestamp ? " - (stripAnsi(timestamp).length + 2)" : ""}, 0))) + " " + ${`bold(textColors.message.footer.${color}(${theme.labels.message.footer[variant] ? `"${theme.labels.message.footer[variant]}"` : timestamp && "timestamp"}))`} + " " + borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottom}".repeat(4))` : `borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottom}".repeat(Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.message.outline[variant].bottomLeft.length + theme.borderStyles.message.outline[variant].bottomRight.length}, 0)))`} + borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottomRight}"), { consoleFn: console.${consoleFnName} });
823
+ writeLine(borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottomLeft}") + ${theme.labels.message.footer[variant] || timestamp ? `borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottom}".repeat(Math.max(getTerminalSize().columns - ${Math.max(theme.padding.app, 0) * 2 + 4 + (theme.labels.message.footer[variant] ? theme.labels.message.footer[variant].length + 2 : 0) + theme.borderStyles.message.outline[variant].bottomLeft.length + theme.borderStyles.message.outline[variant].bottomRight.length}${!theme.labels.message.footer[variant] && timestamp ? " - (stripAnsi(timestamp).length + 2)" : ""}, 0))) + " " + ${`bold(textColors.message.footer.${color}(${theme.labels.message.footer[variant] ? `"${theme.labels.message.footer[variant]}"` : timestamp && "timestamp"}))`} + " " + borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottom}".repeat(4))` : `borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottom}".repeat(Math.max(getTerminalSize().columns - ${Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.message.outline[variant].bottomLeft.length + theme.borderStyles.message.outline[variant].bottomRight.length}, 0)))`} + borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottomRight}"), { consoleFn: console.${consoleFnName} });
824
824
  `)];
825
825
  }
826
826
  })];
@@ -1013,7 +1013,7 @@ function DividerFunctionDeclaration() {
1013
1013
  }],
1014
1014
  get children() {
1015
1015
  return _alloy_js_core.code`const padding = options.padding ?? ${Math.max(theme.padding.app, 1) * 4};
1016
- const width = options.width ?? (process.stdout.columns - (Math.max(padding, 0) * 2));
1016
+ const width = options.width ?? (getTerminalSize().columns - (Math.max(padding, 0) * 2));
1017
1017
  const border = options.border === "tertiary" ? borderColors.app.divider.tertiary("${theme.borderStyles.app.divider.tertiary.top}") : options.border === "secondary" ? borderColors.app.divider.secondary("${theme.borderStyles.app.divider.secondary.top}") : borderColors.app.divider.primary("${theme.borderStyles.app.divider.primary.top}");
1018
1018
 
1019
1019
  writeLine(" ".repeat(Math.max(padding - ${theme.padding.app}, 0)) + border.repeat(Math.max(width / ${theme.borderStyles.app.divider.primary.top.length ?? 1}, 0)));
@@ -1026,6 +1026,7 @@ function DividerFunctionDeclaration() {
1026
1026
  * A component to generate the `link` function in the `shell-shock:console` builtin module.
1027
1027
  */
1028
1028
  function LinkFunctionDeclaration() {
1029
+ const theme = (0, _shell_shock_plugin_theme_contexts_theme.useTheme)();
1029
1030
  return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
1030
1031
  heading: "Render a hyperlink in the console.",
1031
1032
  get children() {
@@ -1035,8 +1036,12 @@ function LinkFunctionDeclaration() {
1035
1036
  children: `The URL to render as a hyperlink.`
1036
1037
  }),
1037
1038
  (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
1038
- name: "text",
1039
- children: `The text to display for the link. If not provided, the URL will be used as the text.`
1039
+ name: "textOrExternal",
1040
+ children: `The text to display for the link or a boolean indicating whether the link is external. If no text is provided, the URL will be used as the text. If a boolean is provided and is true, the URL will be used as the text and the link will be rendered as an external link.`
1041
+ }),
1042
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
1043
+ name: "external",
1044
+ children: `A boolean indicating whether the link is external. If true, the link will be rendered as an external link.`
1040
1045
  }),
1041
1046
  (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `The formatted hyperlink string.` })
1042
1047
  ];
@@ -1044,28 +1049,40 @@ function LinkFunctionDeclaration() {
1044
1049
  }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
1045
1050
  "export": true,
1046
1051
  name: "link",
1047
- parameters: [{
1048
- name: "url",
1049
- type: "string",
1050
- optional: false
1051
- }, {
1052
- name: "text",
1053
- type: "string",
1054
- optional: true
1055
- }],
1052
+ parameters: [
1053
+ {
1054
+ name: "url",
1055
+ type: "string",
1056
+ optional: false
1057
+ },
1058
+ {
1059
+ name: "textOrExternal",
1060
+ type: "string | boolean",
1061
+ optional: true
1062
+ },
1063
+ {
1064
+ name: "external",
1065
+ type: "boolean",
1066
+ optional: true
1067
+ }
1068
+ ],
1056
1069
  get children() {
1057
1070
  return [
1058
1071
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
1059
1072
  condition: _alloy_js_core.code`isHyperlinkSupported()`,
1060
- children: _alloy_js_core.code`return \`\\x1b]8;;\${url}\\u0007\${text ?? url}\\x1b]8;;\\u0007\`;`
1073
+ get children() {
1074
+ return _alloy_js_core.code`return \`\\x1b]8;;\${url}\\u0007\${typeof textOrExternal === "string" && textOrExternal ? textOrExternal : url}\\x1b]8;;\\u0007\${external === true || textOrExternal === true ? "${theme.icons.link.external}" : ""}\`;`;
1075
+ }
1061
1076
  }),
1062
1077
  (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
1063
1078
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
1064
1079
  condition: _alloy_js_core.code`isColorSupported`,
1065
- children: _alloy_js_core.code`return underline(textColors.body.link(\`\${url}\`));`
1080
+ get children() {
1081
+ return _alloy_js_core.code`return \`\${underline(textColors.body.link(\`\${url}\`))}\${external === true || textOrExternal === true ? "${theme.icons.link.external}" : ""}\`;`;
1082
+ }
1066
1083
  }),
1067
1084
  (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
1068
- _alloy_js_core.code`return \`\${url}\`;`
1085
+ (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`return \`\${url}\${external === true || textOrExternal === true ? "${theme.icons.link.external}" : ""}\`;`)
1069
1086
  ];
1070
1087
  }
1071
1088
  })];
@@ -1100,7 +1117,7 @@ function BlockquoteFunctionDeclaration() {
1100
1117
 
1101
1118
  const lines = splitText(
1102
1119
  String(text),
1103
- Math.max(process.stdout.columns, 20) - 6
1120
+ Math.max(getTerminalSize().columns, 20) - 6
1104
1121
  );
1105
1122
 
1106
1123
  return lines.map((line, index) => \` \${index === 0 ? isUnicodeSupported() ? "❝" : "\\"" : " "} \${italic(line)} \${index === lines.length - 1 ? isUnicodeSupported() ? "❞" : "\\"" : " "} \`).join("\\n"); `
@@ -1141,10 +1158,10 @@ function CodeFunctionDeclaration() {
1141
1158
  return "";
1142
1159
  }
1143
1160
 
1144
- return \` \${borderColors.app.divider.primary("${theme.borderStyles.app.divider.primary.top}".repeat(4))}\${language ? \` \${borderColors.app.divider.primary(language)} \` : ""}\${borderColors.app.divider.primary("${theme.borderStyles.app.divider.primary.top}".repeat(process.stdout.columns - (language ? language.length + 2 : 0) - 5))} \\n\${splitText(
1161
+ return \` \${borderColors.app.divider.primary("${theme.borderStyles.app.divider.primary.top}".repeat(4))}\${language ? \` \${borderColors.app.divider.primary(language)} \` : ""}\${borderColors.app.divider.primary("${theme.borderStyles.app.divider.primary.top}".repeat(getTerminalSize().columns - (language ? language.length + 2 : 0) - 5))} \\n\${splitText(
1145
1162
  String(text),
1146
- Math.max(process.stdout.columns, 20)
1147
- ).map(line => \`\${textColors.body.primary(line)}\`).join("\\n")}\\n \${borderColors.app.divider.primary("${theme.borderStyles.app.divider.primary.bottom}".repeat(process.stdout.columns - 2))} \`; `;
1163
+ Math.max(getTerminalSize().columns, 20)
1164
+ ).map(line => \`\${textColors.body.primary(line)}\`).join("\\n")}\\n \${borderColors.app.divider.primary("${theme.borderStyles.app.divider.primary.bottom}".repeat(getTerminalSize().columns - 2))} \`; `;
1148
1165
  }
1149
1166
  })
1150
1167
  ];
@@ -1786,7 +1803,7 @@ function TableFunctionDeclaration(props) {
1786
1803
  heading: "Calculate the width in characters based on the provided width size.",
1787
1804
  get children() {
1788
1805
  return [
1789
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This function calculates the width in characters based on the provided width size, which can be a predefined string (e.g., "full", "1/2", "1/3", etc.) or a percentage string (e.g., "50%"). The calculation is based on the current width of the console (process.stdout.columns).` }),
1806
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This function calculates the width in characters based on the provided width size, which can be a predefined string (e.g., "full", "1/2", "1/3", etc.) or a percentage string (e.g., "50%"). The calculation is based on the current width of the console (getTerminalSize().columns).` }),
1790
1807
  (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
1791
1808
  name: "size",
1792
1809
  children: `The width size to calculate. This can be a predefined string (e.g., "full", "1/2", "1/3", etc.) or a percentage string (e.g., "50%").`
@@ -1808,40 +1825,40 @@ function TableFunctionDeclaration(props) {
1808
1825
  return [
1809
1826
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
1810
1827
  condition: _alloy_js_core.code`["full", "100%", "1/1"]. includes(size)`,
1811
- children: _alloy_js_core.code`return process.stdout.columns;`
1828
+ children: _alloy_js_core.code`return getTerminalSize().columns;`
1812
1829
  }),
1813
1830
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
1814
1831
  condition: _alloy_js_core.code`["1/2", "50%"].includes(size)`,
1815
- children: _alloy_js_core.code`return Math.round(process.stdout.columns / 2);`
1832
+ children: _alloy_js_core.code`return Math.round(getTerminalSize().columns / 2);`
1816
1833
  }),
1817
1834
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
1818
1835
  condition: _alloy_js_core.code`["1/3", "33.33%"].includes(size)`,
1819
- children: _alloy_js_core.code`return Math.round(process.stdout.columns / 3);`
1836
+ children: _alloy_js_core.code`return Math.round(getTerminalSize().columns / 3);`
1820
1837
  }),
1821
1838
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
1822
1839
  condition: _alloy_js_core.code`["1/4", "25%"].includes(size)`,
1823
- children: _alloy_js_core.code`return Math.round(process.stdout.columns / 4);`
1840
+ children: _alloy_js_core.code`return Math.round(getTerminalSize().columns / 4);`
1824
1841
  }),
1825
1842
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
1826
1843
  condition: _alloy_js_core.code`["1/5", "20%"].includes(size)`,
1827
- children: _alloy_js_core.code`return Math.round(process.stdout.columns / 5);`
1844
+ children: _alloy_js_core.code`return Math.round(getTerminalSize().columns / 5);`
1828
1845
  }),
1829
1846
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
1830
1847
  condition: _alloy_js_core.code`["1/6", "10%"].includes(size)`,
1831
- children: _alloy_js_core.code`return Math.round(process.stdout.columns / 6);`
1848
+ children: _alloy_js_core.code`return Math.round(getTerminalSize().columns / 6);`
1832
1849
  }),
1833
1850
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
1834
1851
  condition: _alloy_js_core.code`["1/12", "5%"].includes(size)`,
1835
- children: _alloy_js_core.code`return Math.round(process.stdout.columns / 12);`
1852
+ children: _alloy_js_core.code`return Math.round(getTerminalSize().columns / 12);`
1836
1853
  }),
1837
1854
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
1838
1855
  condition: _alloy_js_core.code`["1/24", "2.5%"].includes(size)`,
1839
- children: _alloy_js_core.code`return Math.round(process.stdout.columns / 24);`
1856
+ children: _alloy_js_core.code`return Math.round(getTerminalSize().columns / 24);`
1840
1857
  }),
1841
1858
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { children: _alloy_js_core.code`
1842
1859
  const match = size.match(/(\\d+(\\.\\d+)?)%/);
1843
1860
  if (match) {
1844
- return Math.round((process.stdout.columns * parseFloat(match[1])) / 100);
1861
+ return Math.round((getTerminalSize().columns * parseFloat(match[1])) / 100);
1845
1862
  }
1846
1863
 
1847
1864
  throw new Error(\`Invalid width size: \${size}\`);
@@ -2328,7 +2345,7 @@ do {
2328
2345
  }
2329
2346
 
2330
2347
  rowDims.forEach((row, rowIndex) => {
2331
- if (!recalculate && row.width > Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2}, 0)) {
2348
+ if (!recalculate && row.width > Math.max(getTerminalSize().columns - ${Math.max(theme.padding.app, 0) * 2}, 0)) {
2332
2349
  const cell = cells[rowIndex]!.reduce((largestCell, cell) => {
2333
2350
  if (cell.width > largestCell.width) {
2334
2351
  return cell;
@@ -2338,7 +2355,7 @@ do {
2338
2355
 
2339
2356
  const lines = splitText(
2340
2357
  cell.value,
2341
- Math.min(Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2} - (row.width - (cell.width - cell.padding * 2)), 0),
2358
+ Math.min(Math.max(getTerminalSize().columns - ${Math.max(theme.padding.app, 0) * 2} - (row.width - (cell.width - cell.padding * 2)), 0),
2342
2359
  cell.maxWidth ?? Number.POSITIVE_INFINITY)
2343
2360
  );
2344
2361
 
@@ -2350,7 +2367,7 @@ do {
2350
2367
  }
2351
2368
  });
2352
2369
 
2353
- if (!recalculate && colWidths.reduce((a, b) => a + b, 0) > Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2}, 0)) {
2370
+ if (!recalculate && colWidths.reduce((a, b) => a + b, 0) > Math.max(getTerminalSize().columns - ${Math.max(theme.padding.app, 0) * 2}, 0)) {
2354
2371
  let colIndex = 0;
2355
2372
  const cell = cells.reduce((ret, row) => {
2356
2373
  return row.reduce((largest, current, index) => {
@@ -2364,7 +2381,7 @@ do {
2364
2381
 
2365
2382
  const lines = splitText(
2366
2383
  cell.value,
2367
- Math.min(Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2} - (colWidths.filter((_, i) => i !== colIndex).reduce((a, b) => a + b, 0)) - cell.padding * 2, 0),
2384
+ Math.min(Math.max(getTerminalSize().columns - ${Math.max(theme.padding.app, 0) * 2} - (colWidths.filter((_, i) => i !== colIndex).reduce((a, b) => a + b, 0)) - cell.padding * 2, 0),
2368
2385
  cell.maxWidth ?? Number.POSITIVE_INFINITY)
2369
2386
  );
2370
2387
 
@@ -2453,7 +2470,8 @@ function ConsoleBuiltin(props) {
2453
2470
  "isColorSupported",
2454
2471
  "colorSupportLevels",
2455
2472
  "isUnicodeSupported",
2456
- "isHyperlinkSupported"
2473
+ "isHyperlinkSupported",
2474
+ "getTerminalSize"
2457
2475
  ],
2458
2476
  env: [
2459
2477
  "env",
@@ -1 +1 @@
1
- {"version":3,"file":"console-builtin.d.cts","names":[],"sources":["../../src/components/console-builtin.tsx"],"mappings":";;;;;;;iBAkEgB,uBAAA,CAAA,GAAuB,QAAA;AAAA,UA8L7B,cAAA;EAAA,CACP,GAAA,WAAc,iBAAA,GAAoB,cAAA;AAAA;AAAA,UAG3B,yBAAA;EACR,IAAA;EACA,OAAA;EACA,MAAA,EAAQ,cAAA;EACR,OAAA,EAAS,cAAA;EACT,OAAA,EAAS,cAAA;AAAA;AAAA,iBAGK,wBAAA,CAAyB,KAAA,EAAO,yBAAA,GAAyB,QAAA;AAAA,iBA0EzD,0BAAA,CAA2B,KAAA,EAAO,yBAAA,GAAyB,QAAA;;;;iBA8E3D,6BAAA,CAAA,GAA6B,QAAA;;;;iBA0J7B,4BAAA,CAAA,GAA4B,QAAA;;;;iBAiL5B,wBAAA,CAAA,GAAwB,QAAA;;;;iBAgExB,4BAAA,CAAA,GAA4B,QAAA;AAAA,KAqEhC,+BAAA,GAAkC,OAAA,CAC5C,IAAA,CAAK,wBAAA;EAEL,IAAA;EASA,OAAA,EAAS,mBAAA;EACT,KAAA,GAAQ,mBAAA;EACR,aAAA;EACA,WAAA;EACA,MAAA,GAAS,QAAA;EACT,SAAA;AAAA;;;;iBAMc,0BAAA,CACd,KAAA,EAAO,+BAAA,GAA+B,QAAA;;AAtjBxC;;iBAwuBgB,gBAAA,CAAA,GAAgB,QAAA;;;;iBA4EhB,4BAAA,CAAA,GAA4B,QAAA;;;AAtuB5C;iBAywBgB,0BAAA,CAAA,GAA0B,QAAA;;;;iBAoF1B,uBAAA,CAAA,GAAuB,QAAA;;;;iBAwCvB,6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AA4B,QAAA;;;;iBAiL5B,wBAAA,CAAA,GAAwB,QAAA;;;;iBAgExB,4BAAA,CAAA,GAA4B,QAAA;AAAA,KAqEhC,+BAAA,GAAkC,OAAA,CAC5C,IAAA,CAAK,wBAAA;EAEL,IAAA;EASA,OAAA,EAAS,mBAAA;EACT,KAAA,GAAQ,mBAAA;EACR,aAAA;EACA,WAAA;EACA,MAAA,GAAS,QAAA;EACT,SAAA;AAAA;;;;iBAMc,0BAAA,CACd,KAAA,EAAO,+BAAA,GAA+B,QAAA;;AAtjBxC;;iBAwuBgB,gBAAA,CAAA,GAAgB,QAAA;;;;iBA4EhB,4BAAA,CAAA,GAA4B,QAAA;;;AAtuB5C;iBAywBgB,0BAAA,CAAA,GAA0B,QAAA;;;;iBAoF1B,uBAAA,CAAA,GAAuB,QAAA;;;;iBAoDvB,6BAAA,CAAA,GAA6B,QAAA;AAtkB7C;;;AAAA,iBA8mBgB,uBAAA,CAAA,GAAuB,QAAA;;AA9iBvC;;iBAgmBgB,6BAAA,CAAA,GAA6B,QAAA;;;AA3hB7C;iBA8jBgB,0BAAA,CAAA,GAA0B,QAAA;;;;KA0hB9B,6BAAA,GAAgC,IAAA,CAC1C,wBAAA;;;;iBAOc,wBAAA,CAAyB,KAAA,EAAO,6BAAA,GAA6B,QAAA;AAAA,KA0nBjE,mBAAA,GAAsB,IAAA,CAChC,gBAAA;;;;iBAOc,cAAA,CAAe,KAAA,EAAO,mBAAA,GAAmB,QAAA"}
@@ -811,14 +811,14 @@ function MessageFunctionDeclaration(props) {
811
811
 
812
812
  ${!theme.labels.message.footer[variant] && timestamp ? `const timestamp = \`\${textColors.message.footer.${color}(new Date().toLocaleDateString())} \${borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottom}")} \${textColors.message.footer.${color}(new Date().toLocaleTimeString())}\`; ` : ""}
813
813
 
814
- writeLine(borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].topLeft}") + ${theme.labels.message.header[variant] || theme.icons.message.header[variant] ? `borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].top}".repeat(4)) + " " + ${theme.icons.message.header[variant] ? `borderColors.message.outline.${color}("${theme.icons.message.header[variant]}") + " " +` : ""} bold(textColors.message.header.${color}(header || "${theme.labels.message.header[variant]}")) + " " + borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].top}".repeat(Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.message.outline[variant].topLeft.length + 4 + (theme.icons.message.header[variant] ? 2 + (theme.labels.message.header[variant] ? 0 : 1) : 0) + (theme.labels.message.header[variant] ? theme.labels.message.header[variant].length + 2 : 0) + theme.borderStyles.message.outline[variant].topRight.length}, 0)))` : `borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].top}".repeat(Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.message.outline[variant].topLeft.length + theme.borderStyles.message.outline[variant].topRight.length}, 0)))`} + borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].topRight}"), { consoleFn: console.${consoleFnName} });
814
+ writeLine(borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].topLeft}") + ${theme.labels.message.header[variant] || theme.icons.message.header[variant] ? `borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].top}".repeat(4)) + " " + ${theme.icons.message.header[variant] ? `borderColors.message.outline.${color}("${theme.icons.message.header[variant]}") + " " +` : ""} bold(textColors.message.header.${color}(header || "${theme.labels.message.header[variant]}")) + " " + borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].top}".repeat(Math.max(getTerminalSize().columns - ${Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.message.outline[variant].topLeft.length + 4 + (theme.icons.message.header[variant] ? 2 + (theme.labels.message.header[variant] ? 0 : 1) : 0) + (theme.labels.message.header[variant] ? theme.labels.message.header[variant].length + 2 : 0) + theme.borderStyles.message.outline[variant].topRight.length}, 0)))` : `borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].top}".repeat(Math.max(getTerminalSize().columns - ${Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.message.outline[variant].topLeft.length + theme.borderStyles.message.outline[variant].topRight.length}, 0)))`} + borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].topRight}"), { consoleFn: console.${consoleFnName} });
815
815
  splitText(
816
816
  message,
817
- Math.max(process.stdout.columns - ${(Math.max(theme.padding.app, 0) + Math.max(theme.padding.message, 0)) * 2 + theme.borderStyles.message.outline[variant].left.length + theme.borderStyles.message.outline[variant].right.length}, 0)
817
+ Math.max(getTerminalSize().columns - ${(Math.max(theme.padding.app, 0) + Math.max(theme.padding.message, 0)) * 2 + theme.borderStyles.message.outline[variant].left.length + theme.borderStyles.message.outline[variant].right.length}, 0)
818
818
  ).forEach((line) => {
819
- writeLine(borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].left + " ".repeat(Math.max(theme.padding.message, 0))}") + textColors.message.description.${color}(line) + " ".repeat(Math.max(process.stdout.columns - (stripAnsi(line).length + ${Math.max(theme.padding.app, 0) * 2 + Math.max(theme.padding.message, 0) + theme.borderStyles.message.outline[variant].left.length + theme.borderStyles.message.outline[variant].right.length}), 0)) + borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
819
+ writeLine(borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].left + " ".repeat(Math.max(theme.padding.message, 0))}") + textColors.message.description.${color}(line) + " ".repeat(Math.max(getTerminalSize().columns - (stripAnsi(line).length + ${Math.max(theme.padding.app, 0) * 2 + Math.max(theme.padding.message, 0) + theme.borderStyles.message.outline[variant].left.length + theme.borderStyles.message.outline[variant].right.length}), 0)) + borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
820
820
  });
821
- writeLine(borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottomLeft}") + ${theme.labels.message.footer[variant] || timestamp ? `borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottom}".repeat(Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2 + 4 + (theme.labels.message.footer[variant] ? theme.labels.message.footer[variant].length + 2 : 0) + theme.borderStyles.message.outline[variant].bottomLeft.length + theme.borderStyles.message.outline[variant].bottomRight.length}${!theme.labels.message.footer[variant] && timestamp ? " - (stripAnsi(timestamp).length + 2)" : ""}, 0))) + " " + ${`bold(textColors.message.footer.${color}(${theme.labels.message.footer[variant] ? `"${theme.labels.message.footer[variant]}"` : timestamp && "timestamp"}))`} + " " + borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottom}".repeat(4))` : `borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottom}".repeat(Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.message.outline[variant].bottomLeft.length + theme.borderStyles.message.outline[variant].bottomRight.length}, 0)))`} + borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottomRight}"), { consoleFn: console.${consoleFnName} });
821
+ writeLine(borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottomLeft}") + ${theme.labels.message.footer[variant] || timestamp ? `borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottom}".repeat(Math.max(getTerminalSize().columns - ${Math.max(theme.padding.app, 0) * 2 + 4 + (theme.labels.message.footer[variant] ? theme.labels.message.footer[variant].length + 2 : 0) + theme.borderStyles.message.outline[variant].bottomLeft.length + theme.borderStyles.message.outline[variant].bottomRight.length}${!theme.labels.message.footer[variant] && timestamp ? " - (stripAnsi(timestamp).length + 2)" : ""}, 0))) + " " + ${`bold(textColors.message.footer.${color}(${theme.labels.message.footer[variant] ? `"${theme.labels.message.footer[variant]}"` : timestamp && "timestamp"}))`} + " " + borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottom}".repeat(4))` : `borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottom}".repeat(Math.max(getTerminalSize().columns - ${Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.message.outline[variant].bottomLeft.length + theme.borderStyles.message.outline[variant].bottomRight.length}, 0)))`} + borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottomRight}"), { consoleFn: console.${consoleFnName} });
822
822
  `)];
823
823
  }
824
824
  })];
@@ -1011,7 +1011,7 @@ function DividerFunctionDeclaration() {
1011
1011
  }],
1012
1012
  get children() {
1013
1013
  return code`const padding = options.padding ?? ${Math.max(theme.padding.app, 1) * 4};
1014
- const width = options.width ?? (process.stdout.columns - (Math.max(padding, 0) * 2));
1014
+ const width = options.width ?? (getTerminalSize().columns - (Math.max(padding, 0) * 2));
1015
1015
  const border = options.border === "tertiary" ? borderColors.app.divider.tertiary("${theme.borderStyles.app.divider.tertiary.top}") : options.border === "secondary" ? borderColors.app.divider.secondary("${theme.borderStyles.app.divider.secondary.top}") : borderColors.app.divider.primary("${theme.borderStyles.app.divider.primary.top}");
1016
1016
 
1017
1017
  writeLine(" ".repeat(Math.max(padding - ${theme.padding.app}, 0)) + border.repeat(Math.max(width / ${theme.borderStyles.app.divider.primary.top.length ?? 1}, 0)));
@@ -1024,6 +1024,7 @@ function DividerFunctionDeclaration() {
1024
1024
  * A component to generate the `link` function in the `shell-shock:console` builtin module.
1025
1025
  */
1026
1026
  function LinkFunctionDeclaration() {
1027
+ const theme = useTheme();
1027
1028
  return [createComponent(TSDoc, {
1028
1029
  heading: "Render a hyperlink in the console.",
1029
1030
  get children() {
@@ -1033,8 +1034,12 @@ function LinkFunctionDeclaration() {
1033
1034
  children: `The URL to render as a hyperlink.`
1034
1035
  }),
1035
1036
  createComponent(TSDocParam, {
1036
- name: "text",
1037
- children: `The text to display for the link. If not provided, the URL will be used as the text.`
1037
+ name: "textOrExternal",
1038
+ children: `The text to display for the link or a boolean indicating whether the link is external. If no text is provided, the URL will be used as the text. If a boolean is provided and is true, the URL will be used as the text and the link will be rendered as an external link.`
1039
+ }),
1040
+ createComponent(TSDocParam, {
1041
+ name: "external",
1042
+ children: `A boolean indicating whether the link is external. If true, the link will be rendered as an external link.`
1038
1043
  }),
1039
1044
  createComponent(TSDocReturns, { children: `The formatted hyperlink string.` })
1040
1045
  ];
@@ -1042,28 +1047,40 @@ function LinkFunctionDeclaration() {
1042
1047
  }), createComponent(FunctionDeclaration, {
1043
1048
  "export": true,
1044
1049
  name: "link",
1045
- parameters: [{
1046
- name: "url",
1047
- type: "string",
1048
- optional: false
1049
- }, {
1050
- name: "text",
1051
- type: "string",
1052
- optional: true
1053
- }],
1050
+ parameters: [
1051
+ {
1052
+ name: "url",
1053
+ type: "string",
1054
+ optional: false
1055
+ },
1056
+ {
1057
+ name: "textOrExternal",
1058
+ type: "string | boolean",
1059
+ optional: true
1060
+ },
1061
+ {
1062
+ name: "external",
1063
+ type: "boolean",
1064
+ optional: true
1065
+ }
1066
+ ],
1054
1067
  get children() {
1055
1068
  return [
1056
1069
  createComponent(IfStatement, {
1057
1070
  condition: code`isHyperlinkSupported()`,
1058
- children: code`return \`\\x1b]8;;\${url}\\u0007\${text ?? url}\\x1b]8;;\\u0007\`;`
1071
+ get children() {
1072
+ return code`return \`\\x1b]8;;\${url}\\u0007\${typeof textOrExternal === "string" && textOrExternal ? textOrExternal : url}\\x1b]8;;\\u0007\${external === true || textOrExternal === true ? "${theme.icons.link.external}" : ""}\`;`;
1073
+ }
1059
1074
  }),
1060
1075
  createIntrinsic("hbr", {}),
1061
1076
  createComponent(IfStatement, {
1062
1077
  condition: code`isColorSupported`,
1063
- children: code`return underline(textColors.body.link(\`\${url}\`));`
1078
+ get children() {
1079
+ return code`return \`\${underline(textColors.body.link(\`\${url}\`))}\${external === true || textOrExternal === true ? "${theme.icons.link.external}" : ""}\`;`;
1080
+ }
1064
1081
  }),
1065
1082
  createIntrinsic("hbr", {}),
1066
- code`return \`\${url}\`;`
1083
+ memo(() => code`return \`\${url}\${external === true || textOrExternal === true ? "${theme.icons.link.external}" : ""}\`;`)
1067
1084
  ];
1068
1085
  }
1069
1086
  })];
@@ -1098,7 +1115,7 @@ function BlockquoteFunctionDeclaration() {
1098
1115
 
1099
1116
  const lines = splitText(
1100
1117
  String(text),
1101
- Math.max(process.stdout.columns, 20) - 6
1118
+ Math.max(getTerminalSize().columns, 20) - 6
1102
1119
  );
1103
1120
 
1104
1121
  return lines.map((line, index) => \` \${index === 0 ? isUnicodeSupported() ? "❝" : "\\"" : " "} \${italic(line)} \${index === lines.length - 1 ? isUnicodeSupported() ? "❞" : "\\"" : " "} \`).join("\\n"); `
@@ -1139,10 +1156,10 @@ function CodeFunctionDeclaration() {
1139
1156
  return "";
1140
1157
  }
1141
1158
 
1142
- return \` \${borderColors.app.divider.primary("${theme.borderStyles.app.divider.primary.top}".repeat(4))}\${language ? \` \${borderColors.app.divider.primary(language)} \` : ""}\${borderColors.app.divider.primary("${theme.borderStyles.app.divider.primary.top}".repeat(process.stdout.columns - (language ? language.length + 2 : 0) - 5))} \\n\${splitText(
1159
+ return \` \${borderColors.app.divider.primary("${theme.borderStyles.app.divider.primary.top}".repeat(4))}\${language ? \` \${borderColors.app.divider.primary(language)} \` : ""}\${borderColors.app.divider.primary("${theme.borderStyles.app.divider.primary.top}".repeat(getTerminalSize().columns - (language ? language.length + 2 : 0) - 5))} \\n\${splitText(
1143
1160
  String(text),
1144
- Math.max(process.stdout.columns, 20)
1145
- ).map(line => \`\${textColors.body.primary(line)}\`).join("\\n")}\\n \${borderColors.app.divider.primary("${theme.borderStyles.app.divider.primary.bottom}".repeat(process.stdout.columns - 2))} \`; `;
1161
+ Math.max(getTerminalSize().columns, 20)
1162
+ ).map(line => \`\${textColors.body.primary(line)}\`).join("\\n")}\\n \${borderColors.app.divider.primary("${theme.borderStyles.app.divider.primary.bottom}".repeat(getTerminalSize().columns - 2))} \`; `;
1146
1163
  }
1147
1164
  })
1148
1165
  ];
@@ -1784,7 +1801,7 @@ function TableFunctionDeclaration(props) {
1784
1801
  heading: "Calculate the width in characters based on the provided width size.",
1785
1802
  get children() {
1786
1803
  return [
1787
- createComponent(TSDocRemarks, { children: `This function calculates the width in characters based on the provided width size, which can be a predefined string (e.g., "full", "1/2", "1/3", etc.) or a percentage string (e.g., "50%"). The calculation is based on the current width of the console (process.stdout.columns).` }),
1804
+ createComponent(TSDocRemarks, { children: `This function calculates the width in characters based on the provided width size, which can be a predefined string (e.g., "full", "1/2", "1/3", etc.) or a percentage string (e.g., "50%"). The calculation is based on the current width of the console (getTerminalSize().columns).` }),
1788
1805
  createComponent(TSDocParam, {
1789
1806
  name: "size",
1790
1807
  children: `The width size to calculate. This can be a predefined string (e.g., "full", "1/2", "1/3", etc.) or a percentage string (e.g., "50%").`
@@ -1806,40 +1823,40 @@ function TableFunctionDeclaration(props) {
1806
1823
  return [
1807
1824
  createComponent(IfStatement, {
1808
1825
  condition: code`["full", "100%", "1/1"]. includes(size)`,
1809
- children: code`return process.stdout.columns;`
1826
+ children: code`return getTerminalSize().columns;`
1810
1827
  }),
1811
1828
  createComponent(ElseIfClause, {
1812
1829
  condition: code`["1/2", "50%"].includes(size)`,
1813
- children: code`return Math.round(process.stdout.columns / 2);`
1830
+ children: code`return Math.round(getTerminalSize().columns / 2);`
1814
1831
  }),
1815
1832
  createComponent(ElseIfClause, {
1816
1833
  condition: code`["1/3", "33.33%"].includes(size)`,
1817
- children: code`return Math.round(process.stdout.columns / 3);`
1834
+ children: code`return Math.round(getTerminalSize().columns / 3);`
1818
1835
  }),
1819
1836
  createComponent(ElseIfClause, {
1820
1837
  condition: code`["1/4", "25%"].includes(size)`,
1821
- children: code`return Math.round(process.stdout.columns / 4);`
1838
+ children: code`return Math.round(getTerminalSize().columns / 4);`
1822
1839
  }),
1823
1840
  createComponent(ElseIfClause, {
1824
1841
  condition: code`["1/5", "20%"].includes(size)`,
1825
- children: code`return Math.round(process.stdout.columns / 5);`
1842
+ children: code`return Math.round(getTerminalSize().columns / 5);`
1826
1843
  }),
1827
1844
  createComponent(ElseIfClause, {
1828
1845
  condition: code`["1/6", "10%"].includes(size)`,
1829
- children: code`return Math.round(process.stdout.columns / 6);`
1846
+ children: code`return Math.round(getTerminalSize().columns / 6);`
1830
1847
  }),
1831
1848
  createComponent(ElseIfClause, {
1832
1849
  condition: code`["1/12", "5%"].includes(size)`,
1833
- children: code`return Math.round(process.stdout.columns / 12);`
1850
+ children: code`return Math.round(getTerminalSize().columns / 12);`
1834
1851
  }),
1835
1852
  createComponent(ElseIfClause, {
1836
1853
  condition: code`["1/24", "2.5%"].includes(size)`,
1837
- children: code`return Math.round(process.stdout.columns / 24);`
1854
+ children: code`return Math.round(getTerminalSize().columns / 24);`
1838
1855
  }),
1839
1856
  createComponent(ElseClause, { children: code`
1840
1857
  const match = size.match(/(\\d+(\\.\\d+)?)%/);
1841
1858
  if (match) {
1842
- return Math.round((process.stdout.columns * parseFloat(match[1])) / 100);
1859
+ return Math.round((getTerminalSize().columns * parseFloat(match[1])) / 100);
1843
1860
  }
1844
1861
 
1845
1862
  throw new Error(\`Invalid width size: \${size}\`);
@@ -2326,7 +2343,7 @@ do {
2326
2343
  }
2327
2344
 
2328
2345
  rowDims.forEach((row, rowIndex) => {
2329
- if (!recalculate && row.width > Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2}, 0)) {
2346
+ if (!recalculate && row.width > Math.max(getTerminalSize().columns - ${Math.max(theme.padding.app, 0) * 2}, 0)) {
2330
2347
  const cell = cells[rowIndex]!.reduce((largestCell, cell) => {
2331
2348
  if (cell.width > largestCell.width) {
2332
2349
  return cell;
@@ -2336,7 +2353,7 @@ do {
2336
2353
 
2337
2354
  const lines = splitText(
2338
2355
  cell.value,
2339
- Math.min(Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2} - (row.width - (cell.width - cell.padding * 2)), 0),
2356
+ Math.min(Math.max(getTerminalSize().columns - ${Math.max(theme.padding.app, 0) * 2} - (row.width - (cell.width - cell.padding * 2)), 0),
2340
2357
  cell.maxWidth ?? Number.POSITIVE_INFINITY)
2341
2358
  );
2342
2359
 
@@ -2348,7 +2365,7 @@ do {
2348
2365
  }
2349
2366
  });
2350
2367
 
2351
- if (!recalculate && colWidths.reduce((a, b) => a + b, 0) > Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2}, 0)) {
2368
+ if (!recalculate && colWidths.reduce((a, b) => a + b, 0) > Math.max(getTerminalSize().columns - ${Math.max(theme.padding.app, 0) * 2}, 0)) {
2352
2369
  let colIndex = 0;
2353
2370
  const cell = cells.reduce((ret, row) => {
2354
2371
  return row.reduce((largest, current, index) => {
@@ -2362,7 +2379,7 @@ do {
2362
2379
 
2363
2380
  const lines = splitText(
2364
2381
  cell.value,
2365
- Math.min(Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2} - (colWidths.filter((_, i) => i !== colIndex).reduce((a, b) => a + b, 0)) - cell.padding * 2, 0),
2382
+ Math.min(Math.max(getTerminalSize().columns - ${Math.max(theme.padding.app, 0) * 2} - (colWidths.filter((_, i) => i !== colIndex).reduce((a, b) => a + b, 0)) - cell.padding * 2, 0),
2366
2383
  cell.maxWidth ?? Number.POSITIVE_INFINITY)
2367
2384
  );
2368
2385
 
@@ -2451,7 +2468,8 @@ function ConsoleBuiltin(props) {
2451
2468
  "isColorSupported",
2452
2469
  "colorSupportLevels",
2453
2470
  "isUnicodeSupported",
2454
- "isHyperlinkSupported"
2471
+ "isHyperlinkSupported",
2472
+ "getTerminalSize"
2455
2473
  ],
2456
2474
  env: [
2457
2475
  "env",
@@ -1 +1 @@
1
- {"version":3,"file":"console-builtin.mjs","names":[],"sources":["../../src/components/console-builtin.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Children } from \"@alloy-js/core\";\nimport { code, For, Show } from \"@alloy-js/core\";\nimport type { FunctionDeclarationProps } from \"@alloy-js/typescript\";\nimport {\n ElseClause,\n ElseIfClause,\n FunctionDeclaration,\n IfStatement,\n InterfaceDeclaration,\n InterfaceMember,\n TypeDeclaration,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport {\n ClassDeclaration,\n ClassField,\n ClassMethod,\n ClassPropertyGet,\n ClassPropertySet\n} from \"@powerlines/plugin-alloy/typescript\";\nimport type { BuiltinFileProps } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport { BuiltinFile } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport {\n TSDoc,\n TSDocDefaultValue,\n TSDocExample,\n TSDocParam,\n TSDocRemarks,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { IsNotDebug, IsNotVerbose } from \"@shell-shock/core/components/helpers\";\nimport type {\n ThemeMessageVariant,\n ThemeResolvedConfig\n} from \"@shell-shock/plugin-theme\";\nimport { useColors, useTheme } from \"@shell-shock/plugin-theme/contexts/theme\";\nimport type { AnsiColorWrappers } from \"@shell-shock/plugin-theme/helpers/ansi-utils\";\nimport {\n colorKeys,\n modifierKeys\n} from \"@shell-shock/plugin-theme/helpers/ansi-utils\";\nimport { camelCase } from \"@stryke/string-format\";\nimport { getIndefiniteArticle } from \"@stryke/string-format/vowels\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { defu } from \"defu\";\n\nexport function AnsiHelpersDeclarations() {\n return (\n <>\n <VarDeclaration\n const\n export\n name=\"beep\"\n doc=\"The ASCII Bell character, which can be used to trigger a beep sound in the console.\">\n {code` \"\\\\u0007\"; `}\n </VarDeclaration>\n <Spacing />\n <VarDeclaration\n const\n export\n name=\"cursor\"\n doc=\"An object containing ANSI escape codes for controlling the console cursor.\">\n {code` {\n to(x: number, y?: number) {\n if (!y) {\n return \\`\\\\x1B[\\${x + 1}G\\`;\n }\n\n return \\`\\\\x1B[\\${y + 1};\\${x + 1}H\\`;\n },\n move(x: number, y: number) {\n let ret = '';\n\n if (x < 0) {\n ret += \\`\\\\x1B[\\${-x}D\\`;\n } else if (x > 0) {\n ret += \\`\\\\x1B[\\${x}C\\`;\n }\n\n if (y < 0) {\n ret += \\`\\\\x1B[\\${-y}A\\`;\n } else if (y > 0) {\n ret += \\`\\\\x1B[\\${y}B\\`;\n }\n\n return ret;\n },\n up: (count = 1) => \\`\\\\x1B[\\${count}A\\`,\n down: (count = 1) => \\`\\\\x1B[\\${count}B\\`,\n forward: (count = 1) => \\`\\\\x1B[\\${count}C\\`,\n backward: (count = 1) => \\`\\\\x1B[\\${count}D\\`,\n nextLine: (count = 1) => \"\\\\x1B[E\".repeat(count),\n prevLine: (count = 1) => \"\\\\x1B[F\".repeat(count),\n left: \"\\\\x1B[G\",\n hide: \"\\\\x1B[?25l\",\n show: \"\\\\x1B[?25h\",\n save: \"\\\\x1B7\",\n restore: \"\\\\x1B8\"\n } `}\n </VarDeclaration>\n <Spacing />\n <VarDeclaration\n const\n export\n name=\"erase\"\n doc=\"An object containing ANSI escape codes for erasing parts of the console.\">\n {code` {\n screen: \"\\\\x1B[2J\",\n up: (count = 1) => \"\\\\x1B[1J\".repeat(count),\n down: (count = 1) => \"\\\\x1B[J\".repeat(count),\n line: \"\\\\x1B[2K\",\n lineEnd: \"\\\\x1B[K\",\n lineStart: \"\\\\x1B[1K\",\n lines(count: number) {\n let lineClear = \"\";\n for (let i = 0; i < count; i++) {\n lineClear += this.line + (i < count - 1 ? cursor.up() : \"\");\n }\n\n if (count) {\n lineClear += cursor.left;\n }\n\n return lineClear;\n }\n } `}\n </VarDeclaration>\n <Spacing />\n <VarDeclaration\n const\n export\n name=\"scroll\"\n doc=\"An object containing ANSI escape codes for scrolling the console.\">\n {code` {\n up: (count = 1) => \"\\\\x1B[S\".repeat(count),\n down: (count = 1) => \"\\\\x1B[T\".repeat(count)\n } `}\n </VarDeclaration>\n <Spacing />\n <FunctionDeclaration\n export\n name=\"clear\"\n doc=\"A helper function to clear the console based on a count of lines\"\n parameters={[\n {\n name: \"current\",\n type: \"string\",\n doc: \"The current console output to be cleared\"\n },\n {\n name: \"consoleWidth\",\n type: \"number\",\n doc: \"The number of characters per line in the console\"\n }\n ]}>\n {code`if (!consoleWidth) {\n return erase.line + cursor.to(0);\n }\n\n let rows = 0;\n const lines = current.split(/\\\\r?\\\\n/);\n for (let line of lines) {\n rows += 1 + Math.floor(Math.max([...stripAnsi(line)].length - 1, 0) / consoleWidth);\n }\n\n return erase.lines(rows); `}\n </FunctionDeclaration>\n <Spacing />\n </>\n );\n}\n\ntype ColorFunctionProps = Record<\n \"ansi16\" | \"ansi256\" | \"ansi16m\",\n AnsiColorWrappers\n> & {\n skipBackground?: boolean;\n};\n\n/**\n * A component to generate a console message function in a Shell Shock project.\n */\nfunction ColorFunction({\n ansi16,\n ansi256,\n ansi16m,\n skipBackground = false\n}: ColorFunctionProps) {\n return code` (text: string${\n skipBackground ? \"\" : `, background = false`\n }): string => {\n try {\n if (text === undefined || text === null || text === \"\") {\n return \"\";\n }\n\n if (!isColorSupported) {\n return String(text);\n }\n\n if (colorSupportLevels.stdout === 1) {\n return wrapAnsi(text, ${\n skipBackground\n ? `\"${ansi16.open}\", \"${ansi16.close}\"`\n : `background ? \"${\n ansi16.background.open\n }\" : \"${ansi16.open}\", background ? \"${\n ansi16.background.close\n }\" : \"${ansi16.close}\"`\n });\n } else if (colorSupportLevels.stdout === 2) {\n return wrapAnsi(text, ${\n skipBackground\n ? `\"${ansi256.open}\", \"${ansi256.close}\"`\n : `background ? \"${\n ansi256.background.open\n }\" : \"${ansi256.open}\", background ? \"${\n ansi256.background.close\n }\" : \"${ansi256.close}\"`\n });\n }\n\n return wrapAnsi(text, ${\n skipBackground\n ? `\"${ansi16m.open}\", \"${ansi16m.close}\"`\n : `background ? \"${ansi16m.background.open}\" : \"${\n ansi16m.open\n }\", background ? \"${ansi16m.background.close}\" : \"${ansi16m.close}\"`\n });\n } catch {\n return String(text);\n }\n }\n`;\n}\n\ninterface ThemeColorNode {\n [key: string]: AnsiColorWrappers | ThemeColorNode;\n}\n\ninterface ThemeColorDefinitionProps {\n type: string;\n subType?: string;\n ansi16: ThemeColorNode;\n ansi256: ThemeColorNode;\n ansi16m: ThemeColorNode;\n}\n\nexport function ThemeColorTypeDefinition(props: ThemeColorDefinitionProps) {\n const { ansi16, ansi256, ansi16m, type, subType } = props;\n\n return (\n <For\n each={Object.entries(ansi16)}\n semicolon\n doubleHardline\n enderPunctuation>\n {([color, value]) => (\n <>\n <Show when={isSetObject(value)}>\n <Show\n when={\"open\" in value && \"close\" in value}\n fallback={\n <>\n <TSDoc\n heading={`An object containing various ${\n subType ? `${subType} ` : \"\"\n }${color}${\n type ? ` ${type}` : \"\"\n } theme coloring functions.`}></TSDoc>\n {code` ${camelCase(color)}: { `}\n <hbr />\n <ThemeColorTypeDefinition\n ansi16={ansi16[color] as ThemeColorNode}\n ansi256={ansi256[color] as ThemeColorNode}\n ansi16m={ansi16m[color] as ThemeColorNode}\n type={subType || type}\n subType={color}\n />\n <hbr />\n {code` }`}\n </>\n }>\n <TSDoc\n heading={`A function that applies ${getIndefiniteArticle(color)} ${\n color\n }${type ? ` ${type}` : \"\"}${\n subType ? ` ${subType}` : \"\"\n } color styling to provided console text.`}>\n <TSDocRemarks>\n {`This function takes a string and an optional boolean indicating whether to apply the color as a background. It returns the input string wrapped in the appropriate ANSI escape codes for ${\n color\n }${type ? ` ${type}` : \"\"}${\n subType ? ` ${subType}` : \"\"\n } color styling, based on the terminal's color support level. If colors are not supported, it simply returns the input text as a string.`}\n </TSDocRemarks>\n <hbr />\n <TSDocParam name=\"text\">\n {`The console text to which the ${color}${\n type ? ` ${type}` : \"\"\n }${subType ? ` ${subType}` : \"\"} color styling should be applied.`}\n </TSDocParam>\n <TSDocParam name=\"background\">\n {`A boolean indicating whether to apply the color as a background. Defaults to \\`false\\`.`}\n </TSDocParam>\n <TSDocReturns>\n {`A string with ANSI escape codes applied for ${color}${\n type ? ` ${type}` : \"\"\n }${\n subType ? ` ${subType}` : \"\"\n } color styling, or the original text if the style is not supported in the current terminal.`}\n </TSDocReturns>\n </TSDoc>\n {code`${camelCase(color)}: (text: string, background?: boolean) => string`}\n </Show>\n </Show>\n </>\n )}\n </For>\n );\n}\n\nexport function ThemeColorObjectDefinition(props: ThemeColorDefinitionProps) {\n const { ansi16, ansi256, ansi16m, type, subType } = props;\n\n return (\n <For each={Object.entries(ansi16)} comma doubleHardline enderPunctuation>\n {([color, value]) => (\n <>\n <Show when={isSetObject(value)}>\n <Show\n when={\"open\" in value && \"close\" in value}\n fallback={\n <>\n <TSDoc\n heading={`An object containing various ${\n subType ? `${subType} ` : \"\"\n }${color}${\n type ? ` ${type}` : \"\"\n } theme coloring functions.`}></TSDoc>\n {code` ${camelCase(color)}: { `}\n <hbr />\n <ThemeColorObjectDefinition\n ansi16={ansi16[color] as ThemeColorNode}\n ansi256={ansi256[color] as ThemeColorNode}\n ansi16m={ansi16m[color] as ThemeColorNode}\n type={subType || type}\n subType={color}\n />\n <hbr />\n {code` }`}\n </>\n }>\n <TSDoc\n heading={`A function that applies ${getIndefiniteArticle(color)} ${\n color\n }${type ? ` ${type}` : \"\"}${\n subType ? ` ${subType}` : \"\"\n } color styling to provided console text.`}>\n <TSDocRemarks>\n {`This function takes a string and an optional boolean indicating whether to apply the color as a background. It returns the input string wrapped in the appropriate ANSI escape codes for ${\n color\n }${type ? ` ${type}` : \"\"}${\n subType ? ` ${subType}` : \"\"\n } color styling, based on the terminal's color support level. If colors are not supported, it simply returns the input text as a string.`}\n </TSDocRemarks>\n <hbr />\n <TSDocParam name=\"text\">\n {`The console text to which the ${color}${\n type ? ` ${type}` : \"\"\n }${subType ? ` ${subType}` : \"\"} color styling should be applied.`}\n </TSDocParam>\n <TSDocParam name=\"background\">\n {`A boolean indicating whether to apply the color as a background. Defaults to \\`false\\`.`}\n </TSDocParam>\n <TSDocReturns>\n {`A string with ANSI escape codes applied for ${color}${\n type ? ` ${type}` : \"\"\n }${\n subType ? ` ${subType}` : \"\"\n } color styling, or the original text if the style is not supported in the current terminal.`}\n </TSDocReturns>\n </TSDoc>\n {code`${camelCase(color)}: `}\n <ColorFunction\n ansi16={ansi16[color] as AnsiColorWrappers}\n ansi256={ansi256[color] as AnsiColorWrappers}\n ansi16m={ansi16m[color] as AnsiColorWrappers}\n />\n </Show>\n </Show>\n </>\n )}\n </For>\n );\n}\n\n/**\n * A component to generate an object containing functions for coloring text in a Shell Shock project.\n */\nexport function AnsiStyleFunctionsDeclaration() {\n const colors = useColors();\n\n return (\n <>\n <For each={modifierKeys} semicolon doubleHardline enderPunctuation>\n {modifier => (\n <>\n <TSDoc\n heading={`A function that applies ${\n modifier\n } styling to provided console text.`}>\n <TSDocRemarks>\n {`This function takes a string and an optional boolean indicating whether to apply the color as a background. It returns the input string wrapped in the appropriate ANSI escape codes for the specified color, based on the terminal's color support level. If colors are not supported, it simply returns the input text as a string.`}\n </TSDocRemarks>\n <hbr />\n <TSDocParam name=\"text\">\n {`The console text to which the ${\n modifier\n } styling should be applied.`}\n </TSDocParam>\n <TSDocReturns>\n {`A string with ANSI escape codes applied for ${\n modifier\n } styling, or the original text if the style is not supported in the current terminal.`}\n </TSDocReturns>\n </TSDoc>\n <VarDeclaration\n const\n export\n name={camelCase(modifier)}\n initializer={\n <ColorFunction\n ansi16={\n colors.ansi16[\n modifier as keyof typeof colors.ansi16\n ] as AnsiColorWrappers\n }\n ansi256={\n colors.ansi256[\n modifier as keyof typeof colors.ansi256\n ] as AnsiColorWrappers\n }\n ansi16m={\n colors.ansi16m[\n modifier as keyof typeof colors.ansi16m\n ] as AnsiColorWrappers\n }\n skipBackground={true}\n />\n }\n />\n </>\n )}\n </For>\n <Spacing />\n <For each={colorKeys} semicolon doubleHardline enderPunctuation>\n {color => (\n <>\n <TSDoc\n heading={`A helper function to color the provided text as ${color}.`}>\n <TSDocRemarks>\n {`This function takes a string and an optional boolean indicating whether to apply the color as a background. It returns the input string wrapped in the appropriate ANSI escape codes for the specified color, based on the terminal's color support level. If colors are not supported, it simply returns the input text as a string.`}\n </TSDocRemarks>\n <hbr />\n <TSDocParam name=\"text\">\n {`The console text to which the ${color} color should be applied.`}\n </TSDocParam>\n <TSDocReturns>\n {`A string with ANSI escape codes applied for ${color} color, or the original text if the color is not supported in the current terminal.`}\n </TSDocReturns>\n </TSDoc>\n <VarDeclaration\n const\n export\n name={camelCase(color)}\n initializer={\n <ColorFunction\n ansi16={\n colors.ansi16[\n color as keyof typeof colors.ansi16\n ] as AnsiColorWrappers\n }\n ansi256={\n colors.ansi256[\n color as keyof typeof colors.ansi256\n ] as AnsiColorWrappers\n }\n ansi16m={\n colors.ansi16m[\n color as keyof typeof colors.ansi16m\n ] as AnsiColorWrappers\n }\n />\n }\n />\n </>\n )}\n </For>\n <Spacing />\n\n <For\n each={Object.keys(colors.ansi16.theme)}\n semicolon\n doubleHardline\n enderPunctuation>\n {type => (\n <>\n <TSDoc\n heading={`A nested object containing functions for applying ${\n type\n } theme colors to the console.`}\n />\n <VarDeclaration\n export\n name={`${camelCase(type)}Colors`}\n initializer={\n <>\n {code` {`}\n <hbr />\n <ThemeColorObjectDefinition\n ansi16={\n colors.ansi16.theme[\n type as keyof typeof colors.ansi16.theme\n ]\n }\n ansi256={\n colors.ansi256.theme[\n type as keyof typeof colors.ansi256.theme\n ]\n }\n ansi16m={\n colors.ansi16m.theme[\n type as keyof typeof colors.ansi16m.theme\n ]\n }\n type={type}\n />\n <hbr />\n {code`}`}\n </>\n }\n />\n </>\n )}\n </For>\n <Spacing />\n </>\n );\n}\n\n/**\n * A component to generate the `splitText` function in the `shell-shock:console` builtin module.\n */\nexport function SplitTextFunctionDeclaration() {\n return (\n <>\n <FunctionDeclaration\n name=\"adjustIndex\"\n parameters={[\n {\n name: \"line\",\n type: \"string\"\n },\n {\n name: \"index\",\n type: \"number\"\n }\n ]}\n returnType=\"number\">\n {code`let adjustedIndex = 0;\n\n const segments = line.match(/\\\\x1b\\\\[(\\\\d|;)+m.*\\\\x1b\\\\[(\\\\d|;)+m/gi);\n if (segments && segments.length > 0) {\n segments.reduce((count, matched) => {\n if (count < index) {\n const stripped = stripAnsi(matched);\n if (count + stripped.length < index) {\n count += stripped.length;\n adjustedIndex += matched.length;\n } else {\n adjustedIndex += index - count + (matched.slice(0, index - count).match(/\\\\x1b\\\\[(\\\\d|;)+m/g)?.join(\"\")?.length ?? 0);\n count = index;\n }\n }\n\n return count;\n }, 0);\n } else {\n adjustedIndex = index;\n }\n\n return adjustedIndex - (line.slice(0, adjustedIndex).match(/\\\\x1b\\\\[/g)?.length ?? 0); `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"breakLine\"\n parameters={[\n {\n name: \"line\",\n type: \"string\"\n },\n {\n name: \"index\",\n type: \"number\"\n }\n ]}\n returnType=\"[string, string]\">\n {code`const first = line.slice(0, index);\n const second = line.slice(index);\n\n // Match all ANSI escape sequences in the first string\n const ansiRegex = /[\\\\x1b\\\\u009b][[\\\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]+)*|[a-zA-Z\\\\d]+(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?(?:\\\\u0007))|(?:(?:\\\\d{1,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TZcf-nq-uy=><~]))/g;\n\n const openCodes: string[] = [];\n const closeCodes: string[] = [];\n let match: RegExpExecArray | null;\n\n while ((match = ansiRegex.exec(first)) !== null) {\n const code = match[0];\n // Check if this is a reset/close code (e.g., \\\\x1b[0m, \\\\x1b[39m, \\\\x1b[49m, etc.)\n if (/\\\\x1b\\\\[(?:0|22|23|24|27|28|29|39|49)m/.test(code)) {\n // A close/reset code cancels the last open code\n openCodes.pop();\n closeCodes.pop();\n } else {\n openCodes.push(code);\n // Derive a close code: map SGR open codes to their reset counterparts\n const sgrMatch = code.match(/\\\\x1b\\\\[(\\\\d+)m/);\n if (sgrMatch) {\n const n = parseInt(sgrMatch[1]!, 10);\n let closeCode: string;\n if (n >= 30 && n <= 37) closeCode = \"\\\\x1b[39m\";\n else if (n >= 40 && n <= 47) closeCode = \"\\\\x1b[49m\";\n else if (n >= 90 && n <= 97) closeCode = \"\\\\x1b[39m\";\n else if (n >= 100 && n <= 107) closeCode = \"\\\\x1b[49m\";\n else if (n === 1) closeCode = \"\\\\x1b[22m\";\n else if (n === 2) closeCode = \"\\\\x1b[22m\";\n else if (n === 3) closeCode = \"\\\\x1b[23m\";\n else if (n === 4) closeCode = \"\\\\x1b[24m\";\n else if (n === 7) closeCode = \"\\\\x1b[27m\";\n else if (n === 8) closeCode = \"\\\\x1b[28m\";\n else if (n === 9) closeCode = \"\\\\x1b[29m\";\n else closeCode = \"\\\\x1b[0m\";\n closeCodes.push(closeCode);\n } else {\n closeCodes.push(\"\\\\x1b[0m\");\n }\n }\n }\n\n // Append close codes to the end of \"first\" (in reverse order)\n const closeSequence = closeCodes.slice().reverse().join(\"\");\n // Prepend open codes to the start of \"second\"\n const openSequence = openCodes.join(\"\");\n\n return [first.replace(/^\\\\s+/, \"\").replace(/\\\\s+$/, \"\") + closeSequence, openSequence + second.replace(/^\\\\s+/, \"\").replace(/\\\\s+$/, \"\")]; `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"Split text into multiple lines based on a maximum length.\">\n <TSDocRemarks>\n {`This function splits the provided text into multiple lines based on the specified maximum length, ensuring that words are not broken in the middle.`}\n </TSDocRemarks>\n <hbr />\n <TSDocParam name=\"text\">\n {`The text to split into multiple lines.`}\n </TSDocParam>\n <TSDocParam name=\"maxLength\">\n {`The maximum length of each line.`}\n </TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"splitText\"\n parameters={[\n {\n name: \"text\",\n type: \"string\"\n },\n {\n name: \"maxLength\",\n type: \"number | SizeToken\"\n }\n ]}>\n {code`\n let line = text;\n let result = [] as string[];\n\n const calculatedMaxLength = isSizeToken(maxLength) ? calculateWidth(maxLength) : maxLength;\n while (stripAnsi(line).length > calculatedMaxLength || line.indexOf(\"\\\\n\") !== -1) {\n if (line.indexOf(\"\\\\n\") !== -1) {\n result.push(...splitText(line.slice(0, line.indexOf(\"\\\\n\")).replace(/(\\\\r)?\\\\n/, \"\"), calculatedMaxLength));\n line = line.indexOf(\"\\\\n\") + 1 < line.length\n ? line.slice(line.indexOf(\"\\\\n\") + 1)\n : \"\";\n } else {\n const index = [\" \", \"/\", \".\", \",\", \"-\", \":\", \"|\", \"@\", \"+\"].reduce((ret, split) => {\n let current = ret;\n while (stripAnsi(line).indexOf(split, current + 1) !== -1 && stripAnsi(line).indexOf(split, current + 1) <= calculatedMaxLength) {\n current = line.indexOf(split, adjustIndex(line, current + 1));\n }\n\n return current;\n }, -1);\n if (index === -1) {\n break;\n }\n\n const lines = breakLine(line, index);\n result.push(lines[0]);\n line = lines[1];\n }\n }\n\n while (stripAnsi(line).length > calculatedMaxLength) {\n const lines = breakLine(line, calculatedMaxLength);\n result.push(lines[0]);\n line = lines[1];\n }\n\n result.push(line);\n return result;\n`}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * A component to generate the `write` function in the `shell-shock:console` builtin module.\n */\nexport function WriteFunctionDeclaration() {\n return (\n <>\n <InterfaceDeclaration\n export\n name=\"WriteOptions\"\n doc=\"Options for writing to the console.\">\n <TSDoc heading=\"Console function to use for writing to the console\">\n <TSDocRemarks>\n {`The console function to use for writing to the console. If not specified, the default console function \\`console.log\\` will be used.`}\n </TSDocRemarks>\n <hbr />\n <TSDocDefaultValue\n type={ReflectionKind.method}\n defaultValue={`\\`console.log\\``}\n />\n </TSDoc>\n <InterfaceMember\n name=\"consoleFn\"\n optional\n type=\"(text: string) => void\"\n />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Write to the console.\">\n <TSDocRemarks>\n {`This function writes to the console, applying the appropriate padding as defined in the current theme configuration and wrapping as needed.`}\n </TSDocRemarks>\n <hbr />\n <TSDocParam name=\"text\">\n {`The text to write to the console.`}\n </TSDocParam>\n <TSDocParam name=\"options\">{`The options to apply when writing to the console.`}</TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"write\"\n parameters={[\n {\n name: \"text\",\n type: \"string | number | boolean | null\",\n optional: true\n },\n {\n name: \"options\",\n type: \"WriteOptions\",\n default: \"{}\"\n }\n ]}>\n {code`const consoleFn = options.consoleFn ?? console.log;\n if (text === undefined || text === null || text === \"\") {\n consoleFn(\"\");\n return;\n }\n\n consoleFn(String(text)); `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * A component to generate the `writeLine` function in the `shell-shock:console` builtin module.\n */\nexport function WriteLineFunctionDeclaration() {\n const theme = useTheme();\n\n return (\n <>\n <InterfaceDeclaration\n export\n name=\"WriteLineOptions\"\n doc=\"Options for writing a line to the console.\"\n extends={[\"WriteOptions\"]}>\n <TSDoc heading=\"Padding to apply to the line\">\n <TSDocRemarks>\n {`The amount of padding (in spaces) to apply to the line when writing to the console. This value is applied to both the left and right sides of the line. If not specified, the default padding defined in the current theme configuration will be used.`}\n </TSDocRemarks>\n </TSDoc>\n <InterfaceMember name=\"padding\" optional type=\"number\" />\n <hbr />\n <TSDoc heading=\"Color of the line text\">\n <TSDocRemarks>\n {`The color to apply to the line text when writing to the console. This can be one of the predefined color themes: \"primary\", \"secondary\", or \"tertiary\". If not specified, no specific coloring will be applied to the text (the default/system terminal text color will likely be used).`}\n </TSDocRemarks>\n <hbr />\n </TSDoc>\n <InterfaceMember\n name=\"color\"\n optional\n type='\"primary\" | \"secondary\" | \"tertiary\"'\n />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Write a line to the console.\">\n <TSDocRemarks>\n {`This function writes a line to the console, applying the appropriate padding as defined in the current theme configuration and wrapping as needed.`}\n </TSDocRemarks>\n <hbr />\n <TSDocParam name=\"text\">\n {`The line text to write to the console.`}\n </TSDocParam>\n <TSDocParam name=\"options\">{`The options to apply when writing the line to the console.`}</TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"writeLine\"\n parameters={[\n {\n name: \"text\",\n type: \"string | number | boolean | null\",\n optional: true\n },\n {\n name: \"options\",\n type: \"WriteLineOptions\",\n default: \"{}\"\n }\n ]}>\n {code`const color = options.color;\n if (text === undefined || text === null || text === \"\") {\n write(\"\", options);\n return;\n }\n\n write(\\`\\${\" \".repeat(Math.max(options.padding ?? ${\n theme.padding.app\n }, 0))}\\${color ? textColors.body[color](String(text)) : String(text)}\\`, options); `}\n </FunctionDeclaration>\n </>\n );\n}\n\nexport type MessageFunctionDeclarationProps = Partial<\n Pick<FunctionDeclarationProps, \"parameters\">\n> & {\n type:\n | \"success\"\n | \"help\"\n | \"info\"\n | \"debug\"\n | \"verbose\"\n | \"warn\"\n | \"danger\"\n | \"error\";\n variant: ThemeMessageVariant;\n color?: ThemeMessageVariant;\n consoleFnName: \"log\" | \"info\" | \"warn\" | \"error\" | \"debug\";\n description: string;\n prefix?: Children;\n timestamp?: boolean;\n};\n\n/**\n * A component to generate the message functions in the `shell-shock:console` builtin module.\n */\nexport function MessageFunctionDeclaration(\n props: MessageFunctionDeclarationProps\n) {\n const {\n type,\n variant,\n consoleFnName,\n description,\n prefix,\n parameters,\n timestamp,\n color = variant\n } = props;\n\n const theme = useTheme();\n\n return (\n <>\n <TSDoc\n heading={`Write ${getIndefiniteArticle(\n description\n )} ${description} message to the console.`}>\n <TSDocRemarks>\n {`This function initializes the Powerlines environment configuration object.`}\n </TSDocRemarks>\n <hbr />\n <TSDocParam name=\"message\">\n {`The message to write to the console.`}\n </TSDocParam>\n <TSDocParam name=\"header\">\n {`An optional header to display above the message. If not provided, a default header based on the message type and variant will be used if defined in the theme configuration; otherwise, no header will be displayed.`}\n </TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n name={type}\n parameters={\n parameters ?? [\n {\n name: \"message\",\n type: \"string\",\n optional: false\n },\n {\n name: \"header\",\n type: \"string\",\n optional: true\n }\n ]\n }>\n <Show when={Boolean(prefix)}>\n {prefix}\n <hbr />\n <hbr />\n </Show>\n {code`\n if (!message) {\n return;\n }\n\n ${\n !theme.labels.message.footer[variant] && timestamp\n ? `const timestamp = \\`\\${textColors.message.footer.${\n color\n }(new Date().toLocaleDateString())} \\${borderColors.message.outline.${\n color\n }(\"${\n theme.borderStyles.message.outline[variant].bottom\n }\")} \\${textColors.message.footer.${\n color\n }(new Date().toLocaleTimeString())}\\`; `\n : \"\"\n }\n\n writeLine(borderColors.message.outline.${color}(\"${\n theme.borderStyles.message.outline[variant].topLeft\n }\") + ${\n theme.labels.message.header[variant] ||\n theme.icons.message.header[variant]\n ? `borderColors.message.outline.${color}(\"${\n theme.borderStyles.message.outline[variant].top\n }\".repeat(4)) + \" \" + ${\n theme.icons.message.header[variant]\n ? `borderColors.message.outline.${color}(\"${\n theme.icons.message.header[variant]\n }\") + \" \" +`\n : \"\"\n } bold(textColors.message.header.${color}(header || \"${\n theme.labels.message.header[variant]\n }\")) + \" \" + borderColors.message.outline.${color}(\"${\n theme.borderStyles.message.outline[variant].top\n }\".repeat(Math.max(process.stdout.columns - ${\n Math.max(theme.padding.app, 0) * 2 +\n theme.borderStyles.message.outline[variant].topLeft.length +\n 4 +\n (theme.icons.message.header[variant]\n ? 2 + (theme.labels.message.header[variant] ? 0 : 1)\n : 0) +\n (theme.labels.message.header[variant]\n ? theme.labels.message.header[variant].length + 2\n : 0) +\n theme.borderStyles.message.outline[variant].topRight.length\n }, 0)))`\n : `borderColors.message.outline.${color}(\"${\n theme.borderStyles.message.outline[variant].top\n }\".repeat(Math.max(process.stdout.columns - ${\n Math.max(theme.padding.app, 0) * 2 +\n theme.borderStyles.message.outline[variant].topLeft.length +\n theme.borderStyles.message.outline[variant].topRight.length\n }, 0)))`\n } + borderColors.message.outline.${color}(\"${\n theme.borderStyles.message.outline[variant].topRight\n }\"), { consoleFn: console.${consoleFnName} });\n splitText(\n message,\n Math.max(process.stdout.columns - ${\n (Math.max(theme.padding.app, 0) +\n Math.max(theme.padding.message, 0)) *\n 2 +\n theme.borderStyles.message.outline[variant].left.length +\n theme.borderStyles.message.outline[variant].right.length\n }, 0)\n ).forEach((line) => {\n writeLine(borderColors.message.outline.${color}(\"${\n theme.borderStyles.message.outline[variant].left +\n \" \".repeat(Math.max(theme.padding.message, 0))\n }\") + textColors.message.description.${color}(line) + \" \".repeat(Math.max(process.stdout.columns - (stripAnsi(line).length + ${\n Math.max(theme.padding.app, 0) * 2 +\n Math.max(theme.padding.message, 0) +\n theme.borderStyles.message.outline[variant].left.length +\n theme.borderStyles.message.outline[variant].right.length\n }), 0)) + borderColors.message.outline.${color}(\"${\n theme.borderStyles.message.outline[variant].right\n }\"), { consoleFn: console.${consoleFnName} });\n });\n writeLine(borderColors.message.outline.${color}(\"${\n theme.borderStyles.message.outline[variant].bottomLeft\n }\") + ${\n theme.labels.message.footer[variant] || timestamp\n ? `borderColors.message.outline.${color}(\"${\n theme.borderStyles.message.outline[variant].bottom\n }\".repeat(Math.max(process.stdout.columns - ${\n Math.max(theme.padding.app, 0) * 2 +\n 4 +\n (theme.labels.message.footer[variant]\n ? theme.labels.message.footer[variant].length + 2\n : 0) +\n theme.borderStyles.message.outline[variant].bottomLeft.length +\n theme.borderStyles.message.outline[variant].bottomRight.length\n }${\n !theme.labels.message.footer[variant] && timestamp\n ? \" - (stripAnsi(timestamp).length + 2)\"\n : \"\"\n }, 0))) + \" \" + ${`bold(textColors.message.footer.${color}(${\n theme.labels.message.footer[variant]\n ? `\"${theme.labels.message.footer[variant]}\"`\n : timestamp && \"timestamp\"\n }))`} + \" \" + borderColors.message.outline.${color}(\"${\n theme.borderStyles.message.outline[variant].bottom\n }\".repeat(4))`\n : `borderColors.message.outline.${color}(\"${\n theme.borderStyles.message.outline[variant].bottom\n }\".repeat(Math.max(process.stdout.columns - ${\n Math.max(theme.padding.app, 0) * 2 +\n theme.borderStyles.message.outline[variant].bottomLeft.length +\n theme.borderStyles.message.outline[variant].bottomRight.length\n }, 0)))`\n } + borderColors.message.outline.${color}(\"${\n theme.borderStyles.message.outline[variant].bottomRight\n }\"), { consoleFn: console.${consoleFnName} });\n`}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * A component to generate the `wrapAnsi` function in the `shell-shock:console` builtin module.\n */\nexport function WrapAnsiFunction() {\n return (\n <>\n <TSDoc heading=\"Applies ANSI escape codes to a string.\">\n <TSDocRemarks>\n {`Split text by /\\\\\\\\x1b[\\\\[|\\\\]][0-9;]*m/ and wrap non-ANSI parts with open/closing tags.`}\n </TSDocRemarks>\n\n <TSDocExample>\n {`const result = wrapAnsi(\"Hello\\\\\\\\x1b[31mWorld\\\\\\\\x1b[0mAgain\", \"\\\\\\\\x1b[36m\", \"\\\\\\\\x1b[39\");\\nconsole.log(result); // \"\\\\\\\\x1b[36mHello\\\\\\\\x1b[39\\\\\\\\x1b[31mWorld\\\\\\\\x1b[0m\\\\\\\\x1b[36mAgain\\\\\\\\x1b[39\"`}\n </TSDocExample>\n\n <TSDocParam name=\"text\">\n {`The text to apply ANSI codes to.`}\n </TSDocParam>\n <TSDocParam name=\"open\">{`The opening ANSI code.`}</TSDocParam>\n <TSDocParam name=\"close\">{`The closing ANSI code.`}</TSDocParam>\n <TSDocReturns>{`The text with ANSI codes applied.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n name=\"wrapAnsi\"\n parameters={[\n {\n name: \"text\",\n type: \"string | number\",\n optional: false\n },\n {\n name: \"open\",\n type: \"string\",\n optional: false\n },\n { name: \"close\", type: \"string\", optional: false }\n ]}>\n {code`const str = String(text);\n const tokens = [] as string[];\n\n let last = 0;\n let match: RegExpExecArray | null;\n while ((match = /\\\\\\\\x1b[\\\\[|\\\\]][0-9;]*m/g.exec(str)) !== null) {\n if (match.index > last) tokens.push(str.slice(last, match.index));\n tokens.push(match[0]);\n last = match.index + match[0].length;\n }\n\n if (last < str.length) {\n tokens.push(str.slice(last));\n }\n\n let result = \"\";\n for (let i = 0; i < tokens.length; i++) {\n const seg = tokens[i]!;\n if (/^\\\\\\\\x1b[\\\\[|\\\\]][0-9;]*m$/.test(seg)) {\n result += seg;\n continue;\n }\n\n if (!seg) {\n continue;\n }\n\n result += i > 0 && /^\\\\\\\\x1b[\\\\[|\\\\]][0-9;]*m$/.test(tokens[i - 1]!) && i + 1 < tokens.length && /^\\\\\\\\x1b[\\\\[|\\\\]][0-9;]*m$/.test(tokens[i + 1]!)\n ? seg\n : \\`\\${open}\\${seg}\\${close}\\`;\n }\n\n return result;\n`}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * A component to generate the `stripAnsi` function in the `shell-shock:console` builtin module.\n */\nexport function StripAnsiFunctionDeclaration() {\n return (\n <>\n <TSDoc heading=\"Removes ANSI escape codes from a string.\">\n <TSDocExample>\n {`const result = stripAnsi(\"Hello\\\\\\\\x1b[31mWorld\\\\\\\\x1b[0mAgain\"); // \"HelloWorldAgain\"`}\n </TSDocExample>\n\n <TSDocParam name=\"text\">\n {`The text to strip ANSI codes from.`}\n </TSDocParam>\n <TSDocReturns>{`The text with ANSI codes removed.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"stripAnsi\"\n parameters={[\n {\n name: \"text\",\n type: \"string | number\",\n optional: false\n }\n ]}>\n {code`return String(text).replace(new RegExp([\n String.raw\\`[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]+)*|[a-zA-Z\\\\d]+(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?\\\\u0007)\\`,\n String.raw\\`(?:(?:\\\\d{1,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TZcf-nq-uy=><~]))\\`\n ].join(\"|\"), \"g\"), \"\");`}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * A component to generate the `stripAnsi` function in the `shell-shock:console` builtin module.\n */\nexport function DividerFunctionDeclaration() {\n const theme = useTheme();\n\n return (\n <>\n <InterfaceDeclaration\n export\n name=\"DividerOptions\"\n doc=\"Options for formatting the divider line written to console.\">\n <InterfaceMember\n name=\"width\"\n optional\n type=\"number\"\n doc=\"The width of the divider line. If not specified, the divider will span the full width of the console, minus the padding.\"\n />\n <hbr />\n <TSDoc heading=\"The border of the divider line. Can be 'primary', 'secondary', 'tertiary', or 'none'. If not specified, the default border style will be used.\">\n <TSDocRemarks>\n {`The value provided will determine the border style and color based on the current theme configuration.`}\n </TSDocRemarks>\n <TSDocDefaultValue\n type={ReflectionKind.string}\n defaultValue=\"primary\"\n />\n </TSDoc>\n <InterfaceMember\n name=\"border\"\n optional\n type='\"primary\" | \"secondary\" | \"tertiary\"'\n doc=\"The border style/color of the divider line. Can be 'primary', 'secondary', 'tertiary', or 'none'. If not specified, the default border style will be used.\"\n />\n <hbr />\n <TSDoc heading=\"Padding to apply to the line\">\n <TSDocRemarks>\n {`The amount of padding (in spaces) to apply to the line when writing to the console. This value is applied to both the left and right sides of the line. If not specified, the default padding defined in the current theme configuration will be used.`}\n </TSDocRemarks>\n <TSDocDefaultValue\n type={ReflectionKind.number}\n defaultValue={theme.padding.app * 4}\n />\n </TSDoc>\n <InterfaceMember name=\"padding\" optional type=\"number\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Write a horizontal divider line to the console.\">\n <TSDocExample>\n {`divider({ width: 50, border: \"primary\" }); // Writes a horizontal divider line of width 50 with primary border.`}\n </TSDocExample>\n <TSDocParam name=\"options\">\n {`Options for formatting the divider line.`}\n </TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"divider\"\n parameters={[\n {\n name: \"options\",\n type: \"DividerOptions\",\n optional: false\n }\n ]}>\n {code`const padding = options.padding ?? ${Math.max(theme.padding.app, 1) * 4};\n const width = options.width ?? (process.stdout.columns - (Math.max(padding, 0) * 2));\n const border = options.border === \"tertiary\" ? borderColors.app.divider.tertiary(\"${\n theme.borderStyles.app.divider.tertiary.top\n }\") : options.border === \"secondary\" ? borderColors.app.divider.secondary(\"${\n theme.borderStyles.app.divider.secondary.top\n }\") : borderColors.app.divider.primary(\"${\n theme.borderStyles.app.divider.primary.top\n }\");\n\n writeLine(\" \".repeat(Math.max(padding - ${theme.padding.app}, 0)) + border.repeat(Math.max(width / ${\n theme.borderStyles.app.divider.primary.top.length ?? 1\n }, 0)));\n `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * A component to generate the `link` function in the `shell-shock:console` builtin module.\n */\nexport function LinkFunctionDeclaration() {\n return (\n <>\n <TSDoc heading=\"Render a hyperlink in the console.\">\n <TSDocParam name=\"url\">\n {`The URL to render as a hyperlink.`}\n </TSDocParam>\n <TSDocParam name=\"text\">\n {`The text to display for the link. If not provided, the URL will be used as the text.`}\n </TSDocParam>\n <TSDocReturns>{`The formatted hyperlink string.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"link\"\n parameters={[\n {\n name: \"url\",\n type: \"string\",\n optional: false\n },\n { name: \"text\", type: \"string\", optional: true }\n ]}>\n <IfStatement condition={code`isHyperlinkSupported()`}>\n {code`return \\`\\\\x1b]8;;\\${url}\\\\u0007\\${text ?? url}\\\\x1b]8;;\\\\u0007\\`;`}\n </IfStatement>\n <hbr />\n <IfStatement condition={code`isColorSupported`}>\n {code`return underline(textColors.body.link(\\`\\${url}\\`));`}\n </IfStatement>\n <hbr />\n {code`return \\`\\${url}\\`;`}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * A component to generate the `blockquote` function declaration\n */\nexport function BlockquoteFunctionDeclaration() {\n return (\n <>\n <Spacing />\n <TSDoc\n heading={`Format a string with blockquote styling for display in console.`}>\n <TSDocParam name=\"text\">\n {`The text to format with blockquote styling.`}\n </TSDocParam>\n <TSDocReturns>{`The formatted string with blockquote styling.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"blockquote\"\n parameters={[\n {\n name: \"text\",\n type: \"string | number | boolean | null\",\n optional: true\n }\n ]}\n returnType=\"string\">\n {code`if (text === undefined || text === null || text === \"\") {\n return \"\";\n }\n\n const lines = splitText(\n String(text),\n Math.max(process.stdout.columns, 20) - 6\n );\n\n return lines.map((line, index) => \\` \\${index === 0 ? isUnicodeSupported() ? \"❝\" : \"\\\\\"\" : \" \"} \\${italic(line)} \\${index === lines.length - 1 ? isUnicodeSupported() ? \"❞\" : \"\\\\\"\" : \" \"} \\`).join(\"\\\\n\"); `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * A component to generate the `code` function declaration\n */\nexport function CodeFunctionDeclaration() {\n const theme = useTheme();\n\n return (\n <>\n <Spacing />\n <TSDoc heading={`Format a source code string for display in console.`}>\n <TSDocParam name=\"text\">\n {`The source code text to format with code styling.`}\n </TSDocParam>\n <TSDocReturns>{`The formatted string with code styling.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"code\"\n parameters={[\n {\n name: \"text\",\n type: \"string | number | boolean | null\",\n optional: true\n },\n {\n name: \"language\",\n type: \"string\",\n optional: true\n }\n ]}\n returnType=\"string\">\n {code`if (text === undefined || text === null || text === \"\") {\n return \"\";\n }\n\n return \\` \\${borderColors.app.divider.primary(\"${\n theme.borderStyles.app.divider.primary.top\n }\".repeat(4))}\\${language ? \\` \\${borderColors.app.divider.primary(language)} \\` : \"\"}\\${borderColors.app.divider.primary(\"${\n theme.borderStyles.app.divider.primary.top\n }\".repeat(process.stdout.columns - (language ? language.length + 2 : 0) - 5))} \\\\n\\${splitText(\n String(text),\n Math.max(process.stdout.columns, 20)\n ).map(line => \\`\\${textColors.body.primary(line)}\\`).join(\"\\\\n\")}\\\\n \\${borderColors.app.divider.primary(\"${\n theme.borderStyles.app.divider.primary.bottom\n }\".repeat(process.stdout.columns - 2))} \\`; `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * A component to generate the `inlineCode` function declaration\n */\nexport function InlineCodeFunctionDeclaration() {\n return (\n <>\n <Spacing />\n <TSDoc\n heading={`Format a string with inline code styling for display in console.`}>\n <TSDocParam name=\"text\">\n {`The text to format with inline code styling.`}\n </TSDocParam>\n <TSDocReturns>{`The formatted string with inline code styling.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"inlineCode\"\n parameters={[\n {\n name: \"text\",\n type: \"string | number | boolean | null\",\n optional: true\n }\n ]}\n returnType=\"string\">\n {code`if (text === undefined || text === null || text === \"\") {\n return \"\";\n }\n\n return textColors.body.primary(inverse(\\` \\${text} \\`), true); `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * A component to generate the `spinner` function in the `shell-shock:console` builtin module.\n */\nexport function SpinnerFunctionDeclaration() {\n const theme = useTheme();\n\n return (\n <>\n <TypeDeclaration name=\"WriteStream\">\n {`NodeJS.WriteStream;`}\n </TypeDeclaration>\n <Spacing />\n <VarDeclaration\n const\n name=\"activeHooksPerStream\"\n initializer=\"new Set();\"\n />\n <Spacing />\n <InterfaceDeclaration\n export\n name=\"SpinnerOptions\"\n doc=\"Options for configuring the spinner.\">\n <InterfaceMember\n name=\"message\"\n optional\n type=\"string\"\n doc=\"The message text to display next to the spinner. Defaults to an empty string.\"\n />\n <hbr />\n <InterfaceMember\n name=\"stream\"\n optional\n type=\"WriteStream\"\n doc=\"The output stream to write the spinner to. Defaults to process.stderr.\"\n />\n <hbr />\n <InterfaceMember\n name=\"spinner\"\n optional\n type=\"ThemeSpinnerResolvedConfig | SpinnerPreset\"\n doc=\"The spinner animation to use. Should be an object with a 'frames' property (an array of strings representing each frame of the animation) and an 'interval' property (the time in milliseconds between each frame). If not specified, a default spinner animation will be used.\"\n />\n </InterfaceDeclaration>\n\n <Spacing />\n <ClassDeclaration name=\"Spinner\">\n <ClassField name=\"frames\" isPrivateMember type=\"string[]\" />\n <hbr />\n <ClassField name=\"interval\" isPrivateMember type=\"number\" />\n <hbr />\n <ClassField name=\"currentFrame\" isPrivateMember type=\"number\">\n {code`-1`}\n </ClassField>\n <hbr />\n <ClassField\n name=\"timer\"\n isPrivateMember\n optional\n type=\"NodeJS.Timeout\"\n />\n <hbr />\n <ClassField name=\"message\" isPrivateMember type=\"string\">\n {code`\"\"`}\n </ClassField>\n <hbr />\n <ClassField name=\"stream\" isPrivateMember type=\"WriteStream\">\n {code`process.stderr`}\n </ClassField>\n <hbr />\n <ClassField name=\"lines\" isPrivateMember type=\"number\">\n {code`0`}\n </ClassField>\n <hbr />\n <ClassField\n name=\"exitHandlerBound\"\n isPrivateMember\n type=\"(signal: any) => void\">\n {code`() => {}`}\n </ClassField>\n <hbr />\n <ClassField name=\"lastSpinnerFrameTime\" isPrivateMember type=\"number\">\n {code`0`}\n </ClassField>\n <hbr />\n <ClassField name=\"isSpinning\" isPrivateMember type=\"boolean\">\n {code`false`}\n </ClassField>\n <hbr />\n <ClassField\n name=\"hookedStreams\"\n isPrivateMember\n type='Map<WriteStream, { write?: WriteStream[\"write\"]; originalWrite: WriteStream[\"write\"]; hookedWrite: WriteStream[\"write\"] }>'>\n {code`new Map()`}\n </ClassField>\n <hbr />\n <ClassField name=\"isInternalWrite\" isPrivateMember type=\"boolean\">\n {code`false`}\n </ClassField>\n <hbr />\n <ClassField name=\"isDeferringRender\" isPrivateMember type=\"boolean\">\n {code`false`}\n </ClassField>\n <Spacing />\n {code`constructor(options: SpinnerOptions = {}) {\n const spinner = (typeof options.spinner === \"string\" ? resolveSpinner(options.spinner as SpinnerPreset) : options.spinner) ?? ${JSON.stringify(\n theme.spinner\n )};\n this.#frames = spinner.frames;\n this.#interval = spinner.interval;\n\n if (options.message) {\n this.#message = options.message;\n }\n if (options.stream) {\n this.#stream = options.stream;\n }\n\n this.#exitHandlerBound = this.#exitHandler.bind(this);\n }\n\n #internalWrite(action: () => unknown) {\n this.#isInternalWrite = true;\n try {\n return action();\n } finally {\n this.#isInternalWrite = false;\n }\n }\n\n #stringifyChunk(chunk: string | Uint8Array<ArrayBufferLike> | ArrayBufferLike) {\n if (chunk === undefined || chunk === null) {\n return \"\";\n }\n\n if (typeof chunk === \"string\") {\n return chunk;\n }\n\n if (Buffer.isBuffer(chunk) || ArrayBuffer.isView(chunk)) {\n return Buffer.from(chunk).toString(\"utf8\");\n }\n\n return String(chunk);\n }\n\n #withSynchronizedOutput(action: () => unknown) {\n if (!isInteractive) {\n return action();\n }\n\n try {\n this.#write(\"\\\\u001B[?2026h\");\n return action();\n } finally {\n this.#write(\"\\\\u001B[?2026l\");\n }\n }\n\n #hookStream(stream: WriteStream) {\n if (!stream || this.#hookedStreams.has(stream) || typeof stream.write !== \"function\") {\n return;\n }\n\n if (activeHooksPerStream.has(stream)) {\n return;\n }\n\n const originalWrite = stream.write;\n const hookedWrite = ((...writeArguments: Parameters<WriteStream[\"write\"]>) => this.#hookedWrite(stream, originalWrite, writeArguments)) as WriteStream[\"write\"];\n\n this.#hookedStreams.set(stream, {originalWrite, hookedWrite});\n activeHooksPerStream.add(stream);\n stream.write = hookedWrite;\n }\n\n #installHook() {\n if (!isInteractive || this.#hookedStreams.size > 0) {\n return;\n }\n\n const streamsToHook = new Set([this.#stream]);\n if (isInteractive && (this.#stream === process.stdout || this.#stream === process.stderr)) {\n streamsToHook.add(process.stdout);\n streamsToHook.add(process.stderr);\n }\n\n for (const stream of streamsToHook) {\n this.#hookStream(stream);\n }\n }\n\n #uninstallHook() {\n for (const [stream, hookInfo] of this.#hookedStreams) {\n if (stream.write === hookInfo.hookedWrite) {\n stream.write = hookInfo.originalWrite;\n }\n\n activeHooksPerStream.delete(stream);\n }\n\n this.#hookedStreams.clear();\n }\n\n #hookedWrite(stream: WriteStream, originalWrite: typeof stream.write, writeArguments: Parameters<typeof stream.write>) {\n const [chunk, callback] = writeArguments;\n\n if (this.#isInternalWrite || !this.isSpinning) {\n return originalWrite.call(stream, chunk);\n }\n\n if (this.#lines > 0) {\n this.clear();\n }\n\n const chunkString = this.#stringifyChunk(chunk);\n const chunkTerminatesLine = chunkString.at(-1) === \"\\\\n\";\n const writeResult = originalWrite.call(stream, chunk);\n\n if (chunkTerminatesLine) {\n this.#isDeferringRender = false;\n } else if (chunkString !== \"\") {\n this.#isDeferringRender = true;\n }\n\n if (this.isSpinning && !this.#isDeferringRender) {\n this.#render();\n }\n\n return writeResult;\n }\n\n #stopWithIcon(icon: string, message: string) {\n return this.stop(\\` \\${icon} \\${message ?? this.#message}\\`);\n }\n\n #render() {\n if (this.#isDeferringRender) {\n return;\n }\n\n if (this.#currentFrame === -1 || Date.now() - this.#lastSpinnerFrameTime >= this.#interval) {\n this.#currentFrame = ++this.#currentFrame % this.#frames.length;\n this.#lastSpinnerFrameTime = Date.now();\n }\n\n let display = \\`\\${textColors.spinner.icon.active(this.#frames[this.#currentFrame])} \\${textColors.spinner.message.active(this.#message)}\\`;\n if (!isInteractive) {\n display += \"\\\\n\";\n }\n\n if (isInteractive) {\n this.#withSynchronizedOutput(() => {\n this.clear();\n this.#write(display);\n });\n } else {\n this.#write(display);\n }\n\n if (isInteractive) {\n this.#lines = this.#lineCount(display);\n }\n }\n\n #write(message: string) {\n this.#internalWrite(() => {\n this.#stream.write(message);\n });\n }\n\n #lineCount(message: string) {\n const width = this.#stream.columns ?? 80;\n const lines = stripVTControlCharacters(message).split(\"\\\\n\");\n\n let lineCount = 0;\n for (const line of lines) {\n lineCount += Math.max(1, Math.ceil(line.length / width));\n }\n\n return lineCount;\n }\n\n #hideCursor() {\n if (isInteractive) {\n this.#write(\"\\\\u001B[?25l\");\n }\n }\n\n #showCursor() {\n if (isInteractive) {\n this.#write(\"\\\\u001B[?25h\");\n }\n }\n\n #subscribeToProcessEvents() {\n process.once(\"SIGINT\", this.#exitHandlerBound);\n process.once(\"SIGTERM\", this.#exitHandlerBound);\n }\n\n #unsubscribeFromProcessEvents() {\n process.off(\"SIGINT\", this.#exitHandlerBound);\n process.off(\"SIGTERM\", this.#exitHandlerBound);\n }\n\n #exitHandler(signal: any) {\n if (this.isSpinning) {\n this.stop();\n }\n\n process.exit(signal === \"SIGINT\" ? 130 : (signal === \"SIGTERM\" ? 143 : 1));\n } `}\n <ClassPropertyGet\n public\n name=\"isSpinning\"\n type=\"boolean\"\n doc=\"Whether the spinner is currently active and spinning.\">\n {code`return this.#isSpinning;`}\n </ClassPropertyGet>\n <Spacing />\n <ClassPropertySet\n public\n name=\"message\"\n type=\"string\"\n doc=\"Set the message displayed by the spinner.\">\n {code`this.#message = value;`}\n </ClassPropertySet>\n <Spacing />\n <ClassPropertyGet\n public\n name=\"message\"\n type=\"string\"\n doc=\"Get the message displayed by the spinner.\">\n {code`return this.#message;`}\n </ClassPropertyGet>\n <Spacing />\n <ClassMethod\n name=\"start\"\n doc=\"Start the spinner animation.\"\n parameters={[{ name: \"message\", type: \"string\" }]}>\n <IfStatement condition={code`message !== undefined`}>\n {code`this.#message = message;`}\n </IfStatement>\n <IfStatement condition={code`this.isSpinning`}>\n {code`return this;`}\n </IfStatement>\n {code`this.#isSpinning = true;\n this.#hideCursor();\n this.#installHook();\n this.#render();\n this.#subscribeToProcessEvents();\n\n if (isInteractive) {\n this.#timer = setInterval(() => {\n this.#render();\n }, this.#interval);\n }\n\n return this;\n `}\n </ClassMethod>\n <Spacing />\n <ClassMethod\n name=\"stop\"\n doc=\"Stop the spinner animation.\"\n parameters={[\n { name: \"finalMessage\", optional: true, type: \"string\" }\n ]}>\n {code`if (!this.isSpinning) {\n return this;\n }\n\n const shouldWriteNewline = this.#isDeferringRender;\n this.#isSpinning = false;\n if (this.#timer) {\n clearInterval(this.#timer);\n this.#timer = undefined;\n }\n\n this.#isDeferringRender = false;\n this.#uninstallHook();\n this.#showCursor();\n this.clear();\n this.#unsubscribeFromProcessEvents();\n\n if (finalMessage) {\n const prefix = shouldWriteNewline ? \"\\\\n\" : \"\";\n this.#stream.write(\\`\\${prefix}\\${finalMessage}\\\\n\\`);\n }\n\n return this;\n\n `}\n </ClassMethod>\n <Spacing />\n <ClassMethod name=\"clear\" doc=\"Clear the spinner animation.\">\n {code`if (!isInteractive) {\n return this;\n }\n\n if (this.#lines === 0) {\n return this;\n }\n\n this.#internalWrite(() => {\n this.#stream.cursorTo(0);\n\n for (let index = 0; index < this.#lines; index++) {\n if (index > 0) {\n this.#stream.moveCursor(0, -1);\n }\n\n this.#stream.clearLine(1);\n }\n });\n\n this.#lines = 0;\n return this; `}\n </ClassMethod>\n <Spacing />\n <ClassMethod\n name=\"success\"\n doc=\"Mark the spinner as successful.\"\n parameters={[{ name: \"message\", type: \"string\" }]}>\n {code`return this.#stopWithIcon(textColors.spinner.icon.success(\"${\n theme.icons.spinner.success\n }\"), textColors.spinner.message.success(message)); `}\n </ClassMethod>\n <Spacing />\n <ClassMethod\n name=\"error\"\n doc=\"Mark the spinner as failed.\"\n parameters={[{ name: \"message\", type: \"string\" }]}>\n {code`return this.#stopWithIcon(textColors.spinner.icon.error(\"${\n theme.icons.spinner.error\n }\"), textColors.spinner.message.error(message)); `}\n </ClassMethod>\n <Spacing />\n <ClassMethod\n name=\"warning\"\n doc=\"Mark the spinner as warning.\"\n parameters={[{ name: \"message\", type: \"string\" }]}>\n {code`return this.#stopWithIcon(textColors.spinner.icon.warning(\"${\n theme.icons.spinner.warning\n }\"), textColors.spinner.message.warning(message)); `}\n </ClassMethod>\n <Spacing />\n <ClassMethod\n name=\"info\"\n doc=\"Mark the spinner as informational.\"\n parameters={[{ name: \"message\", type: \"string\" }]}>\n {code`return this.#stopWithIcon(textColors.spinner.icon.info(\"${\n theme.icons.spinner.info\n }\"), textColors.spinner.message.info(message)); `}\n </ClassMethod>\n <Spacing />\n <ClassMethod\n name=\"help\"\n doc=\"Mark the spinner as help.\"\n parameters={[{ name: \"message\", type: \"string\" }]}>\n {code`return this.#stopWithIcon(textColors.spinner.icon.help(\"${\n theme.icons.spinner.help\n }\"), textColors.spinner.message.help(message)); `}\n </ClassMethod>\n <Spacing />\n </ClassDeclaration>\n <Spacing />\n <TSDoc heading=\"Render a spinner in the console.\">\n <TSDocParam name=\"options\">\n {`Options for configuring the spinner, including the message to display, the output stream to write to, and the spinner animation to use.`}\n </TSDocParam>\n <TSDocReturns>{`An instance of the Spinner class, which can be used to control the spinner animation (e.g., start, stop, mark as success/error, etc.).`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"createSpinner\"\n parameters={[\n {\n name: \"options\",\n type: \"SpinnerOptions\",\n optional: true\n }\n ]}>\n {code`return new Spinner(options);`}\n </FunctionDeclaration>\n </>\n );\n}\n\nfunction extractBorderOptionsObject(\n direction:\n | \"top\"\n | \"right\"\n | \"bottom\"\n | \"left\"\n | \"topLeft\"\n | \"topRight\"\n | \"bottomLeft\"\n | \"bottomRight\",\n theme: ThemeResolvedConfig\n): string {\n return `borderOptions.${\n direction\n } === \"primary\" ? borderColors.app.table.primary(\"${\n theme.borderStyles.app.table.primary[direction]\n }\") : borderOptions.${\n direction\n } === \"secondary\" ? borderColors.app.table.secondary(\"${\n theme.borderStyles.app.table.secondary[direction]\n }\") : borderOptions.${\n direction\n } === \"tertiary\" ? borderColors.app.table.tertiary(\"${\n theme.borderStyles.app.table.tertiary[direction]\n }\") : !borderOptions.${direction} || borderOptions.${\n direction\n } === \"none\" ? \"\" : borderOptions.${direction}`;\n}\n\nfunction extractBorderOptionsString(\n direction:\n | \"top\"\n | \"right\"\n | \"bottom\"\n | \"left\"\n | \"topLeft\"\n | \"topRight\"\n | \"bottomLeft\"\n | \"bottomRight\",\n theme: ThemeResolvedConfig\n): string {\n return `borderOptions === \"primary\" ? borderColors.app.table.primary(\"${\n theme.borderStyles.app.table.primary[direction]\n }\") : borderOptions === \"secondary\" ? borderColors.app.table.secondary(\"${\n theme.borderStyles.app.table.secondary[direction]\n }\") : borderOptions === \"tertiary\" ? borderColors.app.table.tertiary(\"${\n theme.borderStyles.app.table.tertiary[direction]\n }\") : !borderOptions || borderOptions === \"none\" ? \"\" : borderOptions`;\n}\n\n/**\n * Props for the TableFunctionDeclaration component.\n */\nexport type TableFunctionDeclarationProps = Omit<\n FunctionDeclarationProps,\n \"parameters\" | \"name\"\n>;\n\n/**\n * A component to generate the table functions in the `shell-shock:console` builtin module.\n */\nexport function TableFunctionDeclaration(props: TableFunctionDeclarationProps) {\n const theme = useTheme();\n\n return (\n <>\n <TypeDeclaration\n export\n name=\"SizeToken\"\n doc=\"A type representing the width size of an item in the console.\">\n {code`\"full\" | \"1/1\" | \"1/2\" | \"1/3\" | \"1/4\" | \"1/5\" | \"1/6\" | \"1/12\" | \"1/24\" | \"100%\" | \"50%\" | \"33.33%\" | \"25%\" | \"20%\" | \"10%\" | \"5%\" | \"2.5%\"`}\n </TypeDeclaration>\n <Spacing />\n <TSDoc heading=\"Determine if a value is a valid size token.\">\n <TSDocRemarks>\n {`This function checks if the provided value is a valid size token, which can be one of the predefined strings representing common width sizes (e.g., \"full\", \"1/2\", \"1/3\", etc.) or percentage strings (e.g., \"50%\").`}\n </TSDocRemarks>\n <TSDocParam name=\"value\">{`The value to check for being a valid size token.`}</TSDocParam>\n <TSDocReturns>{`True if the value is a valid size token, false otherwise.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n doc=\"Determines if the provided value is a valid size token.\"\n name=\"isSizeToken\"\n parameters={[\n {\n name: \"value\",\n type: \"any\"\n }\n ]}\n returnType=\"value is SizeToken\">\n <IfStatement\n condition={code`[\"full\", \"1/1\", \"1/2\", \"1/3\", \"1/4\", \"1/5\", \"1/6\", \"1/12\", \"1/24\", \"100%\", \"50%\", \"33.33%\", \"25%\", \"20%\", \"10%\", \"5%\", \"2.5%\"].includes(value)`}>\n {code`return true; `}\n </IfStatement>\n {code`return false; `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"Calculate the width in characters based on the provided width size.\">\n <TSDocRemarks>\n {`This function calculates the width in characters based on the provided width size, which can be a predefined string (e.g., \"full\", \"1/2\", \"1/3\", etc.) or a percentage string (e.g., \"50%\"). The calculation is based on the current width of the console (process.stdout.columns).`}\n </TSDocRemarks>\n <TSDocParam name=\"size\">\n {`The width size to calculate. This can be a predefined string (e.g., \"full\", \"1/2\", \"1/3\", etc.) or a percentage string (e.g., \"50%\").`}\n </TSDocParam>\n <TSDocReturns>{`The calculated width in characters.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"calculateWidth\"\n parameters={[\n {\n name: \"size\",\n type: \"SizeToken\",\n optional: false\n }\n ]}\n returnType=\"number\">\n <IfStatement condition={code`[\"full\", \"100%\", \"1/1\"]. includes(size)`}>\n {code`return process.stdout.columns;`}\n </IfStatement>\n <ElseIfClause condition={code`[\"1/2\", \"50%\"].includes(size)`}>\n {code`return Math.round(process.stdout.columns / 2);`}\n </ElseIfClause>\n <ElseIfClause condition={code`[\"1/3\", \"33.33%\"].includes(size)`}>\n {code`return Math.round(process.stdout.columns / 3);`}\n </ElseIfClause>\n <ElseIfClause condition={code`[\"1/4\", \"25%\"].includes(size)`}>\n {code`return Math.round(process.stdout.columns / 4);`}\n </ElseIfClause>\n <ElseIfClause condition={code`[\"1/5\", \"20%\"].includes(size)`}>\n {code`return Math.round(process.stdout.columns / 5);`}\n </ElseIfClause>\n <ElseIfClause condition={code`[\"1/6\", \"10%\"].includes(size)`}>\n {code`return Math.round(process.stdout.columns / 6);`}\n </ElseIfClause>\n <ElseIfClause condition={code`[\"1/12\", \"5%\"].includes(size)`}>\n {code`return Math.round(process.stdout.columns / 12);`}\n </ElseIfClause>\n <ElseIfClause condition={code`[\"1/24\", \"2.5%\"].includes(size)`}>\n {code`return Math.round(process.stdout.columns / 24);`}\n </ElseIfClause>\n <ElseClause>\n {code`\n const match = size.match(/(\\\\d+(\\\\.\\\\d+)?)%/);\n if (match) {\n return Math.round((process.stdout.columns * parseFloat(match[1])) / 100);\n }\n\n throw new Error(\\`Invalid width size: \\${size}\\`);\n `}\n </ElseClause>\n <Spacing />\n </FunctionDeclaration>\n\n <TypeDeclaration\n export\n name=\"BorderOption\"\n doc=\"The border options applied to table cells.\">\n {code`\"primary\" | \"secondary\" | \"tertiary\" | \"none\" | string; `}\n </TypeDeclaration>\n <Spacing />\n <InterfaceDeclaration\n export\n name=\"TableOutputOptions\"\n doc=\"Options to customize the output of the {@link table} function.\">\n <TSDoc heading=\"Border variant for the table cell.\">\n <TSDocRemarks>\n {`The border variant to use for the table cell. This determines the color and style of the border around the cell.`}\n </TSDocRemarks>\n <hbr />\n <TSDocDefaultValue\n type={ReflectionKind.property}\n defaultValue=\"primary\"\n />\n </TSDoc>\n <InterfaceMember\n name=\"border\"\n optional\n type=\"BorderOption | { top?: BorderOption; right?: BorderOption; bottom?: BorderOption; left?: BorderOption; topLeft?: BorderOption; topRight?: BorderOption; bottomLeft?: BorderOption; bottomRight?: BorderOption; }\"\n />\n <hbr />\n <TSDoc heading=\"Padding for the table cell.\">\n <TSDocRemarks>\n {`The amount of padding (in spaces) to apply to the table cell. This value is applied to both the left and right sides of the cell. If not specified, the default table padding defined in the current theme configuration will be used.`}\n </TSDocRemarks>\n <hbr />\n <TSDocDefaultValue\n type={ReflectionKind.property}\n defaultValue={`\\`${theme.padding.table}\\``}\n />\n </TSDoc>\n <InterfaceMember name=\"padding\" optional type=\"number\" />\n <hbr />\n <TSDoc heading=\"Alignment for the table cell.\">\n <TSDocRemarks>\n {`The alignment for the table cell. This determines how the text within the cell is aligned. If not specified, the default alignment is \"left\".`}\n </TSDocRemarks>\n <hbr />\n <TSDocDefaultValue\n type={ReflectionKind.property}\n defaultValue=\"left\"\n />\n </TSDoc>\n <InterfaceMember\n name=\"align\"\n optional\n type='\"left\" | \"right\" | \"center\"'\n />\n <hbr />\n </InterfaceDeclaration>\n <Spacing />\n <InterfaceDeclaration\n export\n name=\"TableCellOptions\"\n extends=\"TableOutputOptions\"\n doc=\"Options for a specific table cell provided to the {@link table} function.\">\n <InterfaceMember\n name=\"value\"\n optional\n type=\"string\"\n doc=\"The actual string value of the table cell.\"\n />\n <hbr />\n <TSDoc heading=\"Width of the table cell.\">\n <TSDocRemarks>\n {`The width of the table cell (where 1 is a single character in the terminal). If not specified, the width will be determined based on the content of the cell and the available space in the console.`}\n </TSDocRemarks>\n </TSDoc>\n <InterfaceMember\n name=\"maxWidth\"\n type=\"number | SizeToken | undefined\"\n />\n <hbr />\n </InterfaceDeclaration>\n <Spacing />\n <InterfaceDeclaration\n export\n name=\"TableRowOptions\"\n extends=\"TableOutputOptions\"\n doc=\"Options for a specific table row provided to the {@link table} function.\">\n <InterfaceMember\n name=\"values\"\n optional\n type=\"(string | TableCellOptions)[]\"\n doc=\"The actual string values of the table row's cells.\"\n />\n <hbr />\n </InterfaceDeclaration>\n <Spacing />\n <InterfaceDeclaration\n export\n name=\"TableOptions\"\n extends=\"TableOutputOptions\"\n doc=\"Options for a specific table cell provided to the {@link table} function.\">\n <InterfaceMember\n name=\"values\"\n optional\n type=\"(string | TableCellOptions)[][]\"\n doc=\"The actual string values of the table's rows' cells.\"\n />\n <hbr />\n </InterfaceDeclaration>\n <Spacing />\n <InterfaceDeclaration\n name=\"Dimensions\"\n doc=\"The height and width for a specific table/cell used internally in the {@link table} function.\">\n <InterfaceMember\n name=\"height\"\n type=\"number\"\n doc=\"The height of the row/cell (where 1 is a single line in the terminal).\"\n />\n <hbr />\n <InterfaceMember\n name=\"width\"\n type=\"number\"\n doc=\"The width of the row/cell (where 1 is a single character in the terminal).\"\n />\n <hbr />\n </InterfaceDeclaration>\n <Spacing />\n <InterfaceDeclaration\n name=\"TableCellBorder\"\n doc=\"The resolved complete border styles for a table cell.\">\n <InterfaceMember\n name=\"top\"\n type=\"string\"\n doc=\"The top border style of the table cell.\"\n />\n <hbr />\n <InterfaceMember\n name=\"bottom\"\n type=\"string\"\n doc=\"The bottom border style of the table cell.\"\n />\n <hbr />\n <InterfaceMember\n name=\"right\"\n type=\"string\"\n doc=\"The right border style of the table cell.\"\n />\n <hbr />\n <InterfaceMember\n name=\"left\"\n type=\"string\"\n doc=\"The left border style of the table cell.\"\n />\n <hbr />\n <InterfaceMember\n name=\"topLeft\"\n type=\"string\"\n doc=\"The top-left border style of the table cell.\"\n />\n <hbr />\n <InterfaceMember\n name=\"topRight\"\n type=\"string\"\n doc=\"The top-right border style of the table cell.\"\n />\n <hbr />\n <InterfaceMember\n name=\"bottomLeft\"\n type=\"string\"\n doc=\"The bottom-left border style of the table cell.\"\n />\n <hbr />\n <InterfaceMember\n name=\"bottomRight\"\n type=\"string\"\n doc=\"The bottom-right border style of the table cell.\"\n />\n <hbr />\n </InterfaceDeclaration>\n <Spacing />\n <TypeDeclaration\n name=\"TableCell\"\n doc=\"The internal state of a formatted table cell in the {@link table} function.\">\n {code`Required<Omit<TableCellOptions, \"maxWidth\" | \"border\">> & Dimensions & {\n border: TableCellBorder;\n maxWidth?: number;\n };\n `}\n </TypeDeclaration>\n <Spacing />\n <TSDoc heading=\"Write a table to the console.\">\n <TSDocRemarks>\n {`This function writes a table to the console, applying the appropriate padding as defined in the current theme configuration and wrapping as needed.`}\n </TSDocRemarks>\n <hbr />\n <TSDocParam name=\"options\">\n {`Options to customize the table output.`}\n </TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n {...props}\n name=\"table\"\n parameters={[\n {\n name: \"options\",\n type: \"TableOptions | TableRowOptions[] | TableCellOptions[][] | string[] | string[][]\",\n optional: false\n }\n ]}>\n <IfStatement\n condition={code`!options ||\n (!Array.isArray(options) && (typeof options !== \"object\" || !options.values || !Array.isArray(options.values) || options.values.length === 0)) ||\n (Array.isArray(options) && !options.every(item => typeof item === \"object\" || typeof item === \"string\" || Array.isArray(item))) `}>\n {code`return;`}\n </IfStatement>\n <Spacing />\n <VarDeclaration\n let\n name=\"cells\"\n type={`TableCell[][]`}\n initializer={code`[];`}\n />\n <hbr />\n {code`\n const extractTableCell = (cell: string | TableCellOptions, columnIndex: number, rowLength: number, opts?: TableOutputOptions): TableCell => {\n if (typeof cell === \"string\") {\n const borderOptions = opts?.border || \"primary\";\n\n let border = {} as TableCellBorder;\n if (typeof borderOptions === \"object\") {\n border = {\n top: ${extractBorderOptionsObject(\"top\", theme)},\n bottom: ${extractBorderOptionsObject(\"bottom\", theme)},\n left: ${extractBorderOptionsObject(\"left\", theme)},\n right: ${extractBorderOptionsObject(\"right\", theme)},\n topLeft: ${extractBorderOptionsObject(\"topLeft\", theme)},\n topRight: ${extractBorderOptionsObject(\"topRight\", theme)},\n bottomLeft: ${extractBorderOptionsObject(\"bottomLeft\", theme)},\n bottomRight: ${extractBorderOptionsObject(\"bottomRight\", theme)},\n };\n } else {\n border.top = ${extractBorderOptionsString(\"top\", theme)};\n border.bottom = ${extractBorderOptionsString(\"bottom\", theme)};\n border.left = ${extractBorderOptionsString(\"left\", theme)};\n border.right = ${extractBorderOptionsString(\"right\", theme)};\n border.topLeft = ${extractBorderOptionsString(\"topLeft\", theme)};\n border.topRight = ${extractBorderOptionsString(\"topRight\", theme)};\n border.bottomLeft = ${extractBorderOptionsString(\"bottomLeft\", theme)};\n border.bottomRight = ${extractBorderOptionsString(\"bottomRight\", theme)};\n }\n\n const padding = Math.max(0, opts?.padding ?? ${theme.padding.table}) * (columnIndex === 0 || columnIndex === rowLength - 1 ? 2 : 1);\n const value = cell ?? \"\";\n const width = stripAnsi(value).length + padding * 2;\n\n return {\n value,\n height: 1,\n width,\n border,\n padding,\n align: opts?.align || \"left\",\n };\n } else {\n const borderOptions = cell.border || opts?.border || \"primary\";\n\n let border = {} as TableCellBorder;\n if (typeof borderOptions === \"object\") {\n border = {\n top: ${extractBorderOptionsObject(\"top\", theme)},\n bottom: ${extractBorderOptionsObject(\"bottom\", theme)},\n left: ${extractBorderOptionsObject(\"left\", theme)},\n right: ${extractBorderOptionsObject(\"right\", theme)},\n topLeft: ${extractBorderOptionsObject(\"topLeft\", theme)},\n topRight: ${extractBorderOptionsObject(\"topRight\", theme)},\n bottomLeft: ${extractBorderOptionsObject(\"bottomLeft\", theme)},\n bottomRight: ${extractBorderOptionsObject(\"bottomRight\", theme)},\n };\n } else {\n border.top = ${extractBorderOptionsString(\"top\", theme)};\n border.bottom = ${extractBorderOptionsString(\"bottom\", theme)};\n border.left = ${extractBorderOptionsString(\"left\", theme)};\n border.right = ${extractBorderOptionsString(\"right\", theme)};\n border.topLeft = ${extractBorderOptionsString(\"topLeft\", theme)};\n border.topRight = ${extractBorderOptionsString(\"topRight\", theme)};\n border.bottomLeft = ${extractBorderOptionsString(\"bottomLeft\", theme)};\n border.bottomRight = ${extractBorderOptionsString(\"bottomRight\", theme)};\n }\n\n const padding = Math.max(0, cell.padding ?? opts?.padding ?? ${\n theme.padding.table\n });\n const value = cell.value ?? \"\";\n const width = stripAnsi(value).length + padding * 2;\n const maxWidth = cell.maxWidth ? typeof cell.maxWidth === \"number\" ? cell.maxWidth : calculateWidth(cell.maxWidth) : undefined;\n\n return {\n value,\n height: 1,\n width,\n maxWidth,\n border,\n padding,\n align: cell.align || opts?.align || \"left\",\n };\n }\n };\n\n let colMaxWidths = [] as (number | undefined)[];\n `}\n <hbr />\n <IfStatement condition={code`Array.isArray(options)`}>\n <IfStatement\n condition={code`options.every(row => typeof row === \"string\" || (typeof row === \"object\" && !Array.isArray(row) && !(\"values\" in row)))`}>\n {code`cells.push(options.map((cell, index) => extractTableCell(cell as string | TableCellOptions, index, options.length)));`}\n </IfStatement>\n <ElseClause>\n {code`\n cells.push(\n ...options.map(row => Array.isArray(row)\n ? row.reduce((cellRow, cell, index) => {\n if (colMaxWidths.length <= index) {\n colMaxWidths.push(undefined);\n }\n const newCell = extractTableCell(cell, index, row.length);\n if (newCell.maxWidth && (!colMaxWidths[index] || newCell.maxWidth < colMaxWidths[index]!)) {\n colMaxWidths[index] = newCell.maxWidth;\n }\n cellRow.push(newCell);\n return cellRow;\n }, [] as TableCell[])\n : (row as TableRowOptions).values?.reduce((cellRow, cell, index) => {\n if (colMaxWidths.length <= index) {\n colMaxWidths.push(undefined);\n }\n const newCell = extractTableCell(cell, index, (row as TableRowOptions).values?.length ?? 1, row as TableRowOptions);\n if (newCell.maxWidth && (!colMaxWidths[index] || newCell.maxWidth < colMaxWidths[index]!)) {\n colMaxWidths[index] = newCell.maxWidth;\n }\n cellRow.push(newCell);\n return cellRow;\n }, [] as TableCell[]) ?? []\n )\n );\n `}\n </ElseClause>\n </IfStatement>\n <ElseClause>\n {code`\n cells.push(\n ...options.values!.map(row => Array.isArray(row)\n ? row.reduce((cellRow, cell, index) => {\n if (colMaxWidths.length <= index) {\n colMaxWidths.push(undefined);\n }\n const newCell = extractTableCell(cell, index, row.length);\n if (newCell.maxWidth && (!colMaxWidths[index] || newCell.maxWidth < colMaxWidths[index]!)) {\n colMaxWidths[index] = newCell.maxWidth;\n }\n cellRow.push(newCell);\n return cellRow;\n }, [] as TableCell[])\n : (row as TableRowOptions).values?.reduce((cellRow, cell, index) => {\n if (colMaxWidths.length <= index) {\n colMaxWidths.push(undefined);\n }\n const newCell = extractTableCell(cell, index, (row as TableRowOptions).values?.length ?? 1, options);\n if (newCell.maxWidth && (!colMaxWidths[index] || newCell.maxWidth < colMaxWidths[index]!)) {\n colMaxWidths[index] = newCell.maxWidth;\n }\n cellRow.push(newCell);\n return cellRow;\n }, [] as TableCell[]) ?? []\n )\n );\n\n `}\n </ElseClause>\n <hbr />\n {code`\ncells = cells.filter(row => row.length > 0);\nif (cells.length === 0) {\n return;\n}\n\ncells.forEach(row => row.forEach((cell, index) => {\n if (colMaxWidths[index] && cell.maxWidth !== colMaxWidths[index]!) {\n cell.maxWidth = colMaxWidths[index]!;\n }\n}));\n\n// Calculate table dimensions\nlet colWidths = [] as number[];\nlet rowDims = [] as Dimensions[];\n\nconst calculateRowDimensions = () => {\n colWidths = [];\n return cells.reduce((dims, row) => {\n dims.push(row.reduce((dim, cell, index) => {\n dim.width += cell.width;\n if (cell.height > dim.height) {\n dim.height = cell.height;\n }\n if (!colWidths[index] || cell.width > colWidths[index]!) {\n colWidths[index] = cell.width;\n }\n\n return dim;\n }, { width: 0, height: 0 } as Dimensions));\n\n return dims;\n }, [] as Dimensions[]);\n}\n\nlet recalculate!: boolean;\ndo {\n recalculate = false;\n rowDims = calculateRowDimensions();\n\n if (!recalculate && colWidths.some((colWidth, index) => colMaxWidths[index] && colWidth > colMaxWidths[index]!)) {\n (colWidths.map((colWidth, index) => colMaxWidths[index] && colWidth > colMaxWidths[index]! ? index : undefined).filter(colWidth => colWidth !== undefined) as number[]).forEach(index => {\n cells.forEach(row => {\n const cell = row[index]!;\n if (colMaxWidths[index] && cell.width > colMaxWidths[index]) {\n const lines = splitText(\n cell.value,\n colMaxWidths[index] - cell.padding * 2,\n );\n\n cell.value = lines.join(\"\\\\n\");\n cell.height = lines.length;\n cell.width = Math.max(...lines.map(line => stripAnsi(line).length)) + cell.padding * 2;\n\n recalculate = true;\n }\n });\n });\n }\n\n rowDims.forEach((row, rowIndex) => {\n if (!recalculate && row.width > Math.max(process.stdout.columns - ${\n Math.max(theme.padding.app, 0) * 2\n }, 0)) {\n const cell = cells[rowIndex]!.reduce((largestCell, cell) => {\n if (cell.width > largestCell.width) {\n return cell;\n }\n return largestCell;\n }, cells[rowIndex]![0]!);\n\n const lines = splitText(\n cell.value,\n Math.min(Math.max(process.stdout.columns - ${\n Math.max(theme.padding.app, 0) * 2\n } - (row.width - (cell.width - cell.padding * 2)), 0),\n cell.maxWidth ?? Number.POSITIVE_INFINITY)\n );\n\n cell.value = lines.join(\"\\\\n\");\n cell.height = lines.length;\n cell.width = Math.max(...lines.map(line => stripAnsi(line).length)) + cell.padding * 2;\n\n recalculate = true;\n }\n });\n\n if (!recalculate && colWidths.reduce((a, b) => a + b, 0) > Math.max(process.stdout.columns - ${\n Math.max(theme.padding.app, 0) * 2\n }, 0)) {\n let colIndex = 0;\n const cell = cells.reduce((ret, row) => {\n return row.reduce((largest, current, index) => {\n if (largest.width < current.width) {\n colIndex = index;\n return current;\n }\n return largest;\n }, ret);\n }, cells[0]![0]!);\n\n const lines = splitText(\n cell.value,\n Math.min(Math.max(process.stdout.columns - ${\n Math.max(theme.padding.app, 0) * 2\n } - (colWidths.filter((_, i) => i !== colIndex).reduce((a, b) => a + b, 0)) - cell.padding * 2, 0),\n cell.maxWidth ?? Number.POSITIVE_INFINITY)\n );\n\n cell.value = lines.join(\"\\\\n\");\n cell.height = lines.length;\n cell.width = Math.max(...lines.map(line => stripAnsi(line).length)) + cell.padding * 2;\n\n recalculate = true;\n }\n} while (recalculate);\n\n// Render table\ncells.forEach((row, rowIndex) => {\n const outputs = [] as string[][];\n row.forEach((cell, colIndex) => {\n const lines = cell.value.split(\"\\\\n\");\n while (lines.length < rowDims[rowIndex]!.height) {\n lines.push(\"\");\n }\n\n outputs.push(lines.map(line => {\n let paddedContent = \"\";\n switch (cell.align) {\n case \"right\":\n paddedContent = \" \".repeat(Math.max(colWidths[colIndex] - stripAnsi(line).length - cell.padding, 0)) + line + \" \".repeat(cell.padding);\n break;\n case \"center\":\n const leftPadding = Math.floor((colWidths[colIndex] - stripAnsi(line).length - cell.padding) / 2);\n const rightPadding = colWidths[colIndex] - stripAnsi(line).length - leftPadding;\n paddedContent = \" \".repeat(leftPadding) + line + \" \".repeat(rightPadding);\n break;\n case \"left\":\n default:\n paddedContent = \" \".repeat(cell.padding) + line + \" \".repeat(Math.max(colWidths[colIndex] - stripAnsi(line).length - cell.padding, 0));\n break;\n }\n\n if (colIndex === row.length - 1) {\n return cell.border.left + paddedContent + cell.border.right;\n } else {\n return cell.border.left + paddedContent;\n }\n }));\n });\n\n for (let index = 0; index < rowDims[rowIndex]!.height; index++) {\n writeLine(outputs.map(output => output[index] ?? \"\").join(\"\"));\n }\n});\n`}\n </FunctionDeclaration>\n </>\n );\n}\n\nexport type ConsoleBuiltinProps = Pick<\n BuiltinFileProps,\n \"children\" | \"imports\" | \"builtinImports\"\n>;\n\n/**\n * A built-in console utilities module for Shell Shock.\n */\nexport function ConsoleBuiltin(props: ConsoleBuiltinProps) {\n const { children, imports, builtinImports } = props;\n\n return (\n <BuiltinFile\n id=\"console\"\n description=\"A collection of helper utilities to assist in generating content meant for display in the console.\"\n imports={defu(imports, {\n \"@shell-shock/plugin-theme/types/theme\": [\n { name: \"ThemeColorsResolvedConfig\", type: true },\n { name: \"ThemeSpinnerResolvedConfig\", type: true }\n ],\n \"@shell-shock/plugin-theme/helpers/spinners\": [\n { name: \"SpinnerPreset\", type: true },\n { name: \"resolveSpinner\" }\n ],\n \"node:buffer\": [\"WithImplicitCoercion\"],\n \"node:util\": [\"stripVTControlCharacters\"]\n })}\n builtinImports={defu(builtinImports, {\n utils: [\n \"isMinimal\",\n \"isInteractive\",\n \"isColorSupported\",\n \"colorSupportLevels\",\n \"isUnicodeSupported\",\n \"isHyperlinkSupported\"\n ],\n env: [\"env\", \"isDevelopment\", \"isDebug\"],\n state: [\"hasFlag\"]\n })}>\n <AnsiHelpersDeclarations />\n <Spacing />\n <StripAnsiFunctionDeclaration />\n <Spacing />\n <WrapAnsiFunction />\n <Spacing />\n <AnsiStyleFunctionsDeclaration />\n <Spacing />\n <WriteFunctionDeclaration />\n <Spacing />\n <WriteLineFunctionDeclaration />\n <Spacing />\n <SplitTextFunctionDeclaration />\n <Spacing />\n <LinkFunctionDeclaration />\n <Spacing />\n <DividerFunctionDeclaration />\n <Spacing />\n <SpinnerFunctionDeclaration />\n <Spacing />\n <MessageFunctionDeclaration\n type=\"help\"\n variant=\"help\"\n consoleFnName=\"log\"\n description=\"help\"\n />\n <Spacing />\n <MessageFunctionDeclaration\n type=\"success\"\n variant=\"success\"\n consoleFnName=\"info\"\n description=\"success\"\n />\n <Spacing />\n <MessageFunctionDeclaration\n type=\"info\"\n variant=\"info\"\n consoleFnName=\"info\"\n description=\"informational\"\n />\n <Spacing />\n <MessageFunctionDeclaration\n type=\"debug\"\n variant=\"debug\"\n consoleFnName=\"debug\"\n description=\"debug\"\n timestamp\n prefix={\n <IfStatement condition={<IsNotDebug />}>{code`return; `}</IfStatement>\n }\n />\n <Spacing />\n <MessageFunctionDeclaration\n type=\"verbose\"\n variant=\"info\"\n color=\"debug\"\n consoleFnName=\"debug\"\n description=\"verbose\"\n timestamp\n prefix={\n <IfStatement\n condition={<IsNotVerbose />}>{code`return; `}</IfStatement>\n }\n />\n <Spacing />\n <MessageFunctionDeclaration\n type=\"warn\"\n variant=\"warning\"\n consoleFnName=\"warn\"\n description=\"warning\"\n />\n <Spacing />\n <MessageFunctionDeclaration\n type=\"danger\"\n variant=\"danger\"\n consoleFnName=\"error\"\n description=\"destructive/danger\"\n />\n <Spacing />\n <MessageFunctionDeclaration\n type=\"error\"\n variant=\"error\"\n consoleFnName=\"error\"\n description=\"error\"\n timestamp\n parameters={[\n {\n name: \"err\",\n type: \"string | Error\",\n optional: false\n },\n {\n name: \"header\",\n type: \"string\",\n optional: true\n }\n ]}\n prefix={\n <>\n <VarDeclaration let name=\"message\" type=\"string | undefined\" />\n <Spacing />\n <IfStatement condition={code`(err as Error)?.message`}>\n {code`message = (err as Error).message;`}\n </IfStatement>\n <ElseClause>{code`message = String(err);`}</ElseClause>\n <Spacing />\n <IfStatement condition={code`env.STACKTRACE`}>\n <IfStatement condition={code`(err as Error)?.stack`}>\n {code`message += \" \\\\n\\\\n\" + ((err as Error).stack || \"\");`}\n </IfStatement>\n <ElseClause>{code`message += \" \\\\n\\\\n\" + ((new Error(\" \")).stack || \"\").split(\"\\\\n\").slice(2).map(line => line.trim()).join(\"\\\\n\");`}</ElseClause>\n </IfStatement>\n </>\n }\n />\n <Spacing />\n <TableFunctionDeclaration />\n <Spacing />\n <BlockquoteFunctionDeclaration />\n <Spacing />\n <CodeFunctionDeclaration />\n <Spacing />\n <InlineCodeFunctionDeclaration />\n <Spacing />\n {children}\n <Spacing />\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAsCA,SAAE,0BAAA;AACA,QAAO;EAAA,gBAAkB,gBAAiB;GAC5C,SAAa;GACb,UAAS;GACT,MAAO;GACL,KAAK;GACL,UAAA,IAAA;GACA,CAAA;EAAA,gBAAY,SAAA,EAAA,CAAA;EAAA,gBAAA,gBAAA;GACZ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AAS,IAAA;QACT,IAAA,WAAA;;UAEA,WAAe,IAAC;UACd,UAAM,IAAQ;UACd,CAAA,EAAA,gBAAA,YAAA,EACF,UAAc,IAAI,qHAClB,CAAA,CAAK;;;;;KAIV,CAAC;IAAE,gBAAS,SAAA,EAAA,CAAA;IAAA,gBAAA,0BAAA,EAAA,CAAA;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,+BAAA,EAAA,CAAA;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,yBAAA,EAAA,CAAA;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,+BAAA,EAAA,CAAA;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA;;EAEhB,CAAC"}
1
+ {"version":3,"file":"console-builtin.mjs","names":[],"sources":["../../src/components/console-builtin.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Children } from \"@alloy-js/core\";\nimport { code, For, Show } from \"@alloy-js/core\";\nimport type { FunctionDeclarationProps } from \"@alloy-js/typescript\";\nimport {\n ElseClause,\n ElseIfClause,\n FunctionDeclaration,\n IfStatement,\n InterfaceDeclaration,\n InterfaceMember,\n TypeDeclaration,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport {\n ClassDeclaration,\n ClassField,\n ClassMethod,\n ClassPropertyGet,\n ClassPropertySet\n} from \"@powerlines/plugin-alloy/typescript\";\nimport type { BuiltinFileProps } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport { BuiltinFile } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport {\n TSDoc,\n TSDocDefaultValue,\n TSDocExample,\n TSDocParam,\n TSDocRemarks,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { IsNotDebug, IsNotVerbose } from \"@shell-shock/core/components/helpers\";\nimport type {\n ThemeMessageVariant,\n ThemeResolvedConfig\n} from \"@shell-shock/plugin-theme\";\nimport { useColors, useTheme } from \"@shell-shock/plugin-theme/contexts/theme\";\nimport type { AnsiColorWrappers } from \"@shell-shock/plugin-theme/helpers/ansi-utils\";\nimport {\n colorKeys,\n modifierKeys\n} from \"@shell-shock/plugin-theme/helpers/ansi-utils\";\nimport { camelCase } from \"@stryke/string-format\";\nimport { getIndefiniteArticle } from \"@stryke/string-format/vowels\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { defu } from \"defu\";\n\nexport function AnsiHelpersDeclarations() {\n return (\n <>\n <VarDeclaration\n const\n export\n name=\"beep\"\n doc=\"The ASCII Bell character, which can be used to trigger a beep sound in the console.\">\n {code` \"\\\\u0007\"; `}\n </VarDeclaration>\n <Spacing />\n <VarDeclaration\n const\n export\n name=\"cursor\"\n doc=\"An object containing ANSI escape codes for controlling the console cursor.\">\n {code` {\n to(x: number, y?: number) {\n if (!y) {\n return \\`\\\\x1B[\\${x + 1}G\\`;\n }\n\n return \\`\\\\x1B[\\${y + 1};\\${x + 1}H\\`;\n },\n move(x: number, y: number) {\n let ret = '';\n\n if (x < 0) {\n ret += \\`\\\\x1B[\\${-x}D\\`;\n } else if (x > 0) {\n ret += \\`\\\\x1B[\\${x}C\\`;\n }\n\n if (y < 0) {\n ret += \\`\\\\x1B[\\${-y}A\\`;\n } else if (y > 0) {\n ret += \\`\\\\x1B[\\${y}B\\`;\n }\n\n return ret;\n },\n up: (count = 1) => \\`\\\\x1B[\\${count}A\\`,\n down: (count = 1) => \\`\\\\x1B[\\${count}B\\`,\n forward: (count = 1) => \\`\\\\x1B[\\${count}C\\`,\n backward: (count = 1) => \\`\\\\x1B[\\${count}D\\`,\n nextLine: (count = 1) => \"\\\\x1B[E\".repeat(count),\n prevLine: (count = 1) => \"\\\\x1B[F\".repeat(count),\n left: \"\\\\x1B[G\",\n hide: \"\\\\x1B[?25l\",\n show: \"\\\\x1B[?25h\",\n save: \"\\\\x1B7\",\n restore: \"\\\\x1B8\"\n } `}\n </VarDeclaration>\n <Spacing />\n <VarDeclaration\n const\n export\n name=\"erase\"\n doc=\"An object containing ANSI escape codes for erasing parts of the console.\">\n {code` {\n screen: \"\\\\x1B[2J\",\n up: (count = 1) => \"\\\\x1B[1J\".repeat(count),\n down: (count = 1) => \"\\\\x1B[J\".repeat(count),\n line: \"\\\\x1B[2K\",\n lineEnd: \"\\\\x1B[K\",\n lineStart: \"\\\\x1B[1K\",\n lines(count: number) {\n let lineClear = \"\";\n for (let i = 0; i < count; i++) {\n lineClear += this.line + (i < count - 1 ? cursor.up() : \"\");\n }\n\n if (count) {\n lineClear += cursor.left;\n }\n\n return lineClear;\n }\n } `}\n </VarDeclaration>\n <Spacing />\n <VarDeclaration\n const\n export\n name=\"scroll\"\n doc=\"An object containing ANSI escape codes for scrolling the console.\">\n {code` {\n up: (count = 1) => \"\\\\x1B[S\".repeat(count),\n down: (count = 1) => \"\\\\x1B[T\".repeat(count)\n } `}\n </VarDeclaration>\n <Spacing />\n <FunctionDeclaration\n export\n name=\"clear\"\n doc=\"A helper function to clear the console based on a count of lines\"\n parameters={[\n {\n name: \"current\",\n type: \"string\",\n doc: \"The current console output to be cleared\"\n },\n {\n name: \"consoleWidth\",\n type: \"number\",\n doc: \"The number of characters per line in the console\"\n }\n ]}>\n {code`if (!consoleWidth) {\n return erase.line + cursor.to(0);\n }\n\n let rows = 0;\n const lines = current.split(/\\\\r?\\\\n/);\n for (let line of lines) {\n rows += 1 + Math.floor(Math.max([...stripAnsi(line)].length - 1, 0) / consoleWidth);\n }\n\n return erase.lines(rows); `}\n </FunctionDeclaration>\n <Spacing />\n </>\n );\n}\n\ntype ColorFunctionProps = Record<\n \"ansi16\" | \"ansi256\" | \"ansi16m\",\n AnsiColorWrappers\n> & {\n skipBackground?: boolean;\n};\n\n/**\n * A component to generate a console message function in a Shell Shock project.\n */\nfunction ColorFunction({\n ansi16,\n ansi256,\n ansi16m,\n skipBackground = false\n}: ColorFunctionProps) {\n return code` (text: string${\n skipBackground ? \"\" : `, background = false`\n }): string => {\n try {\n if (text === undefined || text === null || text === \"\") {\n return \"\";\n }\n\n if (!isColorSupported) {\n return String(text);\n }\n\n if (colorSupportLevels.stdout === 1) {\n return wrapAnsi(text, ${\n skipBackground\n ? `\"${ansi16.open}\", \"${ansi16.close}\"`\n : `background ? \"${\n ansi16.background.open\n }\" : \"${ansi16.open}\", background ? \"${\n ansi16.background.close\n }\" : \"${ansi16.close}\"`\n });\n } else if (colorSupportLevels.stdout === 2) {\n return wrapAnsi(text, ${\n skipBackground\n ? `\"${ansi256.open}\", \"${ansi256.close}\"`\n : `background ? \"${\n ansi256.background.open\n }\" : \"${ansi256.open}\", background ? \"${\n ansi256.background.close\n }\" : \"${ansi256.close}\"`\n });\n }\n\n return wrapAnsi(text, ${\n skipBackground\n ? `\"${ansi16m.open}\", \"${ansi16m.close}\"`\n : `background ? \"${ansi16m.background.open}\" : \"${\n ansi16m.open\n }\", background ? \"${ansi16m.background.close}\" : \"${ansi16m.close}\"`\n });\n } catch {\n return String(text);\n }\n }\n`;\n}\n\ninterface ThemeColorNode {\n [key: string]: AnsiColorWrappers | ThemeColorNode;\n}\n\ninterface ThemeColorDefinitionProps {\n type: string;\n subType?: string;\n ansi16: ThemeColorNode;\n ansi256: ThemeColorNode;\n ansi16m: ThemeColorNode;\n}\n\nexport function ThemeColorTypeDefinition(props: ThemeColorDefinitionProps) {\n const { ansi16, ansi256, ansi16m, type, subType } = props;\n\n return (\n <For\n each={Object.entries(ansi16)}\n semicolon\n doubleHardline\n enderPunctuation>\n {([color, value]) => (\n <>\n <Show when={isSetObject(value)}>\n <Show\n when={\"open\" in value && \"close\" in value}\n fallback={\n <>\n <TSDoc\n heading={`An object containing various ${\n subType ? `${subType} ` : \"\"\n }${color}${\n type ? ` ${type}` : \"\"\n } theme coloring functions.`}></TSDoc>\n {code` ${camelCase(color)}: { `}\n <hbr />\n <ThemeColorTypeDefinition\n ansi16={ansi16[color] as ThemeColorNode}\n ansi256={ansi256[color] as ThemeColorNode}\n ansi16m={ansi16m[color] as ThemeColorNode}\n type={subType || type}\n subType={color}\n />\n <hbr />\n {code` }`}\n </>\n }>\n <TSDoc\n heading={`A function that applies ${getIndefiniteArticle(color)} ${\n color\n }${type ? ` ${type}` : \"\"}${\n subType ? ` ${subType}` : \"\"\n } color styling to provided console text.`}>\n <TSDocRemarks>\n {`This function takes a string and an optional boolean indicating whether to apply the color as a background. It returns the input string wrapped in the appropriate ANSI escape codes for ${\n color\n }${type ? ` ${type}` : \"\"}${\n subType ? ` ${subType}` : \"\"\n } color styling, based on the terminal's color support level. If colors are not supported, it simply returns the input text as a string.`}\n </TSDocRemarks>\n <hbr />\n <TSDocParam name=\"text\">\n {`The console text to which the ${color}${\n type ? ` ${type}` : \"\"\n }${subType ? ` ${subType}` : \"\"} color styling should be applied.`}\n </TSDocParam>\n <TSDocParam name=\"background\">\n {`A boolean indicating whether to apply the color as a background. Defaults to \\`false\\`.`}\n </TSDocParam>\n <TSDocReturns>\n {`A string with ANSI escape codes applied for ${color}${\n type ? ` ${type}` : \"\"\n }${\n subType ? ` ${subType}` : \"\"\n } color styling, or the original text if the style is not supported in the current terminal.`}\n </TSDocReturns>\n </TSDoc>\n {code`${camelCase(color)}: (text: string, background?: boolean) => string`}\n </Show>\n </Show>\n </>\n )}\n </For>\n );\n}\n\nexport function ThemeColorObjectDefinition(props: ThemeColorDefinitionProps) {\n const { ansi16, ansi256, ansi16m, type, subType } = props;\n\n return (\n <For each={Object.entries(ansi16)} comma doubleHardline enderPunctuation>\n {([color, value]) => (\n <>\n <Show when={isSetObject(value)}>\n <Show\n when={\"open\" in value && \"close\" in value}\n fallback={\n <>\n <TSDoc\n heading={`An object containing various ${\n subType ? `${subType} ` : \"\"\n }${color}${\n type ? ` ${type}` : \"\"\n } theme coloring functions.`}></TSDoc>\n {code` ${camelCase(color)}: { `}\n <hbr />\n <ThemeColorObjectDefinition\n ansi16={ansi16[color] as ThemeColorNode}\n ansi256={ansi256[color] as ThemeColorNode}\n ansi16m={ansi16m[color] as ThemeColorNode}\n type={subType || type}\n subType={color}\n />\n <hbr />\n {code` }`}\n </>\n }>\n <TSDoc\n heading={`A function that applies ${getIndefiniteArticle(color)} ${\n color\n }${type ? ` ${type}` : \"\"}${\n subType ? ` ${subType}` : \"\"\n } color styling to provided console text.`}>\n <TSDocRemarks>\n {`This function takes a string and an optional boolean indicating whether to apply the color as a background. It returns the input string wrapped in the appropriate ANSI escape codes for ${\n color\n }${type ? ` ${type}` : \"\"}${\n subType ? ` ${subType}` : \"\"\n } color styling, based on the terminal's color support level. If colors are not supported, it simply returns the input text as a string.`}\n </TSDocRemarks>\n <hbr />\n <TSDocParam name=\"text\">\n {`The console text to which the ${color}${\n type ? ` ${type}` : \"\"\n }${subType ? ` ${subType}` : \"\"} color styling should be applied.`}\n </TSDocParam>\n <TSDocParam name=\"background\">\n {`A boolean indicating whether to apply the color as a background. Defaults to \\`false\\`.`}\n </TSDocParam>\n <TSDocReturns>\n {`A string with ANSI escape codes applied for ${color}${\n type ? ` ${type}` : \"\"\n }${\n subType ? ` ${subType}` : \"\"\n } color styling, or the original text if the style is not supported in the current terminal.`}\n </TSDocReturns>\n </TSDoc>\n {code`${camelCase(color)}: `}\n <ColorFunction\n ansi16={ansi16[color] as AnsiColorWrappers}\n ansi256={ansi256[color] as AnsiColorWrappers}\n ansi16m={ansi16m[color] as AnsiColorWrappers}\n />\n </Show>\n </Show>\n </>\n )}\n </For>\n );\n}\n\n/**\n * A component to generate an object containing functions for coloring text in a Shell Shock project.\n */\nexport function AnsiStyleFunctionsDeclaration() {\n const colors = useColors();\n\n return (\n <>\n <For each={modifierKeys} semicolon doubleHardline enderPunctuation>\n {modifier => (\n <>\n <TSDoc\n heading={`A function that applies ${\n modifier\n } styling to provided console text.`}>\n <TSDocRemarks>\n {`This function takes a string and an optional boolean indicating whether to apply the color as a background. It returns the input string wrapped in the appropriate ANSI escape codes for the specified color, based on the terminal's color support level. If colors are not supported, it simply returns the input text as a string.`}\n </TSDocRemarks>\n <hbr />\n <TSDocParam name=\"text\">\n {`The console text to which the ${\n modifier\n } styling should be applied.`}\n </TSDocParam>\n <TSDocReturns>\n {`A string with ANSI escape codes applied for ${\n modifier\n } styling, or the original text if the style is not supported in the current terminal.`}\n </TSDocReturns>\n </TSDoc>\n <VarDeclaration\n const\n export\n name={camelCase(modifier)}\n initializer={\n <ColorFunction\n ansi16={\n colors.ansi16[\n modifier as keyof typeof colors.ansi16\n ] as AnsiColorWrappers\n }\n ansi256={\n colors.ansi256[\n modifier as keyof typeof colors.ansi256\n ] as AnsiColorWrappers\n }\n ansi16m={\n colors.ansi16m[\n modifier as keyof typeof colors.ansi16m\n ] as AnsiColorWrappers\n }\n skipBackground={true}\n />\n }\n />\n </>\n )}\n </For>\n <Spacing />\n <For each={colorKeys} semicolon doubleHardline enderPunctuation>\n {color => (\n <>\n <TSDoc\n heading={`A helper function to color the provided text as ${color}.`}>\n <TSDocRemarks>\n {`This function takes a string and an optional boolean indicating whether to apply the color as a background. It returns the input string wrapped in the appropriate ANSI escape codes for the specified color, based on the terminal's color support level. If colors are not supported, it simply returns the input text as a string.`}\n </TSDocRemarks>\n <hbr />\n <TSDocParam name=\"text\">\n {`The console text to which the ${color} color should be applied.`}\n </TSDocParam>\n <TSDocReturns>\n {`A string with ANSI escape codes applied for ${color} color, or the original text if the color is not supported in the current terminal.`}\n </TSDocReturns>\n </TSDoc>\n <VarDeclaration\n const\n export\n name={camelCase(color)}\n initializer={\n <ColorFunction\n ansi16={\n colors.ansi16[\n color as keyof typeof colors.ansi16\n ] as AnsiColorWrappers\n }\n ansi256={\n colors.ansi256[\n color as keyof typeof colors.ansi256\n ] as AnsiColorWrappers\n }\n ansi16m={\n colors.ansi16m[\n color as keyof typeof colors.ansi16m\n ] as AnsiColorWrappers\n }\n />\n }\n />\n </>\n )}\n </For>\n <Spacing />\n\n <For\n each={Object.keys(colors.ansi16.theme)}\n semicolon\n doubleHardline\n enderPunctuation>\n {type => (\n <>\n <TSDoc\n heading={`A nested object containing functions for applying ${\n type\n } theme colors to the console.`}\n />\n <VarDeclaration\n export\n name={`${camelCase(type)}Colors`}\n initializer={\n <>\n {code` {`}\n <hbr />\n <ThemeColorObjectDefinition\n ansi16={\n colors.ansi16.theme[\n type as keyof typeof colors.ansi16.theme\n ]\n }\n ansi256={\n colors.ansi256.theme[\n type as keyof typeof colors.ansi256.theme\n ]\n }\n ansi16m={\n colors.ansi16m.theme[\n type as keyof typeof colors.ansi16m.theme\n ]\n }\n type={type}\n />\n <hbr />\n {code`}`}\n </>\n }\n />\n </>\n )}\n </For>\n <Spacing />\n </>\n );\n}\n\n/**\n * A component to generate the `splitText` function in the `shell-shock:console` builtin module.\n */\nexport function SplitTextFunctionDeclaration() {\n return (\n <>\n <FunctionDeclaration\n name=\"adjustIndex\"\n parameters={[\n {\n name: \"line\",\n type: \"string\"\n },\n {\n name: \"index\",\n type: \"number\"\n }\n ]}\n returnType=\"number\">\n {code`let adjustedIndex = 0;\n\n const segments = line.match(/\\\\x1b\\\\[(\\\\d|;)+m.*\\\\x1b\\\\[(\\\\d|;)+m/gi);\n if (segments && segments.length > 0) {\n segments.reduce((count, matched) => {\n if (count < index) {\n const stripped = stripAnsi(matched);\n if (count + stripped.length < index) {\n count += stripped.length;\n adjustedIndex += matched.length;\n } else {\n adjustedIndex += index - count + (matched.slice(0, index - count).match(/\\\\x1b\\\\[(\\\\d|;)+m/g)?.join(\"\")?.length ?? 0);\n count = index;\n }\n }\n\n return count;\n }, 0);\n } else {\n adjustedIndex = index;\n }\n\n return adjustedIndex - (line.slice(0, adjustedIndex).match(/\\\\x1b\\\\[/g)?.length ?? 0); `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"breakLine\"\n parameters={[\n {\n name: \"line\",\n type: \"string\"\n },\n {\n name: \"index\",\n type: \"number\"\n }\n ]}\n returnType=\"[string, string]\">\n {code`const first = line.slice(0, index);\n const second = line.slice(index);\n\n // Match all ANSI escape sequences in the first string\n const ansiRegex = /[\\\\x1b\\\\u009b][[\\\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]+)*|[a-zA-Z\\\\d]+(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?(?:\\\\u0007))|(?:(?:\\\\d{1,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TZcf-nq-uy=><~]))/g;\n\n const openCodes: string[] = [];\n const closeCodes: string[] = [];\n let match: RegExpExecArray | null;\n\n while ((match = ansiRegex.exec(first)) !== null) {\n const code = match[0];\n // Check if this is a reset/close code (e.g., \\\\x1b[0m, \\\\x1b[39m, \\\\x1b[49m, etc.)\n if (/\\\\x1b\\\\[(?:0|22|23|24|27|28|29|39|49)m/.test(code)) {\n // A close/reset code cancels the last open code\n openCodes.pop();\n closeCodes.pop();\n } else {\n openCodes.push(code);\n // Derive a close code: map SGR open codes to their reset counterparts\n const sgrMatch = code.match(/\\\\x1b\\\\[(\\\\d+)m/);\n if (sgrMatch) {\n const n = parseInt(sgrMatch[1]!, 10);\n let closeCode: string;\n if (n >= 30 && n <= 37) closeCode = \"\\\\x1b[39m\";\n else if (n >= 40 && n <= 47) closeCode = \"\\\\x1b[49m\";\n else if (n >= 90 && n <= 97) closeCode = \"\\\\x1b[39m\";\n else if (n >= 100 && n <= 107) closeCode = \"\\\\x1b[49m\";\n else if (n === 1) closeCode = \"\\\\x1b[22m\";\n else if (n === 2) closeCode = \"\\\\x1b[22m\";\n else if (n === 3) closeCode = \"\\\\x1b[23m\";\n else if (n === 4) closeCode = \"\\\\x1b[24m\";\n else if (n === 7) closeCode = \"\\\\x1b[27m\";\n else if (n === 8) closeCode = \"\\\\x1b[28m\";\n else if (n === 9) closeCode = \"\\\\x1b[29m\";\n else closeCode = \"\\\\x1b[0m\";\n closeCodes.push(closeCode);\n } else {\n closeCodes.push(\"\\\\x1b[0m\");\n }\n }\n }\n\n // Append close codes to the end of \"first\" (in reverse order)\n const closeSequence = closeCodes.slice().reverse().join(\"\");\n // Prepend open codes to the start of \"second\"\n const openSequence = openCodes.join(\"\");\n\n return [first.replace(/^\\\\s+/, \"\").replace(/\\\\s+$/, \"\") + closeSequence, openSequence + second.replace(/^\\\\s+/, \"\").replace(/\\\\s+$/, \"\")]; `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"Split text into multiple lines based on a maximum length.\">\n <TSDocRemarks>\n {`This function splits the provided text into multiple lines based on the specified maximum length, ensuring that words are not broken in the middle.`}\n </TSDocRemarks>\n <hbr />\n <TSDocParam name=\"text\">\n {`The text to split into multiple lines.`}\n </TSDocParam>\n <TSDocParam name=\"maxLength\">\n {`The maximum length of each line.`}\n </TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"splitText\"\n parameters={[\n {\n name: \"text\",\n type: \"string\"\n },\n {\n name: \"maxLength\",\n type: \"number | SizeToken\"\n }\n ]}>\n {code`\n let line = text;\n let result = [] as string[];\n\n const calculatedMaxLength = isSizeToken(maxLength) ? calculateWidth(maxLength) : maxLength;\n while (stripAnsi(line).length > calculatedMaxLength || line.indexOf(\"\\\\n\") !== -1) {\n if (line.indexOf(\"\\\\n\") !== -1) {\n result.push(...splitText(line.slice(0, line.indexOf(\"\\\\n\")).replace(/(\\\\r)?\\\\n/, \"\"), calculatedMaxLength));\n line = line.indexOf(\"\\\\n\") + 1 < line.length\n ? line.slice(line.indexOf(\"\\\\n\") + 1)\n : \"\";\n } else {\n const index = [\" \", \"/\", \".\", \",\", \"-\", \":\", \"|\", \"@\", \"+\"].reduce((ret, split) => {\n let current = ret;\n while (stripAnsi(line).indexOf(split, current + 1) !== -1 && stripAnsi(line).indexOf(split, current + 1) <= calculatedMaxLength) {\n current = line.indexOf(split, adjustIndex(line, current + 1));\n }\n\n return current;\n }, -1);\n if (index === -1) {\n break;\n }\n\n const lines = breakLine(line, index);\n result.push(lines[0]);\n line = lines[1];\n }\n }\n\n while (stripAnsi(line).length > calculatedMaxLength) {\n const lines = breakLine(line, calculatedMaxLength);\n result.push(lines[0]);\n line = lines[1];\n }\n\n result.push(line);\n return result;\n`}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * A component to generate the `write` function in the `shell-shock:console` builtin module.\n */\nexport function WriteFunctionDeclaration() {\n return (\n <>\n <InterfaceDeclaration\n export\n name=\"WriteOptions\"\n doc=\"Options for writing to the console.\">\n <TSDoc heading=\"Console function to use for writing to the console\">\n <TSDocRemarks>\n {`The console function to use for writing to the console. If not specified, the default console function \\`console.log\\` will be used.`}\n </TSDocRemarks>\n <hbr />\n <TSDocDefaultValue\n type={ReflectionKind.method}\n defaultValue={`\\`console.log\\``}\n />\n </TSDoc>\n <InterfaceMember\n name=\"consoleFn\"\n optional\n type=\"(text: string) => void\"\n />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Write to the console.\">\n <TSDocRemarks>\n {`This function writes to the console, applying the appropriate padding as defined in the current theme configuration and wrapping as needed.`}\n </TSDocRemarks>\n <hbr />\n <TSDocParam name=\"text\">\n {`The text to write to the console.`}\n </TSDocParam>\n <TSDocParam name=\"options\">{`The options to apply when writing to the console.`}</TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"write\"\n parameters={[\n {\n name: \"text\",\n type: \"string | number | boolean | null\",\n optional: true\n },\n {\n name: \"options\",\n type: \"WriteOptions\",\n default: \"{}\"\n }\n ]}>\n {code`const consoleFn = options.consoleFn ?? console.log;\n if (text === undefined || text === null || text === \"\") {\n consoleFn(\"\");\n return;\n }\n\n consoleFn(String(text)); `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * A component to generate the `writeLine` function in the `shell-shock:console` builtin module.\n */\nexport function WriteLineFunctionDeclaration() {\n const theme = useTheme();\n\n return (\n <>\n <InterfaceDeclaration\n export\n name=\"WriteLineOptions\"\n doc=\"Options for writing a line to the console.\"\n extends={[\"WriteOptions\"]}>\n <TSDoc heading=\"Padding to apply to the line\">\n <TSDocRemarks>\n {`The amount of padding (in spaces) to apply to the line when writing to the console. This value is applied to both the left and right sides of the line. If not specified, the default padding defined in the current theme configuration will be used.`}\n </TSDocRemarks>\n </TSDoc>\n <InterfaceMember name=\"padding\" optional type=\"number\" />\n <hbr />\n <TSDoc heading=\"Color of the line text\">\n <TSDocRemarks>\n {`The color to apply to the line text when writing to the console. This can be one of the predefined color themes: \"primary\", \"secondary\", or \"tertiary\". If not specified, no specific coloring will be applied to the text (the default/system terminal text color will likely be used).`}\n </TSDocRemarks>\n <hbr />\n </TSDoc>\n <InterfaceMember\n name=\"color\"\n optional\n type='\"primary\" | \"secondary\" | \"tertiary\"'\n />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Write a line to the console.\">\n <TSDocRemarks>\n {`This function writes a line to the console, applying the appropriate padding as defined in the current theme configuration and wrapping as needed.`}\n </TSDocRemarks>\n <hbr />\n <TSDocParam name=\"text\">\n {`The line text to write to the console.`}\n </TSDocParam>\n <TSDocParam name=\"options\">{`The options to apply when writing the line to the console.`}</TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"writeLine\"\n parameters={[\n {\n name: \"text\",\n type: \"string | number | boolean | null\",\n optional: true\n },\n {\n name: \"options\",\n type: \"WriteLineOptions\",\n default: \"{}\"\n }\n ]}>\n {code`const color = options.color;\n if (text === undefined || text === null || text === \"\") {\n write(\"\", options);\n return;\n }\n\n write(\\`\\${\" \".repeat(Math.max(options.padding ?? ${\n theme.padding.app\n }, 0))}\\${color ? textColors.body[color](String(text)) : String(text)}\\`, options); `}\n </FunctionDeclaration>\n </>\n );\n}\n\nexport type MessageFunctionDeclarationProps = Partial<\n Pick<FunctionDeclarationProps, \"parameters\">\n> & {\n type:\n | \"success\"\n | \"help\"\n | \"info\"\n | \"debug\"\n | \"verbose\"\n | \"warn\"\n | \"danger\"\n | \"error\";\n variant: ThemeMessageVariant;\n color?: ThemeMessageVariant;\n consoleFnName: \"log\" | \"info\" | \"warn\" | \"error\" | \"debug\";\n description: string;\n prefix?: Children;\n timestamp?: boolean;\n};\n\n/**\n * A component to generate the message functions in the `shell-shock:console` builtin module.\n */\nexport function MessageFunctionDeclaration(\n props: MessageFunctionDeclarationProps\n) {\n const {\n type,\n variant,\n consoleFnName,\n description,\n prefix,\n parameters,\n timestamp,\n color = variant\n } = props;\n\n const theme = useTheme();\n\n return (\n <>\n <TSDoc\n heading={`Write ${getIndefiniteArticle(\n description\n )} ${description} message to the console.`}>\n <TSDocRemarks>\n {`This function initializes the Powerlines environment configuration object.`}\n </TSDocRemarks>\n <hbr />\n <TSDocParam name=\"message\">\n {`The message to write to the console.`}\n </TSDocParam>\n <TSDocParam name=\"header\">\n {`An optional header to display above the message. If not provided, a default header based on the message type and variant will be used if defined in the theme configuration; otherwise, no header will be displayed.`}\n </TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n name={type}\n parameters={\n parameters ?? [\n {\n name: \"message\",\n type: \"string\",\n optional: false\n },\n {\n name: \"header\",\n type: \"string\",\n optional: true\n }\n ]\n }>\n <Show when={Boolean(prefix)}>\n {prefix}\n <hbr />\n <hbr />\n </Show>\n {code`\n if (!message) {\n return;\n }\n\n ${\n !theme.labels.message.footer[variant] && timestamp\n ? `const timestamp = \\`\\${textColors.message.footer.${\n color\n }(new Date().toLocaleDateString())} \\${borderColors.message.outline.${\n color\n }(\"${\n theme.borderStyles.message.outline[variant].bottom\n }\")} \\${textColors.message.footer.${\n color\n }(new Date().toLocaleTimeString())}\\`; `\n : \"\"\n }\n\n writeLine(borderColors.message.outline.${color}(\"${\n theme.borderStyles.message.outline[variant].topLeft\n }\") + ${\n theme.labels.message.header[variant] ||\n theme.icons.message.header[variant]\n ? `borderColors.message.outline.${color}(\"${\n theme.borderStyles.message.outline[variant].top\n }\".repeat(4)) + \" \" + ${\n theme.icons.message.header[variant]\n ? `borderColors.message.outline.${color}(\"${\n theme.icons.message.header[variant]\n }\") + \" \" +`\n : \"\"\n } bold(textColors.message.header.${color}(header || \"${\n theme.labels.message.header[variant]\n }\")) + \" \" + borderColors.message.outline.${color}(\"${\n theme.borderStyles.message.outline[variant].top\n }\".repeat(Math.max(getTerminalSize().columns - ${\n Math.max(theme.padding.app, 0) * 2 +\n theme.borderStyles.message.outline[variant].topLeft.length +\n 4 +\n (theme.icons.message.header[variant]\n ? 2 + (theme.labels.message.header[variant] ? 0 : 1)\n : 0) +\n (theme.labels.message.header[variant]\n ? theme.labels.message.header[variant].length + 2\n : 0) +\n theme.borderStyles.message.outline[variant].topRight.length\n }, 0)))`\n : `borderColors.message.outline.${color}(\"${\n theme.borderStyles.message.outline[variant].top\n }\".repeat(Math.max(getTerminalSize().columns - ${\n Math.max(theme.padding.app, 0) * 2 +\n theme.borderStyles.message.outline[variant].topLeft.length +\n theme.borderStyles.message.outline[variant].topRight.length\n }, 0)))`\n } + borderColors.message.outline.${color}(\"${\n theme.borderStyles.message.outline[variant].topRight\n }\"), { consoleFn: console.${consoleFnName} });\n splitText(\n message,\n Math.max(getTerminalSize().columns - ${\n (Math.max(theme.padding.app, 0) +\n Math.max(theme.padding.message, 0)) *\n 2 +\n theme.borderStyles.message.outline[variant].left.length +\n theme.borderStyles.message.outline[variant].right.length\n }, 0)\n ).forEach((line) => {\n writeLine(borderColors.message.outline.${color}(\"${\n theme.borderStyles.message.outline[variant].left +\n \" \".repeat(Math.max(theme.padding.message, 0))\n }\") + textColors.message.description.${color}(line) + \" \".repeat(Math.max(getTerminalSize().columns - (stripAnsi(line).length + ${\n Math.max(theme.padding.app, 0) * 2 +\n Math.max(theme.padding.message, 0) +\n theme.borderStyles.message.outline[variant].left.length +\n theme.borderStyles.message.outline[variant].right.length\n }), 0)) + borderColors.message.outline.${color}(\"${\n theme.borderStyles.message.outline[variant].right\n }\"), { consoleFn: console.${consoleFnName} });\n });\n writeLine(borderColors.message.outline.${color}(\"${\n theme.borderStyles.message.outline[variant].bottomLeft\n }\") + ${\n theme.labels.message.footer[variant] || timestamp\n ? `borderColors.message.outline.${color}(\"${\n theme.borderStyles.message.outline[variant].bottom\n }\".repeat(Math.max(getTerminalSize().columns - ${\n Math.max(theme.padding.app, 0) * 2 +\n 4 +\n (theme.labels.message.footer[variant]\n ? theme.labels.message.footer[variant].length + 2\n : 0) +\n theme.borderStyles.message.outline[variant].bottomLeft.length +\n theme.borderStyles.message.outline[variant].bottomRight.length\n }${\n !theme.labels.message.footer[variant] && timestamp\n ? \" - (stripAnsi(timestamp).length + 2)\"\n : \"\"\n }, 0))) + \" \" + ${`bold(textColors.message.footer.${color}(${\n theme.labels.message.footer[variant]\n ? `\"${theme.labels.message.footer[variant]}\"`\n : timestamp && \"timestamp\"\n }))`} + \" \" + borderColors.message.outline.${color}(\"${\n theme.borderStyles.message.outline[variant].bottom\n }\".repeat(4))`\n : `borderColors.message.outline.${color}(\"${\n theme.borderStyles.message.outline[variant].bottom\n }\".repeat(Math.max(getTerminalSize().columns - ${\n Math.max(theme.padding.app, 0) * 2 +\n theme.borderStyles.message.outline[variant].bottomLeft.length +\n theme.borderStyles.message.outline[variant].bottomRight.length\n }, 0)))`\n } + borderColors.message.outline.${color}(\"${\n theme.borderStyles.message.outline[variant].bottomRight\n }\"), { consoleFn: console.${consoleFnName} });\n`}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * A component to generate the `wrapAnsi` function in the `shell-shock:console` builtin module.\n */\nexport function WrapAnsiFunction() {\n return (\n <>\n <TSDoc heading=\"Applies ANSI escape codes to a string.\">\n <TSDocRemarks>\n {`Split text by /\\\\\\\\x1b[\\\\[|\\\\]][0-9;]*m/ and wrap non-ANSI parts with open/closing tags.`}\n </TSDocRemarks>\n\n <TSDocExample>\n {`const result = wrapAnsi(\"Hello\\\\\\\\x1b[31mWorld\\\\\\\\x1b[0mAgain\", \"\\\\\\\\x1b[36m\", \"\\\\\\\\x1b[39\");\\nconsole.log(result); // \"\\\\\\\\x1b[36mHello\\\\\\\\x1b[39\\\\\\\\x1b[31mWorld\\\\\\\\x1b[0m\\\\\\\\x1b[36mAgain\\\\\\\\x1b[39\"`}\n </TSDocExample>\n\n <TSDocParam name=\"text\">\n {`The text to apply ANSI codes to.`}\n </TSDocParam>\n <TSDocParam name=\"open\">{`The opening ANSI code.`}</TSDocParam>\n <TSDocParam name=\"close\">{`The closing ANSI code.`}</TSDocParam>\n <TSDocReturns>{`The text with ANSI codes applied.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n name=\"wrapAnsi\"\n parameters={[\n {\n name: \"text\",\n type: \"string | number\",\n optional: false\n },\n {\n name: \"open\",\n type: \"string\",\n optional: false\n },\n { name: \"close\", type: \"string\", optional: false }\n ]}>\n {code`const str = String(text);\n const tokens = [] as string[];\n\n let last = 0;\n let match: RegExpExecArray | null;\n while ((match = /\\\\\\\\x1b[\\\\[|\\\\]][0-9;]*m/g.exec(str)) !== null) {\n if (match.index > last) tokens.push(str.slice(last, match.index));\n tokens.push(match[0]);\n last = match.index + match[0].length;\n }\n\n if (last < str.length) {\n tokens.push(str.slice(last));\n }\n\n let result = \"\";\n for (let i = 0; i < tokens.length; i++) {\n const seg = tokens[i]!;\n if (/^\\\\\\\\x1b[\\\\[|\\\\]][0-9;]*m$/.test(seg)) {\n result += seg;\n continue;\n }\n\n if (!seg) {\n continue;\n }\n\n result += i > 0 && /^\\\\\\\\x1b[\\\\[|\\\\]][0-9;]*m$/.test(tokens[i - 1]!) && i + 1 < tokens.length && /^\\\\\\\\x1b[\\\\[|\\\\]][0-9;]*m$/.test(tokens[i + 1]!)\n ? seg\n : \\`\\${open}\\${seg}\\${close}\\`;\n }\n\n return result;\n`}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * A component to generate the `stripAnsi` function in the `shell-shock:console` builtin module.\n */\nexport function StripAnsiFunctionDeclaration() {\n return (\n <>\n <TSDoc heading=\"Removes ANSI escape codes from a string.\">\n <TSDocExample>\n {`const result = stripAnsi(\"Hello\\\\\\\\x1b[31mWorld\\\\\\\\x1b[0mAgain\"); // \"HelloWorldAgain\"`}\n </TSDocExample>\n\n <TSDocParam name=\"text\">\n {`The text to strip ANSI codes from.`}\n </TSDocParam>\n <TSDocReturns>{`The text with ANSI codes removed.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"stripAnsi\"\n parameters={[\n {\n name: \"text\",\n type: \"string | number\",\n optional: false\n }\n ]}>\n {code`return String(text).replace(new RegExp([\n String.raw\\`[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]+)*|[a-zA-Z\\\\d]+(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?\\\\u0007)\\`,\n String.raw\\`(?:(?:\\\\d{1,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TZcf-nq-uy=><~]))\\`\n ].join(\"|\"), \"g\"), \"\");`}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * A component to generate the `stripAnsi` function in the `shell-shock:console` builtin module.\n */\nexport function DividerFunctionDeclaration() {\n const theme = useTheme();\n\n return (\n <>\n <InterfaceDeclaration\n export\n name=\"DividerOptions\"\n doc=\"Options for formatting the divider line written to console.\">\n <InterfaceMember\n name=\"width\"\n optional\n type=\"number\"\n doc=\"The width of the divider line. If not specified, the divider will span the full width of the console, minus the padding.\"\n />\n <hbr />\n <TSDoc heading=\"The border of the divider line. Can be 'primary', 'secondary', 'tertiary', or 'none'. If not specified, the default border style will be used.\">\n <TSDocRemarks>\n {`The value provided will determine the border style and color based on the current theme configuration.`}\n </TSDocRemarks>\n <TSDocDefaultValue\n type={ReflectionKind.string}\n defaultValue=\"primary\"\n />\n </TSDoc>\n <InterfaceMember\n name=\"border\"\n optional\n type='\"primary\" | \"secondary\" | \"tertiary\"'\n doc=\"The border style/color of the divider line. Can be 'primary', 'secondary', 'tertiary', or 'none'. If not specified, the default border style will be used.\"\n />\n <hbr />\n <TSDoc heading=\"Padding to apply to the line\">\n <TSDocRemarks>\n {`The amount of padding (in spaces) to apply to the line when writing to the console. This value is applied to both the left and right sides of the line. If not specified, the default padding defined in the current theme configuration will be used.`}\n </TSDocRemarks>\n <TSDocDefaultValue\n type={ReflectionKind.number}\n defaultValue={theme.padding.app * 4}\n />\n </TSDoc>\n <InterfaceMember name=\"padding\" optional type=\"number\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Write a horizontal divider line to the console.\">\n <TSDocExample>\n {`divider({ width: 50, border: \"primary\" }); // Writes a horizontal divider line of width 50 with primary border.`}\n </TSDocExample>\n <TSDocParam name=\"options\">\n {`Options for formatting the divider line.`}\n </TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"divider\"\n parameters={[\n {\n name: \"options\",\n type: \"DividerOptions\",\n optional: false\n }\n ]}>\n {code`const padding = options.padding ?? ${Math.max(theme.padding.app, 1) * 4};\n const width = options.width ?? (getTerminalSize().columns - (Math.max(padding, 0) * 2));\n const border = options.border === \"tertiary\" ? borderColors.app.divider.tertiary(\"${\n theme.borderStyles.app.divider.tertiary.top\n }\") : options.border === \"secondary\" ? borderColors.app.divider.secondary(\"${\n theme.borderStyles.app.divider.secondary.top\n }\") : borderColors.app.divider.primary(\"${\n theme.borderStyles.app.divider.primary.top\n }\");\n\n writeLine(\" \".repeat(Math.max(padding - ${theme.padding.app}, 0)) + border.repeat(Math.max(width / ${\n theme.borderStyles.app.divider.primary.top.length ?? 1\n }, 0)));\n `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * A component to generate the `link` function in the `shell-shock:console` builtin module.\n */\nexport function LinkFunctionDeclaration() {\n const theme = useTheme();\n\n return (\n <>\n <TSDoc heading=\"Render a hyperlink in the console.\">\n <TSDocParam name=\"url\">\n {`The URL to render as a hyperlink.`}\n </TSDocParam>\n <TSDocParam name=\"textOrExternal\">\n {`The text to display for the link or a boolean indicating whether the link is external. If no text is provided, the URL will be used as the text. If a boolean is provided and is true, the URL will be used as the text and the link will be rendered as an external link.`}\n </TSDocParam>\n <TSDocParam name=\"external\">\n {`A boolean indicating whether the link is external. If true, the link will be rendered as an external link.`}\n </TSDocParam>\n <TSDocReturns>{`The formatted hyperlink string.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"link\"\n parameters={[\n {\n name: \"url\",\n type: \"string\",\n optional: false\n },\n { name: \"textOrExternal\", type: \"string | boolean\", optional: true },\n { name: \"external\", type: \"boolean\", optional: true }\n ]}>\n <IfStatement condition={code`isHyperlinkSupported()`}>\n {code`return \\`\\\\x1b]8;;\\${url}\\\\u0007\\${typeof textOrExternal === \"string\" && textOrExternal ? textOrExternal : url}\\\\x1b]8;;\\\\u0007\\${external === true || textOrExternal === true ? \"${\n theme.icons.link.external\n }\" : \"\"}\\`;`}\n </IfStatement>\n <hbr />\n <IfStatement condition={code`isColorSupported`}>\n {code`return \\`\\${underline(textColors.body.link(\\`\\${url}\\`))}\\${external === true || textOrExternal === true ? \"${\n theme.icons.link.external\n }\" : \"\"}\\`;`}\n </IfStatement>\n <hbr />\n {code`return \\`\\${url}\\${external === true || textOrExternal === true ? \"${\n theme.icons.link.external\n }\" : \"\"}\\`;`}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * A component to generate the `blockquote` function declaration\n */\nexport function BlockquoteFunctionDeclaration() {\n return (\n <>\n <Spacing />\n <TSDoc\n heading={`Format a string with blockquote styling for display in console.`}>\n <TSDocParam name=\"text\">\n {`The text to format with blockquote styling.`}\n </TSDocParam>\n <TSDocReturns>{`The formatted string with blockquote styling.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"blockquote\"\n parameters={[\n {\n name: \"text\",\n type: \"string | number | boolean | null\",\n optional: true\n }\n ]}\n returnType=\"string\">\n {code`if (text === undefined || text === null || text === \"\") {\n return \"\";\n }\n\n const lines = splitText(\n String(text),\n Math.max(getTerminalSize().columns, 20) - 6\n );\n\n return lines.map((line, index) => \\` \\${index === 0 ? isUnicodeSupported() ? \"❝\" : \"\\\\\"\" : \" \"} \\${italic(line)} \\${index === lines.length - 1 ? isUnicodeSupported() ? \"❞\" : \"\\\\\"\" : \" \"} \\`).join(\"\\\\n\"); `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * A component to generate the `code` function declaration\n */\nexport function CodeFunctionDeclaration() {\n const theme = useTheme();\n\n return (\n <>\n <Spacing />\n <TSDoc heading={`Format a source code string for display in console.`}>\n <TSDocParam name=\"text\">\n {`The source code text to format with code styling.`}\n </TSDocParam>\n <TSDocReturns>{`The formatted string with code styling.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"code\"\n parameters={[\n {\n name: \"text\",\n type: \"string | number | boolean | null\",\n optional: true\n },\n {\n name: \"language\",\n type: \"string\",\n optional: true\n }\n ]}\n returnType=\"string\">\n {code`if (text === undefined || text === null || text === \"\") {\n return \"\";\n }\n\n return \\` \\${borderColors.app.divider.primary(\"${\n theme.borderStyles.app.divider.primary.top\n }\".repeat(4))}\\${language ? \\` \\${borderColors.app.divider.primary(language)} \\` : \"\"}\\${borderColors.app.divider.primary(\"${\n theme.borderStyles.app.divider.primary.top\n }\".repeat(getTerminalSize().columns - (language ? language.length + 2 : 0) - 5))} \\\\n\\${splitText(\n String(text),\n Math.max(getTerminalSize().columns, 20)\n ).map(line => \\`\\${textColors.body.primary(line)}\\`).join(\"\\\\n\")}\\\\n \\${borderColors.app.divider.primary(\"${\n theme.borderStyles.app.divider.primary.bottom\n }\".repeat(getTerminalSize().columns - 2))} \\`; `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * A component to generate the `inlineCode` function declaration\n */\nexport function InlineCodeFunctionDeclaration() {\n return (\n <>\n <Spacing />\n <TSDoc\n heading={`Format a string with inline code styling for display in console.`}>\n <TSDocParam name=\"text\">\n {`The text to format with inline code styling.`}\n </TSDocParam>\n <TSDocReturns>{`The formatted string with inline code styling.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"inlineCode\"\n parameters={[\n {\n name: \"text\",\n type: \"string | number | boolean | null\",\n optional: true\n }\n ]}\n returnType=\"string\">\n {code`if (text === undefined || text === null || text === \"\") {\n return \"\";\n }\n\n return textColors.body.primary(inverse(\\` \\${text} \\`), true); `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * A component to generate the `spinner` function in the `shell-shock:console` builtin module.\n */\nexport function SpinnerFunctionDeclaration() {\n const theme = useTheme();\n\n return (\n <>\n <TypeDeclaration name=\"WriteStream\">\n {`NodeJS.WriteStream;`}\n </TypeDeclaration>\n <Spacing />\n <VarDeclaration\n const\n name=\"activeHooksPerStream\"\n initializer=\"new Set();\"\n />\n <Spacing />\n <InterfaceDeclaration\n export\n name=\"SpinnerOptions\"\n doc=\"Options for configuring the spinner.\">\n <InterfaceMember\n name=\"message\"\n optional\n type=\"string\"\n doc=\"The message text to display next to the spinner. Defaults to an empty string.\"\n />\n <hbr />\n <InterfaceMember\n name=\"stream\"\n optional\n type=\"WriteStream\"\n doc=\"The output stream to write the spinner to. Defaults to process.stderr.\"\n />\n <hbr />\n <InterfaceMember\n name=\"spinner\"\n optional\n type=\"ThemeSpinnerResolvedConfig | SpinnerPreset\"\n doc=\"The spinner animation to use. Should be an object with a 'frames' property (an array of strings representing each frame of the animation) and an 'interval' property (the time in milliseconds between each frame). If not specified, a default spinner animation will be used.\"\n />\n </InterfaceDeclaration>\n\n <Spacing />\n <ClassDeclaration name=\"Spinner\">\n <ClassField name=\"frames\" isPrivateMember type=\"string[]\" />\n <hbr />\n <ClassField name=\"interval\" isPrivateMember type=\"number\" />\n <hbr />\n <ClassField name=\"currentFrame\" isPrivateMember type=\"number\">\n {code`-1`}\n </ClassField>\n <hbr />\n <ClassField\n name=\"timer\"\n isPrivateMember\n optional\n type=\"NodeJS.Timeout\"\n />\n <hbr />\n <ClassField name=\"message\" isPrivateMember type=\"string\">\n {code`\"\"`}\n </ClassField>\n <hbr />\n <ClassField name=\"stream\" isPrivateMember type=\"WriteStream\">\n {code`process.stderr`}\n </ClassField>\n <hbr />\n <ClassField name=\"lines\" isPrivateMember type=\"number\">\n {code`0`}\n </ClassField>\n <hbr />\n <ClassField\n name=\"exitHandlerBound\"\n isPrivateMember\n type=\"(signal: any) => void\">\n {code`() => {}`}\n </ClassField>\n <hbr />\n <ClassField name=\"lastSpinnerFrameTime\" isPrivateMember type=\"number\">\n {code`0`}\n </ClassField>\n <hbr />\n <ClassField name=\"isSpinning\" isPrivateMember type=\"boolean\">\n {code`false`}\n </ClassField>\n <hbr />\n <ClassField\n name=\"hookedStreams\"\n isPrivateMember\n type='Map<WriteStream, { write?: WriteStream[\"write\"]; originalWrite: WriteStream[\"write\"]; hookedWrite: WriteStream[\"write\"] }>'>\n {code`new Map()`}\n </ClassField>\n <hbr />\n <ClassField name=\"isInternalWrite\" isPrivateMember type=\"boolean\">\n {code`false`}\n </ClassField>\n <hbr />\n <ClassField name=\"isDeferringRender\" isPrivateMember type=\"boolean\">\n {code`false`}\n </ClassField>\n <Spacing />\n {code`constructor(options: SpinnerOptions = {}) {\n const spinner = (typeof options.spinner === \"string\" ? resolveSpinner(options.spinner as SpinnerPreset) : options.spinner) ?? ${JSON.stringify(\n theme.spinner\n )};\n this.#frames = spinner.frames;\n this.#interval = spinner.interval;\n\n if (options.message) {\n this.#message = options.message;\n }\n if (options.stream) {\n this.#stream = options.stream;\n }\n\n this.#exitHandlerBound = this.#exitHandler.bind(this);\n }\n\n #internalWrite(action: () => unknown) {\n this.#isInternalWrite = true;\n try {\n return action();\n } finally {\n this.#isInternalWrite = false;\n }\n }\n\n #stringifyChunk(chunk: string | Uint8Array<ArrayBufferLike> | ArrayBufferLike) {\n if (chunk === undefined || chunk === null) {\n return \"\";\n }\n\n if (typeof chunk === \"string\") {\n return chunk;\n }\n\n if (Buffer.isBuffer(chunk) || ArrayBuffer.isView(chunk)) {\n return Buffer.from(chunk).toString(\"utf8\");\n }\n\n return String(chunk);\n }\n\n #withSynchronizedOutput(action: () => unknown) {\n if (!isInteractive) {\n return action();\n }\n\n try {\n this.#write(\"\\\\u001B[?2026h\");\n return action();\n } finally {\n this.#write(\"\\\\u001B[?2026l\");\n }\n }\n\n #hookStream(stream: WriteStream) {\n if (!stream || this.#hookedStreams.has(stream) || typeof stream.write !== \"function\") {\n return;\n }\n\n if (activeHooksPerStream.has(stream)) {\n return;\n }\n\n const originalWrite = stream.write;\n const hookedWrite = ((...writeArguments: Parameters<WriteStream[\"write\"]>) => this.#hookedWrite(stream, originalWrite, writeArguments)) as WriteStream[\"write\"];\n\n this.#hookedStreams.set(stream, {originalWrite, hookedWrite});\n activeHooksPerStream.add(stream);\n stream.write = hookedWrite;\n }\n\n #installHook() {\n if (!isInteractive || this.#hookedStreams.size > 0) {\n return;\n }\n\n const streamsToHook = new Set([this.#stream]);\n if (isInteractive && (this.#stream === process.stdout || this.#stream === process.stderr)) {\n streamsToHook.add(process.stdout);\n streamsToHook.add(process.stderr);\n }\n\n for (const stream of streamsToHook) {\n this.#hookStream(stream);\n }\n }\n\n #uninstallHook() {\n for (const [stream, hookInfo] of this.#hookedStreams) {\n if (stream.write === hookInfo.hookedWrite) {\n stream.write = hookInfo.originalWrite;\n }\n\n activeHooksPerStream.delete(stream);\n }\n\n this.#hookedStreams.clear();\n }\n\n #hookedWrite(stream: WriteStream, originalWrite: typeof stream.write, writeArguments: Parameters<typeof stream.write>) {\n const [chunk, callback] = writeArguments;\n\n if (this.#isInternalWrite || !this.isSpinning) {\n return originalWrite.call(stream, chunk);\n }\n\n if (this.#lines > 0) {\n this.clear();\n }\n\n const chunkString = this.#stringifyChunk(chunk);\n const chunkTerminatesLine = chunkString.at(-1) === \"\\\\n\";\n const writeResult = originalWrite.call(stream, chunk);\n\n if (chunkTerminatesLine) {\n this.#isDeferringRender = false;\n } else if (chunkString !== \"\") {\n this.#isDeferringRender = true;\n }\n\n if (this.isSpinning && !this.#isDeferringRender) {\n this.#render();\n }\n\n return writeResult;\n }\n\n #stopWithIcon(icon: string, message: string) {\n return this.stop(\\` \\${icon} \\${message ?? this.#message}\\`);\n }\n\n #render() {\n if (this.#isDeferringRender) {\n return;\n }\n\n if (this.#currentFrame === -1 || Date.now() - this.#lastSpinnerFrameTime >= this.#interval) {\n this.#currentFrame = ++this.#currentFrame % this.#frames.length;\n this.#lastSpinnerFrameTime = Date.now();\n }\n\n let display = \\`\\${textColors.spinner.icon.active(this.#frames[this.#currentFrame])} \\${textColors.spinner.message.active(this.#message)}\\`;\n if (!isInteractive) {\n display += \"\\\\n\";\n }\n\n if (isInteractive) {\n this.#withSynchronizedOutput(() => {\n this.clear();\n this.#write(display);\n });\n } else {\n this.#write(display);\n }\n\n if (isInteractive) {\n this.#lines = this.#lineCount(display);\n }\n }\n\n #write(message: string) {\n this.#internalWrite(() => {\n this.#stream.write(message);\n });\n }\n\n #lineCount(message: string) {\n const width = this.#stream.columns ?? 80;\n const lines = stripVTControlCharacters(message).split(\"\\\\n\");\n\n let lineCount = 0;\n for (const line of lines) {\n lineCount += Math.max(1, Math.ceil(line.length / width));\n }\n\n return lineCount;\n }\n\n #hideCursor() {\n if (isInteractive) {\n this.#write(\"\\\\u001B[?25l\");\n }\n }\n\n #showCursor() {\n if (isInteractive) {\n this.#write(\"\\\\u001B[?25h\");\n }\n }\n\n #subscribeToProcessEvents() {\n process.once(\"SIGINT\", this.#exitHandlerBound);\n process.once(\"SIGTERM\", this.#exitHandlerBound);\n }\n\n #unsubscribeFromProcessEvents() {\n process.off(\"SIGINT\", this.#exitHandlerBound);\n process.off(\"SIGTERM\", this.#exitHandlerBound);\n }\n\n #exitHandler(signal: any) {\n if (this.isSpinning) {\n this.stop();\n }\n\n process.exit(signal === \"SIGINT\" ? 130 : (signal === \"SIGTERM\" ? 143 : 1));\n } `}\n <ClassPropertyGet\n public\n name=\"isSpinning\"\n type=\"boolean\"\n doc=\"Whether the spinner is currently active and spinning.\">\n {code`return this.#isSpinning;`}\n </ClassPropertyGet>\n <Spacing />\n <ClassPropertySet\n public\n name=\"message\"\n type=\"string\"\n doc=\"Set the message displayed by the spinner.\">\n {code`this.#message = value;`}\n </ClassPropertySet>\n <Spacing />\n <ClassPropertyGet\n public\n name=\"message\"\n type=\"string\"\n doc=\"Get the message displayed by the spinner.\">\n {code`return this.#message;`}\n </ClassPropertyGet>\n <Spacing />\n <ClassMethod\n name=\"start\"\n doc=\"Start the spinner animation.\"\n parameters={[{ name: \"message\", type: \"string\" }]}>\n <IfStatement condition={code`message !== undefined`}>\n {code`this.#message = message;`}\n </IfStatement>\n <IfStatement condition={code`this.isSpinning`}>\n {code`return this;`}\n </IfStatement>\n {code`this.#isSpinning = true;\n this.#hideCursor();\n this.#installHook();\n this.#render();\n this.#subscribeToProcessEvents();\n\n if (isInteractive) {\n this.#timer = setInterval(() => {\n this.#render();\n }, this.#interval);\n }\n\n return this;\n `}\n </ClassMethod>\n <Spacing />\n <ClassMethod\n name=\"stop\"\n doc=\"Stop the spinner animation.\"\n parameters={[\n { name: \"finalMessage\", optional: true, type: \"string\" }\n ]}>\n {code`if (!this.isSpinning) {\n return this;\n }\n\n const shouldWriteNewline = this.#isDeferringRender;\n this.#isSpinning = false;\n if (this.#timer) {\n clearInterval(this.#timer);\n this.#timer = undefined;\n }\n\n this.#isDeferringRender = false;\n this.#uninstallHook();\n this.#showCursor();\n this.clear();\n this.#unsubscribeFromProcessEvents();\n\n if (finalMessage) {\n const prefix = shouldWriteNewline ? \"\\\\n\" : \"\";\n this.#stream.write(\\`\\${prefix}\\${finalMessage}\\\\n\\`);\n }\n\n return this;\n\n `}\n </ClassMethod>\n <Spacing />\n <ClassMethod name=\"clear\" doc=\"Clear the spinner animation.\">\n {code`if (!isInteractive) {\n return this;\n }\n\n if (this.#lines === 0) {\n return this;\n }\n\n this.#internalWrite(() => {\n this.#stream.cursorTo(0);\n\n for (let index = 0; index < this.#lines; index++) {\n if (index > 0) {\n this.#stream.moveCursor(0, -1);\n }\n\n this.#stream.clearLine(1);\n }\n });\n\n this.#lines = 0;\n return this; `}\n </ClassMethod>\n <Spacing />\n <ClassMethod\n name=\"success\"\n doc=\"Mark the spinner as successful.\"\n parameters={[{ name: \"message\", type: \"string\" }]}>\n {code`return this.#stopWithIcon(textColors.spinner.icon.success(\"${\n theme.icons.spinner.success\n }\"), textColors.spinner.message.success(message)); `}\n </ClassMethod>\n <Spacing />\n <ClassMethod\n name=\"error\"\n doc=\"Mark the spinner as failed.\"\n parameters={[{ name: \"message\", type: \"string\" }]}>\n {code`return this.#stopWithIcon(textColors.spinner.icon.error(\"${\n theme.icons.spinner.error\n }\"), textColors.spinner.message.error(message)); `}\n </ClassMethod>\n <Spacing />\n <ClassMethod\n name=\"warning\"\n doc=\"Mark the spinner as warning.\"\n parameters={[{ name: \"message\", type: \"string\" }]}>\n {code`return this.#stopWithIcon(textColors.spinner.icon.warning(\"${\n theme.icons.spinner.warning\n }\"), textColors.spinner.message.warning(message)); `}\n </ClassMethod>\n <Spacing />\n <ClassMethod\n name=\"info\"\n doc=\"Mark the spinner as informational.\"\n parameters={[{ name: \"message\", type: \"string\" }]}>\n {code`return this.#stopWithIcon(textColors.spinner.icon.info(\"${\n theme.icons.spinner.info\n }\"), textColors.spinner.message.info(message)); `}\n </ClassMethod>\n <Spacing />\n <ClassMethod\n name=\"help\"\n doc=\"Mark the spinner as help.\"\n parameters={[{ name: \"message\", type: \"string\" }]}>\n {code`return this.#stopWithIcon(textColors.spinner.icon.help(\"${\n theme.icons.spinner.help\n }\"), textColors.spinner.message.help(message)); `}\n </ClassMethod>\n <Spacing />\n </ClassDeclaration>\n <Spacing />\n <TSDoc heading=\"Render a spinner in the console.\">\n <TSDocParam name=\"options\">\n {`Options for configuring the spinner, including the message to display, the output stream to write to, and the spinner animation to use.`}\n </TSDocParam>\n <TSDocReturns>{`An instance of the Spinner class, which can be used to control the spinner animation (e.g., start, stop, mark as success/error, etc.).`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"createSpinner\"\n parameters={[\n {\n name: \"options\",\n type: \"SpinnerOptions\",\n optional: true\n }\n ]}>\n {code`return new Spinner(options);`}\n </FunctionDeclaration>\n </>\n );\n}\n\nfunction extractBorderOptionsObject(\n direction:\n | \"top\"\n | \"right\"\n | \"bottom\"\n | \"left\"\n | \"topLeft\"\n | \"topRight\"\n | \"bottomLeft\"\n | \"bottomRight\",\n theme: ThemeResolvedConfig\n): string {\n return `borderOptions.${\n direction\n } === \"primary\" ? borderColors.app.table.primary(\"${\n theme.borderStyles.app.table.primary[direction]\n }\") : borderOptions.${\n direction\n } === \"secondary\" ? borderColors.app.table.secondary(\"${\n theme.borderStyles.app.table.secondary[direction]\n }\") : borderOptions.${\n direction\n } === \"tertiary\" ? borderColors.app.table.tertiary(\"${\n theme.borderStyles.app.table.tertiary[direction]\n }\") : !borderOptions.${direction} || borderOptions.${\n direction\n } === \"none\" ? \"\" : borderOptions.${direction}`;\n}\n\nfunction extractBorderOptionsString(\n direction:\n | \"top\"\n | \"right\"\n | \"bottom\"\n | \"left\"\n | \"topLeft\"\n | \"topRight\"\n | \"bottomLeft\"\n | \"bottomRight\",\n theme: ThemeResolvedConfig\n): string {\n return `borderOptions === \"primary\" ? borderColors.app.table.primary(\"${\n theme.borderStyles.app.table.primary[direction]\n }\") : borderOptions === \"secondary\" ? borderColors.app.table.secondary(\"${\n theme.borderStyles.app.table.secondary[direction]\n }\") : borderOptions === \"tertiary\" ? borderColors.app.table.tertiary(\"${\n theme.borderStyles.app.table.tertiary[direction]\n }\") : !borderOptions || borderOptions === \"none\" ? \"\" : borderOptions`;\n}\n\n/**\n * Props for the TableFunctionDeclaration component.\n */\nexport type TableFunctionDeclarationProps = Omit<\n FunctionDeclarationProps,\n \"parameters\" | \"name\"\n>;\n\n/**\n * A component to generate the table functions in the `shell-shock:console` builtin module.\n */\nexport function TableFunctionDeclaration(props: TableFunctionDeclarationProps) {\n const theme = useTheme();\n\n return (\n <>\n <TypeDeclaration\n export\n name=\"SizeToken\"\n doc=\"A type representing the width size of an item in the console.\">\n {code`\"full\" | \"1/1\" | \"1/2\" | \"1/3\" | \"1/4\" | \"1/5\" | \"1/6\" | \"1/12\" | \"1/24\" | \"100%\" | \"50%\" | \"33.33%\" | \"25%\" | \"20%\" | \"10%\" | \"5%\" | \"2.5%\"`}\n </TypeDeclaration>\n <Spacing />\n <TSDoc heading=\"Determine if a value is a valid size token.\">\n <TSDocRemarks>\n {`This function checks if the provided value is a valid size token, which can be one of the predefined strings representing common width sizes (e.g., \"full\", \"1/2\", \"1/3\", etc.) or percentage strings (e.g., \"50%\").`}\n </TSDocRemarks>\n <TSDocParam name=\"value\">{`The value to check for being a valid size token.`}</TSDocParam>\n <TSDocReturns>{`True if the value is a valid size token, false otherwise.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n doc=\"Determines if the provided value is a valid size token.\"\n name=\"isSizeToken\"\n parameters={[\n {\n name: \"value\",\n type: \"any\"\n }\n ]}\n returnType=\"value is SizeToken\">\n <IfStatement\n condition={code`[\"full\", \"1/1\", \"1/2\", \"1/3\", \"1/4\", \"1/5\", \"1/6\", \"1/12\", \"1/24\", \"100%\", \"50%\", \"33.33%\", \"25%\", \"20%\", \"10%\", \"5%\", \"2.5%\"].includes(value)`}>\n {code`return true; `}\n </IfStatement>\n {code`return false; `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"Calculate the width in characters based on the provided width size.\">\n <TSDocRemarks>\n {`This function calculates the width in characters based on the provided width size, which can be a predefined string (e.g., \"full\", \"1/2\", \"1/3\", etc.) or a percentage string (e.g., \"50%\"). The calculation is based on the current width of the console (getTerminalSize().columns).`}\n </TSDocRemarks>\n <TSDocParam name=\"size\">\n {`The width size to calculate. This can be a predefined string (e.g., \"full\", \"1/2\", \"1/3\", etc.) or a percentage string (e.g., \"50%\").`}\n </TSDocParam>\n <TSDocReturns>{`The calculated width in characters.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"calculateWidth\"\n parameters={[\n {\n name: \"size\",\n type: \"SizeToken\",\n optional: false\n }\n ]}\n returnType=\"number\">\n <IfStatement condition={code`[\"full\", \"100%\", \"1/1\"]. includes(size)`}>\n {code`return getTerminalSize().columns;`}\n </IfStatement>\n <ElseIfClause condition={code`[\"1/2\", \"50%\"].includes(size)`}>\n {code`return Math.round(getTerminalSize().columns / 2);`}\n </ElseIfClause>\n <ElseIfClause condition={code`[\"1/3\", \"33.33%\"].includes(size)`}>\n {code`return Math.round(getTerminalSize().columns / 3);`}\n </ElseIfClause>\n <ElseIfClause condition={code`[\"1/4\", \"25%\"].includes(size)`}>\n {code`return Math.round(getTerminalSize().columns / 4);`}\n </ElseIfClause>\n <ElseIfClause condition={code`[\"1/5\", \"20%\"].includes(size)`}>\n {code`return Math.round(getTerminalSize().columns / 5);`}\n </ElseIfClause>\n <ElseIfClause condition={code`[\"1/6\", \"10%\"].includes(size)`}>\n {code`return Math.round(getTerminalSize().columns / 6);`}\n </ElseIfClause>\n <ElseIfClause condition={code`[\"1/12\", \"5%\"].includes(size)`}>\n {code`return Math.round(getTerminalSize().columns / 12);`}\n </ElseIfClause>\n <ElseIfClause condition={code`[\"1/24\", \"2.5%\"].includes(size)`}>\n {code`return Math.round(getTerminalSize().columns / 24);`}\n </ElseIfClause>\n <ElseClause>\n {code`\n const match = size.match(/(\\\\d+(\\\\.\\\\d+)?)%/);\n if (match) {\n return Math.round((getTerminalSize().columns * parseFloat(match[1])) / 100);\n }\n\n throw new Error(\\`Invalid width size: \\${size}\\`);\n `}\n </ElseClause>\n <Spacing />\n </FunctionDeclaration>\n\n <TypeDeclaration\n export\n name=\"BorderOption\"\n doc=\"The border options applied to table cells.\">\n {code`\"primary\" | \"secondary\" | \"tertiary\" | \"none\" | string; `}\n </TypeDeclaration>\n <Spacing />\n <InterfaceDeclaration\n export\n name=\"TableOutputOptions\"\n doc=\"Options to customize the output of the {@link table} function.\">\n <TSDoc heading=\"Border variant for the table cell.\">\n <TSDocRemarks>\n {`The border variant to use for the table cell. This determines the color and style of the border around the cell.`}\n </TSDocRemarks>\n <hbr />\n <TSDocDefaultValue\n type={ReflectionKind.property}\n defaultValue=\"primary\"\n />\n </TSDoc>\n <InterfaceMember\n name=\"border\"\n optional\n type=\"BorderOption | { top?: BorderOption; right?: BorderOption; bottom?: BorderOption; left?: BorderOption; topLeft?: BorderOption; topRight?: BorderOption; bottomLeft?: BorderOption; bottomRight?: BorderOption; }\"\n />\n <hbr />\n <TSDoc heading=\"Padding for the table cell.\">\n <TSDocRemarks>\n {`The amount of padding (in spaces) to apply to the table cell. This value is applied to both the left and right sides of the cell. If not specified, the default table padding defined in the current theme configuration will be used.`}\n </TSDocRemarks>\n <hbr />\n <TSDocDefaultValue\n type={ReflectionKind.property}\n defaultValue={`\\`${theme.padding.table}\\``}\n />\n </TSDoc>\n <InterfaceMember name=\"padding\" optional type=\"number\" />\n <hbr />\n <TSDoc heading=\"Alignment for the table cell.\">\n <TSDocRemarks>\n {`The alignment for the table cell. This determines how the text within the cell is aligned. If not specified, the default alignment is \"left\".`}\n </TSDocRemarks>\n <hbr />\n <TSDocDefaultValue\n type={ReflectionKind.property}\n defaultValue=\"left\"\n />\n </TSDoc>\n <InterfaceMember\n name=\"align\"\n optional\n type='\"left\" | \"right\" | \"center\"'\n />\n <hbr />\n </InterfaceDeclaration>\n <Spacing />\n <InterfaceDeclaration\n export\n name=\"TableCellOptions\"\n extends=\"TableOutputOptions\"\n doc=\"Options for a specific table cell provided to the {@link table} function.\">\n <InterfaceMember\n name=\"value\"\n optional\n type=\"string\"\n doc=\"The actual string value of the table cell.\"\n />\n <hbr />\n <TSDoc heading=\"Width of the table cell.\">\n <TSDocRemarks>\n {`The width of the table cell (where 1 is a single character in the terminal). If not specified, the width will be determined based on the content of the cell and the available space in the console.`}\n </TSDocRemarks>\n </TSDoc>\n <InterfaceMember\n name=\"maxWidth\"\n type=\"number | SizeToken | undefined\"\n />\n <hbr />\n </InterfaceDeclaration>\n <Spacing />\n <InterfaceDeclaration\n export\n name=\"TableRowOptions\"\n extends=\"TableOutputOptions\"\n doc=\"Options for a specific table row provided to the {@link table} function.\">\n <InterfaceMember\n name=\"values\"\n optional\n type=\"(string | TableCellOptions)[]\"\n doc=\"The actual string values of the table row's cells.\"\n />\n <hbr />\n </InterfaceDeclaration>\n <Spacing />\n <InterfaceDeclaration\n export\n name=\"TableOptions\"\n extends=\"TableOutputOptions\"\n doc=\"Options for a specific table cell provided to the {@link table} function.\">\n <InterfaceMember\n name=\"values\"\n optional\n type=\"(string | TableCellOptions)[][]\"\n doc=\"The actual string values of the table's rows' cells.\"\n />\n <hbr />\n </InterfaceDeclaration>\n <Spacing />\n <InterfaceDeclaration\n name=\"Dimensions\"\n doc=\"The height and width for a specific table/cell used internally in the {@link table} function.\">\n <InterfaceMember\n name=\"height\"\n type=\"number\"\n doc=\"The height of the row/cell (where 1 is a single line in the terminal).\"\n />\n <hbr />\n <InterfaceMember\n name=\"width\"\n type=\"number\"\n doc=\"The width of the row/cell (where 1 is a single character in the terminal).\"\n />\n <hbr />\n </InterfaceDeclaration>\n <Spacing />\n <InterfaceDeclaration\n name=\"TableCellBorder\"\n doc=\"The resolved complete border styles for a table cell.\">\n <InterfaceMember\n name=\"top\"\n type=\"string\"\n doc=\"The top border style of the table cell.\"\n />\n <hbr />\n <InterfaceMember\n name=\"bottom\"\n type=\"string\"\n doc=\"The bottom border style of the table cell.\"\n />\n <hbr />\n <InterfaceMember\n name=\"right\"\n type=\"string\"\n doc=\"The right border style of the table cell.\"\n />\n <hbr />\n <InterfaceMember\n name=\"left\"\n type=\"string\"\n doc=\"The left border style of the table cell.\"\n />\n <hbr />\n <InterfaceMember\n name=\"topLeft\"\n type=\"string\"\n doc=\"The top-left border style of the table cell.\"\n />\n <hbr />\n <InterfaceMember\n name=\"topRight\"\n type=\"string\"\n doc=\"The top-right border style of the table cell.\"\n />\n <hbr />\n <InterfaceMember\n name=\"bottomLeft\"\n type=\"string\"\n doc=\"The bottom-left border style of the table cell.\"\n />\n <hbr />\n <InterfaceMember\n name=\"bottomRight\"\n type=\"string\"\n doc=\"The bottom-right border style of the table cell.\"\n />\n <hbr />\n </InterfaceDeclaration>\n <Spacing />\n <TypeDeclaration\n name=\"TableCell\"\n doc=\"The internal state of a formatted table cell in the {@link table} function.\">\n {code`Required<Omit<TableCellOptions, \"maxWidth\" | \"border\">> & Dimensions & {\n border: TableCellBorder;\n maxWidth?: number;\n };\n `}\n </TypeDeclaration>\n <Spacing />\n <TSDoc heading=\"Write a table to the console.\">\n <TSDocRemarks>\n {`This function writes a table to the console, applying the appropriate padding as defined in the current theme configuration and wrapping as needed.`}\n </TSDocRemarks>\n <hbr />\n <TSDocParam name=\"options\">\n {`Options to customize the table output.`}\n </TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n {...props}\n name=\"table\"\n parameters={[\n {\n name: \"options\",\n type: \"TableOptions | TableRowOptions[] | TableCellOptions[][] | string[] | string[][]\",\n optional: false\n }\n ]}>\n <IfStatement\n condition={code`!options ||\n (!Array.isArray(options) && (typeof options !== \"object\" || !options.values || !Array.isArray(options.values) || options.values.length === 0)) ||\n (Array.isArray(options) && !options.every(item => typeof item === \"object\" || typeof item === \"string\" || Array.isArray(item))) `}>\n {code`return;`}\n </IfStatement>\n <Spacing />\n <VarDeclaration\n let\n name=\"cells\"\n type={`TableCell[][]`}\n initializer={code`[];`}\n />\n <hbr />\n {code`\n const extractTableCell = (cell: string | TableCellOptions, columnIndex: number, rowLength: number, opts?: TableOutputOptions): TableCell => {\n if (typeof cell === \"string\") {\n const borderOptions = opts?.border || \"primary\";\n\n let border = {} as TableCellBorder;\n if (typeof borderOptions === \"object\") {\n border = {\n top: ${extractBorderOptionsObject(\"top\", theme)},\n bottom: ${extractBorderOptionsObject(\"bottom\", theme)},\n left: ${extractBorderOptionsObject(\"left\", theme)},\n right: ${extractBorderOptionsObject(\"right\", theme)},\n topLeft: ${extractBorderOptionsObject(\"topLeft\", theme)},\n topRight: ${extractBorderOptionsObject(\"topRight\", theme)},\n bottomLeft: ${extractBorderOptionsObject(\"bottomLeft\", theme)},\n bottomRight: ${extractBorderOptionsObject(\"bottomRight\", theme)},\n };\n } else {\n border.top = ${extractBorderOptionsString(\"top\", theme)};\n border.bottom = ${extractBorderOptionsString(\"bottom\", theme)};\n border.left = ${extractBorderOptionsString(\"left\", theme)};\n border.right = ${extractBorderOptionsString(\"right\", theme)};\n border.topLeft = ${extractBorderOptionsString(\"topLeft\", theme)};\n border.topRight = ${extractBorderOptionsString(\"topRight\", theme)};\n border.bottomLeft = ${extractBorderOptionsString(\"bottomLeft\", theme)};\n border.bottomRight = ${extractBorderOptionsString(\"bottomRight\", theme)};\n }\n\n const padding = Math.max(0, opts?.padding ?? ${theme.padding.table}) * (columnIndex === 0 || columnIndex === rowLength - 1 ? 2 : 1);\n const value = cell ?? \"\";\n const width = stripAnsi(value).length + padding * 2;\n\n return {\n value,\n height: 1,\n width,\n border,\n padding,\n align: opts?.align || \"left\",\n };\n } else {\n const borderOptions = cell.border || opts?.border || \"primary\";\n\n let border = {} as TableCellBorder;\n if (typeof borderOptions === \"object\") {\n border = {\n top: ${extractBorderOptionsObject(\"top\", theme)},\n bottom: ${extractBorderOptionsObject(\"bottom\", theme)},\n left: ${extractBorderOptionsObject(\"left\", theme)},\n right: ${extractBorderOptionsObject(\"right\", theme)},\n topLeft: ${extractBorderOptionsObject(\"topLeft\", theme)},\n topRight: ${extractBorderOptionsObject(\"topRight\", theme)},\n bottomLeft: ${extractBorderOptionsObject(\"bottomLeft\", theme)},\n bottomRight: ${extractBorderOptionsObject(\"bottomRight\", theme)},\n };\n } else {\n border.top = ${extractBorderOptionsString(\"top\", theme)};\n border.bottom = ${extractBorderOptionsString(\"bottom\", theme)};\n border.left = ${extractBorderOptionsString(\"left\", theme)};\n border.right = ${extractBorderOptionsString(\"right\", theme)};\n border.topLeft = ${extractBorderOptionsString(\"topLeft\", theme)};\n border.topRight = ${extractBorderOptionsString(\"topRight\", theme)};\n border.bottomLeft = ${extractBorderOptionsString(\"bottomLeft\", theme)};\n border.bottomRight = ${extractBorderOptionsString(\"bottomRight\", theme)};\n }\n\n const padding = Math.max(0, cell.padding ?? opts?.padding ?? ${\n theme.padding.table\n });\n const value = cell.value ?? \"\";\n const width = stripAnsi(value).length + padding * 2;\n const maxWidth = cell.maxWidth ? typeof cell.maxWidth === \"number\" ? cell.maxWidth : calculateWidth(cell.maxWidth) : undefined;\n\n return {\n value,\n height: 1,\n width,\n maxWidth,\n border,\n padding,\n align: cell.align || opts?.align || \"left\",\n };\n }\n };\n\n let colMaxWidths = [] as (number | undefined)[];\n `}\n <hbr />\n <IfStatement condition={code`Array.isArray(options)`}>\n <IfStatement\n condition={code`options.every(row => typeof row === \"string\" || (typeof row === \"object\" && !Array.isArray(row) && !(\"values\" in row)))`}>\n {code`cells.push(options.map((cell, index) => extractTableCell(cell as string | TableCellOptions, index, options.length)));`}\n </IfStatement>\n <ElseClause>\n {code`\n cells.push(\n ...options.map(row => Array.isArray(row)\n ? row.reduce((cellRow, cell, index) => {\n if (colMaxWidths.length <= index) {\n colMaxWidths.push(undefined);\n }\n const newCell = extractTableCell(cell, index, row.length);\n if (newCell.maxWidth && (!colMaxWidths[index] || newCell.maxWidth < colMaxWidths[index]!)) {\n colMaxWidths[index] = newCell.maxWidth;\n }\n cellRow.push(newCell);\n return cellRow;\n }, [] as TableCell[])\n : (row as TableRowOptions).values?.reduce((cellRow, cell, index) => {\n if (colMaxWidths.length <= index) {\n colMaxWidths.push(undefined);\n }\n const newCell = extractTableCell(cell, index, (row as TableRowOptions).values?.length ?? 1, row as TableRowOptions);\n if (newCell.maxWidth && (!colMaxWidths[index] || newCell.maxWidth < colMaxWidths[index]!)) {\n colMaxWidths[index] = newCell.maxWidth;\n }\n cellRow.push(newCell);\n return cellRow;\n }, [] as TableCell[]) ?? []\n )\n );\n `}\n </ElseClause>\n </IfStatement>\n <ElseClause>\n {code`\n cells.push(\n ...options.values!.map(row => Array.isArray(row)\n ? row.reduce((cellRow, cell, index) => {\n if (colMaxWidths.length <= index) {\n colMaxWidths.push(undefined);\n }\n const newCell = extractTableCell(cell, index, row.length);\n if (newCell.maxWidth && (!colMaxWidths[index] || newCell.maxWidth < colMaxWidths[index]!)) {\n colMaxWidths[index] = newCell.maxWidth;\n }\n cellRow.push(newCell);\n return cellRow;\n }, [] as TableCell[])\n : (row as TableRowOptions).values?.reduce((cellRow, cell, index) => {\n if (colMaxWidths.length <= index) {\n colMaxWidths.push(undefined);\n }\n const newCell = extractTableCell(cell, index, (row as TableRowOptions).values?.length ?? 1, options);\n if (newCell.maxWidth && (!colMaxWidths[index] || newCell.maxWidth < colMaxWidths[index]!)) {\n colMaxWidths[index] = newCell.maxWidth;\n }\n cellRow.push(newCell);\n return cellRow;\n }, [] as TableCell[]) ?? []\n )\n );\n\n `}\n </ElseClause>\n <hbr />\n {code`\ncells = cells.filter(row => row.length > 0);\nif (cells.length === 0) {\n return;\n}\n\ncells.forEach(row => row.forEach((cell, index) => {\n if (colMaxWidths[index] && cell.maxWidth !== colMaxWidths[index]!) {\n cell.maxWidth = colMaxWidths[index]!;\n }\n}));\n\n// Calculate table dimensions\nlet colWidths = [] as number[];\nlet rowDims = [] as Dimensions[];\n\nconst calculateRowDimensions = () => {\n colWidths = [];\n return cells.reduce((dims, row) => {\n dims.push(row.reduce((dim, cell, index) => {\n dim.width += cell.width;\n if (cell.height > dim.height) {\n dim.height = cell.height;\n }\n if (!colWidths[index] || cell.width > colWidths[index]!) {\n colWidths[index] = cell.width;\n }\n\n return dim;\n }, { width: 0, height: 0 } as Dimensions));\n\n return dims;\n }, [] as Dimensions[]);\n}\n\nlet recalculate!: boolean;\ndo {\n recalculate = false;\n rowDims = calculateRowDimensions();\n\n if (!recalculate && colWidths.some((colWidth, index) => colMaxWidths[index] && colWidth > colMaxWidths[index]!)) {\n (colWidths.map((colWidth, index) => colMaxWidths[index] && colWidth > colMaxWidths[index]! ? index : undefined).filter(colWidth => colWidth !== undefined) as number[]).forEach(index => {\n cells.forEach(row => {\n const cell = row[index]!;\n if (colMaxWidths[index] && cell.width > colMaxWidths[index]) {\n const lines = splitText(\n cell.value,\n colMaxWidths[index] - cell.padding * 2,\n );\n\n cell.value = lines.join(\"\\\\n\");\n cell.height = lines.length;\n cell.width = Math.max(...lines.map(line => stripAnsi(line).length)) + cell.padding * 2;\n\n recalculate = true;\n }\n });\n });\n }\n\n rowDims.forEach((row, rowIndex) => {\n if (!recalculate && row.width > Math.max(getTerminalSize().columns - ${\n Math.max(theme.padding.app, 0) * 2\n }, 0)) {\n const cell = cells[rowIndex]!.reduce((largestCell, cell) => {\n if (cell.width > largestCell.width) {\n return cell;\n }\n return largestCell;\n }, cells[rowIndex]![0]!);\n\n const lines = splitText(\n cell.value,\n Math.min(Math.max(getTerminalSize().columns - ${\n Math.max(theme.padding.app, 0) * 2\n } - (row.width - (cell.width - cell.padding * 2)), 0),\n cell.maxWidth ?? Number.POSITIVE_INFINITY)\n );\n\n cell.value = lines.join(\"\\\\n\");\n cell.height = lines.length;\n cell.width = Math.max(...lines.map(line => stripAnsi(line).length)) + cell.padding * 2;\n\n recalculate = true;\n }\n });\n\n if (!recalculate && colWidths.reduce((a, b) => a + b, 0) > Math.max(getTerminalSize().columns - ${\n Math.max(theme.padding.app, 0) * 2\n }, 0)) {\n let colIndex = 0;\n const cell = cells.reduce((ret, row) => {\n return row.reduce((largest, current, index) => {\n if (largest.width < current.width) {\n colIndex = index;\n return current;\n }\n return largest;\n }, ret);\n }, cells[0]![0]!);\n\n const lines = splitText(\n cell.value,\n Math.min(Math.max(getTerminalSize().columns - ${\n Math.max(theme.padding.app, 0) * 2\n } - (colWidths.filter((_, i) => i !== colIndex).reduce((a, b) => a + b, 0)) - cell.padding * 2, 0),\n cell.maxWidth ?? Number.POSITIVE_INFINITY)\n );\n\n cell.value = lines.join(\"\\\\n\");\n cell.height = lines.length;\n cell.width = Math.max(...lines.map(line => stripAnsi(line).length)) + cell.padding * 2;\n\n recalculate = true;\n }\n} while (recalculate);\n\n// Render table\ncells.forEach((row, rowIndex) => {\n const outputs = [] as string[][];\n row.forEach((cell, colIndex) => {\n const lines = cell.value.split(\"\\\\n\");\n while (lines.length < rowDims[rowIndex]!.height) {\n lines.push(\"\");\n }\n\n outputs.push(lines.map(line => {\n let paddedContent = \"\";\n switch (cell.align) {\n case \"right\":\n paddedContent = \" \".repeat(Math.max(colWidths[colIndex] - stripAnsi(line).length - cell.padding, 0)) + line + \" \".repeat(cell.padding);\n break;\n case \"center\":\n const leftPadding = Math.floor((colWidths[colIndex] - stripAnsi(line).length - cell.padding) / 2);\n const rightPadding = colWidths[colIndex] - stripAnsi(line).length - leftPadding;\n paddedContent = \" \".repeat(leftPadding) + line + \" \".repeat(rightPadding);\n break;\n case \"left\":\n default:\n paddedContent = \" \".repeat(cell.padding) + line + \" \".repeat(Math.max(colWidths[colIndex] - stripAnsi(line).length - cell.padding, 0));\n break;\n }\n\n if (colIndex === row.length - 1) {\n return cell.border.left + paddedContent + cell.border.right;\n } else {\n return cell.border.left + paddedContent;\n }\n }));\n });\n\n for (let index = 0; index < rowDims[rowIndex]!.height; index++) {\n writeLine(outputs.map(output => output[index] ?? \"\").join(\"\"));\n }\n});\n`}\n </FunctionDeclaration>\n </>\n );\n}\n\nexport type ConsoleBuiltinProps = Pick<\n BuiltinFileProps,\n \"children\" | \"imports\" | \"builtinImports\"\n>;\n\n/**\n * A built-in console utilities module for Shell Shock.\n */\nexport function ConsoleBuiltin(props: ConsoleBuiltinProps) {\n const { children, imports, builtinImports } = props;\n\n return (\n <BuiltinFile\n id=\"console\"\n description=\"A collection of helper utilities to assist in generating content meant for display in the console.\"\n imports={defu(imports, {\n \"@shell-shock/plugin-theme/types/theme\": [\n { name: \"ThemeColorsResolvedConfig\", type: true },\n { name: \"ThemeSpinnerResolvedConfig\", type: true }\n ],\n \"@shell-shock/plugin-theme/helpers/spinners\": [\n { name: \"SpinnerPreset\", type: true },\n { name: \"resolveSpinner\" }\n ],\n \"node:buffer\": [\"WithImplicitCoercion\"],\n \"node:util\": [\"stripVTControlCharacters\"]\n })}\n builtinImports={defu(builtinImports, {\n utils: [\n \"isMinimal\",\n \"isInteractive\",\n \"isColorSupported\",\n \"colorSupportLevels\",\n \"isUnicodeSupported\",\n \"isHyperlinkSupported\",\n \"getTerminalSize\"\n ],\n env: [\"env\", \"isDevelopment\", \"isDebug\"],\n state: [\"hasFlag\"]\n })}>\n <AnsiHelpersDeclarations />\n <Spacing />\n <StripAnsiFunctionDeclaration />\n <Spacing />\n <WrapAnsiFunction />\n <Spacing />\n <AnsiStyleFunctionsDeclaration />\n <Spacing />\n <WriteFunctionDeclaration />\n <Spacing />\n <WriteLineFunctionDeclaration />\n <Spacing />\n <SplitTextFunctionDeclaration />\n <Spacing />\n <LinkFunctionDeclaration />\n <Spacing />\n <DividerFunctionDeclaration />\n <Spacing />\n <SpinnerFunctionDeclaration />\n <Spacing />\n <MessageFunctionDeclaration\n type=\"help\"\n variant=\"help\"\n consoleFnName=\"log\"\n description=\"help\"\n />\n <Spacing />\n <MessageFunctionDeclaration\n type=\"success\"\n variant=\"success\"\n consoleFnName=\"info\"\n description=\"success\"\n />\n <Spacing />\n <MessageFunctionDeclaration\n type=\"info\"\n variant=\"info\"\n consoleFnName=\"info\"\n description=\"informational\"\n />\n <Spacing />\n <MessageFunctionDeclaration\n type=\"debug\"\n variant=\"debug\"\n consoleFnName=\"debug\"\n description=\"debug\"\n timestamp\n prefix={\n <IfStatement condition={<IsNotDebug />}>{code`return; `}</IfStatement>\n }\n />\n <Spacing />\n <MessageFunctionDeclaration\n type=\"verbose\"\n variant=\"info\"\n color=\"debug\"\n consoleFnName=\"debug\"\n description=\"verbose\"\n timestamp\n prefix={\n <IfStatement\n condition={<IsNotVerbose />}>{code`return; `}</IfStatement>\n }\n />\n <Spacing />\n <MessageFunctionDeclaration\n type=\"warn\"\n variant=\"warning\"\n consoleFnName=\"warn\"\n description=\"warning\"\n />\n <Spacing />\n <MessageFunctionDeclaration\n type=\"danger\"\n variant=\"danger\"\n consoleFnName=\"error\"\n description=\"destructive/danger\"\n />\n <Spacing />\n <MessageFunctionDeclaration\n type=\"error\"\n variant=\"error\"\n consoleFnName=\"error\"\n description=\"error\"\n timestamp\n parameters={[\n {\n name: \"err\",\n type: \"string | Error\",\n optional: false\n },\n {\n name: \"header\",\n type: \"string\",\n optional: true\n }\n ]}\n prefix={\n <>\n <VarDeclaration let name=\"message\" type=\"string | undefined\" />\n <Spacing />\n <IfStatement condition={code`(err as Error)?.message`}>\n {code`message = (err as Error).message;`}\n </IfStatement>\n <ElseClause>{code`message = String(err);`}</ElseClause>\n <Spacing />\n <IfStatement condition={code`env.STACKTRACE`}>\n <IfStatement condition={code`(err as Error)?.stack`}>\n {code`message += \" \\\\n\\\\n\" + ((err as Error).stack || \"\");`}\n </IfStatement>\n <ElseClause>{code`message += \" \\\\n\\\\n\" + ((new Error(\" \")).stack || \"\").split(\"\\\\n\").slice(2).map(line => line.trim()).join(\"\\\\n\");`}</ElseClause>\n </IfStatement>\n </>\n }\n />\n <Spacing />\n <TableFunctionDeclaration />\n <Spacing />\n <BlockquoteFunctionDeclaration />\n <Spacing />\n <CodeFunctionDeclaration />\n <Spacing />\n <InlineCodeFunctionDeclaration />\n <Spacing />\n {children}\n <Spacing />\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAsCA,SAAE,0BAAA;AACA,QAAO;EAAA,gBAAkB,gBAAiB;GAC5C,SAAa;GACb,UAAS;GACT,MAAO;GACL,KAAK;GACL,UAAA,IAAA;GACA,CAAA;EAAA,gBAAY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MAAM;MACN,UAAM;MACP,CAAC;KACF,IAAI,SAAI;AACN,aAAM;OAAA,gBAAe,gBAAA;QACnB,OAAG;QACH,MAAM;QACN,MAAE;QACH,CAAC;OAAE,gBAAkB,SAAA,EAAA,CAAA;OAAA,gBAA4B,aAAgB;QAChE,WAAS,IAAM;QACf,UAAS,IAAK;QACf,CAAC;OAAE,gBAAkB,YAAC,EACrB,UAAS,IAAA,0BACV,CAAC;OAAE,gBAAkB,SAAI,EAAA,CAAA;OAAA,gBAA4B,aAAa;QACjE,WAAS,IAAA;QACT,IAAA,WAAA;;UAEA,WAAe,IAAC;UACd,UAAM,IAAQ;UACd,CAAA,EAAA,gBAAA,YAAA,EACF,UAAc,IAAI,qHAClB,CAAA,CAAK;;;;;KAIV,CAAC;IAAE,gBAAS,SAAA,EAAA,CAAA;IAAA,gBAAA,0BAAA,EAAA,CAAA;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,+BAAA,EAAA,CAAA;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,yBAAA,EAAA,CAAA;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,+BAAA,EAAA,CAAA;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA;;EAEhB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shell-shock/plugin-console",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "private": false,
5
5
  "description": "A package containing a Shell Shock plugin to generate the `console` built-in module.",
6
6
  "keywords": [
@@ -128,8 +128,8 @@
128
128
  "@powerlines/deepkit": "^0.6.167",
129
129
  "@powerlines/plugin-alloy": "^0.26.9",
130
130
  "@powerlines/plugin-plugin": "^0.12.343",
131
- "@shell-shock/core": "^0.16.2",
132
- "@shell-shock/plugin-theme": "^0.4.12",
131
+ "@shell-shock/core": "^0.17.0",
132
+ "@shell-shock/plugin-theme": "^0.4.13",
133
133
  "@stryke/string-format": "^0.17.9",
134
134
  "@stryke/type-checks": "^0.6.1",
135
135
  "defu": "^6.1.7",
@@ -154,5 +154,5 @@
154
154
  "./package.json": "./package.json"
155
155
  }
156
156
  },
157
- "gitHead": "c1b938503f5de35ab59e58638029def62257a504"
157
+ "gitHead": "8ca409c1453d9722650670c3df4f4da72abdc308"
158
158
  }