@shell-shock/plugin-console 0.2.9 → 0.2.10

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.
@@ -458,35 +458,34 @@ function SplitTextFunctionDeclaration() {
458
458
  name: "adjustIndex",
459
459
  parameters: [{
460
460
  name: "line",
461
- type: "string"
461
+ type: "string",
462
+ doc: "An input line which may contain ANSI escape codes. This is used to adjust the index for splitting the line based on visible characters rather than raw string length, ensuring that ANSI codes do not cause incorrect splitting of the text."
462
463
  }, {
463
464
  name: "index",
464
- type: "number"
465
+ type: "number",
466
+ doc: "The index at which to split the line, based on visible characters (does not account for ANSI escape codes)."
465
467
  }],
466
468
  returnType: "number",
467
469
  children: _alloy_js_core.code`let adjustedIndex = 0;
470
+ let visibleCount = 0;
471
+ const ansiRegex = new RegExp([
472
+ String.raw\`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)\`,
473
+ String.raw\`(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))\`
474
+ ].join("|"), "g");
468
475
 
469
- const segments = line.match(/\\x1b\\[(\\d|;)+m.*\\x1b\\[(\\d|;)+m/gi);
470
- if (segments && segments.length > 0) {
471
- segments.reduce((count, matched) => {
472
- if (count < index) {
473
- const stripped = stripAnsi(matched);
474
- if (count + stripped.length < index) {
475
- count += stripped.length;
476
- adjustedIndex += matched.length;
477
- } else {
478
- adjustedIndex += index - count + (matched.slice(0, index - count).match(/\\x1b\\[(\\d|;)+m/g)?.join("")?.length ?? 0);
479
- count = index;
480
- }
481
- }
476
+ while (visibleCount < index && adjustedIndex < line.length) {
477
+ ansiRegex.lastIndex = adjustedIndex;
478
+ const match = ansiRegex.exec(line);
482
479
 
483
- return count;
484
- }, 0);
485
- } else {
486
- adjustedIndex = index;
480
+ if (match && match.index === adjustedIndex) {
481
+ adjustedIndex += match[0].length;
482
+ } else {
483
+ adjustedIndex++;
484
+ visibleCount++;
485
+ }
487
486
  }
488
487
 
489
- return adjustedIndex - (line.slice(0, adjustedIndex).match(/\\x1b\\[/g)?.length ?? 0); `
488
+ return adjustedIndex; `
490
489
  }),
491
490
  (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
492
491
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
@@ -499,8 +498,9 @@ function SplitTextFunctionDeclaration() {
499
498
  type: "number"
500
499
  }],
501
500
  returnType: "[string, string]",
502
- children: _alloy_js_core.code`const first = line.slice(0, index);
503
- const second = line.slice(index);
501
+ children: _alloy_js_core.code`const adjustedIndex = adjustIndex(line, index);
502
+ const first = line.slice(0, adjustedIndex);
503
+ const second = line.slice(adjustedIndex);
504
504
 
505
505
  // Match all ANSI escape sequences in the first string
506
506
  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;
@@ -550,8 +550,26 @@ function SplitTextFunctionDeclaration() {
550
550
  return [first.replace(/^\\s+/, "").replace(/\\s+$/, "") + closeSequence, openSequence + second.replace(/^\\s+/, "").replace(/\\s+$/, "")]; `
551
551
  }),
