@apia/theme 4.0.37 → 4.0.41
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-DYGQfvLC.js → index-B2pK-8hw.js} +192 -142
- package/dist/index-B2pK-8hw.js.map +1 -0
- package/dist/index.d.ts +67 -46
- package/dist/index.js +1 -1
- package/dist/{styles-BQLlZhHD.js → styles-Diuey2Pf.js} +14 -4
- package/dist/{styles-BQLlZhHD.js.map → styles-Diuey2Pf.js.map} +1 -1
- package/package.json +3 -3
- package/dist/index-DYGQfvLC.js.map +0 -1
|
@@ -5757,51 +5757,6 @@ const semanticSearch = {
|
|
|
5757
5757
|
padding: "0 24px 32px 24px",
|
|
5758
5758
|
fontWeight: "bold"
|
|
5759
5759
|
},
|
|
5760
|
-
".markdown": {
|
|
5761
|
-
padding: "0 24px 32px 24px",
|
|
5762
|
-
"h1, h2, h3, h4, h5, h6": {
|
|
5763
|
-
margin: "32px 0px 20px 0px",
|
|
5764
|
-
"& *": {
|
|
5765
|
-
fontSize: "inherit",
|
|
5766
|
-
fontWeight: "inherit",
|
|
5767
|
-
fontFamily: "inherit"
|
|
5768
|
-
}
|
|
5769
|
-
},
|
|
5770
|
-
blockquote: {
|
|
5771
|
-
fontStyle: "italic"
|
|
5772
|
-
},
|
|
5773
|
-
table: {
|
|
5774
|
-
variant: "layout.common.tables.secondary",
|
|
5775
|
-
thead: {
|
|
5776
|
-
zIndex: 0
|
|
5777
|
-
}
|
|
5778
|
-
},
|
|
5779
|
-
h2: {
|
|
5780
|
-
display: "block",
|
|
5781
|
-
borderBottom: "2px solid hsl(195deg 10% 49% / 50%)",
|
|
5782
|
-
paddingBottom: "16px"
|
|
5783
|
-
},
|
|
5784
|
-
h3: {
|
|
5785
|
-
textDecoration: "underline"
|
|
5786
|
-
},
|
|
5787
|
-
h4: {
|
|
5788
|
-
fontSize: "20px"
|
|
5789
|
-
},
|
|
5790
|
-
ul: {
|
|
5791
|
-
listStyle: "unset",
|
|
5792
|
-
listStyleType: "disc",
|
|
5793
|
-
margin: "unset",
|
|
5794
|
-
padding: "unset",
|
|
5795
|
-
paddingLeft: "20px",
|
|
5796
|
-
paddingBottom: "16px"
|
|
5797
|
-
},
|
|
5798
|
-
"ol + ul, ul + ul, ol ul, ul ul": {
|
|
5799
|
-
paddingLeft: "72px"
|
|
5800
|
-
},
|
|
5801
|
-
"p, ul, ol, blockQuote, table": {
|
|
5802
|
-
mt: "16px"
|
|
5803
|
-
}
|
|
5804
|
-
},
|
|
5805
5760
|
".filters__container": {
|
|
5806
5761
|
" > div": {
|
|
5807
5762
|
display: "flex",
|
|
@@ -6343,9 +6298,10 @@ const controller = {
|
|
|
6343
6298
|
display: "flex",
|
|
6344
6299
|
flexDirection: "column",
|
|
6345
6300
|
alignItems: "stretch",
|
|
6346
|
-
|
|
6301
|
+
height: "100%",
|
|
6347
6302
|
gap: 3,
|
|
6348
6303
|
flexBasis: "50vh",
|
|
6304
|
+
flexGrow: 1,
|
|
6349
6305
|
".autoscrollContainer": {
|
|
6350
6306
|
flexGrow: 1,
|
|
6351
6307
|
flexShrink: 1,
|
|
@@ -6356,7 +6312,8 @@ const controller = {
|
|
|
6356
6312
|
},
|
|
6357
6313
|
".assistantHistory": {
|
|
6358
6314
|
flexGrow: 1,
|
|
6359
|
-
overflow: "auto"
|
|
6315
|
+
overflow: "auto",
|
|
6316
|
+
maxHeight: "77vh"
|
|
6360
6317
|
}
|
|
6361
6318
|
};
|
|
6362
6319
|
|
|
@@ -6463,6 +6420,9 @@ const assistant = {
|
|
|
6463
6420
|
".modal__main": {
|
|
6464
6421
|
maxWidth: "unset",
|
|
6465
6422
|
overflow: "hidden"
|
|
6423
|
+
},
|
|
6424
|
+
"#floatingAssistant": {
|
|
6425
|
+
minWidth: "500px"
|
|
6466
6426
|
}
|
|
6467
6427
|
}
|
|
6468
6428
|
};
|
|
@@ -6477,6 +6437,52 @@ const chat = {
|
|
|
6477
6437
|
message
|
|
6478
6438
|
};
|
|
6479
6439
|
|
|
6440
|
+
const markdown = {
|
|
6441
|
+
padding: "0 24px 32px 24px",
|
|
6442
|
+
"h1, h2, h3, h4, h5, h6": {
|
|
6443
|
+
margin: "32px 0px 20px 0px",
|
|
6444
|
+
"& *": {
|
|
6445
|
+
fontSize: "inherit",
|
|
6446
|
+
fontWeight: "inherit",
|
|
6447
|
+
fontFamily: "inherit"
|
|
6448
|
+
}
|
|
6449
|
+
},
|
|
6450
|
+
blockquote: {
|
|
6451
|
+
fontStyle: "italic"
|
|
6452
|
+
},
|
|
6453
|
+
table: {
|
|
6454
|
+
variant: "layout.common.tables.secondary",
|
|
6455
|
+
thead: {
|
|
6456
|
+
zIndex: 0
|
|
6457
|
+
}
|
|
6458
|
+
},
|
|
6459
|
+
h2: {
|
|
6460
|
+
display: "block",
|
|
6461
|
+
borderBottom: "2px solid hsl(195deg 10% 49% / 50%)",
|
|
6462
|
+
paddingBottom: "16px"
|
|
6463
|
+
},
|
|
6464
|
+
h3: {
|
|
6465
|
+
textDecoration: "underline"
|
|
6466
|
+
},
|
|
6467
|
+
h4: {
|
|
6468
|
+
fontSize: "20px"
|
|
6469
|
+
},
|
|
6470
|
+
ul: {
|
|
6471
|
+
listStyle: "unset",
|
|
6472
|
+
listStyleType: "disc",
|
|
6473
|
+
margin: "unset",
|
|
6474
|
+
padding: "unset",
|
|
6475
|
+
paddingLeft: "20px",
|
|
6476
|
+
paddingBottom: "16px"
|
|
6477
|
+
},
|
|
6478
|
+
"ol + ul, ul + ul, ol ul, ul ul": {
|
|
6479
|
+
paddingLeft: "72px"
|
|
6480
|
+
},
|
|
6481
|
+
"p, ul, ol, blockQuote, table": {
|
|
6482
|
+
mt: "16px"
|
|
6483
|
+
}
|
|
6484
|
+
};
|
|
6485
|
+
|
|
6480
6486
|
const common = (theme) => {
|
|
6481
6487
|
return {
|
|
6482
6488
|
boxes,
|
|
@@ -6487,7 +6493,8 @@ const common = (theme) => {
|
|
|
6487
6493
|
trees,
|
|
6488
6494
|
tooltips,
|
|
6489
6495
|
ai,
|
|
6490
|
-
chat
|
|
6496
|
+
chat,
|
|
6497
|
+
markdown
|
|
6491
6498
|
/* PREPEND HERE */
|
|
6492
6499
|
};
|
|
6493
6500
|
};
|
|
@@ -7835,6 +7842,37 @@ const ApiaThemeProvider = ({
|
|
|
7835
7842
|
return /* @__PURE__ */ jsx(ThemeProvider, { theme, children });
|
|
7836
7843
|
};
|
|
7837
7844
|
|
|
7845
|
+
const name$5 = "pageBreak";
|
|
7846
|
+
const pageBreakTag = "@@@ PAGEBREAK @@@";
|
|
7847
|
+
const pageBreakExtension = {
|
|
7848
|
+
name: name$5,
|
|
7849
|
+
parser: (state, startLine, _endLine, checkMode) => {
|
|
7850
|
+
const line = state.getLines(startLine, startLine + 1, 0, false);
|
|
7851
|
+
if (line.trim() !== pageBreakTag)
|
|
7852
|
+
return false;
|
|
7853
|
+
if (checkMode)
|
|
7854
|
+
return true;
|
|
7855
|
+
state.tokens.push({
|
|
7856
|
+
type: name$5,
|
|
7857
|
+
level: 0,
|
|
7858
|
+
lines: [startLine, startLine + 1]
|
|
7859
|
+
});
|
|
7860
|
+
state.line = startLine + 1;
|
|
7861
|
+
return true;
|
|
7862
|
+
},
|
|
7863
|
+
replacer: () => () => `<div class="${name$5}"></div>`,
|
|
7864
|
+
styles: () => `
|
|
7865
|
+
.${name$5} + * {
|
|
7866
|
+
page-break-before: always;
|
|
7867
|
+
}
|
|
7868
|
+
|
|
7869
|
+
.${name$5} {
|
|
7870
|
+
display: none;
|
|
7871
|
+
}
|
|
7872
|
+
|
|
7873
|
+
`
|
|
7874
|
+
};
|
|
7875
|
+
|
|
7838
7876
|
function assignHelp(fn) {
|
|
7839
7877
|
Object.assign(fn, {
|
|
7840
7878
|
help: `A markdown parser. Accepts a configuration object with the following structure:
|
|
@@ -7900,17 +7938,17 @@ const errorExtension = {
|
|
|
7900
7938
|
}`
|
|
7901
7939
|
};
|
|
7902
7940
|
|
|
7903
|
-
var __defProp$
|
|
7904
|
-
var __defNormalProp$
|
|
7905
|
-
var __publicField$
|
|
7906
|
-
__defNormalProp$
|
|
7941
|
+
var __defProp$5 = Object.defineProperty;
|
|
7942
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7943
|
+
var __publicField$5 = (obj, key, value) => {
|
|
7944
|
+
__defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7907
7945
|
return value;
|
|
7908
7946
|
};
|
|
7909
7947
|
class HeadingToken {
|
|
7910
7948
|
constructor(content, level) {
|
|
7911
7949
|
this.level = level;
|
|
7912
|
-
__publicField$
|
|
7913
|
-
__publicField$
|
|
7950
|
+
__publicField$5(this, "_content");
|
|
7951
|
+
__publicField$5(this, "type", "heading");
|
|
7914
7952
|
this._content = content;
|
|
7915
7953
|
}
|
|
7916
7954
|
get content() {
|
|
@@ -7979,10 +8017,10 @@ const successExtension = {
|
|
|
7979
8017
|
}`
|
|
7980
8018
|
};
|
|
7981
8019
|
|
|
7982
|
-
var __defProp$
|
|
7983
|
-
var __defNormalProp$
|
|
7984
|
-
var __publicField$
|
|
7985
|
-
__defNormalProp$
|
|
8020
|
+
var __defProp$4 = Object.defineProperty;
|
|
8021
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8022
|
+
var __publicField$4 = (obj, key, value) => {
|
|
8023
|
+
__defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7986
8024
|
return value;
|
|
7987
8025
|
};
|
|
7988
8026
|
var __accessCheck$1 = (obj, member, msg) => {
|
|
@@ -8010,9 +8048,9 @@ class TableToken {
|
|
|
8010
8048
|
constructor(content, lines) {
|
|
8011
8049
|
this.lines = lines;
|
|
8012
8050
|
__privateAdd$1(this, _getColumnAlignment$1);
|
|
8013
|
-
__publicField$
|
|
8014
|
-
__publicField$
|
|
8015
|
-
__publicField$
|
|
8051
|
+
__publicField$4(this, "content");
|
|
8052
|
+
__publicField$4(this, "level", 1);
|
|
8053
|
+
__publicField$4(this, "type", name$1);
|
|
8016
8054
|
this.content = JSON.stringify(content);
|
|
8017
8055
|
}
|
|
8018
8056
|
getTable() {
|
|
@@ -8047,7 +8085,7 @@ getColumnAlignment_fn$1 = function(table, index) {
|
|
|
8047
8085
|
return getCell(table.header[i - 1]).align;
|
|
8048
8086
|
};
|
|
8049
8087
|
const name$1 = "advancedTable";
|
|
8050
|
-
const headerRowRegex = /^ *(?:\{ *#([\w
|
|
8088
|
+
const headerRowRegex = /^ *(?:\{ *#([\w-]+) *\})? *((?:\|.+)+\|) *$/;
|
|
8051
8089
|
const rowRegex = /^ *(?:\|.+)+\| *$/;
|
|
8052
8090
|
const separatorRegex = /^ *(?:\| *:? *----* *:? *)+\| *$/;
|
|
8053
8091
|
class TableExtension {
|
|
@@ -8062,7 +8100,7 @@ class TableExtension {
|
|
|
8062
8100
|
return `${cell.className ? ` class="${cell.className ?? ""}"` : ""}`;
|
|
8063
8101
|
},
|
|
8064
8102
|
parseCellString(content) {
|
|
8065
|
-
const classNameRegex = /\(\.([
|
|
8103
|
+
const classNameRegex = /\(\.([^)]+)\)/;
|
|
8066
8104
|
const className = content.match(classNameRegex)?.[1];
|
|
8067
8105
|
return {
|
|
8068
8106
|
parsedCell: { className },
|
|
@@ -8104,7 +8142,7 @@ class TableExtension {
|
|
|
8104
8142
|
return `${style ? ` style="${style}"` : ""}`;
|
|
8105
8143
|
},
|
|
8106
8144
|
parseCellString(content) {
|
|
8107
|
-
const stylesRegex = /\(\{style:([
|
|
8145
|
+
const stylesRegex = /\(\{style:([^}]+)\}\)/;
|
|
8108
8146
|
const style = content.match(stylesRegex)?.[1] ?? "";
|
|
8109
8147
|
return {
|
|
8110
8148
|
parsedCell: { style },
|
|
@@ -8113,8 +8151,8 @@ class TableExtension {
|
|
|
8113
8151
|
}
|
|
8114
8152
|
}
|
|
8115
8153
|
]);
|
|
8116
|
-
__publicField$
|
|
8117
|
-
__publicField$
|
|
8154
|
+
__publicField$4(this, "name", name$1);
|
|
8155
|
+
__publicField$4(this, "parser", (state, startLine, endLine, checkMode) => {
|
|
8118
8156
|
if (startLine + 1 >= endLine) {
|
|
8119
8157
|
return false;
|
|
8120
8158
|
}
|
|
@@ -8169,10 +8207,10 @@ class TableExtension {
|
|
|
8169
8207
|
}
|
|
8170
8208
|
return false;
|
|
8171
8209
|
});
|
|
8172
|
-
__publicField$
|
|
8210
|
+
__publicField$4(this, "replacer", (md) => (tokens, idx) => {
|
|
8173
8211
|
return tokens[idx].getTableString(__privateGet$1(this, _cellParsers), md);
|
|
8174
8212
|
});
|
|
8175
|
-
__publicField$
|
|
8213
|
+
__publicField$4(this, "styles", () => "");
|
|
8176
8214
|
}
|
|
8177
8215
|
}
|
|
8178
8216
|
_cellParsers = new WeakMap();
|
|
@@ -8245,7 +8283,8 @@ const markdownExtensions = [
|
|
|
8245
8283
|
errorExtension,
|
|
8246
8284
|
successExtension,
|
|
8247
8285
|
new TableExtension(),
|
|
8248
|
-
warningExtension
|
|
8286
|
+
warningExtension,
|
|
8287
|
+
pageBreakExtension
|
|
8249
8288
|
];
|
|
8250
8289
|
|
|
8251
8290
|
function isInlineExtension(ext) {
|
|
@@ -8273,7 +8312,7 @@ async function getRemarkable(extensions) {
|
|
|
8273
8312
|
|
|
8274
8313
|
const parseMarkdown = async (options) => {
|
|
8275
8314
|
const markdownLibrary = await getRemarkable(options.extensions);
|
|
8276
|
-
const css = (await import('./styles-
|
|
8315
|
+
const css = (await import('./styles-Diuey2Pf.js')).markdownParserStyles ?? new ErrorImporting();
|
|
8277
8316
|
if (css instanceof ErrorImporting)
|
|
8278
8317
|
throw new Error("Could not import css, cannot continue");
|
|
8279
8318
|
const html = options.htmlTemplate ?? (await import('./html-B-K0BIiw.js')).markdownHtml ?? new ErrorImporting();
|
|
@@ -8282,59 +8321,16 @@ const parseMarkdown = async (options) => {
|
|
|
8282
8321
|
const markdownString = options.content;
|
|
8283
8322
|
const markdownParser = markdownLibrary.render.bind(markdownLibrary);
|
|
8284
8323
|
let htmlString = markdownParser(markdownString);
|
|
8285
|
-
if (options.
|
|
8324
|
+
if (options.tocProps) {
|
|
8286
8325
|
const b = new MarkdownBuilder();
|
|
8287
|
-
htmlString = b.addTableOfContents(options.
|
|
8326
|
+
htmlString = b.addTableOfContents(options.tocProps, htmlString);
|
|
8288
8327
|
}
|
|
8289
8328
|
const rendered = html(
|
|
8290
8329
|
options.title,
|
|
8291
8330
|
css(options.additionalStyles, options.extensions),
|
|
8292
8331
|
`${options?.additionalBodyContent?.before ?? ""}${htmlString}${options?.additionalBodyContent?.after ?? ""}`
|
|
8293
8332
|
);
|
|
8294
|
-
|
|
8295
|
-
try {
|
|
8296
|
-
const DOMParserCtor = globalThis.DOMParser;
|
|
8297
|
-
const hasDOM = typeof DOMParserCtor !== "undefined" && typeof globalThis.document !== "undefined";
|
|
8298
|
-
if (hasDOM) {
|
|
8299
|
-
const parser = new DOMParserCtor();
|
|
8300
|
-
const doc = parser.parseFromString(finalHtml, "text/html");
|
|
8301
|
-
const body = doc.body;
|
|
8302
|
-
const headings = Array.from(
|
|
8303
|
-
body.querySelectorAll("h1, h2, h3")
|
|
8304
|
-
);
|
|
8305
|
-
for (const h of headings) {
|
|
8306
|
-
if (h.tagName === "H1") {
|
|
8307
|
-
h.classList.add("mt-high");
|
|
8308
|
-
}
|
|
8309
|
-
const parent = h.parentElement;
|
|
8310
|
-
if (parent && parent.tagName === "DIV" && parent.getAttribute("data-keep-with-next") === "true") {
|
|
8311
|
-
continue;
|
|
8312
|
-
}
|
|
8313
|
-
const wrapper = doc.createElement("div");
|
|
8314
|
-
wrapper.setAttribute(
|
|
8315
|
-
"style",
|
|
8316
|
-
"break-inside: avoid; display: flex; flex-direction: column; gap: var(--space-6)"
|
|
8317
|
-
);
|
|
8318
|
-
wrapper.setAttribute("data-keep-with-next", "true");
|
|
8319
|
-
h.parentNode.insertBefore(wrapper, h);
|
|
8320
|
-
let node = h;
|
|
8321
|
-
while (node) {
|
|
8322
|
-
const next = node.nextSibling;
|
|
8323
|
-
wrapper.appendChild(node);
|
|
8324
|
-
if (next && next.tagName) {
|
|
8325
|
-
const tag = String(next.tagName);
|
|
8326
|
-
if (/^H[1-6]$/.test(tag)) {
|
|
8327
|
-
break;
|
|
8328
|
-
}
|
|
8329
|
-
}
|
|
8330
|
-
node = next;
|
|
8331
|
-
}
|
|
8332
|
-
}
|
|
8333
|
-
finalHtml = doc.documentElement.outerHTML;
|
|
8334
|
-
}
|
|
8335
|
-
} catch {
|
|
8336
|
-
}
|
|
8337
|
-
return finalHtml;
|
|
8333
|
+
return rendered;
|
|
8338
8334
|
};
|
|
8339
8335
|
assignHelp(parseMarkdown);
|
|
8340
8336
|
|
|
@@ -8381,17 +8377,17 @@ class MarkdownHeader extends MarkdownParagraph {
|
|
|
8381
8377
|
}
|
|
8382
8378
|
}
|
|
8383
8379
|
|
|
8384
|
-
var __defProp$
|
|
8385
|
-
var __defNormalProp$
|
|
8386
|
-
var __publicField$
|
|
8387
|
-
__defNormalProp$
|
|
8380
|
+
var __defProp$3 = Object.defineProperty;
|
|
8381
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8382
|
+
var __publicField$3 = (obj, key, value) => {
|
|
8383
|
+
__defNormalProp$3(obj, key + "" , value);
|
|
8388
8384
|
return value;
|
|
8389
8385
|
};
|
|
8390
8386
|
class MarkdownList extends MarkdownBlock {
|
|
8391
8387
|
constructor(sorted = false) {
|
|
8392
8388
|
super();
|
|
8393
8389
|
this.sorted = sorted;
|
|
8394
|
-
__publicField$
|
|
8390
|
+
__publicField$3(this, "items", []);
|
|
8395
8391
|
}
|
|
8396
8392
|
/**
|
|
8397
8393
|
* Cada elemento de la lista es un MarkdownBuilder.
|
|
@@ -8431,6 +8427,39 @@ class MarkdownList extends MarkdownBlock {
|
|
|
8431
8427
|
}
|
|
8432
8428
|
}
|
|
8433
8429
|
|
|
8430
|
+
var __defProp$2 = Object.defineProperty;
|
|
8431
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8432
|
+
var __publicField$2 = (obj, key, value) => {
|
|
8433
|
+
__defNormalProp$2(obj, key + "" , value);
|
|
8434
|
+
return value;
|
|
8435
|
+
};
|
|
8436
|
+
class MarkdownPage extends MarkdownBlock {
|
|
8437
|
+
constructor() {
|
|
8438
|
+
super(...arguments);
|
|
8439
|
+
__publicField$2(this, "items", []);
|
|
8440
|
+
}
|
|
8441
|
+
/**
|
|
8442
|
+
* Cada elemento de la lista es un MarkdownBuilder.
|
|
8443
|
+
*
|
|
8444
|
+
* Si se pasa text como parámetro, este texto será agregado mediante
|
|
8445
|
+
* builder.p(text)
|
|
8446
|
+
*/
|
|
8447
|
+
add(text) {
|
|
8448
|
+
const newBuilder = new MarkdownBuilder();
|
|
8449
|
+
if (text)
|
|
8450
|
+
newBuilder.p(text);
|
|
8451
|
+
this.items.push(newBuilder);
|
|
8452
|
+
return newBuilder;
|
|
8453
|
+
}
|
|
8454
|
+
toString() {
|
|
8455
|
+
return `<div class="md-page">
|
|
8456
|
+
|
|
8457
|
+
${this.items.map((c) => c.toMarkdown()).join("\n")}
|
|
8458
|
+
|
|
8459
|
+
</div>`;
|
|
8460
|
+
}
|
|
8461
|
+
}
|
|
8462
|
+
|
|
8434
8463
|
var __defProp$1 = Object.defineProperty;
|
|
8435
8464
|
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8436
8465
|
var __publicField$1 = (obj, key, value) => {
|
|
@@ -8593,25 +8622,29 @@ class MarkdownTableOfContents extends MarkdownParagraph {
|
|
|
8593
8622
|
* procesados por setUniqueIds) y crea una tabla de contenidos a partir de
|
|
8594
8623
|
* esos ids
|
|
8595
8624
|
*/
|
|
8596
|
-
static makeTableOfContents(
|
|
8625
|
+
static makeTableOfContents(props, html) {
|
|
8597
8626
|
const idMap = {};
|
|
8598
8627
|
const parser = new DOMParser();
|
|
8599
8628
|
const parsedDocument = parser.parseFromString(html, "text/html");
|
|
8600
|
-
const headers = parsedDocument.querySelectorAll(
|
|
8629
|
+
const headers = parsedDocument.querySelectorAll(
|
|
8630
|
+
new Array(props.maxLevel || 3).fill(1).map((_, i) => `h${i}`).join(", ")
|
|
8631
|
+
);
|
|
8601
8632
|
const root = document.createElement("ul");
|
|
8602
8633
|
root.id = "TableOfContents";
|
|
8603
8634
|
const prevParentMap = { 0: root };
|
|
8604
8635
|
for (const header of headers) {
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8636
|
+
if (!props.filter || props.filter(header)) {
|
|
8637
|
+
this.setUniqueId(idMap, header);
|
|
8638
|
+
const depth = this.getNodeDepth(header);
|
|
8639
|
+
const parentDepth = depth - 1;
|
|
8640
|
+
this.deletePrevValues(prevParentMap, depth);
|
|
8641
|
+
const ulParent = this.getParent(prevParentMap, parentDepth);
|
|
8642
|
+
this.createNewLevel(header, ulParent, prevParentMap, parentDepth);
|
|
8643
|
+
}
|
|
8611
8644
|
}
|
|
8612
8645
|
return parsedDocument.documentElement.outerHTML.replace(
|
|
8613
8646
|
tocPlaceholder,
|
|
8614
|
-
`<h2>${title}</h2>${root.outerHTML}`
|
|
8647
|
+
`<h2>${props.title}</h2>${root.outerHTML}`
|
|
8615
8648
|
);
|
|
8616
8649
|
}
|
|
8617
8650
|
static deletePrevValues(prevParentMap, depth) {
|
|
@@ -8654,7 +8687,7 @@ class MarkdownTableOfContents extends MarkdownParagraph {
|
|
|
8654
8687
|
* De esta forma, nos aseguramos que ningún heading tenga un id igual a otro
|
|
8655
8688
|
*/
|
|
8656
8689
|
static setUniqueId(idMap, element) {
|
|
8657
|
-
const replacementRegex = /[\s
|
|
8690
|
+
const replacementRegex = /[\s()]+/g;
|
|
8658
8691
|
const replacementChar = "-";
|
|
8659
8692
|
const id = (element.id ? element.id : element.textContent)?.toLocaleLowerCase().trim().replaceAll(replacementRegex, replacementChar);
|
|
8660
8693
|
const tokens = id.split("_-_", 2);
|
|
@@ -8670,8 +8703,8 @@ class MarkdownTableOfContents extends MarkdownParagraph {
|
|
|
8670
8703
|
cond = idMap[`${tokens[0]}_-_${tokens[1]}`];
|
|
8671
8704
|
element.id = `${tokens[0]}_-_${tokens[1]}`;
|
|
8672
8705
|
}
|
|
8673
|
-
static appendTableOfContents(
|
|
8674
|
-
return this.makeTableOfContents(
|
|
8706
|
+
static appendTableOfContents(props, html) {
|
|
8707
|
+
return this.makeTableOfContents(props, html);
|
|
8675
8708
|
}
|
|
8676
8709
|
}
|
|
8677
8710
|
|
|
@@ -8723,11 +8756,23 @@ class MarkdownBuilder {
|
|
|
8723
8756
|
this.blocks.push(heading);
|
|
8724
8757
|
return heading;
|
|
8725
8758
|
}
|
|
8759
|
+
html(text) {
|
|
8760
|
+
this.blocks.push({
|
|
8761
|
+
toString() {
|
|
8762
|
+
return text.replaceAll(/\s{2,}/g, " ");
|
|
8763
|
+
}
|
|
8764
|
+
});
|
|
8765
|
+
}
|
|
8726
8766
|
p(text) {
|
|
8727
8767
|
const p = new MarkdownParagraph(text);
|
|
8728
8768
|
this.blocks.push(p);
|
|
8729
8769
|
return p;
|
|
8730
8770
|
}
|
|
8771
|
+
page() {
|
|
8772
|
+
const page = new MarkdownPage();
|
|
8773
|
+
this.blocks.push(page);
|
|
8774
|
+
return page;
|
|
8775
|
+
}
|
|
8731
8776
|
list(sorted = false) {
|
|
8732
8777
|
const list = new MarkdownList(sorted);
|
|
8733
8778
|
this.blocks.push(list);
|
|
@@ -8738,6 +8783,14 @@ class MarkdownBuilder {
|
|
|
8738
8783
|
this.blocks.push(box);
|
|
8739
8784
|
return box;
|
|
8740
8785
|
}
|
|
8786
|
+
pageBreak() {
|
|
8787
|
+
this.blocks.push({
|
|
8788
|
+
toString() {
|
|
8789
|
+
return `
|
|
8790
|
+
${pageBreakTag}`;
|
|
8791
|
+
}
|
|
8792
|
+
});
|
|
8793
|
+
}
|
|
8741
8794
|
table(header = [], rows = []) {
|
|
8742
8795
|
const table = new MarkdownTable(header, rows);
|
|
8743
8796
|
this.blocks.push(table);
|
|
@@ -8752,13 +8805,10 @@ class MarkdownBuilder {
|
|
|
8752
8805
|
}
|
|
8753
8806
|
/**
|
|
8754
8807
|
* Este método recibe un html y le agrega la tabla de contenidos, dentro de
|
|
8755
|
-
* un div con id="
|
|
8808
|
+
* un div con id="TableOfContents"
|
|
8756
8809
|
*/
|
|
8757
|
-
addTableOfContents(
|
|
8758
|
-
return MarkdownTableOfContents.appendTableOfContents(
|
|
8759
|
-
tableOfContentsTitle,
|
|
8760
|
-
html
|
|
8761
|
-
);
|
|
8810
|
+
addTableOfContents(props, html) {
|
|
8811
|
+
return MarkdownTableOfContents.appendTableOfContents(props, html);
|
|
8762
8812
|
}
|
|
8763
8813
|
toMarkdown() {
|
|
8764
8814
|
let markdown = this.blocks.map((current) => current.toString()).join("\n\n");
|
|
@@ -8767,11 +8817,11 @@ class MarkdownBuilder {
|
|
|
8767
8817
|
}
|
|
8768
8818
|
toHtml(options) {
|
|
8769
8819
|
let content = this.toMarkdown();
|
|
8770
|
-
if (options?.
|
|
8771
|
-
content = this.addTableOfContents(options.
|
|
8820
|
+
if (options?.tocProps)
|
|
8821
|
+
content = this.addTableOfContents(options.tocProps, content);
|
|
8772
8822
|
return parseMarkdown({ ...options, content });
|
|
8773
8823
|
}
|
|
8774
8824
|
}
|
|
8775
8825
|
|
|
8776
8826
|
export { ApiaThemeProvider as A, MarkdownTableOfContents as B, Form as F, MaterialInput as M, Table as T, getColorStates as a, getColorsAndStatesByDefinition as b, getColorsAndStatesByPath as c, getColorsByDefinition as d, getColorsByPath as e, getOneColorState as f, getColorState as g, applyStatesGetColor as h, makeStyledComponent as i, injectStyles as j, getSpacingLayouts as k, spacing as l, markdownExtensions as m, smallButton as n, focusOutline as o, parsePalette as p, getVariant as q, responsive$1 as r, spacingLayouts as s, MarkdownBlock as t, useMainTheme as u, MarkdownBuilder as v, parseMarkdown as w, MarkdownList as x, MarkdownParagraph as y, MarkdownTable as z };
|
|
8777
|
-
//# sourceMappingURL=index-
|
|
8827
|
+
//# sourceMappingURL=index-B2pK-8hw.js.map
|