@aeondave/pi-theme-1337 0.5.1 → 0.6.0

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.
@@ -0,0 +1,26 @@
1
+ /** Status row styles and foreground roles for Git change counts. */
2
+ import type { GitStatus } from "./git-status.ts";
3
+
4
+ export type StatusStyle = "segmented" | "classic";
5
+ export type StatusBadgeTone = "staged" | "modified" | "untracked" | "conflicted";
6
+
7
+ interface GitStatusBadge {
8
+ text: string;
9
+ tone: StatusBadgeTone;
10
+ }
11
+
12
+ /** Compact whole-count badges, ordered by the usual Git index/worktree states. */
13
+ export function gitStatusBadges(status: GitStatus | undefined): GitStatusBadge[] {
14
+ if (!status) return [];
15
+ const badges: GitStatusBadge[] = [];
16
+ for (const [key, prefix, tone] of [
17
+ ["staged", "+", "staged"],
18
+ ["modified", "~", "modified"],
19
+ ["untracked", "?", "untracked"],
20
+ ["conflicted", "!", "conflicted"],
21
+ ] as const) {
22
+ const value = status[key];
23
+ if (Number.isSafeInteger(value) && value > 0) badges.push({ text: `${prefix}${value}`, tone });
24
+ }
25
+ return badges;
26
+ }