552
552
  (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
553
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
554
+ heading: "Split text into multiple lines based on a maximum length.",
555
+ get children() {
556
+ return [
557
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This function splits the provided text into multiple lines based on the specified maximum length, ensuring that words are not broken in the middle.` }),
558
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
559
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
560
+ name: "text",
561
+ children: `The text to split into multiple lines.`
562
+ }),
563
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
564
+ name: "maxLength",
565
+ children: `The maximum length of each line.`
566
+ })
567
+ ];
568
+ }
569
+ }),
553
570
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
554
- name: "innerSplitText",
571
+ name: "splitText",
572
+ "export": true,
555
573
  parameters: [{
556
574
  name: "text",
557
575
  type: "string"
@@ -565,18 +583,20 @@ function SplitTextFunctionDeclaration() {
565
583
  const calculatedMaxLength = isSizeToken(maxLength) ? calculateWidth(maxLength) : maxLength;
566
584
  while (stripAnsi(line).length > calculatedMaxLength || line.indexOf("\\n") !== -1) {
567
585
  if (line.indexOf("\\n") !== -1) {
568
- result.push(...innerSplitText(line.slice(0, line.indexOf("\\n")).replace(/(\\r)?\\n/, ""), calculatedMaxLength));
586
+ result.push(...splitText(line.slice(0, line.indexOf("\\n")).replace(/(\\r)?\\n/, ""), calculatedMaxLength));
569
587
  line = line.indexOf("\\n") + 1 < line.length
570
588
  ? line.slice(line.indexOf("\\n") + 1)
571
589
  : "";
572
590
  } else {
573
- const index = [" ", "/", ".", ",", "-", ":", "|", "@", "+"].reduce((ret, split) => {
574
- let current = ret;
575
- while (stripAnsi(line).indexOf(split, current + 1) !== -1 && stripAnsi(line).indexOf(split, current + 1) <= calculatedMaxLength) {
576
- current = line.indexOf(split, adjustIndex(line, current + 1));
591
+ const strippedLine = stripAnsi(line);
592
+ const index = [" ", "/", "+", ".", ","].reduce((ret, split) => {
593
+ let cursor = ret;
594
+ while (strippedLine.substring(cursor + 1).includes(split) &&
595
+ strippedLine.indexOf(split, cursor + 1) <= calculatedMaxLength) {
596
+ cursor = strippedLine.indexOf(split, cursor + 1);
577
597
  }
578
598
 
579
- return current;
599
+ return cursor;
580
600
  }, -1);
581
601
  if (index === -1) {
582
602
  break;
@@ -596,45 +616,6 @@ function SplitTextFunctionDeclaration() {
596
616
 
597
617
  result.push(line);
598
618
  return result; `
599
- }),
600
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
601
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
602
- heading: "Split text into multiple lines based on a maximum length.",
603
- get children() {
604
- return [
605
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This function splits the provided text into multiple lines based on the specified maximum length, ensuring that words are not broken in the middle.` }),
606
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
607
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
608
- name: "text",
609
- children: `The text to split into multiple lines.`
610
- }),
611
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
612
- name: "maxLength",
613
- children: `The maximum length of each line.`
614
- })
615
- ];
616
- }
617
- }),
618
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
619
- "export": true,
620
- name: "splitText",
621
- parameters: [{
622
- name: "text",
623
- type: "string"
624
- }, {
625
- name: "maxLength",
626
- type: "number | SizeToken"
627
- }],
628
- children: _alloy_js_core.code`const timeout = setTimeout(() => {
629
- throw new Error("Text splitting took too long, likely due to a very long line without spaces or a very small maxLength. Please ensure that the input text contains reasonable break points and that maxLength is set to a reasonable value.");
630
- }, 1000);
631
-
632
- try {
633
- return innerSplitText(text, maxLength);
634
- } finally {
635
- clearTimeout(timeout);
636
- }
637
- `
638
619
  })
639
620
  ];
640
621
  }
@@ -848,8 +829,8 @@ function MessageFunctionDeclaration(props) {
848
829
  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} });
849
830
  splitText(
850
831
  message,
851
- 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)
852
- ).forEach((line) => {
832
+ 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}, 12)
833
+ ).forEach(line => {
853
834
  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} });
854
835
  });
855
836
  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} });
@@ -1252,7 +1233,7 @@ function InlineCodeFunctionDeclaration() {
1252
1233
  return "";
1253
1234
  }
1254
1235
 
1255
- return textColors.body.primary(inverse(\` \${text} \`), true); `
1236
+ return inverse(\`\${text}\`); `
1256
1237
  })
1257
1238
  ];
1258
1239
  }
@@ -2649,10 +2630,7 @@ function ConsoleBuiltin(props) {
2649
2630
  (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2650
2631
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
2651
2632
  condition: _alloy_js_core.code`env.STACKTRACE && typeof err === "object" && (err as { stack?: string })?.stack`,
2652
- children: _alloy_js_core.code`message += " \\n\\n" + (err as { stack?: string })?.stack
2653
- .split("\\n")
2654
- .slice(1)
2655
- .map(line => {
2633
+ children: _alloy_js_core.code`message += " \\n\\n" + (err as { stack: string }).stack.split("\\n").slice(1).map(line => {
2656
2634
  const match = line.match(/at (?:(.+?)\\s+\\()?(?:(.+?):(\\d+)(?::(\\d+))?|([^)]+))\\)?/);
2657
2635
  if (match) {
2658
2636
  const filePath = match[2] || match[5] || "<unknown>";
@@ -2660,8 +2638,7 @@ function ConsoleBuiltin(props) {
2660
2638
  }
2661
2639
 
2662
2640
  return line.trim();
2663
- })
2664
- .join("\\n"); `
2641
+ }).join("\\n"); `
2665
2642
  })
2666
2643
  ];
2667
2644
  }
