innernote 0.3.1 → 0.3.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/dist/index.js +41 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -261,6 +261,14 @@ var MARK_BLOCK_COUNT = MARK_GRID.reduce((n, row) => n + row.split("").filter((c)
|
|
|
261
261
|
function paintRGB(r, g, b, s) {
|
|
262
262
|
return paint(r, g, b, s);
|
|
263
263
|
}
|
|
264
|
+
function paintBgRGB(r, g, b, s) {
|
|
265
|
+
if (!wantsColor)
|
|
266
|
+
return s;
|
|
267
|
+
if (truecolor)
|
|
268
|
+
return `\x1B[48;2;${r};${g};${b}m${s}\x1B[49m`;
|
|
269
|
+
const q = (v) => Math.round(v / 255 * 5);
|
|
270
|
+
return `\x1B[48;5;${16 + 36 * q(r) + 6 * q(g) + q(b)}m${s}\x1B[49m`;
|
|
271
|
+
}
|
|
264
272
|
function logo(cells = 2) {
|
|
265
273
|
return MARK_GRID.map((row) => row.split("").map((c) => c === "#" ? "█".repeat(cells) : " ".repeat(cells)).join(""));
|
|
266
274
|
}
|
|
@@ -716,20 +724,47 @@ function level(s, t) {
|
|
|
716
724
|
const tri = up <= 1 ? up : 2 - up;
|
|
717
725
|
return 0.18 + tri * 0.82;
|
|
718
726
|
}
|
|
719
|
-
function
|
|
727
|
+
function rampAt(level2) {
|
|
720
728
|
const from = [74, 58, 44];
|
|
721
729
|
const to = [232, 201, 176];
|
|
722
730
|
const c = (i) => Math.round(from[i] + (to[i] - from[i]) * level2);
|
|
723
|
-
return
|
|
731
|
+
return [c(0), c(1), c(2)];
|
|
724
732
|
}
|
|
725
733
|
function frame(t) {
|
|
726
734
|
const grid = logoGrid();
|
|
727
735
|
const lit = new Map;
|
|
728
736
|
for (const s of SPARKS)
|
|
729
737
|
lit.set(`${s.row},${s.col}`, level(s, t));
|
|
730
|
-
|
|
738
|
+
const levelAt = (row, col) => {
|
|
739
|
+
if (row >= grid.length || grid[row][col] !== "#")
|
|
740
|
+
return null;
|
|
741
|
+
return lit.get(`${row},${col}`) ?? 0.18;
|
|
742
|
+
};
|
|
743
|
+
const rows = [];
|
|
744
|
+
for (let top = 0;top < grid.length; top += 2) {
|
|
745
|
+
let line = "";
|
|
746
|
+
for (let col = 0;col < grid[0].length; col++) {
|
|
747
|
+
const upper = levelAt(top, col);
|
|
748
|
+
const lower = levelAt(top + 1, col);
|
|
749
|
+
if (upper == null && lower == null) {
|
|
750
|
+
line += " ";
|
|
751
|
+
} else if (upper != null && lower == null) {
|
|
752
|
+
const [r, g, b] = rampAt(upper);
|
|
753
|
+
line += paintRGB(r, g, b, "▀");
|
|
754
|
+
} else if (upper == null && lower != null) {
|
|
755
|
+
const [r, g, b] = rampAt(lower);
|
|
756
|
+
line += paintRGB(r, g, b, "▄");
|
|
757
|
+
} else {
|
|
758
|
+
const [r, g, b] = rampAt(upper);
|
|
759
|
+
const [br, bg, bb] = rampAt(lower);
|
|
760
|
+
line += paintBgRGB(br, bg, bb, paintRGB(r, g, b, "▀"));
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
rows.push(line.trimEnd());
|
|
764
|
+
}
|
|
765
|
+
return rows;
|
|
731
766
|
}
|
|
732
|
-
var HEIGHT =
|
|
767
|
+
var HEIGHT = 5;
|
|
733
768
|
|
|
734
769
|
class Thinking {
|
|
735
770
|
phases;
|
|
@@ -760,7 +795,7 @@ class Thinking {
|
|
|
760
795
|
this.label = p.text;
|
|
761
796
|
const rows = frame(t);
|
|
762
797
|
const mid = Math.floor(rows.length / 2);
|
|
763
|
-
const out2 = rows.map((r, i) => ` ${r}${i === mid ? `
|
|
798
|
+
const out2 = rows.map((r, i) => ` ${r}${i === mid ? ` \x1B[2m${this.label}\x1B[0m` : ""}`).join(`
|
|
764
799
|
`);
|
|
765
800
|
if (this.drawn)
|
|
766
801
|
process.stderr.write(`\x1B[${HEIGHT}A`);
|
|
@@ -1498,7 +1533,7 @@ function suggest(state) {
|
|
|
1498
1533
|
// package.json
|
|
1499
1534
|
var package_default = {
|
|
1500
1535
|
name: "innernote",
|
|
1501
|
-
version: "0.3.
|
|
1536
|
+
version: "0.3.2",
|
|
1502
1537
|
description: "Write LinkedIn posts in your voice, from the terminal.",
|
|
1503
1538
|
type: "module",
|
|
1504
1539
|
bin: {
|