@jackens/nnn 2025.12.23 → 2025.12.29

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.
Files changed (4) hide show
  1. package/nnn.d.ts +25 -25
  2. package/nnn.js +53 -56
  3. package/package.json +1 -1
  4. package/readme.md +2 -0
package/nnn.d.ts CHANGED
@@ -306,31 +306,6 @@ export declare const is_string: (arg: unknown) => arg is string;
306
306
  * The parsed value with handler substitutions applied.
307
307
  */
308
308
  export declare const js_on_parse: (handlers: Record<PropertyKey, Function>, text: string) => any;
309
- /**
310
- * A Monokai-inspired color scheme for use with the {@link c} helper and {@link nanolight_ts} tokenizer.
311
- *
312
- * Defines CSS custom properties for eight colors (`--black`, `--blue`, `--green`, `--grey`,
313
- * `--purple`, `--red`, `--white`, `--yellow`) with both light and dark mode variants.
314
- *
315
- * @remarks
316
- *
317
- * - In light mode, `--black` is a light background and `--white` is dark text.
318
- * - In dark mode (via `prefers-color-scheme: dark`), the palette inverts to a dark background with light text.
319
- * - Includes base styles for `body`, `pre` and `code>span.*` (syntax highlighting).
320
- */
321
- export declare const monokai: CRoot;
322
- /**
323
- * A TypeScript/JavaScript syntax highlighting tokenizer built using {@link new_tokenizer}.
324
- *
325
- * @param code
326
- *
327
- * The source code string to tokenize.
328
- *
329
- * @returns
330
- *
331
- * An array of {@link HArgs1} elements suitable for rendering with {@link h}.
332
- */
333
- export declare const nanolight_ts: (code: string) => HArgs1[];
334
309
  /**
335
310
  * Creates a function that returns the appropriate Polish noun form based on a numeric value.
336
311
  *
@@ -433,6 +408,31 @@ export declare const pro: (ref: unknown) => any;
433
408
  * 3. Among matches of the same position and length, the one defined earlier wins.
434
409
  */
435
410
  export declare const new_tokenizer: <M, T>(decorator: (chunk: string, metadata?: M) => T, ...specs: [M, string | RegExp][]) => (code: string) => T[];
