pi-arsenal 0.1.4 → 0.2.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.
@@ -142,13 +142,13 @@ function paint(line: string, colors: string, theme: Theme): string {
142
142
 
143
143
  function splash(theme: Theme, width: number): string[] {
144
144
  const label = `${theme.bold(theme.fg("error", "◆"))}${theme.fg("text", " ID: 沫路")} ${theme.fg("dim", "// PI ARSENAL")}`;
145
- const artWidth = Math.max(...PORTRAIT.map(visibleWidth), visibleWidth(label));
146
- if (width < artWidth) return [truncateToWidth(label, width)];
147
- const center = (line: string) => " ".repeat(Math.max(0, Math.floor((width - artWidth) / 2))) + line;
148
- const logoWidth = Math.max(...ARSENAL_LOGO.map(visibleWidth));
149
- if (width < Math.max(artWidth, logoWidth)) return [truncateToWidth(label, width)];
150
- const centerLogo = (line: string) => " ".repeat(Math.max(0, Math.floor((width - logoWidth) / 2))) + theme.fg("error", line);
151
- return ["", ...PORTRAIT.map((line, index) => center(paint(line, COLOR_MASK[index] || "", theme))), "", ...ARSENAL_LOGO.map(centerLogo), center(label), ""];
145
+ // Use a single block width so PORTRAIT, ARSENAL_LOGO, and label all share
146
+ // the same centre point and never drift apart on wide terminals.
147
+ const blockWidth = Math.max(...PORTRAIT.map(visibleWidth), ...ARSENAL_LOGO.map(visibleWidth), visibleWidth(label));
148
+ if (width < blockWidth) return [truncateToWidth(label, width)];
149
+ const pad = " ".repeat(Math.max(0, Math.floor((width - blockWidth) / 2)));
150
+ const center = (line: string) => pad + line;
151
+ return ["", ...PORTRAIT.map((line, index) => center(paint(line, COLOR_MASK[index] || "", theme))), "", ...ARSENAL_LOGO.map((line) => center(theme.fg("error", line))), center(label), ""];
152
152
  }
153
153
 
154
154
  export default function startupSplash(pi: ExtensionAPI) {