@jackens/nnn 2024.1.2 → 2024.2.9
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/chartable.d.ts +3 -1
- package/chartable.js +8 -0
- package/nanolightJs.js +10 -10
- package/package.json +1 -1
- package/readme.md +5 -3
package/chartable.d.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* - `id`: chart id
|
|
11
11
|
* - `left`: left padding (for data series labels)
|
|
12
12
|
* - `maxY`: number of Y axis lines
|
|
13
|
+
* - `reverse`: flag to reverse all data series
|
|
13
14
|
* - `right`: right padding (for data series labels)
|
|
14
15
|
* - `singleScale`: flag to force single scale
|
|
15
16
|
* - `table`: `HTMLTableElement` to extract data, data series labels and X axis labels
|
|
@@ -19,7 +20,7 @@
|
|
|
19
20
|
* - `zLabels`: data series labels
|
|
20
21
|
* - `zxY`: chart data
|
|
21
22
|
*/
|
|
22
|
-
export function chartable({ bottom, gapX, gapY, headerColumn, headerRow, id, left, maxY, right, singleScale, table, title, top, xLabels, zLabels, zxY }?: {
|
|
23
|
+
export function chartable({ bottom, gapX, gapY, headerColumn, headerRow, id, left, maxY, reverse, right, singleScale, table, title, top, xLabels, zLabels, zxY }?: {
|
|
23
24
|
bottom?: number;
|
|
24
25
|
gapX?: number;
|
|
25
26
|
gapY?: number;
|
|
@@ -28,6 +29,7 @@ export function chartable({ bottom, gapX, gapY, headerColumn, headerRow, id, lef
|
|
|
28
29
|
id?: string;
|
|
29
30
|
left?: number;
|
|
30
31
|
maxY?: number;
|
|
32
|
+
reverse?: boolean;
|
|
31
33
|
right?: number;
|
|
32
34
|
singleScale?: boolean;
|
|
33
35
|
table?: HTMLTableElement;
|
package/chartable.js
CHANGED
|
@@ -14,6 +14,7 @@ const COLORS = ['#e22', '#e73', '#fc3', '#ad4', '#4d9', '#3be', '#45d', '#c3e']
|
|
|
14
14
|
* - `id`: chart id
|
|
15
15
|
* - `left`: left padding (for data series labels)
|
|
16
16
|
* - `maxY`: number of Y axis lines
|
|
17
|
+
* - `reverse`: flag to reverse all data series
|
|
17
18
|
* - `right`: right padding (for data series labels)
|
|
18
19
|
* - `singleScale`: flag to force single scale
|
|
19
20
|
* - `table`: `HTMLTableElement` to extract data, data series labels and X axis labels
|
|
@@ -32,6 +33,7 @@ const COLORS = ['#e22', '#e73', '#fc3', '#ad4', '#4d9', '#3be', '#45d', '#c3e']
|
|
|
32
33
|
* id?: string;
|
|
33
34
|
* left?: number;
|
|
34
35
|
* maxY?: number;
|
|
36
|
+
* reverse?: boolean;
|
|
35
37
|
* right?: number;
|
|
36
38
|
* singleScale?: boolean;
|
|
37
39
|
* table?: HTMLTableElement;
|
|
@@ -51,6 +53,7 @@ export const chartable = ({
|
|
|
51
53
|
id,
|
|
52
54
|
left = 200,
|
|
53
55
|
maxY = 10,
|
|
56
|
+
reverse = false,
|
|
54
57
|
right = 200,
|
|
55
58
|
singleScale = false,
|
|
56
59
|
table,
|
|
@@ -83,6 +86,11 @@ export const chartable = ({
|
|
|
83
86
|
}))
|
|
84
87
|
}
|
|
85
88
|
|
|
89
|
+
if (reverse) {
|
|
90
|
+
xLabels.reverse()
|
|
91
|
+
zxY.forEach(xY => xY.reverse())
|
|
92
|
+
}
|
|
93
|
+
|
|
86
94
|
let bestScales = [Infinity, -Infinity, Infinity, -Infinity, Infinity]
|
|
87
95
|
|
|
88
96
|
const ranges = zxY.map(xY => {
|
package/nanolightJs.js
CHANGED
|
@@ -6,16 +6,16 @@ import { nanolight } from './nanolight.js'
|
|
|
6
6
|
*/
|
|
7
7
|
// @ts-ignore
|
|
8
8
|
export const nanolightJs = nanolight.bind(0,
|
|
9
|
-
/('.*?'|".*?"|`[\s\S]*?`)|(\/\/.*?\n|\/\*[\s\S]*?\*\/)|(break|case|catch|const|continue|debugger|default|delete|do|else|eval|export
|
|
9
|
+
/('.*?'|".*?"|`[\s\S]*?`)|(\/\/.*?\n|\/\*[\s\S]*?\*\/)|(any|bigint|break|boolean|case|catch|const|continue|debugger|default|delete|do|else|eval|export|extends|false|finally|for|from|function|goto|if|import|in|instanceof|is|keyof|let|NaN|new|number|null|package|return|string|super|switch|symbol|this|throw|true|try|type|typeof|undefined|unknown|var|void|while|with|yield)(?!\w)|([<>=.?:&|!^~*/%+-])|(0x[\dabcdef]+|0o[01234567]+|0b[01]+|\d+(?:\.[\d_]+)?(?:e[+-]?[\d_]+)?)|([$\w]+)(?=\()|([$\wąćęłńóśżźĄĆĘŁŃÓŚŻŹ]+)/,
|
|
10
10
|
[
|
|
11
|
-
chunk => chunk,
|
|
12
|
-
chunk => ['
|
|
13
|
-
chunk => ['
|
|
14
|
-
chunk => ['
|
|
15
|
-
chunk => ['
|
|
16
|
-
chunk => ['
|
|
17
|
-
chunk => ['
|
|
18
|
-
chunk => ['
|
|
11
|
+
chunk => chunk,
|
|
12
|
+
chunk => ['span', { class: 'string' }, chunk],
|
|
13
|
+
chunk => ['span', { class: 'comment' }, chunk],
|
|
14
|
+
chunk => ['span', { class: 'keyword' }, chunk],
|
|
15
|
+
chunk => ['span', { class: 'operator' }, chunk],
|
|
16
|
+
chunk => ['span', { class: 'number' }, chunk],
|
|
17
|
+
chunk => ['span', { class: 'function' }, chunk],
|
|
18
|
+
chunk => ['span', { class: 'literal' }, chunk]
|
|
19
19
|
]
|
|
20
20
|
)
|
|
21
21
|
|
|
@@ -24,6 +24,6 @@ export const tests = {
|
|
|
24
24
|
const codeJs = 'const answerToLifeTheUniverseAndEverything = 42'
|
|
25
25
|
|
|
26
26
|
console.assert(h('pre', ['code', ...nanolightJs(codeJs)]).outerHTML ===
|
|
27
|
-
'<pre><code><
|
|
27
|
+
'<pre><code><span class="keyword">const</span> <span class="literal">answerToLifeTheUniverseAndEverything</span> <span class="operator">=</span> <span class="number">42</span></code></pre>')
|
|
28
28
|
}
|
|
29
29
|
}
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Jackens’ JavaScript helpers.
|
|
4
4
|
|
|
5
|
-
<sub>Version: <code class="version">2024.
|
|
5
|
+
<sub>Version: <code class="version">2024.2.9</code></sub>
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -101,7 +101,7 @@ The type of arguments of the `jcss` helper.
|
|
|
101
101
|
### chartable
|
|
102
102
|
|
|
103
103
|
```ts
|
|
104
|
-
export function chartable({ bottom, gapX, gapY, headerColumn, headerRow, id, left, maxY, right, singleScale, table, title, top, xLabels, zLabels, zxY }?: {
|
|
104
|
+
export function chartable({ bottom, gapX, gapY, headerColumn, headerRow, id, left, maxY, reverse, right, singleScale, table, title, top, xLabels, zLabels, zxY }?: {
|
|
105
105
|
bottom?: number;
|
|
106
106
|
gapX?: number;
|
|
107
107
|
gapY?: number;
|
|
@@ -110,6 +110,7 @@ export function chartable({ bottom, gapX, gapY, headerColumn, headerRow, id, lef
|
|
|
110
110
|
id?: string;
|
|
111
111
|
left?: number;
|
|
112
112
|
maxY?: number;
|
|
113
|
+
reverse?: boolean;
|
|
113
114
|
right?: number;
|
|
114
115
|
singleScale?: boolean;
|
|
115
116
|
table?: HTMLTableElement;
|
|
@@ -132,6 +133,7 @@ Options:
|
|
|
132
133
|
- `id`: chart id
|
|
133
134
|
- `left`: left padding (for data series labels)
|
|
134
135
|
- `maxY`: number of Y axis lines
|
|
136
|
+
- `reverse`: flag to reverse all data series
|
|
135
137
|
- `right`: right padding (for data series labels)
|
|
136
138
|
- `singleScale`: flag to force single scale
|
|
137
139
|
- `table`: `HTMLTableElement` to extract data, data series labels and X axis labels
|
|
@@ -764,7 +766,7 @@ A helper for highlighting JavaScript.
|
|
|
764
766
|
const codeJs = 'const answerToLifeTheUniverseAndEverything = 42'
|
|
765
767
|
|
|
766
768
|
console.assert(h('pre', ['code', ...nanolightJs(codeJs)]).outerHTML ===
|
|
767
|
-
'<pre><code><
|
|
769
|
+
'<pre><code><span class="keyword">const</span> <span class="literal">answerToLifeTheUniverseAndEverything</span> <span class="operator">=</span> <span class="number">42</span></code></pre>')
|
|
768
770
|
```
|
|
769
771
|
|
|
770
772
|
### plUral
|