@@ -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;;;;iBAiK7B,4BAAA,CAAA,GA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hB9B,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"}
@@ -456,35 +456,34 @@ function SplitTextFunctionDeclaration() {
456
456
  name: "adjustIndex",
457
457
  parameters: [{
458
458
  name: "line",
459
- type: "string"
459
+ type: "string",
460
+ doc: "An input line which may contain ANSI escape codes. This is used to adjust the index for splitting the line based on visible characters rather than raw string length, ensuring that ANSI codes do not cause incorrect splitting of the text."
460
461
  }, {
461
462
  name: "index",
462
- type: "number"
463
+ type: "number",
464
+ doc: "The index at which to split the line, based on visible characters (does not account for ANSI escape codes)."
463
465
  }],
464
466
  returnType: "number",
465
467
  children: code`let adjustedIndex = 0;
468
+ let visibleCount = 0;
469
+ const ansiRegex = new RegExp([
470
+ String.raw\`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)\`,
471
+ String.raw\`(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))\`
472
+ ].join("|"), "g");
466
473
 
467
- const segments = line.match(/\\x1b\\[(\\d|;)+m.*\\x1b\\[(\\d|;)+m/gi);
468
- if (segments && segments.length > 0) {
469
- segments.reduce((count, matched) => {
470
- if (count < index) {
471
- const stripped = stripAnsi(matched);
472
- if (count + stripped.length < index) {
473
- count += stripped.length;
474
- adjustedIndex += matched.length;
475
- } else {
476
- adjustedIndex += index - count + (matched.slice(0, index - count).match(/\\x1b\\[(\\d|;)+m/g)?.join("")?.length ?? 0);
477
- count = index;
478
- }
479
- }
474
+ while (visibleCount < index && adjustedIndex < line.length) {
475
+ ansiRegex.lastIndex = adjustedIndex;
476
+ const match = ansiRegex.exec(line);
480
477
 
481
- return count;
482
- }, 0);
483
- } else {
484
- adjustedIndex = index;
478
+ if (match && match.index === adjustedIndex) {
479
+ adjustedIndex += match[0].length;
480
+ } else {
481
+ adjustedIndex++;
482
+ visibleCount++;
483
+ }
485
484
  }
486
485
 
487
- return adjustedIndex - (line.slice(0, adjustedIndex).match(/\\x1b\\[/g)?.length ?? 0); `
486
+ return adjustedIndex; `
488
487
  }),
489
488
  createComponent(Spacing, {}),
490
489
  createComponent(FunctionDeclaration, {
@@ -497,8 +496,9 @@ function SplitTextFunctionDeclaration() {
497
496
  type: "number"
498
497
  }],
499
498
  returnType: "[string, string]",
500
- children: code`const first = line.slice(0, index);
501
- const second = line.slice(index);
499
+ children: code`const adjustedIndex = adjustIndex(line, index);
500
+ const first = line.slice(0, adjustedIndex);
501
+ const second = line.slice(adjustedIndex);
502
502
 
503
503
  // Match all ANSI escape sequences in the first string
504
504
  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;
@@ -548,8 +548,26 @@ function SplitTextFunctionDeclaration() {
548
548
  return [first.replace(/^\\s+/, "").replace(/\\s+$/, "") + closeSequence, openSequence + second.replace(/^\\s+/, "").replace(/\\s+$/, "")]; `
549
549
  }),
550
550
  createComponent(Spacing, {}),