411
+ /**
412
+ * A TypeScript/JavaScript syntax highlighting tokenizer built using {@link new_tokenizer}.
413
+ *
414
+ * @param code
415
+ *
416
+ * The source code string to tokenize.
417
+ *
418
+ * @returns
419
+ *
420
+ * An array of {@link HArgs1} elements suitable for rendering with {@link h}.
421
+ */
422
+ export declare const nanolight_ts: (code: string) => HArgs1[];
423
+ /**
424
+ * A Monokai-inspired color scheme for use with the {@link c} helper and {@link nanolight_ts} tokenizer.
425
+ *
426
+ * Defines CSS custom properties for eight colors (`--black`, `--blue`, `--green`, `--grey`,
427
+ * `--purple`, `--red`, `--white`, `--yellow`) with both light and dark mode variants.
428
+ *
429
+ * @remarks
430
+ *
431
+ * - In light mode, `--black` is a light background and `--white` is dark text.
432
+ * - In dark mode (via `prefers-color-scheme: dark`), the palette inverts to a dark background with light text.
433
+ * - Includes base styles for `body`, `pre` and `code>span.*` (syntax highlighting).
434
+ */
435
+ export declare const monokai: CRoot;
436
436
  /**
437
437
  * Generates a UUID v1 (time-based) identifier.
438
438
  *
package/nnn.js CHANGED
@@ -209,53 +209,15 @@ var js_on_parse = (handlers, text) => JSON.parse(text, (key, value) => {
209
209
  }
210
210
  return value;
211
211
  });
212
- // src/nnn/monokai.ts
213
- var monokai = {
214
- ":root": {
215
- __black: "$faf4f2",
216
- __blue: "#1c8ca8",
217
- __green: "#269d69",
218
- __grey: "#918c8e",
219
- __purple: "#7058be",
220
- __red: "#e14775",
221
- __white: "#29242a",
222
- __yellow: "#cc7a0a"
223
- },
224
- body$$monokai: {
225
- backgroundColor: "var(--black)",
226
- color: "var(--white)"
227
- },
228
- "code>span.": {
229
- black: { color: "var(--black)" },
230
- blue: { color: "var(--blue)" },
231
- green: { color: "var(--green)" },
232
- grey: { color: "var(--grey)" },
233
- purple: { color: "var(--purple)" },
234
- red: { color: "var(--red)" },
235
- white: { color: "var(--white)" },
236
- yellow: { color: "var(--yellow)" }
237
- },
238
- pre: {
239
- margin: 0,
240
- overflow: "visible",
241
- " code": {
242
- fontFamily: '"Source Code Pro"',
243
- padding: 0
244
- }
245
- },
246
- "@media only screen and (prefers-color-scheme: dark)": {
247
- ":root": {
248
- __black: "#2d2a2e",
249
- __blue: "#66d9ef",
250
- __green: "#a9dc76",
251
- __grey: "#727072",
252
- __purple: "#ae81ff",
253
- __red: "#ff6188",
254
- __white: "#fcfcfa",
255
- __yellow: "#ffd866"
256
- }
257
- }
212
+ // src/nnn/noun_form.ts
213
+ var new_noun_form = (singular, plural_2, plural_5) => (value) => {
214
+ const abs_value = Math.abs(value);
215
+ const abs_value_mod_10 = abs_value % 10;
216
+ return value === 1 ? singular : (abs_value_mod_10 === 2 || abs_value_mod_10 === 3 || abs_value_mod_10 === 4) && abs_value !== 12 && abs_value !== 13 && abs_value !== 14 ? plural_2 : plural_5;
258
217
  };
218
+ // src/nnn/omit_pick.ts
219
+ var pick = (ref, keys) => Object.fromEntries(Object.entries(ref).filter(([key]) => keys.includes(key)));
220
+ var omit = (ref, keys) => Object.fromEntries(Object.entries(ref).filter(([key]) => !keys.includes(key)));
259
221
  // src/nnn/tokenizer.ts
260
222
  var new_tokenizer = (decorator, ...specs) => (code) => {
261
223
  const result = [];
@@ -294,8 +256,6 @@ var new_tokenizer = (decorator, ...specs) => (code) => {
294
256
  }
295
257
  return result;
296
258
  };
297
-
298
- // src/nnn/nanolight.ts
299
259
  var BLUE = "blue";
300
260
  var GREEN = "green";
301
261
  var GREY = "grey";
@@ -304,15 +264,52 @@ var RED = "red";
304
264
  var WHITE = "white";
305
265
  var YELLOW = "yellow";
306
266
  var nanolight_ts = /* @__PURE__ */ new_tokenizer((chunk, name) => name != null ? ["span", { class: name }, chunk] : chunk, [YELLOW, /".*?"/], [YELLOW, /'.*?'/], [YELLOW, /`[\s\S]*?`/], [RED, "?"], [RED, /(?<=\s):/], [GREY, "("], [GREY, ")"], [GREY, ","], [GREY, "."], [GREY, ":"], [GREY, ";"], [GREY, "?."], [GREY, "["], [GREY, "]"], [GREY, "{"], [GREY, "}"], [GREY, /\/\*[\s\S]*?\*\//], [GREY, /(?<!\\)\/\/.*?(?=\n)/], [RED, "!"], [RED, "!="], [RED, "!=="], [RED, "%"], [RED, "%="], [RED, "&&"], [RED, "&&="], [RED, "&"], [RED, "&="], [RED, "*"], [RED, "**"], [RED, "**="], [RED, "*="], [RED, "+"], [RED, "++"], [RED, "+="], [RED, "-"], [RED, "--"], [RED, "-="], [RED, "..."], [RED, "/"], [RED, "/="], [RED, ":"], [RED, "<"], [RED, "<<"], [RED, "<<="], [RED, "<="], [RED, "="], [RED, "=="], [RED, "==="], [RED, "=>"], [RED, ">"], [RED, ">="], [RED, ">>"], [RED, ">>="], [RED, ">>>"], [RED, ">>>="], [RED, "?"], [RED, "??"], [RED, "??="], [RED, "^"], [RED, "^="], [RED, "as"], [RED, "async"], [RED, "await"], [RED, "break"], [RED, "case"], [RED, "catch"], [RED, "class"], [RED, "const"], [RED, "continue"], [RED, "debugger"], [RED, "default"], [RED, "delete"], [RED, "do"], [RED, "else"], [RED, "export"], [RED, "extends"], [RED, "finally"], [RED, "for"], [RED, "from"], [RED, "function"], [RED, "function*"], [RED, "goto"], [RED, "if"], [RED, "import"], [RED, "in"], [RED, "instanceof"], [RED, "is"], [RED, "keyof"], [RED, "let"], [RED, "new"], [RED, "of"], [RED, "package"], [RED, "return"], [RED, "super"], [RED, "switch"], [RED, "this"], [RED, "throw"], [RED, "try"], [RED, "type"], [RED, "typeof"], [RED, "var"], [RED, "void"], [RED, "while"], [RED, "with"], [RED, "yield"], [RED, "yield*"], [RED, "|"], [RED, "|="], [RED, "||"], [RED, "||="], [RED, "~"], [RED, "~="], [PURPLE, "false"], [PURPLE, "Infinity"], [PURPLE, "NaN"], [PURPLE, "null"], [PURPLE, "true"], [PURPLE, "undefined"], [PURPLE, /0b[01_]+/], [PURPLE, /0o[01234567_]+/], [PURPLE, /0x[\dabcdef_]+/], [PURPLE, /[\p{Lu}_$][\p{Lu}\d_$]+/u], [PURPLE, /\d[\d_]*(\.[\d_]+)?(e[+-]?[\d_]+)?/], [BLUE, "any"], [BLUE, "bigint"], [BLUE, "boolean"], [BLUE, "eval"], [BLUE, "number"], [BLUE, "string"], [BLUE, "symbol"], [BLUE, "unknown"], [GREEN, /[\p{L}_$][\p{L}\d_$]+(?=\()/u], [BLUE, /\p{Lu}[\p{L}\d_$]+/u], [WHITE, /[\p{L}_$][\p{L}\d_$]+/u]);
307
- // src/nnn/noun_form.ts
308
- var new_noun_form = (singular, plural_2, plural_5) => (value) => {
309
- const abs_value = Math.abs(value);
310
- const abs_value_mod_10 = abs_value % 10;
311
- return value === 1 ? singular : (abs_value_mod_10 === 2 || abs_value_mod_10 === 3 || abs_value_mod_10 === 4) && abs_value !== 12 && abs_value !== 13 && abs_value !== 14 ? plural_2 : plural_5;
267
+ var monokai = {
268
+ ":root": {
269
+ __black: "$faf4f2",
270
+ __blue: "#1c8ca8",
271
+ __green: "#269d69",
272
+ __grey: "#918c8e",
273
+ __purple: "#7058be",
274
+ __red: "#e14775",
275
+ __white: "#29242a",
276
+ __yellow: "#cc7a0a"
277
+ },
278
+ body$$monokai: {
279
+ backgroundColor: "var(--black)",
280
+ color: "var(--white)"
281
+ },
282
+ "code>span.": {
283
+ black: { color: "var(--black)" },
284
+ blue: { color: "var(--blue)" },
285
+ green: { color: "var(--green)" },
286
+ grey: { color: "var(--grey)" },
287
+ purple: { color: "var(--purple)" },
288
+ red: { color: "var(--red)" },
289
+ white: { color: "var(--white)" },
290
+ yellow: { color: "var(--yellow)" }
291
+ },
292
+ pre: {
293
+ margin: 0,
294
+ overflow: "visible",
295
+ " code": {
296
+ fontFamily: '"Source Code Pro"',
297
+ padding: 0
298
+ }
299
+ },
300
+ "@media only screen and (prefers-color-scheme: dark)": {
301
+ ":root": {
302
+ __black: "#2d2a2e",
303
+ __blue: "#66d9ef",
304
+ __green: "#a9dc76",
305
+ __grey: "#727072",
306
+ __purple: "#ae81ff",
307
+ __red: "#ff6188",
308
+ __white: "#fcfcfa",
309
+ __yellow: "#ffd866"
310
+ }
311
+ }
312
312
  };
313
- // src/nnn/omit_pick.ts
314
- var pick = (ref, keys) => Object.fromEntries(Object.entries(ref).filter(([key]) => keys.includes(key)));
315
- var omit = (ref, keys) => Object.fromEntries(Object.entries(ref).filter(([key]) => !keys.includes(key)));
316
313
  // src/nnn/uuid_v1.ts
317
314
  var ZEROS = /* @__PURE__ */ "0".repeat(16);
318
315
  var counter = 0;
package/package.json CHANGED
@@ -41,5 +41,5 @@
41
41
  "name": "@jackens/nnn",
42
42
  "type": "module",
43
43
  "types": "nnn.d.ts",
44
- "version": "2025.12.23"
44
+ "version": "2025.12.29"
45
45
  }
package/readme.md CHANGED
@@ -38,6 +38,7 @@ import { «something» } from './node_modules/@jackens/nnn/nnn.js'
38
38
  - [`escape_values`](#escape_values): Escapes an array of values using the provided escape map.
39
39
  - [`fix_typography`](#fix_typography): Applies Polish-specific typographic corrections to a DOM subtree.
40
40
  - [`h`](#h): A lightweight [HyperScript](https://github.com/hyperhype/hyperscript)-style helper
41
+ for creating and modifying `HTMLElement`s (see also [`s`](#s)).
41
42
  - [`has_own`](#has_own): Checks whether an object has the specified key as its own property.
42
43
  - [`is_array`](#is_array): Checks whether the argument is an array.
43
44
  - [`is_finite_number`](#is_finite_number): Checks whether the argument is a finite number (excludes `±Infinity` and `NaN`).
@@ -55,6 +56,7 @@ import { «something» } from './node_modules/@jackens/nnn/nnn.js'
55
56
  - [`pro`](#pro): A Proxy-based helper for auto-vivification of nested object structures.
56
57
  - [`rwd`](#rwd): A responsive web design helper that generates CSS rules for a grid-like layout.
57
58
  - [`s`](#s): A lightweight [HyperScript](https://github.com/hyperhype/hyperscript)-style helper
59
+ for creating and modifying `SVGElement`s (see also [`h`](#h)).
58
60
  - [`svg_use`](#svg_use): Shorthand for creating an SVG element with a `<use>` child referencing an icon by ID.
59
61
  - [`uuid_v1`](#uuid_v1): Generates a UUID v1 (time-based) identifier.
60
62