@oh-my-pi/pi-tui 15.4.1 → 15.4.3
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.
|
@@ -12,10 +12,12 @@ export interface SettingItem {
|
|
|
12
12
|
values?: string[];
|
|
13
13
|
/** If provided, Enter opens this submenu. Receives current value and done callback. */
|
|
14
14
|
submenu?: (currentValue: string, done: (selectedValue?: string) => void) => Component;
|
|
15
|
+
/** True when the displayed setting differs from its default value. */
|
|
16
|
+
changed?: boolean;
|
|
15
17
|
}
|
|
16
18
|
export interface SettingsListTheme {
|
|
17
|
-
label: (text: string, selected: boolean) => string;
|
|
18
|
-
value: (text: string, selected: boolean) => string;
|
|
19
|
+
label: (text: string, selected: boolean, changed: boolean) => string;
|
|
20
|
+
value: (text: string, selected: boolean, changed: boolean) => string;
|
|
19
21
|
description: (text: string) => string;
|
|
20
22
|
cursor: string;
|
|
21
23
|
hint: (text: string) => string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@oh-my-pi/pi-tui",
|
|
4
|
-
"version": "15.4.
|
|
4
|
+
"version": "15.4.3",
|
|
5
5
|
"description": "Terminal User Interface library with differential rendering for efficient text-based applications",
|
|
6
6
|
"homepage": "https://omp.sh",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"fmt": "biome format --write ."
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@oh-my-pi/pi-natives": "15.4.
|
|
41
|
-
"@oh-my-pi/pi-utils": "15.4.
|
|
40
|
+
"@oh-my-pi/pi-natives": "15.4.3",
|
|
41
|
+
"@oh-my-pi/pi-utils": "15.4.3",
|
|
42
42
|
"lru-cache": "11.3.6",
|
|
43
43
|
"marked": "^18.0.3"
|
|
44
44
|
},
|
|
@@ -15,11 +15,13 @@ export interface SettingItem {
|
|
|
15
15
|
values?: string[];
|
|
16
16
|
/** If provided, Enter opens this submenu. Receives current value and done callback. */
|
|
17
17
|
submenu?: (currentValue: string, done: (selectedValue?: string) => void) => Component;
|
|
18
|
+
/** True when the displayed setting differs from its default value. */
|
|
19
|
+
changed?: boolean;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
export interface SettingsListTheme {
|
|
21
|
-
label: (text: string, selected: boolean) => string;
|
|
22
|
-
value: (text: string, selected: boolean) => string;
|
|
23
|
+
label: (text: string, selected: boolean, changed: boolean) => string;
|
|
24
|
+
value: (text: string, selected: boolean, changed: boolean) => string;
|
|
23
25
|
description: (text: string) => string;
|
|
24
26
|
cursor: string;
|
|
25
27
|
hint: (text: string) => string;
|
|
@@ -117,7 +119,7 @@ export class SettingsList implements Component {
|
|
|
117
119
|
|
|
118
120
|
// Pad label to align values
|
|
119
121
|
const labelPadded = item.label + padding(Math.max(0, maxLabelWidth - visibleWidth(item.label)));
|
|
120
|
-
const labelText = this.#theme.label(labelPadded, isSelected);
|
|
122
|
+
const labelText = this.#theme.label(labelPadded, isSelected, item.changed === true);
|
|
121
123
|
|
|
122
124
|
// Calculate space for value
|
|
123
125
|
const separator = " ";
|
|
@@ -127,6 +129,7 @@ export class SettingsList implements Component {
|
|
|
127
129
|
const valueText = this.#theme.value(
|
|
128
130
|
truncateToWidth(item.currentValue, valueMaxWidth, Ellipsis.Omit),
|
|
129
131
|
isSelected,
|
|
132
|
+
item.changed === true,
|
|
130
133
|
);
|
|
131
134
|
|
|
132
135
|
lines.push(truncateToWidth(prefix + labelText + separator + valueText, width));
|