zion 4.1.0 → 4.1.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.
- package/dist/cli.js +46 -9
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -8,7 +8,7 @@ import os3 from "os";
|
|
|
8
8
|
import path12 from "path";
|
|
9
9
|
|
|
10
10
|
// package.json
|
|
11
|
-
var version = "4.1.
|
|
11
|
+
var version = "4.1.1";
|
|
12
12
|
|
|
13
13
|
// src/lib/theme.ts
|
|
14
14
|
import { Chalk, supportsColor, supportsColorStderr } from "chalk";
|
|
@@ -478,6 +478,7 @@ var STOCK = "#ece6d6";
|
|
|
478
478
|
var INK = "#1f1d1a";
|
|
479
479
|
var SOFT = "#7d776b";
|
|
480
480
|
var BORDER = "#4d4a44";
|
|
481
|
+
var GRAIN = 14;
|
|
481
482
|
var WIDTH = 52;
|
|
482
483
|
var HEIGHT = 13;
|
|
483
484
|
var MARGIN = " ";
|
|
@@ -491,17 +492,17 @@ ${[name, null, email3].map((segment) => segment ? `${MARGIN}${draw(paint, segmen
|
|
|
491
492
|
`;
|
|
492
493
|
}
|
|
493
494
|
const inner = WIDTH - 2;
|
|
494
|
-
|
|
495
|
-
const rows = Array.from({ length: HEIGHT - 2 }, () => blank);
|
|
496
|
-
rows[3] = centered(paint, name, inner);
|
|
497
|
-
rows[7] = centered(paint, email3, inner);
|
|
498
|
-
if (paint.enabled) {
|
|
499
|
-
const stock = paint.bgHex(STOCK);
|
|
495
|
+
if (paint.enabled)
|
|
500
496
|
return `
|
|
501
|
-
${
|
|
497
|
+
${stock(paint, inner, [
|
|
498
|
+
[3, name],
|
|
499
|
+
[7, email3]
|
|
500
|
+
]).join("\n")}
|
|
502
501
|
|
|
503
502
|
`;
|
|
504
|
-
}
|
|
503
|
+
const rows = Array.from({ length: HEIGHT - 2 }, () => " ".repeat(inner));
|
|
504
|
+
rows[3] = centered(paint, name, inner);
|
|
505
|
+
rows[7] = centered(paint, email3, inner);
|
|
505
506
|
const edge = paint.hex(BORDER);
|
|
506
507
|
return `
|
|
507
508
|
${[
|
|
@@ -512,6 +513,42 @@ ${[
|
|
|
512
513
|
|
|
513
514
|
`;
|
|
514
515
|
}
|
|
516
|
+
function stock(paint, inner, lines) {
|
|
517
|
+
const placed = new Map(lines.map(([row, segment]) => [row + 1, segment]));
|
|
518
|
+
const ground = paint.bgHex(STOCK);
|
|
519
|
+
return Array.from({ length: HEIGHT }, (_, y) => {
|
|
520
|
+
const segment = placed.get(y);
|
|
521
|
+
const start = segment ? Math.floor((inner - segment.text.length) / 2) : -1;
|
|
522
|
+
let row = "";
|
|
523
|
+
for (let x = 0; x < inner; x++) {
|
|
524
|
+
if (segment && x === start) {
|
|
525
|
+
row += draw(paint, segment);
|
|
526
|
+
x += segment.text.length - 1;
|
|
527
|
+
continue;
|
|
528
|
+
}
|
|
529
|
+
const beside = segment && x >= start - 1 && x <= start + segment.text.length;
|
|
530
|
+
row += beside ? " " : fiber(paint, x, y);
|
|
531
|
+
}
|
|
532
|
+
return `${MARGIN}${ground(row)}`;
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
var FIBERS = ["\xB7", "\u02D9", ".", ",", "'", "`", "\xB8", "\u02DB"];
|
|
536
|
+
var DENSITY = 0.3;
|
|
537
|
+
function fiber(paint, x, y) {
|
|
538
|
+
if (noise(x, y) > DENSITY) return " ";
|
|
539
|
+
const glyph = FIBERS[Math.floor(noise(x * 1.7, y * 3.1) * FIBERS.length)];
|
|
540
|
+
return paint.hex(shade(STOCK, 1 + noise(x * 2.3, y * 0.7)))(glyph);
|
|
541
|
+
}
|
|
542
|
+
function noise(x, y) {
|
|
543
|
+
const n = Math.sin(x * 12.9898 + y * 78.233) * 43758.5453;
|
|
544
|
+
return n - Math.floor(n);
|
|
545
|
+
}
|
|
546
|
+
function shade(hex3, amount) {
|
|
547
|
+
const step = amount * GRAIN;
|
|
548
|
+
return `#${[1, 3, 5].map((at, i) => parseInt(hex3.slice(at, at + 2), 16) - step * (i === 2 ? 1.25 : 1)).map(
|
|
549
|
+
(c) => Math.round(Math.min(255, Math.max(0, c))).toString(16).padStart(2, "0")
|
|
550
|
+
).join("")}`;
|
|
551
|
+
}
|
|
515
552
|
function centered(paint, segment, inner) {
|
|
516
553
|
const before = Math.floor((inner - segment.text.length) / 2);
|
|
517
554
|
return `${" ".repeat(before)}${draw(paint, segment)}${" ".repeat(inner - before - segment.text.length)}`;
|