@jackens/nnn 2026.8.31 → 2026.9.2
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/nnn.d.ts +200 -423
- package/nnn.js +113 -138
- package/package.json +1 -3
- package/readme.md +296 -670
package/nnn.d.ts
CHANGED
|
@@ -1,144 +1,101 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Represents a CSS rule node for the {@link c} helper.
|
|
3
|
-
*
|
|
2
|
+
* Represents a CSS rule node for the {@link c} helper. Keys
|
|
3
|
+
* are CSS properties or nested selectors.
|
|
4
4
|
*/
|
|
5
5
|
export type CNode = {
|
|
6
6
|
[attributeOrSelector: string]: string | number | CNode | undefined;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* A minimal CSS-in-JS helper that converts a JavaScript
|
|
10
|
+
* object hierarchy into a CSS string.
|
|
11
|
+
*
|
|
12
|
+
* @param node An object describing CSS rules. Keys are
|
|
13
|
+
* selectors or at-rules; values are either CSS property
|
|
14
|
+
* values or nested rule objects. A selector key may
|
|
15
|
+
* contain comma-separated alternatives (e.g. `'.b,.c'`);
|
|
16
|
+
* when nested, each alternative is combined with each
|
|
17
|
+
* parent alternative (cartesian product), producing a
|
|
18
|
+
* comma-joined selector list (e.g. `'a.b,a.c'`).
|
|
19
|
+
* @param splitter A delimiter used to create unique keys
|
|
20
|
+
* (default: `'$$'`). The substring from `splitter` to the
|
|
21
|
+
* end of a key is ignored (e.g., `src$$1` → `src`).
|
|
22
|
+
*
|
|
23
|
+
* @returns A CSS string representing the compiled rules.
|
|
11
24
|
*/
|
|
12
|
-
export
|
|
25
|
+
export declare const c: (node: CNode, splitter?: string) => string;
|
|
13
26
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* into a CSS string.
|
|
27
|
+
* Creates a tag function for escaping interpolated values
|
|
28
|
+
* in template literals.
|
|
17
29
|
*
|
|
18
|
-
* @param
|
|
30
|
+
* @param escapeFn A function that takes a value and returns
|
|
31
|
+
* its escaped string representation.
|
|
19
32
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* values are either CSS property values
|
|
23
|
-
* or nested rule objects.
|
|
24
|
-
*
|
|
25
|
-
* @param splitter
|
|
26
|
-
*
|
|
27
|
-
* A delimiter used to create unique keys (default: `'$$'`).
|
|
28
|
-
* The substring from `splitter` to the end of a key
|
|
29
|
-
* is ignored (e.g., `src$$1` → `src`).
|
|
30
|
-
*
|
|
31
|
-
* @returns
|
|
32
|
-
*
|
|
33
|
-
* A CSS string representing the compiled rules.
|
|
34
|
-
*
|
|
35
|
-
* @remarks
|
|
36
|
-
*
|
|
37
|
-
* - Keys whose values are primitives (`string` | `number`)
|
|
38
|
-
* are treated as CSS properties.
|
|
39
|
-
* - In property keys, uppercase letters
|
|
40
|
-
* become lowercase with a `-` prefix
|
|
41
|
-
* (e.g., `fontFamily` → `font-family`);
|
|
42
|
-
* underscores become hyphens
|
|
43
|
-
* (e.g., `font_family` → `font-family`).
|
|
44
|
-
* - Comma-separated selector keys
|
|
45
|
-
* expand into multiple selectors
|
|
46
|
-
* (e.g., `{ div: { '.a,.b': { margin: 1 } } }` →
|
|
47
|
-
* `div.a,div.b{margin:1}`).
|
|
48
|
-
* - Top-level keys starting with `@` (at-rules)
|
|
49
|
-
* are not concatenated with child selectors.
|
|
50
|
-
*/
|
|
51
|
-
export declare const c: (root: CRoot, splitter?: string) => string;
|
|
52
|
-
/**
|
|
53
|
-
* Creates a tag function
|
|
54
|
-
* for escaping interpolated values in template literals.
|
|
55
|
-
*
|
|
56
|
-
* @param escapeFn
|
|
57
|
-
*
|
|
58
|
-
* A function that takes a value
|
|
59
|
-
* and returns its escaped string representation.
|
|
60
|
-
*
|
|
61
|
-
* @returns
|
|
62
|
-
*
|
|
63
|
-
* A tag function that escapes interpolated values
|
|
64
|
-
* using the provided escape map.
|
|
33
|
+
* @returns A tag function that escapes interpolated values
|
|
34
|
+
* using the provided escape function.
|
|
65
35
|
*/
|
|
66
36
|
export declare const createEscape: (escapeFn: (value: any) => string) => (template: TemplateStringsArray, ...values: unknown[]) => string;
|
|
67
37
|
/**
|
|
68
|
-
* A helper for building simple tokenizers
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* @param decorator
|
|
72
|
-
*
|
|
73
|
-
* A function that wraps each matched chunk.
|
|
74
|
-
* It receives the matched text (`chunk`)
|
|
75
|
-
* and optionally the `metadata`
|
|
76
|
-
* associated with the pattern that produced the match.
|
|
77
|
-
* For unmatched text between patterns,
|
|
78
|
-
* `metadata` is `undefined`.
|
|
79
|
-
*
|
|
80
|
-
* @param specs
|
|
81
|
-
*
|
|
82
|
-
* An array of tuples `[metadata, pattern]` where:
|
|
83
|
-
* - `metadata`: arbitrary data (e.g., a CSS class name)
|
|
84
|
-
* passed to `decorator` when the pattern matches.
|
|
85
|
-
* - `pattern`: a `string` or `RegExp`
|
|
86
|
-
* to match against the input.
|
|
87
|
-
*
|
|
88
|
-
* @returns
|
|
89
|
-
*
|
|
90
|
-
* A tokenizer function that accepts a code string
|
|
91
|
-
* and returns an array of decorated tokens.
|
|
38
|
+
* A helper for building simple tokenizers (see also
|
|
39
|
+
* {@link nanolightTs}).
|
|
92
40
|
*
|
|
93
41
|
* @remarks
|
|
94
42
|
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
43
|
+
* 1. Matches starting at an earlier position take
|
|
44
|
+
* precedence.
|
|
45
|
+
* 2. Among matches at the same position, the longer one
|
|
46
|
+
* wins.
|
|
47
|
+
* 3. Among matches of the same position and length, the one
|
|
48
|
+
* defined earlier wins.
|
|
49
|
+
*
|
|
50
|
+
* @param decorator A function that wraps each matched
|
|
51
|
+
* chunk. It receives the matched text (`chunk`) and
|
|
52
|
+
* optionally the `metadata` associated with the pattern
|
|
53
|
+
* that produced the match. For unmatched text between
|
|
54
|
+
* patterns, `metadata` is `undefined`.
|
|
55
|
+
* @param specs An array of tuples `[metadata, pattern]`
|
|
56
|
+
* where:
|
|
57
|
+
*
|
|
58
|
+
* - `metadata`: arbitrary data (e.g., a CSS class name)
|
|
59
|
+
* passed to `decorator` when the pattern matches.
|
|
60
|
+
* - `pattern`: a `string` or `RegExp` to match against the
|
|
61
|
+
* input.
|
|
62
|
+
*
|
|
63
|
+
* @returns A tokenizer function that accepts a code string
|
|
64
|
+
* and returns an array of decorated tokens.
|
|
101
65
|
*/
|
|
102
66
|
export declare const createTokenizer: <M, T>(decorator: (chunk: string, metadata?: M) => T, ...specs: [M, string | RegExp][]) => (code: string) => T[];
|
|
103
67
|
/**
|
|
104
|
-
* Parses a CSV string
|
|
105
|
-
*
|
|
68
|
+
* Parses a CSV string into a two-dimensional array of
|
|
69
|
+
* strings.
|
|
106
70
|
*
|
|
107
71
|
* Supports quoted fields with escaped double quotes (`""`).
|
|
108
72
|
* Carriage returns are normalized.
|
|
109
73
|
*
|
|
110
|
-
* @param csv
|
|
111
|
-
*
|
|
112
|
-
* The CSV string to parse.
|
|
113
|
-
*
|
|
114
|
-
* @param separator
|
|
115
|
-
*
|
|
116
|
-
* The field delimiter (default: `','`).
|
|
117
|
-
*
|
|
118
|
-
* @returns
|
|
74
|
+
* @param csv The CSV string to parse.
|
|
75
|
+
* @param separator The field delimiter (default: `','`).
|
|
119
76
|
*
|
|
120
|
-
* A 2D array where each inner array
|
|
121
|
-
*
|
|
77
|
+
* @returns A 2D array where each inner array represents a
|
|
78
|
+
* row of fields.
|
|
122
79
|
*/
|
|
123
80
|
export declare const csvParse: (csv: string, separator?: string) => string[][];
|
|
124
81
|
/**
|
|
125
|
-
* Applies Polish-specific typographic corrections
|
|
126
|
-
*
|
|
82
|
+
* Applies Polish-specific typographic corrections to a DOM
|
|
83
|
+
* subtree.
|
|
127
84
|
*
|
|
128
85
|
* This function prevents orphaned conjunctions
|
|
129
86
|
* (single-letter words like “a”, “i”, “o”, “u”, “w”, “z”)
|
|
130
|
-
* from appearing at the end of a
|
|
131
|
-
*
|
|
132
|
-
* in a
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
* The root DOM node to process.
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
87
|
+
* and the em dash (“—”) from appearing at the end of a
|
|
88
|
+
* line. It wraps each such character together with the
|
|
89
|
+
* whitespace that follows it in a `white-space:nowrap`
|
|
90
|
+
* span, removing the only line-break opportunity between it
|
|
91
|
+
* and the next word so the two stay glued together. It also
|
|
92
|
+
* inserts zero-width spaces after slashes and dots to allow
|
|
93
|
+
* line breaks.
|
|
94
|
+
*
|
|
95
|
+
* @param node The root DOM node to process. All descendant
|
|
96
|
+
* text nodes are corrected recursively, except those
|
|
97
|
+
* inside `IFRAME`, `NOSCRIPT`, `PRE`, `SCRIPT`, `STYLE`,
|
|
98
|
+
* or `TEXTAREA` elements.
|
|
142
99
|
*/
|
|
143
100
|
export declare const fixPlTypography: (node: Node) => void;
|
|
144
101
|
/**
|
|
@@ -152,33 +109,31 @@ export type HArgs1 = Record<PropertyKey, unknown> | null | undefined | Node | st
|
|
|
152
109
|
*/
|
|
153
110
|
export type HArgs = [string | Node, ...HArgs1[]];
|
|
154
111
|
/**
|
|
155
|
-
* A lightweight
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
* @returns
|
|
180
|
-
*
|
|
181
|
-
* The created or modified `HTMLElement`.
|
|
112
|
+
* A lightweight _HyperScript_-style helper for creating and
|
|
113
|
+
* modifying `HTMLElement`s (see also {@link s}).
|
|
114
|
+
*
|
|
115
|
+
* @param tagOrNode If a `string`, it is treated as the tag
|
|
116
|
+
* name for a new element. If a `Node`, that node is
|
|
117
|
+
* modified in place.
|
|
118
|
+
* @param args Additional arguments processed as follows:
|
|
119
|
+
*
|
|
120
|
+
* - `Object`: maps attributes/properties. Keys starting
|
|
121
|
+
* with `$` set element properties (without the `$`
|
|
122
|
+
* prefix); if the value is a plain object, it is
|
|
123
|
+
* shallow-merged into the existing property instead of
|
|
124
|
+
* replacing it (useful e.g. for `$style`). Other keys
|
|
125
|
+
* set attributes: a key prefixed with `xlink:` sets the
|
|
126
|
+
* attribute via `setAttributeNS` in the XLink
|
|
127
|
+
* namespace; any other key (without a colon) sets it
|
|
128
|
+
* via `setAttribute`. A value of `false` removes the
|
|
129
|
+
* attribute.
|
|
130
|
+
* - `null`/`undefined`: ignored.
|
|
131
|
+
* - `Node`: appended as a child.
|
|
132
|
+
* - `string`/`number`: converted to a `Text` node and
|
|
133
|
+
* appended.
|
|
134
|
+
* - {@link HArgs} array: processed recursively.
|
|
135
|
+
*
|
|
136
|
+
* @returns The created or modified `HTMLElement`.
|
|
182
137
|
*/
|
|
183
138
|
export declare const h: {
|
|
184
139
|
<T extends keyof HTMLElementTagNameMap>(tag: T, ...args1: HArgs1[]): HTMLElementTagNameMap[T];
|
|
@@ -186,33 +141,30 @@ export declare const h: {
|
|
|
186
141
|
(tagOrNode: string | Node, ...args1: HArgs1[]): Node;
|
|
187
142
|
};
|
|
188
143
|
/**
|
|
189
|
-
* A lightweight
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
* @returns
|
|
214
|
-
*
|
|
215
|
-
* The created or modified `SVGElement`.
|
|
144
|
+
* A lightweight _HyperScript_-style helper for creating and
|
|
145
|
+
* modifying `SVGElement`s (see also {@link h}).
|
|
146
|
+
*
|
|
147
|
+
* @param tagOrNode If a `string`, it is treated as the tag
|
|
148
|
+
* name for a new element. If a `Node`, that node is
|
|
149
|
+
* modified in place.
|
|
150
|
+
* @param args Additional arguments processed as follows:
|
|
151
|
+
*
|
|
152
|
+
* - `Object`: maps attributes/properties. Keys starting
|
|
153
|
+
* with `$` set element properties (without the `$`
|
|
154
|
+
* prefix); if the value is a plain object, it is
|
|
155
|
+
* shallow-merged into the existing property instead of
|
|
156
|
+
* replacing it. Other keys set attributes: a key
|
|
157
|
+
* prefixed with `xlink:` sets the attribute via
|
|
158
|
+
* `setAttributeNS` in the XLink namespace; any other
|
|
159
|
+
* key (without a colon) sets it via `setAttribute`. A
|
|
160
|
+
* value of `false` removes the attribute.
|
|
161
|
+
* - `null`/`undefined`: ignored.
|
|
162
|
+
* - `Node`: appended as a child.
|
|
163
|
+
* - `string`/`number`: converted to a `Text` node and
|
|
164
|
+
* appended.
|
|
165
|
+
* - {@link HArgs} array: processed recursively.
|
|
166
|
+
*
|
|
167
|
+
* @returns The created or modified `SVGElement`.
|
|
216
168
|
*/
|
|
217
169
|
export declare const s: {
|
|
218
170
|
<T extends keyof SVGElementTagNameMap>(tag: T, ...args1: HArgs1[]): SVGElementTagNameMap[T];
|
|
@@ -220,298 +172,123 @@ export declare const s: {
|
|
|
220
172
|
(tagOrNode: string | Node, ...args1: HArgs1[]): Node;
|
|
221
173
|
};
|
|
222
174
|
/**
|
|
223
|
-
* Shorthand for creating an SVG element
|
|
224
|
-
*
|
|
175
|
+
* Shorthand for creating an SVG element with a `<use>`
|
|
176
|
+
* child referencing an icon by ID.
|
|
225
177
|
*
|
|
226
178
|
* Equivalent to:
|
|
227
|
-
* `s('svg', ['use', { 'xlink:href': '#' + id }], ...args)`.
|
|
228
|
-
*
|
|
229
|
-
* @param id
|
|
230
|
-
*
|
|
231
|
-
* The ID of the symbol to reference
|
|
232
|
-
* (without the `#` prefix).
|
|
233
|
-
*
|
|
234
|
-
* @param args
|
|
235
179
|
*
|
|
236
|
-
*
|
|
180
|
+
* ```ts
|
|
181
|
+
* s(
|
|
182
|
+
* 'svg',
|
|
183
|
+
* ['use', { 'xlink:href': '#' + id }],
|
|
184
|
+
* ...args
|
|
185
|
+
* )
|
|
186
|
+
* ```
|
|
237
187
|
*
|
|
238
|
-
* @
|
|
188
|
+
* @param id The ID of the symbol to reference (without the
|
|
189
|
+
* `#` prefix).
|
|
190
|
+
* @param args Additional arguments passed to the outer
|
|
191
|
+
* `<svg>` element.
|
|
239
192
|
*
|
|
240
|
-
* An `SVGSVGElement` containing a `<use>` element.
|
|
193
|
+
* @returns An `SVGSVGElement` containing a `<use>` element.
|
|
241
194
|
*/
|
|
242
195
|
export declare const svgUse: (id: string, ...args: HArgs1[]) => SVGSVGElement;
|
|
243
196
|
/**
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
* A null-safe wrapper around `Object.hasOwn`.
|
|
248
|
-
*
|
|
249
|
-
* @param ref
|
|
250
|
-
*
|
|
251
|
-
* The object to check.
|
|
252
|
-
*
|
|
253
|
-
* @param key
|
|
254
|
-
*
|
|
255
|
-
* The property key to look for.
|
|
256
|
-
*
|
|
257
|
-
* @returns
|
|
258
|
-
*
|
|
259
|
-
* `true` if `ref` is not nullish
|
|
260
|
-
* and has `key` as an own property, `false` otherwise.
|
|
261
|
-
*/
|
|
262
|
-
export declare const hasOwn: (ref: unknown, key: unknown) => boolean;
|
|
263
|
-
/**
|
|
264
|
-
* Checks whether the argument is an array.
|
|
265
|
-
*
|
|
266
|
-
* @param arg
|
|
267
|
-
*
|
|
268
|
-
* The value to check.
|
|
269
|
-
*
|
|
270
|
-
* @returns
|
|
271
|
-
*
|
|
272
|
-
* `true` if `arg` is an array, `false` otherwise.
|
|
273
|
-
*/
|
|
274
|
-
export declare const isArray: (arg: unknown) => arg is unknown[];
|
|
275
|
-
/**
|
|
276
|
-
* Checks whether the argument is of type `number`
|
|
277
|
-
* (includes `NaN` and `±Infinity`).
|
|
278
|
-
*
|
|
279
|
-
* @param arg
|
|
280
|
-
*
|
|
281
|
-
* The value to check.
|
|
282
|
-
*
|
|
283
|
-
* @returns
|
|
284
|
-
*
|
|
285
|
-
* `true` if `typeof arg === 'number'`, `false` otherwise.
|
|
286
|
-
*/
|
|
287
|
-
export declare const isNumber: (arg: unknown) => arg is number;
|
|
288
|
-
/**
|
|
289
|
-
* Checks whether the argument is a finite number
|
|
290
|
-
* (excludes `±Infinity` and `NaN`).
|
|
291
|
-
*
|
|
292
|
-
* @param arg
|
|
293
|
-
*
|
|
294
|
-
* The value to check.
|
|
295
|
-
*
|
|
296
|
-
* @returns
|
|
297
|
-
*
|
|
298
|
-
* `true` if `arg` is a finite number, `false` otherwise.
|
|
299
|
-
*/
|
|
300
|
-
export declare const isFiniteNumber: (arg: unknown) => arg is number;
|
|
301
|
-
/**
|
|
302
|
-
* Checks whether the argument is an integer number.
|
|
303
|
-
*
|
|
304
|
-
* @param arg
|
|
305
|
-
*
|
|
306
|
-
* The value to check.
|
|
307
|
-
*
|
|
308
|
-
* @returns
|
|
309
|
-
*
|
|
310
|
-
* `true` if `arg` is an integer number, `false` otherwise.
|
|
311
|
-
*/
|
|
312
|
-
export declare const isInteger: (arg: unknown) => arg is number;
|
|
313
|
-
/**
|
|
314
|
-
* Checks whether the argument is a string.
|
|
315
|
-
*
|
|
316
|
-
* @param arg
|
|
317
|
-
*
|
|
318
|
-
* The value to check.
|
|
319
|
-
*
|
|
320
|
-
* @returns
|
|
321
|
-
*
|
|
322
|
-
* `true` if `typeof arg === 'string'`, `false` otherwise.
|
|
323
|
-
*/
|
|
324
|
-
export declare const isString: (arg: unknown) => arg is string;
|
|
325
|
-
/**
|
|
326
|
-
* Checks whether the argument is a plain object
|
|
327
|
-
* (not `null` and not an array).
|
|
328
|
-
*
|
|
329
|
-
* @param arg
|
|
330
|
-
*
|
|
331
|
-
* The value to check.
|
|
332
|
-
*
|
|
333
|
-
* @returns
|
|
334
|
-
*
|
|
335
|
-
* `true` if `arg` is a plain object, `false` otherwise.
|
|
197
|
+
* A Monokai-inspired color scheme for use with the {@link c}
|
|
198
|
+
* helper and {@link nanolightTs} tokenizer.
|
|
336
199
|
*/
|
|
337
|
-
export declare const
|
|
338
|
-
/**
|
|
339
|
-
* Parses JSON with support for
|
|
340
|
-
* handler-based value transformation (“JavaScript ON”).
|
|
341
|
-
*
|
|
342
|
-
* Objects with exactly one property
|
|
343
|
-
* whose key exists in `handlers`
|
|
344
|
-
* and whose value is an array
|
|
345
|
-
* are replaced by invoking the corresponding handler
|
|
346
|
-
* with the array elements as arguments.
|
|
347
|
-
*
|
|
348
|
-
* @param handlers
|
|
349
|
-
*
|
|
350
|
-
* An object mapping handler names to functions.
|
|
351
|
-
*
|
|
352
|
-
* @param text
|
|
353
|
-
*
|
|
354
|
-
* The JSON string to parse.
|
|
355
|
-
*
|
|
356
|
-
* @returns
|
|
357
|
-
*
|
|
358
|
-
* The parsed value with handler substitutions applied.
|
|
359
|
-
*/
|
|
360
|
-
export declare const jsOnParse: (handlers: Record<PropertyKey, Function>, text: string) => any;
|
|
361
|
-
/**
|
|
362
|
-
* A Monokai-inspired color scheme
|
|
363
|
-
* for use with the {@link c} helper
|
|
364
|
-
* and {@link nanolightTs} tokenizer.
|
|
365
|
-
*/
|
|
366
|
-
export declare const monokai: CRoot;
|
|
200
|
+
export declare const monokai: CNode;
|
|
367
201
|
/**
|
|
368
202
|
* A TypeScript/JavaScript syntax highlighting tokenizer
|
|
369
203
|
* built using {@link createTokenizer}.
|
|
370
204
|
*
|
|
371
|
-
* @param code
|
|
372
|
-
*
|
|
373
|
-
* The source code string to tokenize.
|
|
205
|
+
* @param code The source code string to tokenize.
|
|
374
206
|
*
|
|
375
|
-
* @returns
|
|
376
|
-
*
|
|
377
|
-
* An array of {@link HArgs1} elements
|
|
378
|
-
* suitable for rendering with {@link h}.
|
|
207
|
+
* @returns An array of {@link HArgs1} elements suitable for
|
|
208
|
+
* rendering with {@link h}.
|
|
379
209
|
*/
|
|
380
210
|
export declare const nanolightTs: (code: string) => HArgs1[];
|
|
381
211
|
/**
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
*
|
|
386
|
-
*
|
|
387
|
-
*
|
|
388
|
-
*
|
|
389
|
-
* @param
|
|
390
|
-
*
|
|
391
|
-
*
|
|
392
|
-
*
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
*
|
|
398
|
-
*
|
|
399
|
-
* A new object without the specified keys.
|
|
212
|
+
* A responsive web design helper that generates CSS rules
|
|
213
|
+
* for a grid-like layout.
|
|
214
|
+
*
|
|
215
|
+
* @param root The CSS root object to populate (see
|
|
216
|
+
* {@link c}).
|
|
217
|
+
* @param selector The CSS selector for the grid item.
|
|
218
|
+
* @param cellWidthPx The base cell width in pixels.
|
|
219
|
+
* @param cellHeightPx The base cell height in pixels.
|
|
220
|
+
* @param specs An array of breakpoint specifications, each
|
|
221
|
+
* a tuple of:
|
|
222
|
+
*
|
|
223
|
+
* - `maxWidth`: maximum number of cells per row (defines
|
|
224
|
+
* the viewport breakpoint).
|
|
225
|
+
* - `width` (optional, default `1`): number of horizontal
|
|
226
|
+
* cells the element spans.
|
|
227
|
+
* - `height` (optional, default `1`): number of vertical
|
|
228
|
+
* cells the element spans.
|
|
400
229
|
*/
|
|
401
|
-
export declare const
|
|
230
|
+
export declare const rwd: (root: CNode, selector: string, cellWidthPx: number, cellHeightPx: number, ...specs: [number, number?, number?][]) => void;
|
|
402
231
|
/**
|
|
403
|
-
*
|
|
404
|
-
* from the source object.
|
|
405
|
-
*
|
|
406
|
-
* A runtime equivalent
|
|
407
|
-
* of TypeScript’s `Pick<T, K>` utility type.
|
|
408
|
-
* See also {@link omit}.
|
|
409
|
-
*
|
|
410
|
-
* @param ref
|
|
411
|
-
*
|
|
412
|
-
* The source object.
|
|
413
|
-
*
|
|
414
|
-
* @param keys
|
|
415
|
-
*
|
|
416
|
-
* An array of keys to include in the result.
|
|
232
|
+
* Generates a UUID v1 (time-based) identifier.
|
|
417
233
|
*
|
|
418
|
-
* @
|
|
234
|
+
* @param date The date to use for the timestamp portion
|
|
235
|
+
* (default: current date/time).
|
|
236
|
+
* @param node A hexadecimal `string` for the node portion
|
|
237
|
+
* (default: random). Must match `/^[0-9a-f]*$/`; it is
|
|
238
|
+
* trimmed to the last 12 characters and left-padded with
|
|
239
|
+
* zeros if shorter.
|
|
419
240
|
*
|
|
420
|
-
* A
|
|
241
|
+
* @returns A UUID v1 `string` in the standard format
|
|
242
|
+
* `xxxxxxxx-xxxx-1xxx-xxxx-xxxxxxxxxxxx`.
|
|
421
243
|
*/
|
|
422
|
-
export declare const
|
|
244
|
+
export declare const uuidV1: (date?: Date, node?: string) => string;
|
|
423
245
|
/**
|
|
424
|
-
* A
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
* @param root
|
|
428
|
-
*
|
|
429
|
-
* The CSS root object to populate (see {@link c}).
|
|
430
|
-
*
|
|
431
|
-
* @param selector
|
|
246
|
+
* A Proxy-based helper for auto-vivification of nested
|
|
247
|
+
* object structures.
|
|
432
248
|
*
|
|
433
|
-
*
|
|
249
|
+
* Accessing, assigning, or deleting any nested property on
|
|
250
|
+
* the returned proxy automatically creates intermediate
|
|
251
|
+
* objects (or arrays for numeric-string keys matching
|
|
252
|
+
* `^(0|[1-9]\d*)$`) as needed, allowing deep operations
|
|
253
|
+
* without explicit null checks.
|
|
434
254
|
*
|
|
435
|
-
*
|
|
255
|
+
* Intermediates of the last level in a get-only property
|
|
256
|
+
* chain are NOT auto-created. For example,
|
|
257
|
+
* `vivify(ref).one.two` will create `ref.one` as `{}`, but
|
|
258
|
+
* will NOT create `ref.one.two`. Only when a deeper access,
|
|
259
|
+
* assignment, or deletion occurs, e.g.
|
|
436
260
|
*
|
|
437
|
-
*
|
|
261
|
+
* ```ts
|
|
262
|
+
* delete vivify(ref).one.two.three
|
|
263
|
+
* ```
|
|
438
264
|
*
|
|
439
|
-
*
|
|
265
|
+
* or
|
|
440
266
|
*
|
|
441
|
-
*
|
|
267
|
+
* ```ts
|
|
268
|
+
* vivify(ref).one.two.three = 4
|
|
269
|
+
* ```
|
|
442
270
|
*
|
|
443
|
-
*
|
|
271
|
+
* Will `ref.one.two` be materialized.
|
|
444
272
|
*
|
|
445
|
-
*
|
|
446
|
-
* -
|
|
447
|
-
*
|
|
448
|
-
*
|
|
449
|
-
*
|
|
450
|
-
* - `height` (optional, default `1`):
|
|
451
|
-
* number of vertical cells the element spans.
|
|
452
|
-
*/
|
|
453
|
-
export declare const rwd: (root: CRoot, selector: string, cellWidthPx: number, cellHeightPx: number, ...specs: [number, number?, number?][]) => void;
|
|
454
|
-
/**
|
|
455
|
-
* Generates a UUID v1 (time-based) identifier.
|
|
456
|
-
*
|
|
457
|
-
* @param date
|
|
273
|
+
* When traversal reaches a primitive value, no
|
|
274
|
+
* auto-creation happens; the primitive’s own property is
|
|
275
|
+
* returned instead (e.g. accessing `.toString.name` on a
|
|
276
|
+
* number yields `'toString'` without modifying the
|
|
277
|
+
* underlying structure).
|
|
458
278
|
*
|
|
459
|
-
*
|
|
460
|
-
*
|
|
279
|
+
* Deletion on a non-existing intermediate path will
|
|
280
|
+
* auto-create intermediates up to the parent of the deleted
|
|
281
|
+
* key, e.g.
|
|
461
282
|
*
|
|
462
|
-
*
|
|
283
|
+
* ```ts
|
|
284
|
+
* delete vivify(ref).one.two.three
|
|
285
|
+
* ```
|
|
463
286
|
*
|
|
464
|
-
*
|
|
465
|
-
* (default: random).
|
|
466
|
-
* Must match `/^[0-9a-f]*$/`;
|
|
467
|
-
* it is trimmed to the last 12 characters
|
|
468
|
-
* and left-padded with zeros if shorter.
|
|
287
|
+
* Will create `ref.one.two` as `{}` if it does not exist.
|
|
469
288
|
*
|
|
470
|
-
* @
|
|
289
|
+
* @param ref The root object to wrap.
|
|
471
290
|
*
|
|
472
|
-
* A
|
|
473
|
-
*
|
|
474
|
-
*/
|
|
475
|
-
export declare const uuidV1: (date?: Date, node?: string) => string;
|
|
476
|
-
/**
|
|
477
|
-
* A Proxy-based helper for auto-vivification
|
|
478
|
-
* of nested object structures.
|
|
479
|
-
*
|
|
480
|
-
* Accessing, assigning, or deleting any nested property
|
|
481
|
-
* on the returned proxy
|
|
482
|
-
* automatically creates intermediate objects
|
|
483
|
-
* (or arrays for numeric-string keys matching
|
|
484
|
-
* `^(0|[1-9]\d*)$`) as needed,
|
|
485
|
-
* allowing deep operations without explicit null checks.
|
|
486
|
-
*
|
|
487
|
-
* Intermediates of the last level
|
|
488
|
-
* in a get-only property chain are NOT auto-created.
|
|
489
|
-
* For example, `vivify(ref).one.two` will create
|
|
490
|
-
* `ref.one` as `{}`, but will NOT create `ref.one.two`.
|
|
491
|
-
* Only when a deeper access, assignment, or deletion occurs
|
|
492
|
-
* (e.g. `delete vivify(ref).one.two.three`
|
|
493
|
-
* or `vivify(ref).one.two.three = 4`)
|
|
494
|
-
* will `ref.one.two` be materialized.
|
|
495
|
-
*
|
|
496
|
-
* When traversal reaches a primitive value,
|
|
497
|
-
* no auto-creation happens;
|
|
498
|
-
* the primitive’s own property is returned instead
|
|
499
|
-
* (e.g. accessing `.toString.name` on a number yields
|
|
500
|
-
* `'toString'` without modifying the underlying structure).
|
|
501
|
-
*
|
|
502
|
-
* Deletion on a non-existing intermediate path
|
|
503
|
-
* will auto-create intermediates up to the parent
|
|
504
|
-
* of the deleted key
|
|
505
|
-
* (e.g. `delete vivify(ref).one.two.three`
|
|
506
|
-
* will create `ref.one.two` as `{}` if it does not exist).
|
|
507
|
-
*
|
|
508
|
-
* @param ref
|
|
509
|
-
*
|
|
510
|
-
* The root object to wrap.
|
|
511
|
-
*
|
|
512
|
-
* @returns
|
|
513
|
-
*
|
|
514
|
-
* A proxy that auto-creates nested objects/arrays
|
|
515
|
-
* on property access.
|
|
291
|
+
* @returns A proxy that auto-creates nested objects/arrays
|
|
292
|
+
* on property access.
|
|
516
293
|
*/
|
|
517
294
|
export declare const vivify: (ref: unknown) => any;
|