@emeryld/manager 0.7.7 → 0.7.9
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/colors-shared.js
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
const ansi = (code) => (text) => `\x1b[${code}m${text}\x1b[0m`;
|
|
2
2
|
export const colors = {
|
|
3
|
-
|
|
3
|
+
black: ansi(30),
|
|
4
|
+
red: ansi(31),
|
|
4
5
|
green: ansi(32),
|
|
5
6
|
yellow: ansi(33),
|
|
7
|
+
blue: ansi(34),
|
|
6
8
|
magenta: ansi(35),
|
|
7
|
-
|
|
9
|
+
cyan: ansi(36),
|
|
10
|
+
white: ansi(37),
|
|
11
|
+
gray: ansi(90),
|
|
12
|
+
brightRed: ansi(91),
|
|
13
|
+
brightGreen: ansi(92),
|
|
14
|
+
brightYellow: ansi(93),
|
|
15
|
+
brightBlue: ansi(94),
|
|
16
|
+
brightMagenta: ansi(95),
|
|
17
|
+
brightCyan: ansi(96),
|
|
18
|
+
brightWhite: ansi(97),
|
|
8
19
|
bold: ansi(1),
|
|
9
20
|
dim: ansi(2),
|
|
10
|
-
gray: ansi(90),
|
|
11
21
|
};
|
|
@@ -63,16 +63,14 @@ function formatInteractiveLines(state, selectedIndex, title, searchState) {
|
|
|
63
63
|
state.options.forEach((option, index) => {
|
|
64
64
|
const isSelected = index === selectedIndex;
|
|
65
65
|
const pointer = isSelected ? `${colors.green('➤')} ` : '';
|
|
66
|
-
const
|
|
66
|
+
const entryColorizer = option.type === 'entry' && option.entry.color
|
|
67
67
|
? getEntryColor(option.entry)
|
|
68
68
|
: colors.cyan;
|
|
69
|
-
const
|
|
69
|
+
const numberLabelColorizer = isSelected ? colors.green : entryColorizer;
|
|
70
|
+
const numberLabel = numberLabelColorizer(`${option.hotkey}`.padStart(2, ' '));
|
|
70
71
|
if (option.type === 'entry') {
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
: isSelected
|
|
74
|
-
? colors.green(option.entry.displayName)
|
|
75
|
-
: option.entry.displayName;
|
|
72
|
+
const labelColorizer = isSelected ? colors.green : entryColorizer;
|
|
73
|
+
const label = labelColorizer(option.entry.displayName);
|
|
76
74
|
const runHint = searchState?.active &&
|
|
77
75
|
searchState.hasResults &&
|
|
78
76
|
index === selectedIndex
|
|
@@ -91,7 +89,11 @@ function formatInteractiveLines(state, selectedIndex, title, searchState) {
|
|
|
91
89
|
: option.action === 'next'
|
|
92
90
|
? 'Next page'
|
|
93
91
|
: 'Back';
|
|
94
|
-
const navLabel = option.enabled
|
|
92
|
+
const navLabel = isSelected && option.enabled
|
|
93
|
+
? colors.green(baseLabel)
|
|
94
|
+
: option.enabled
|
|
95
|
+
? baseLabel
|
|
96
|
+
: colors.dim(baseLabel);
|
|
95
97
|
lines.push(`${pointer}${numberLabel}. ${icon} ${navLabel}`);
|
|
96
98
|
});
|
|
97
99
|
if (searchState?.active && !searchState.hasResults) {
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import { readdir, readFile } from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { pathToFileURL } from 'node:url';
|
|
4
|
-
const
|
|
4
|
+
const PACKAGE_COLOR_INDEX_TABLE = [
|
|
5
|
+
'blue',
|
|
6
|
+
'green',
|
|
7
|
+
'yellow',
|
|
8
|
+
'magenta',
|
|
9
|
+
'red',
|
|
10
|
+
'cyan',
|
|
11
|
+
'brightBlue',
|
|
12
|
+
'brightGreen',
|
|
13
|
+
'brightMagenta',
|
|
14
|
+
];
|
|
15
|
+
// indexes 0-8 map to the same nine package colors
|
|
16
|
+
const DEFAULT_COLOR_PALETTE = PACKAGE_COLOR_INDEX_TABLE;
|
|
5
17
|
const IGNORED_DIRS = new Set([
|
|
6
18
|
'node_modules',
|
|
7
19
|
'.git',
|
|
@@ -123,7 +135,8 @@ export function colorFromSeed(seed) {
|
|
|
123
135
|
for (let i = 0; i < normalized.length; i++) {
|
|
124
136
|
hash = (hash * 31 + normalized.charCodeAt(i)) >>> 0;
|
|
125
137
|
}
|
|
126
|
-
|
|
138
|
+
const index = hash % PACKAGE_COLOR_INDEX_TABLE.length;
|
|
139
|
+
return PACKAGE_COLOR_INDEX_TABLE[index];
|
|
127
140
|
}
|
|
128
141
|
function isManifestMissing(error) {
|
|
129
142
|
if (typeof error !== 'object' || error === null)
|