551
+ createComponent(TSDoc, {
552
+ heading: "Split text into multiple lines based on a maximum length.",
553
+ get children() {
554
+ return [
555
+ createComponent(TSDocRemarks, { children: `This function splits the provided text into multiple lines based on the specified maximum length, ensuring that words are not broken in the middle.` }),
556
+ createIntrinsic("hbr", {}),
557
+ createComponent(TSDocParam, {
558
+ name: "text",
559
+ children: `The text to split into multiple lines.`
560
+ }),
561
+ createComponent(TSDocParam, {
562
+ name: "maxLength",
563
+ children: `The maximum length of each line.`
564
+ })
565
+ ];
566
+ }
567
+ }),
551
568
  createComponent(FunctionDeclaration, {
552
- name: "innerSplitText",
569
+ name: "splitText",
570
+ "export": true,
553
571
  parameters: [{
554
572
  name: "text",
555
573
  type: "string"
@@ -563,18 +581,20 @@ function SplitTextFunctionDeclaration() {
563
581
  const calculatedMaxLength = isSizeToken(maxLength) ? calculateWidth(maxLength) : maxLength;
564
582
  while (stripAnsi(line).length > calculatedMaxLength || line.indexOf("\\n") !== -1) {
565
583
  if (line.indexOf("\\n") !== -1) {
566
- result.push(...innerSplitText(line.slice(0, line.indexOf("\\n")).replace(/(\\r)?\\n/, ""), calculatedMaxLength));
584
+ result.push(...splitText(line.slice(0, line.indexOf("\\n")).replace(/(\\r)?\\n/, ""), calculatedMaxLength));
567
585
  line = line.indexOf("\\n") + 1 < line.length
568
586
  ? line.slice(line.indexOf("\\n") + 1)
569
587
  : "";
570
588
  } else {
571
- const index = [" ", "/", ".", ",", "-", ":", "|", "@", "+"].reduce((ret, split) => {
572
- let current = ret;
573
- while (stripAnsi(line).indexOf(split, current + 1) !== -1 && stripAnsi(line).indexOf(split, current + 1) <= calculatedMaxLength) {
574
- current = line.indexOf(split, adjustIndex(line, current + 1));
589
+ const strippedLine = stripAnsi(line);
590
+ const index = [" ", "/", "+", ".", ","].reduce((ret, split) => {
591
+ let cursor = ret;
592
+ while (strippedLine.substring(cursor + 1).includes(split) &&
593
+ strippedLine.indexOf(split, cursor + 1) <= calculatedMaxLength) {
594
+ cursor = strippedLine.indexOf(split, cursor + 1);
575
595
  }
576
596
 
577
- return current;
597
+ return cursor;
578
598
  }, -1);
579
599
  if (index === -1) {
580
600
  break;
@@ -594,45 +614,6 @@ function SplitTextFunctionDeclaration() {
594
614
 
595
615
  result.push(line);
596
616
  return result; `
597
- }),
598
- createComponent(Spacing, {}),
599
- createComponent(TSDoc, {
600
- heading: "Split text into multiple lines based on a maximum length.",
601
- get children() {
602
- return [
603
- createComponent(TSDocRemarks, { children: `This function splits the provided text into multiple lines based on the specified maximum length, ensuring that words are not broken in the middle.` }),
604
- createIntrinsic("hbr", {}),
605
- createComponent(TSDocParam, {
606
- name: "text",
607
- children: `The text to split into multiple lines.`
608
- }),
609
- createComponent(TSDocParam, {
610
- name: "maxLength",
611
- children: `The maximum length of each line.`
612
- })
613
- ];
614
- }
615
- }),
616
- createComponent(FunctionDeclaration, {
617
- "export": true,
618
- name: "splitText",
619
- parameters: [{
620
- name: "text",
621
- type: "string"
622
- }, {
623
- name: "maxLength",
624
- type: "number | SizeToken"
625
- }],
626
- children: code`const timeout = setTimeout(() => {
627
- throw new Error("Text splitting took too long, likely due to a very long line without spaces or a very small maxLength. Please ensure that the input text contains reasonable break points and that maxLength is set to a reasonable value.");
628
- }, 1000);
629
-
630
- try {
631
- return innerSplitText(text, maxLength);
632
- } finally {
633
- clearTimeout(timeout);
634
- }
635
- `
636
617
  })
637
618
  ];
638
619
  }
@@ -846,8 +827,8 @@ function MessageFunctionDeclaration(props) {
846
827
  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} });
847
828
  splitText(
848
829
  message,
849
- 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)
850
- ).forEach((line) => {
830
+ 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}, 12)
831
+ ).forEach(line => {
851
832
  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} });
852
833
  });
853
834
  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} });
@@ -1250,7 +1231,7 @@ function InlineCodeFunctionDeclaration() {
1250
1231
  return "";
1251
1232
  }
1252
1233
 
1253
- return textColors.body.primary(inverse(\` \${text} \`), true); `
1234
+ return inverse(\`\${text}\`); `
1254
1235
  })
1255
1236
  ];
1256
1237
  }
@@ -2647,10 +2628,7 @@ function ConsoleBuiltin(props) {
2647
2628
  createComponent(Spacing, {}),
2648
2629
  createComponent(IfStatement, {
2649
2630
  condition: code`env.STACKTRACE && typeof err === "object" && (err as { stack?: string })?.stack`,
2650
- children: code`message += " \\n\\n" + (err as { stack?: string })?.stack
2651
- .split("\\n")
2652
- .slice(1)
2653
- .map(line => {
2631
+ children: code`message += " \\n\\n" + (err as { stack: string }).stack.split("\\n").slice(1).map(line => {
2654
2632
  const match = line.match(/at (?:(.+?)\\s+\\()?(?:(.+?):(\\d+)(?::(\\d+))?|([^)]+))\\)?/);
2655
2633
  if (match) {
2656
2634
  const filePath = match[2] || match[5] || "<unknown>";
@@ -2658,8 +2636,7 @@ function ConsoleBuiltin(props) {
2658
2636
  }
2659
2637
 
2660
2638
  return line.trim();
2661
- })
2662
- .join("\\n"); `
2639
+ }).join("\\n"); `
2663
2640
  })
2664
2641
  ];
2665
2642
  }
@@ -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, titleCase } 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 | number | boolean | null | undefined${\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(String(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(String(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(String(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 ${getIndefiniteArticle(\n titleCase(modifier)\n )} ${titleCase(modifier)} text-style to provided console text.`}>\n <TSDocParam name=\"text\">\n {`The console text to which the ${titleCase(\n modifier\n )} text-style should be applied.`}\n </TSDocParam>\n <TSDocReturns>\n {`A string with ANSI escape codes applied for ${titleCase(\n modifier\n )} text-style, 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 function that applies ${getIndefiniteArticle(\n titleCase(color)\n )} ${titleCase(color)} 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 ${getIndefiniteArticle(\n titleCase(color)\n )} ${titleCase(color)} 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 ${titleCase(\n color\n )} 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 ${titleCase(\n color\n )} color 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(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 <FunctionDeclaration\n name=\"innerSplitText\"\n parameters={[\n {\n name: \"text\",\n type: \"string\"\n },\n {\n name: \"maxLength\",\n type: \"number | SizeToken\"\n }\n ]}>\n {code`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(...innerSplitText(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 </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`const timeout = setTimeout(() => {\n throw new Error(\"Text splitting took too long, likely due to a very long line without spaces or a very small maxLength. Please ensure that the input text contains reasonable break points and that maxLength is set to a reasonable value.\");\n }, 1000);\n\n try {\n return innerSplitText(text, maxLength);\n } finally {\n clearTimeout(timeout);\n }\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 <InterfaceDeclaration\n export\n name=\"LinkOptions\"\n doc=\"Options for formatting a hyperlink in the console.\">\n <InterfaceMember\n name=\"external\"\n optional\n type=\"boolean\"\n doc=\"Whether the link is external. If true, an external link icon will be displayed next to the link text (if supported by the terminal) and the link may be styled differently based on the current theme configuration.\"\n />\n <Spacing />\n <InterfaceMember\n name=\"text\"\n optional\n type=\"string\"\n doc=\"The text to display for the link. If not provided, the URL will be used as the text.\"\n />\n <Spacing />\n <InterfaceMember\n name=\"useTextWhenUnsupported\"\n optional\n type=\"boolean\"\n doc=\"Whether to use the text when the hyperlink is not supported. If true, the text will be displayed even if the terminal does not support hyperlinks.\"\n />\n </InterfaceDeclaration>\n <Spacing />\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=\"options\">\n {`Options for formatting the hyperlink.`}\n </TSDocParam>\n <TSDocReturns>{`The formatted hyperlink string for display in the console.`}</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: \"options\", type: \"LinkOptions\", default: \"{}\" }\n ]}>\n <IfStatement condition={code`isHyperlinkSupported()`}>\n {code`return \\`\\\\x1b]8;;\\${url}\\\\u0007\\${options.text ? options.text : url}\\\\x1b]8;;\\\\u0007\\${options.external === true ? \"${\n theme.icons.link.external\n }\" : \"\"}\\`;`}\n </IfStatement>\n <hbr />\n <IfStatement condition={code`isColorSupported`}>\n {code`return \\`\\${underline(textColors.body.link(\\`\\${options.useTextWhenUnsupported && options.text ? options.text : url}\\`))}\\${options.external === true ? \"${\n theme.icons.link.external\n }\" : \"\"}\\`;`}\n </IfStatement>\n <hbr />\n {code`return \\`\\${options.useTextWhenUnsupported && options.text ? options.text : url}\\${options.external === 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 const theme = useTheme();\n\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 => \\`\\${borderColors.app.blockquote.primary(isUnicodeSupported() ? \"${\n theme.borderStyles.app.blockquote.primary.left\n }\" : \"|\")} \\${italic(line)} \\`).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 const lines = splitText(\n String(text),\n Math.max(getTerminalSize().columns, 20)\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\\${lines.map((line, index) => \\` \\${\" \".repeat(String(lines.length).length - String(index + 1).length)}\\${textColors.body.tertiary(index + 1)} \\${textColors.body.primary(line)}\\`).join(\"\\\\n\")}\\`; `}\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\": [\"ThemeSpinnerResolvedConfig\"],\n \"@shell-shock/plugin-theme/helpers/spinners\": [\n \"SpinnerPreset\",\n \"resolveSpinner\"\n ],\n \"node:util\": [\"stripVTControlCharacters\"]\n })}\n builtinImports={defu(builtinImports, {\n utils: [\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 | { message: string; stack?: string }\",\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\n condition={code`(err as { message: string; stack?: string })?.message`}>\n {code`message = (err as { message: string; stack?: string }).message;`}\n </IfStatement>\n <ElseClause>{code`message = String(err);`}</ElseClause>\n <Spacing />\n <IfStatement\n condition={code`env.STACKTRACE && typeof err === \"object\" && (err as { stack?: string })?.stack`}>\n {code`message += \" \\\\n\\\\n\" + (err as { stack?: string })?.stack\n .split(\"\\\\n\")\n .slice(1)\n .map(line => {\n const match = line.match(/at (?:(.+?)\\\\s+\\\\()?(?:(.+?):(\\\\d+)(?::(\\\\d+))?|([^)]+))\\\\)?/);\n if (match) {\n const filePath = match[2] || match[5] || \"<unknown>\";\n return \\`at \\${match[1] || \"<anonymous>\"} (\\${filePath === \"<anonymous>\" || filePath === \"<unknown>\" ? filePath : link(filePath, { text: \\`\\${filePath.replace(/^.*file:\\\\/\\\\//, \"\")}\\${match[3] ? \\`:\\${match[3]}\\${match[4] ? \\`:\\${match[4]}\\` : \"\"}\\` : \"\"}\\`, useTextWhenUnsupported: true })})\\`;\n }\n\n return line.trim();\n })\n .join(\"\\\\n\"); `}\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,SAAU;GACV,UAAY;GACZ,MAAA;GACA,KAAO;GACT,UAAS,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCL,SAAQ;GACR,UAAO;GACP,MAAM;GACN,KAAK;;;;;;;;;;;;;;;;;;;;;GAqBN,CAAC;EAAE,gBAAe,SAAY,EAAE,CAAC;EAAE,gBAAc,gBAAM;GACtD,SAAM;GACN,UAAU;GACV,MAAM;GACN,KAAK;GACL,UAAM,IAAQ;;;;GAIf,CAAC;EAAE,gBAAC,SAAA,EAAA,CAAA;EAAA,gBAAA,qBAAA;GACH,UAAI;GACJ,MAAI;GACJ,KAAI;GACJ,YAAY,CAAA;IACV,MAAG;IACH,MAAI;IACJ,KAAI;IACL,EAAE;IACD,MAAI;IACJ,MAAI;IACJ,KAAI;IACL,CAAC;GACF,UAAQ,IAAI;;;;;;;;;;;GAWb,CAAC;EAAE,gBAAK,SAAA,EAAA,CAAA;EAAA;;;;;AASX,SAAS,cAAc,EACrB,QACA,SACA,SACA,iBAAc,SACT;AACL,QAAM,IAAA,uDAAA,iBAAA,KAAA,uBAAA;;;;;;;;;;;wCAWkB,iBAAA,IAAA,OAAA,KAAA,MAAA,OAAA,MAAA,KAAA,iBAAA,OAAA,WAAA,KAAA,OAAA,OAAA,KAAA,mBAAA,OAAA,WAAA,MAAA,OAAA,OAAA,MAAA,GAAA;;wCAEhB,iBAAA,IAAA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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;;EAET,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, titleCase } 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 | number | boolean | null | undefined${\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(String(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(String(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(String(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 ${getIndefiniteArticle(\n titleCase(modifier)\n )} ${titleCase(modifier)} text-style to provided console text.`}>\n <TSDocParam name=\"text\">\n {`The console text to which the ${titleCase(\n modifier\n )} text-style should be applied.`}\n </TSDocParam>\n <TSDocReturns>\n {`A string with ANSI escape codes applied for ${titleCase(\n modifier\n )} text-style, 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 function that applies ${getIndefiniteArticle(\n titleCase(color)\n )} ${titleCase(color)} 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 ${getIndefiniteArticle(\n titleCase(color)\n )} ${titleCase(color)} 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 ${titleCase(\n color\n )} 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 ${titleCase(\n color\n )} color 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(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 doc: \"An input line which may contain ANSI escape codes. This is used to adjust the index for splitting the line based on visible characters rather than raw string length, ensuring that ANSI codes do not cause incorrect splitting of the text.\"\n },\n {\n name: \"index\",\n type: \"number\",\n doc: \"The index at which to split the line, based on visible characters (does not account for ANSI escape codes).\"\n }\n ]}\n returnType=\"number\">\n {code`let adjustedIndex = 0;\n let visibleCount = 0;\n const ansiRegex = 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\n while (visibleCount < index && adjustedIndex < line.length) {\n ansiRegex.lastIndex = adjustedIndex;\n const match = ansiRegex.exec(line);\n\n if (match && match.index === adjustedIndex) {\n adjustedIndex += match[0].length;\n } else {\n adjustedIndex++;\n visibleCount++;\n }\n }\n\n return adjustedIndex; `}\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 adjustedIndex = adjustIndex(line, index);\n const first = line.slice(0, adjustedIndex);\n const second = line.slice(adjustedIndex);\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 name=\"splitText\"\n export\n parameters={[\n {\n name: \"text\",\n type: \"string\"\n },\n {\n name: \"maxLength\",\n type: \"number | SizeToken\"\n }\n ]}>\n {code`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 strippedLine = stripAnsi(line);\n const index = [\" \", \"/\", \"+\", \".\", \",\"].reduce((ret, split) => {\n let cursor = ret;\n while (strippedLine.substring(cursor + 1).includes(split) &&\n strippedLine.indexOf(split, cursor + 1) <= calculatedMaxLength) {\n cursor = strippedLine.indexOf(split, cursor + 1);\n }\n\n return cursor;\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 </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 }, 12)\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 <InterfaceDeclaration\n export\n name=\"LinkOptions\"\n doc=\"Options for formatting a hyperlink in the console.\">\n <InterfaceMember\n name=\"external\"\n optional\n type=\"boolean\"\n doc=\"Whether the link is external. If true, an external link icon will be displayed next to the link text (if supported by the terminal) and the link may be styled differently based on the current theme configuration.\"\n />\n <Spacing />\n <InterfaceMember\n name=\"text\"\n optional\n type=\"string\"\n doc=\"The text to display for the link. If not provided, the URL will be used as the text.\"\n />\n <Spacing />\n <InterfaceMember\n name=\"useTextWhenUnsupported\"\n optional\n type=\"boolean\"\n doc=\"Whether to use the text when the hyperlink is not supported. If true, the text will be displayed even if the terminal does not support hyperlinks.\"\n />\n </InterfaceDeclaration>\n <Spacing />\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=\"options\">\n {`Options for formatting the hyperlink.`}\n </TSDocParam>\n <TSDocReturns>{`The formatted hyperlink string for display in the console.`}</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: \"options\", type: \"LinkOptions\", default: \"{}\" }\n ]}>\n <IfStatement condition={code`isHyperlinkSupported()`}>\n {code`return \\`\\\\x1b]8;;\\${url}\\\\u0007\\${options.text ? options.text : url}\\\\x1b]8;;\\\\u0007\\${options.external === true ? \"${\n theme.icons.link.external\n }\" : \"\"}\\`;`}\n </IfStatement>\n <hbr />\n <IfStatement condition={code`isColorSupported`}>\n {code`return \\`\\${underline(textColors.body.link(\\`\\${options.useTextWhenUnsupported && options.text ? options.text : url}\\`))}\\${options.external === true ? \"${\n theme.icons.link.external\n }\" : \"\"}\\`;`}\n </IfStatement>\n <hbr />\n {code`return \\`\\${options.useTextWhenUnsupported && options.text ? options.text : url}\\${options.external === 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 const theme = useTheme();\n\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 => \\`\\${borderColors.app.blockquote.primary(isUnicodeSupported() ? \"${\n theme.borderStyles.app.blockquote.primary.left\n }\" : \"|\")} \\${italic(line)} \\`).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 const lines = splitText(\n String(text),\n Math.max(getTerminalSize().columns, 20)\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\\${lines.map((line, index) => \\` \\${\" \".repeat(String(lines.length).length - String(index + 1).length)}\\${textColors.body.tertiary(index + 1)} \\${textColors.body.primary(line)}\\`).join(\"\\\\n\")}\\`; `}\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 inverse(\\`\\${text}\\`); `}\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\": [\"ThemeSpinnerResolvedConfig\"],\n \"@shell-shock/plugin-theme/helpers/spinners\": [\n \"SpinnerPreset\",\n \"resolveSpinner\"\n ],\n \"node:util\": [\"stripVTControlCharacters\"]\n })}\n builtinImports={defu(builtinImports, {\n utils: [\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 | { message: string; stack?: string }\",\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\n condition={code`(err as { message: string; stack?: string })?.message`}>\n {code`message = (err as { message: string; stack?: string }).message;`}\n </IfStatement>\n <ElseClause>{code`message = String(err);`}</ElseClause>\n <Spacing />\n <IfStatement\n condition={code`env.STACKTRACE && typeof err === \"object\" && (err as { stack?: string })?.stack`}>\n {code`message += \" \\\\n\\\\n\" + (err as { stack: string }).stack.split(\"\\\\n\").slice(1).map(line => {\n const match = line.match(/at (?:(.+?)\\\\s+\\\\()?(?:(.+?):(\\\\d+)(?::(\\\\d+))?|([^)]+))\\\\)?/);\n if (match) {\n const filePath = match[2] || match[5] || \"<unknown>\";\n return \\`at \\${match[1] || \"<anonymous>\"} (\\${filePath === \"<anonymous>\" || filePath === \"<unknown>\" ? filePath : link(filePath, { text: \\`\\${filePath.replace(/^.*file:\\\\/\\\\//, \"\")}\\${match[3] ? \\`:\\${match[3]}\\${match[4] ? \\`:\\${match[4]}\\` : \"\"}\\` : \"\"}\\`, useTextWhenUnsupported: true })})\\`;\n }\n\n return line.trim();\n }).join(\"\\\\n\"); `}\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,SAAU;GACV,UAAY;GACZ,MAAA;GACA,KAAO;GACT,UAAS,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCL,SAAQ;GACR,UAAO;GACP,MAAM;GACN,KAAK;;;;;;;;;;;;;;;;;;;;;GAqBN,CAAC;EAAE,gBAAe,SAAY,EAAE,CAAC;EAAE,gBAAc,gBAAM;GACtD,SAAM;GACN,UAAU;GACV,MAAM;GACN,KAAK;GACL,UAAM,IAAQ;;;;GAIf,CAAC;EAAE,gBAAC,SAAA,EAAA,CAAA;EAAA,gBAAA,qBAAA;GACH,UAAI;GACJ,MAAI;GACJ,KAAI;GACJ,YAAY,CAAA;IACV,MAAG;IACH,MAAI;IACJ,KAAI;IACL,EAAE;IACD,MAAI;IACJ,MAAI;IACJ,KAAI;IACL,CAAC;GACF,UAAQ,IAAI;;;;;;;;;;;GAWb,CAAC;EAAE,gBAAK,SAAA,EAAA,CAAA;EAAA;;;;;AASX,SAAS,cAAc,EACrB,QACA,S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;QACZ,UAAU,IAAG;QACd,CAAC;OAAE,gBAAa,YAAA,EACf,UAAI,IAAU,0BACf,CAAC;OAAE,gBAAgB,SAAA,EAAA,CAAA;OAAA,gBAA4B,aAAmB;QACjE,WAAI,IAAW;QACf,UAAG,IAAA;;;;;;;;;QASJ,CAAC;OAAC;;;;;;;;;;;;;;;;EAIV,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shell-shock/plugin-console",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "private": false,
5
5
  "description": "A package containing a Shell Shock plugin to generate the `console` built-in module.",
6
6
  "keywords": [
@@ -125,18 +125,18 @@
125
125
  "dependencies": {
126
126
  "@alloy-js/core": "0.23.0-dev.8",
127
127
  "@alloy-js/typescript": "0.23.0-dev.4",
128
- "@powerlines/deepkit": "^0.8.1",
129
- "@powerlines/plugin-alloy": "^0.26.16",
130
- "@powerlines/plugin-plugin": "^0.12.348",
131
- "@shell-shock/core": "^0.17.5",
132
- "@shell-shock/plugin-theme": "^0.4.18",
128
+ "@powerlines/deepkit": "^0.8.2",
129
+ "@powerlines/plugin-alloy": "^0.26.18",
130
+ "@powerlines/plugin-plugin": "^0.12.350",
131
+ "@shell-shock/core": "^0.17.6",
132
+ "@shell-shock/plugin-theme": "^0.4.19",
133
133
  "@stryke/string-format": "^0.17.9",
134
134
  "@stryke/type-checks": "^0.6.1",
135
135
  "defu": "^6.1.7",
136
- "powerlines": "^0.42.38"
136
+ "powerlines": "^0.42.40"
137
137
  },
138
138
  "devDependencies": {
139
- "@powerlines/plugin-deepkit": "^0.11.278",
139
+ "@powerlines/plugin-deepkit": "^0.11.280",
140
140
  "@types/node": "^25.6.0"
141
141
  },
142
142
  "publishConfig": {
@@ -154,5 +154,5 @@
154
154
  "./package.json": "./package.json"
155
155
  }
156
156
  },
157
- "gitHead": "6ef904ba0c05e26d17cc27465a09c535d6fd6b3c"
157
+ "gitHead": "592aee8162fccb2d8547f6cf31b820aca3ae13ec"
158
158
  }