react-markdown-table-ts 0.5.12 → 0.5.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -18564,21 +18564,28 @@ var Tooltip$1 = Tooltip;
18564
18564
  // CSS styles
18565
18565
  var LIGHT_THEME_CSS = "\ncode[class*=language-],pre[class*=language-]{color:#000;background:0 0;text-shadow:0 1px #fff;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}code[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,pre[class*=language-]::-moz-selection{text-shadow:none;background:#b3d4fc}code[class*=language-] ::selection,code[class*=language-]::selection,pre[class*=language-] ::selection,pre[class*=language-]::selection{text-shadow:none;background:#b3d4fc}@media print{code[class*=language-],pre[class*=language-]{text-shadow:none}}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#f5f2f0}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}pre[class*=language-].line-numbers{position:relative;padding-left:2.4em;counter-reset:linenumber}pre[class*=language-].line-numbers>code{position:relative;white-space:inherit}.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:0;font-size:100%;left:-3.8em;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.line-numbers-rows>span{display:block;counter-increment:linenumber}.line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.5em;text-align:right}\n";
18566
18566
  var DARK_THEME_CSS = "\ncode[class*=language-],pre[class*=language-]{color:#f8f8f2;background:0 0;text-shadow:0 1px rgba(0,0,0,.3);font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto;border-radius:.3em}:not(pre)>code[class*=language-],pre[class*=language-]{background:#282a36}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}pre[class*=language-].line-numbers{position:relative;padding-left:2.4em;counter-reset:linenumber}pre[class*=language-].line-numbers>code{position:relative;white-space:inherit}.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:0;font-size:100%;left:-3.8em;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.line-numbers-rows>span{display:block;counter-increment:linenumber}.line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.5em;text-align:right}\n";
18567
- var generateTableSyntax = function (inputData, hasHeader, columnAlignments, adjustColumnWidths, hasTabs, canReplaceNewlines, hasPadding) {
18568
- if (inputData === null) {
18569
- return 'Error: No data provided for the table.';
18567
+ var validateInputData = function (inputData) {
18568
+ if (inputData === null || !Array.isArray(inputData) || inputData.length === 0) {
18569
+ throw new MarkdownTableError("The 'data' prop must be a non-empty two-dimensional array.");
18570
18570
  }
18571
+ };
18572
+ var getTableData = function (inputData, hasHeader) {
18573
+ return hasHeader
18574
+ ? { inputDataHeader: inputData[0], inputDataBody: inputData.slice(1) }
18575
+ : { inputDataHeader: generateAlphabetHeaders(inputData[0].length), inputDataBody: inputData };
18576
+ };
18577
+ var generateTableSyntax = function (inputData, hasHeader, columnAlignments, adjustColumnWidths, hasTabs, canReplaceNewlines, hasPadding) {
18571
18578
  try {
18572
- if (!Array.isArray(inputData) || inputData.length === 0) {
18573
- throw new MarkdownTableError("The 'data' prop must be a non-empty two-dimensional array.");
18574
- }
18575
- var _a = hasHeader
18576
- ? { inputDataHeader: inputData[0], inputDataBody: inputData.slice(1) }
18577
- : { inputDataHeader: generateAlphabetHeaders(inputData[0].length), inputDataBody: inputData }, inputDataHeader = _a.inputDataHeader, inputDataBody = _a.inputDataBody;
18579
+ validateInputData(inputData);
18580
+ var nonNullInputData = inputData;
18581
+ var _a = getTableData(nonNullInputData, hasHeader), inputDataHeader = _a.inputDataHeader, inputDataBody = _a.inputDataBody;
18578
18582
  return generateMarkdownTableString({ inputDataHeader: inputDataHeader, inputDataBody: inputDataBody }, columnAlignments, adjustColumnWidths, hasTabs, canReplaceNewlines, hasPadding);
18579
18583
  }
18580
18584
  catch (error) {
18581
- return error instanceof MarkdownTableError ? "Error: ".concat(error.message) : (function () { throw error; })();
18585
+ if (error instanceof MarkdownTableError) {
18586
+ return "Error: ".concat(error.message);
18587
+ }
18588
+ throw error;
18582
18589
  }
18583
18590
  };
18584
18591
  var applySyntaxHighlighting = function (preElementRef, markdownTableSyntax) {