@jackens/nnn 2023.12.3 → 2023.12.19
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 +1 -1
- package/eq.d.ts +1 -1
- package/escape.d.ts +1 -1
- package/fixTypography.d.ts +1 -1
- package/h.d.ts +7 -3
- package/has.d.ts +1 -1
- package/is.d.ts +1 -1
- package/jcss.d.ts +1 -1
- package/jsOnParse.d.ts +1 -1
- package/locale.d.ts +1 -1
- package/nanolight.d.ts +2 -2
- package/nanolight.js +2 -2
- package/nanolightJs.d.ts +2 -2
- package/package.json +1 -1
- package/plUral.d.ts +1 -1
- package/pro.d.ts +1 -1
- package/readme.md +26 -72
- package/refsInfo.d.ts +1 -1
- package/tests.d.ts +1 -1
- package/uuid1.d.ts +1 -1
package/chartable.d.ts
CHANGED
package/eq.d.ts
CHANGED
package/escape.d.ts
CHANGED
|
@@ -13,4 +13,4 @@ export function escape(escapeMap: EscapeMap, template: TemplateStringsArray, ...
|
|
|
13
13
|
*/
|
|
14
14
|
export function escapeValues(escapeMap: EscapeMap, values: any[]): string[];
|
|
15
15
|
|
|
16
|
-
export const tests: Record<string, () => void>;
|
|
16
|
+
export const tests: Record<string, () => void>;
|
package/fixTypography.d.ts
CHANGED
package/h.d.ts
CHANGED
|
@@ -23,7 +23,9 @@ export type HArgs1 = Record<string, any> | null | undefined | Node | string | nu
|
|
|
23
23
|
* - All other arguments of type `string`/`number` are converted to `Text` nodes and appended to the element being created or modified.
|
|
24
24
|
* - All other arguments of type `HArgs` are passed to `h` and the results are appended to the element being created or modified.
|
|
25
25
|
*/
|
|
26
|
-
export function h<T extends keyof HTMLElementTagNameMap>(tag: T, ...args1: HArgs1[]): HTMLElementTagNameMap[T]
|
|
26
|
+
export function h<T extends keyof HTMLElementTagNameMap>(tag: T, ...args1: HArgs1[]): HTMLElementTagNameMap[T];
|
|
27
|
+
export function h<N extends Node>(node: N, ...args1: HArgs1[]): N;
|
|
28
|
+
export function h(tagOrNode: string | Node, ...args1: HArgs1[]): Node;
|
|
27
29
|
|
|
28
30
|
/**
|
|
29
31
|
* A lightweight [HyperScript](https://github.com/hyperhype/hyperscript)-style helper for creating and modifying `SVGElement`s (see also `h`).
|
|
@@ -40,6 +42,8 @@ export function h<T extends keyof HTMLElementTagNameMap>(tag: T, ...args1: HArgs
|
|
|
40
42
|
* - All other arguments of type `string`/`number` are converted to `Text` nodes and appended to the element being created or modified.
|
|
41
43
|
* - All other arguments of type `HArgs` are passed to `s` and the results are appended to the element being created or modified.
|
|
42
44
|
*/
|
|
43
|
-
export function s<T extends keyof SVGElementTagNameMap>(tag: T, ...args1: HArgs1[]): SVGElementTagNameMap[T]
|
|
45
|
+
export function s<T extends keyof SVGElementTagNameMap>(tag: T, ...args1: HArgs1[]): SVGElementTagNameMap[T];
|
|
46
|
+
export function s<N extends Node>(node: N, ...args1: HArgs1[]): N;
|
|
47
|
+
export function s(tagOrNode: string | Node, ...args1: HArgs1[]): Node;
|
|
44
48
|
|
|
45
|
-
export const tests: Record<string, () => void>;
|
|
49
|
+
export const tests: Record<string, () => void>;
|
package/has.d.ts
CHANGED
package/is.d.ts
CHANGED
package/jcss.d.ts
CHANGED
package/jsOnParse.d.ts
CHANGED
package/locale.d.ts
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export function locale(locales: Record<string, Record<string, string | Record<string, string>>>, defaultLanguage: string, languages?: readonly string[]): (text?: string | undefined, version?: string | undefined) => string;
|
|
5
5
|
|
|
6
|
-
export const tests: Record<string, () => void>;
|
|
6
|
+
export const tests: Record<string, () => void>;
|
package/nanolight.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A generic helper for syntax highlighting (see also `nanolightJs`).
|
|
3
3
|
*/
|
|
4
|
-
export function nanolight(pattern: RegExp, highlighters: ((chunk: string, index: number) => import('./h.js').
|
|
4
|
+
export function nanolight(pattern: RegExp, highlighters: ((chunk: string, index: number) => import('./h.js').HArgs1)[], code: string): import("./h.js").HArgs1[];
|
|
5
5
|
|
|
6
|
-
export const tests: Record<string, () => void>;
|
|
6
|
+
export const tests: Record<string, () => void>;
|
package/nanolight.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const nanolight = (
|
|
5
5
|
/** @type {RegExp} */ pattern,
|
|
6
|
-
/** @type {((chunk: string, index: number) => import('./h.js').
|
|
6
|
+
/** @type {((chunk: string, index: number) => import('./h.js').HArgs1)[]} */ highlighters,
|
|
7
7
|
/** @type {string} */ code
|
|
8
8
|
) => {
|
|
9
|
-
const /** @type {import('./h.js').
|
|
9
|
+
const /** @type {import('./h.js').HArgs1[]} */ result = []
|
|
10
10
|
|
|
11
11
|
code.split(pattern).forEach((chunk, index) => {
|
|
12
12
|
index %= highlighters.length
|
package/nanolightJs.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A helper for highlighting JavaScript.
|
|
3
3
|
*/
|
|
4
|
-
export const nanolightJs: (code?: string | undefined) => import("./h.js").
|
|
4
|
+
export const nanolightJs: (code?: string | undefined) => import("./h.js").HArgs1[];
|
|
5
5
|
|
|
6
|
-
export const tests: Record<string, () => void>;
|
|
6
|
+
export const tests: Record<string, () => void>;
|
package/package.json
CHANGED
package/plUral.d.ts
CHANGED
package/pro.d.ts
CHANGED
package/readme.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# nnn
|
|
2
2
|
|
|
3
|
-
Jackens’ JavaScript helpers
|
|
3
|
+
Jackens’ JavaScript helpers.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -54,9 +54,7 @@ import { «something» } from './node_modules/@jackens/nnn/nnn.js'
|
|
|
54
54
|
- `s`: A lightweight [HyperScript](https://github.com/hyperhype/hyperscript)-style helper for creating and modifying `SVGElement`s (see also `h`).
|
|
55
55
|
- `uuid1`: A helper that generates a UUID v1 identifier (with a creation timestamp).
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
<h3>EscapeMap</h3>
|
|
59
|
-
</a>
|
|
57
|
+
### EscapeMap
|
|
60
58
|
|
|
61
59
|
```ts
|
|
62
60
|
export type EscapeMap = Map<any, (value?: any) => string>;
|
|
@@ -64,9 +62,7 @@ export type EscapeMap = Map<any, (value?: any) => string>;
|
|
|
64
62
|
|
|
65
63
|
The type of arguments of the `escapeValues` and `escape` helpers.
|
|
66
64
|
|
|
67
|
-
|
|
68
|
-
<h3>HArgs</h3>
|
|
69
|
-
</a>
|
|
65
|
+
### HArgs
|
|
70
66
|
|
|
71
67
|
```ts
|
|
72
68
|
export type HArgs = [string | Node, ...HArgs1[]];
|
|
@@ -74,9 +70,7 @@ export type HArgs = [string | Node, ...HArgs1[]];
|
|
|
74
70
|
|
|
75
71
|
The type of arguments of the `h` and `s` helpers.
|
|
76
72
|
|
|
77
|
-
|
|
78
|
-
<h3>HArgs1</h3>
|
|
79
|
-
</a>
|
|
73
|
+
### HArgs1
|
|
80
74
|
|
|
81
75
|
```ts
|
|
82
76
|
export type HArgs1 = Record<string, any> | null | undefined | Node | string | number | [string | Node, ...HArgs1[]];
|
|
@@ -84,9 +78,7 @@ export type HArgs1 = Record<string, any> | null | undefined | Node | string | nu
|
|
|
84
78
|
|
|
85
79
|
The type of arguments of the `h` and `s` helpers.
|
|
86
80
|
|
|
87
|
-
|
|
88
|
-
<h3>JcssNode</h3>
|
|
89
|
-
</a>
|
|
81
|
+
### JcssNode
|
|
90
82
|
|
|
91
83
|
```ts
|
|
92
84
|
export type JcssNode = {
|
|
@@ -96,9 +88,7 @@ export type JcssNode = {
|
|
|
96
88
|
|
|
97
89
|
The type of arguments of the `jcss` helper.
|
|
98
90
|
|
|
99
|
-
|
|
100
|
-
<h3>JcssRoot</h3>
|
|
101
|
-
</a>
|
|
91
|
+
### JcssRoot
|
|
102
92
|
|
|
103
93
|
```ts
|
|
104
94
|
export type JcssRoot = Record<string, JcssNode>;
|
|
@@ -106,9 +96,7 @@ export type JcssRoot = Record<string, JcssNode>;
|
|
|
106
96
|
|
|
107
97
|
The type of arguments of the `jcss` helper.
|
|
108
98
|
|
|
109
|
-
|
|
110
|
-
<h3>chartable</h3>
|
|
111
|
-
</a>
|
|
99
|
+
### chartable
|
|
112
100
|
|
|
113
101
|
```ts
|
|
114
102
|
export function chartable({ bottom, gapX, gapY, headerColumn, headerRow, id, left, maxY, right, singleScale, table, title, top, xLabels, zLabels, zxY }?: {
|
|
@@ -151,9 +139,7 @@ Options:
|
|
|
151
139
|
- `zLabels`: data series labels
|
|
152
140
|
- `zxY`: chart data
|
|
153
141
|
|
|
154
|
-
|
|
155
|
-
<h3>eq</h3>
|
|
156
|
-
</a>
|
|
142
|
+
### eq
|
|
157
143
|
|
|
158
144
|
```ts
|
|
159
145
|
export function eq(x: any, y: any): boolean;
|
|
@@ -195,9 +181,7 @@ console.assert(!eq(
|
|
|
195
181
|
))
|
|
196
182
|
```
|
|
197
183
|
|
|
198
|
-
|
|
199
|
-
<h3>escape</h3>
|
|
200
|
-
</a>
|
|
184
|
+
### escape
|
|
201
185
|
|
|
202
186
|
```ts
|
|
203
187
|
export function escape(escapeMap: EscapeMap, template: TemplateStringsArray, ...values: any[]): string;
|
|
@@ -232,9 +216,7 @@ const expected = `
|
|
|
232
216
|
console.assert(actual === expected)
|
|
233
217
|
```
|
|
234
218
|
|
|
235
|
-
|
|
236
|
-
<h3>escapeValues</h3>
|
|
237
|
-
</a>
|
|
219
|
+
### escapeValues
|
|
238
220
|
|
|
239
221
|
```ts
|
|
240
222
|
export function escapeValues(escapeMap: EscapeMap, values: any[]): string[];
|
|
@@ -242,9 +224,7 @@ export function escapeValues(escapeMap: EscapeMap, values: any[]): string[];
|
|
|
242
224
|
|
|
243
225
|
A generic helper for escaping `values` by given `escapeMap`.
|
|
244
226
|
|
|
245
|
-
|
|
246
|
-
<h3>fixTypography</h3>
|
|
247
|
-
</a>
|
|
227
|
+
### fixTypography
|
|
248
228
|
|
|
249
229
|
```ts
|
|
250
230
|
export function fixTypography(node: Node): void;
|
|
@@ -264,9 +244,7 @@ console.assert(p.innerHTML ===
|
|
|
264
244
|
'(zob. https://\u200Bpl.\u200Bwikipedia.\u200Borg/\u200Bwiki/\u200BPangram).')
|
|
265
245
|
```
|
|
266
246
|
|
|
267
|
-
|
|
268
|
-
<h3>h</h3>
|
|
269
|
-
</a>
|
|
247
|
+
### h
|
|
270
248
|
|
|
271
249
|
```ts
|
|
272
250
|
export function h<T extends keyof HTMLElementTagNameMap>(tag: T, ...args1: HArgs1[]): HTMLElementTagNameMap[T];
|
|
@@ -356,9 +334,7 @@ h(div, { $key: { two: 2 } })
|
|
|
356
334
|
console.assert(eq(div.key, { one: 1, two: 2 }))
|
|
357
335
|
```
|
|
358
336
|
|
|
359
|
-
|
|
360
|
-
<h3>has</h3>
|
|
361
|
-
</a>
|
|
337
|
+
### has
|
|
362
338
|
|
|
363
339
|
```ts
|
|
364
340
|
export function has(key: any, ref: any): boolean;
|
|
@@ -397,9 +373,7 @@ console.assert(typeError instanceof TypeError) // Cannot use 'in' operator to se
|
|
|
397
373
|
console.assert(!has('key', null))
|
|
398
374
|
```
|
|
399
375
|
|
|
400
|
-
|
|
401
|
-
<h3>is</h3>
|
|
402
|
-
</a>
|
|
376
|
+
### is
|
|
403
377
|
|
|
404
378
|
```ts
|
|
405
379
|
export const is: {
|
|
@@ -459,9 +433,7 @@ console.assert(is(Object, fakeFooBar))
|
|
|
459
433
|
console.assert(!iz(Object, fakeFooBar))
|
|
460
434
|
```
|
|
461
435
|
|
|
462
|
-
|
|
463
|
-
<h3>jcss</h3>
|
|
464
|
-
</a>
|
|
436
|
+
### jcss
|
|
465
437
|
|
|
466
438
|
```ts
|
|
467
439
|
export function jcss(root: JcssRoot, splitter?: string): string;
|
|
@@ -673,9 +645,7 @@ const expected = `
|
|
|
673
645
|
console.assert(actual === expected)
|
|
674
646
|
```
|
|
675
647
|
|
|
676
|
-
|
|
677
|
-
<h3>jsOnParse</h3>
|
|
678
|
-
</a>
|
|
648
|
+
### jsOnParse
|
|
679
649
|
|
|
680
650
|
```ts
|
|
681
651
|
export function jsOnParse(handlers: Record<string, Function>, text: string): any;
|
|
@@ -740,9 +710,7 @@ const expected = [
|
|
|
740
710
|
console.assert(eq(actual, expected))
|
|
741
711
|
```
|
|
742
712
|
|
|
743
|
-
|
|
744
|
-
<h3>locale</h3>
|
|
745
|
-
</a>
|
|
713
|
+
### locale
|
|
746
714
|
|
|
747
715
|
```ts
|
|
748
716
|
export function locale(locales: Record<string, Record<string, string | Record<string, string>>>, defaultLanguage: string, languages?: readonly string[]): (text?: string | undefined, version?: string | undefined) => string;
|
|
@@ -775,22 +743,18 @@ console.assert(_('toString') === 'toString')
|
|
|
775
743
|
console.assert(_('toString', 'undefined_version') === 'toString')
|
|
776
744
|
```
|
|
777
745
|
|
|
778
|
-
|
|
779
|
-
<h3>nanolight</h3>
|
|
780
|
-
</a>
|
|
746
|
+
### nanolight
|
|
781
747
|
|
|
782
748
|
```ts
|
|
783
|
-
export function nanolight(pattern: RegExp, highlighters: ((chunk: string, index: number) => import('./h.js').
|
|
749
|
+
export function nanolight(pattern: RegExp, highlighters: ((chunk: string, index: number) => import('./h.js').HArgs1)[], code: string): import("./h.js").HArgs1[];
|
|
784
750
|
```
|
|
785
751
|
|
|
786
752
|
A generic helper for syntax highlighting (see also `nanolightJs`).
|
|
787
753
|
|
|
788
|
-
|
|
789
|
-
<h3>nanolightJs</h3>
|
|
790
|
-
</a>
|
|
754
|
+
### nanolightJs
|
|
791
755
|
|
|
792
756
|
```ts
|
|
793
|
-
export const nanolightJs: (code?: string | undefined) => import("./h.js").
|
|
757
|
+
export const nanolightJs: (code?: string | undefined) => import("./h.js").HArgs1[];
|
|
794
758
|
```
|
|
795
759
|
|
|
796
760
|
A helper for highlighting JavaScript.
|
|
@@ -804,9 +768,7 @@ console.assert(h('pre', ['code', ...nanolightJs(codeJs)]).outerHTML ===
|
|
|
804
768
|
'<pre><code><b>const</b> <i>answerToLifeTheUniverseAndEverything</i> <b>=</b> <u>42</u></code></pre>')
|
|
805
769
|
```
|
|
806
770
|
|
|
807
|
-
|
|
808
|
-
<h3>plUral</h3>
|
|
809
|
-
</a>
|
|
771
|
+
### plUral
|
|
810
772
|
|
|
811
773
|
```ts
|
|
812
774
|
export function plUral(singular: string, plural2: string, plural5: string, value: number): string;
|
|
@@ -832,9 +794,7 @@ console.assert(car(17) === 'cars')
|
|
|
832
794
|
console.assert(car(42) === 'cars')
|
|
833
795
|
```
|
|
834
796
|
|
|
835
|
-
|
|
836
|
-
<h3>pro</h3>
|
|
837
|
-
</a>
|
|
797
|
+
### pro
|
|
838
798
|
|
|
839
799
|
```ts
|
|
840
800
|
export function pro(ref: any): any;
|
|
@@ -872,9 +832,7 @@ pro(ref).one.two.three.four = 1234
|
|
|
872
832
|
console.assert(eq(ref, { one: { two: { three: { four: 1234 } } } }))
|
|
873
833
|
```
|
|
874
834
|
|
|
875
|
-
|
|
876
|
-
<h3>refsInfo</h3>
|
|
877
|
-
</a>
|
|
835
|
+
### refsInfo
|
|
878
836
|
|
|
879
837
|
```ts
|
|
880
838
|
export function refsInfo(...refs: any[]): [string, string, string[]][];
|
|
@@ -917,9 +875,7 @@ const browserFingerprint = () => {
|
|
|
917
875
|
console.log(browserFingerprint())
|
|
918
876
|
```
|
|
919
877
|
|
|
920
|
-
|
|
921
|
-
<h3>s</h3>
|
|
922
|
-
</a>
|
|
878
|
+
### s
|
|
923
879
|
|
|
924
880
|
```ts
|
|
925
881
|
export function s<T extends keyof SVGElementTagNameMap>(tag: T, ...args1: HArgs1[]): SVGElementTagNameMap[T];
|
|
@@ -941,9 +897,7 @@ A lightweight [HyperScript](https://github.com/hyperhype/hyperscript)-style help
|
|
|
941
897
|
- All other arguments of type `string`/`number` are converted to `Text` nodes and appended to the element being created or modified.
|
|
942
898
|
- All other arguments of type `HArgs` are passed to `s` and the results are appended to the element being created or modified.
|
|
943
899
|
|
|
944
|
-
|
|
945
|
-
<h3>uuid1</h3>
|
|
946
|
-
</a>
|
|
900
|
+
### uuid1
|
|
947
901
|
|
|
948
902
|
```ts
|
|
949
903
|
export function uuid1({ date, node }?: {
|
package/refsInfo.d.ts
CHANGED
package/tests.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const tests: Record<string, () => void>;
|
|
1
|
+
export const tests: Record<string, () => void>;
|
package/uuid1.d.ts
CHANGED