athena-ui-js 2.4.0 → 2.4.1

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.
@@ -1,99 +1,99 @@
1
- /** Splits tokens at the line breaks: an array (one entry per line) of arrays of { type, text }. */
2
- export function tokensToLines(tokens: any): any[][];
3
- /** The nodes of one line: text nodes and <span class="tok-..."> (a span has one class and one text node). */
4
- export function lineNodes(tokens: any): any;
5
- /**
6
- * Writes the highlighted lines of a text into a <code> element (replacing what is there). The editor uses it too.
7
- *
8
- * @param {HTMLElement} code
9
- * @param {string} text
10
- * @param {string|object} [language] a name or alias ("js"), or a language object; unknown: plain text
11
- * @param {object} [options]
12
- * @param {Array<number|string>} [options.highlightLines] line numbers (1-based) or ranges ("5-8") that get a background
13
- * @returns {number} the number of lines
14
- */
15
- export function renderCode(code: HTMLElement, text: string, language?: string | object, { highlightLines }?: {
16
- highlightLines?: Array<number | string>;
17
- }): number;
18
- /**
19
- * Highlights read-only code: a `<pre class="athena-code"><code>` element.
20
- *
21
- * @param {string} text
22
- * @param {string|object} [language] "js", "ts", "json", "html", "css", "sql", "sh", "yaml", "c#", "python" or a language you registered
23
- * @param {object} [options]
24
- * @param {boolean} [options.lineNumbers=false]
25
- * @param {Array<number|string>} [options.highlightLines]
26
- * @param {boolean} [options.wrap=false] long lines wrap instead of scrolling
27
- * @param {string} [options.label] accessible name of the code
28
- * @returns {HTMLPreElement}
29
- */
30
- export function highlightCode(text: string, language?: string | object, { lineNumbers, highlightLines, wrap, label }?: {
31
- lineNumbers?: boolean;
32
- highlightLines?: Array<number | string>;
33
- wrap?: boolean;
34
- label?: string;
35
- }): HTMLPreElement;
36
- /**
37
- * A code block: a label with the language, a copy button and the highlighted code.
38
- *
39
- * @param {object} options
40
- * @param {string|HTMLElement} [options.parent]
41
- * @param {string} options.code
42
- * @param {string|object} [options.language]
43
- * @param {string} [options.title] shown in the header instead of the language
44
- * @param {boolean} [options.lineNumbers=false]
45
- * @param {Array<number|string>} [options.highlightLines]
46
- * @param {boolean} [options.copy=true] the copy button
47
- * @param {boolean} [options.wrap=false]
48
- * @param {string} [options.id]
49
- * @returns {{element: HTMLElement, getCode: () => string, setCode: (code: string, language?: string|object) => void, copy: () => Promise<boolean>, destroy: Function}}
50
- */
51
- export function generateCodeBlock({ parent, code, language, title, lineNumbers, highlightLines, copy, wrap, id }?: {
52
- parent?: string | HTMLElement;
53
- code: string;
54
- language?: string | object;
55
- title?: string;
56
- lineNumbers?: boolean;
57
- highlightLines?: Array<number | string>;
58
- copy?: boolean;
59
- wrap?: boolean;
60
- id?: string;
61
- }): {
62
- element: HTMLElement;
63
- getCode: () => string;
64
- setCode: (code: string, language?: string | object) => void;
65
- copy: () => Promise<boolean>;
66
- destroy: Function;
67
- };
68
- /**
69
- * A view of the difference between two texts, with highlighted code on both sides.
70
- *
71
- * @param {object} options
72
- * @param {string|HTMLElement} [options.parent]
73
- * @param {string} [options.original]
74
- * @param {string} [options.modified]
75
- * @param {string|object} [options.language]
76
- * @param {"unified"|"split"} [options.mode="unified"]
77
- * @param {number} [options.context=3] unchanged lines kept around a change (Infinity: all of them); a button shows the rest
78
- * @param {string} [options.originalLabel]
79
- * @param {string} [options.modifiedLabel]
80
- * @returns {{element: HTMLElement, setTexts: (original: string, modified: string) => void, setMode: (mode: string) => void, getStats: () => {added: number, removed: number}}}
81
- */
82
- export function createDiffView({ parent, original, modified, language, mode, context, originalLabel, modifiedLabel }?: {
83
- parent?: string | HTMLElement;
84
- original?: string;
85
- modified?: string;
86
- language?: string | object;
87
- mode?: "unified" | "split";
88
- context?: number;
89
- originalLabel?: string;
90
- modifiedLabel?: string;
91
- }): {
92
- element: HTMLElement;
93
- setTexts: (original: string, modified: string) => void;
94
- setMode: (mode: string) => void;
95
- getStats: () => {
96
- added: number;
97
- removed: number;
98
- };
99
- };
1
+ /** Splits tokens at the line breaks: an array (one entry per line) of arrays of { type, text }. */
2
+ export function tokensToLines(tokens: any): any[][];
3
+ /** The nodes of one line: text nodes and <span class="tok-..."> (a span has one class and one text node). */
4
+ export function lineNodes(tokens: any): any;
5
+ /**
6
+ * Writes the highlighted lines of a text into a <code> element (replacing what is there). The editor uses it too.
7
+ *
8
+ * @param {HTMLElement} code
9
+ * @param {string} text
10
+ * @param {string|object} [language] a name or alias ("js"), or a language object; unknown: plain text
11
+ * @param {object} [options]
12
+ * @param {Array<number|string>} [options.highlightLines] line numbers (1-based) or ranges ("5-8") that get a background
13
+ * @returns {number} the number of lines
14
+ */
15
+ export function renderCode(code: HTMLElement, text: string, language?: string | object, { highlightLines }?: {
16
+ highlightLines?: Array<number | string>;
17
+ }): number;
18
+ /**
19
+ * Highlights read-only code: a `<pre class="athena-code"><code>` element.
20
+ *
21
+ * @param {string} text
22
+ * @param {string|object} [language] "js", "ts", "json", "html", "css", "sql", "sh", "yaml", "c#", "python" or a language you registered
23
+ * @param {object} [options]
24
+ * @param {boolean} [options.lineNumbers=false]
25
+ * @param {Array<number|string>} [options.highlightLines]
26
+ * @param {boolean} [options.wrap=false] long lines wrap instead of scrolling
27
+ * @param {string} [options.label] accessible name of the code
28
+ * @returns {HTMLPreElement}
29
+ */
30
+ export function highlightCode(text: string, language?: string | object, { lineNumbers, highlightLines, wrap, label }?: {
31
+ lineNumbers?: boolean;
32
+ highlightLines?: Array<number | string>;
33
+ wrap?: boolean;
34
+ label?: string;
35
+ }): HTMLPreElement;
36
+ /**
37
+ * A code block: a label with the language, a copy button and the highlighted code.
38
+ *
39
+ * @param {object} options
40
+ * @param {string|HTMLElement} [options.parent]
41
+ * @param {string} options.code
42
+ * @param {string|object} [options.language]
43
+ * @param {string} [options.title] shown in the header instead of the language
44
+ * @param {boolean} [options.lineNumbers=false]
45
+ * @param {Array<number|string>} [options.highlightLines]
46
+ * @param {boolean} [options.copy=true] the copy button
47
+ * @param {boolean} [options.wrap=false]
48
+ * @param {string} [options.id]
49
+ * @returns {{element: HTMLElement, getCode: () => string, setCode: (code: string, language?: string|object) => void, copy: () => Promise<boolean>, destroy: Function}}
50
+ */
51
+ export function generateCodeBlock({ parent, code, language, title, lineNumbers, highlightLines, copy, wrap, id }?: {
52
+ parent?: string | HTMLElement;
53
+ code: string;
54
+ language?: string | object;
55
+ title?: string;
56
+ lineNumbers?: boolean;
57
+ highlightLines?: Array<number | string>;
58
+ copy?: boolean;
59
+ wrap?: boolean;
60
+ id?: string;
61
+ }): {
62
+ element: HTMLElement;
63
+ getCode: () => string;
64
+ setCode: (code: string, language?: string | object) => void;
65
+ copy: () => Promise<boolean>;
66
+ destroy: Function;
67
+ };
68
+ /**
69
+ * A view of the difference between two texts, with highlighted code on both sides.
70
+ *
71
+ * @param {object} options
72
+ * @param {string|HTMLElement} [options.parent]
73
+ * @param {string} [options.original]
74
+ * @param {string} [options.modified]
75
+ * @param {string|object} [options.language]
76
+ * @param {"unified"|"split"} [options.mode="unified"]
77
+ * @param {number} [options.context=3] unchanged lines kept around a change (Infinity: all of them); a button shows the rest
78
+ * @param {string} [options.originalLabel]
79
+ * @param {string} [options.modifiedLabel]
80
+ * @returns {{element: HTMLElement, setTexts: (original: string, modified: string) => void, setMode: (mode: string) => void, getStats: () => {added: number, removed: number}}}
81
+ */
82
+ export function createDiffView({ parent, original, modified, language, mode, context, originalLabel, modifiedLabel }?: {
83
+ parent?: string | HTMLElement;
84
+ original?: string;
85
+ modified?: string;
86
+ language?: string | object;
87
+ mode?: "unified" | "split";
88
+ context?: number;
89
+ originalLabel?: string;
90
+ modifiedLabel?: string;
91
+ }): {
92
+ element: HTMLElement;
93
+ setTexts: (original: string, modified: string) => void;
94
+ setMode: (mode: string) => void;
95
+ getStats: () => {
96
+ added: number;
97
+ removed: number;
98
+ };
99
+ };