osdy-pi 0.1.6 → 0.1.7

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.
@@ -6,129 +6,129 @@ export const ANIMATION_ENABLED = true;
6
6
  export const ANIMATION_INTERVAL_MS = 30;
7
7
  export const INTRO_ANIMATION_FRAMES = 28;
8
8
  export const WORKING_SPINNER_FRAMES = [
9
- "⠋",
10
- "⠙",
11
- "⠹",
12
- "⠸",
13
- "⠼",
14
- "⠴",
15
- "⠦",
16
- "⠧",
17
- "⠇",
18
- "⠏",
9
+ "⠋",
10
+ "⠙",
11
+ "⠹",
12
+ "⠸",
13
+ "⠼",
14
+ "⠴",
15
+ "⠦",
16
+ "⠧",
17
+ "⠇",
18
+ "⠏",
19
19
  ];
20
20
  export const WORKING_WIDGET_KEY = "osdy-pi-working";
21
21
  export const MASCOT_MIN_ROWS = 34;
22
22
  export const MASCOT_GAP = 0;
23
23
 
24
24
  const HTML_MASCOT = [
25
- " ▓▓▓▓▒ ",
26
- " ░ ▓▓▓ ▒▓ ",
27
- " ░░░▓▓▓ ▓▓ ",
28
- " ▒ ▒ ▒▒ ▒ ░░ ▓▓▓▓ ░▒▓▓ ",
29
- "▓▓▓▓▓▓▓▓░░░░░ ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒ ░░▒▓ ",
30
- "▓▓ ▓▓▓▓▓░░░ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░ ░░▒▒ ",
31
- "▓▓░ ▒▓▓▓▒░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▒▒▒▒▒▒▒░░ ░▒▒ ",
32
- " ▓▒░░ ▒░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓█▓▓█▓▓▓▓▓▒▒▒░▒▒░ ",
33
- " ▓▒░░ ░▒▒▒▒▒▓▓▓▓▓▒█▒▒▒▒▒▓▓▓▓ ░░░ ▓▓▓▓▒▒▒░░ ",
34
- " ▒▒░░ ░▒▒▒▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▓▓ ░ ▓ ▒▒░░ ",
35
- " ▒▒▒▒░▒▒▓▓▓▓░ ░▓▒▒▒▒▒ ░▒▒█▓ ▒▓▓▓░▒ ",
36
- " ░ ░▒▒▓▓▒ ▓░░ ░░ ░ ▓▓▓▒ ",
37
- " ░░▒▓░ ░▒░▓▓ ░░ ░▓▓▒ ",
38
- " ░▒ ▒ ░▒▒▒ ▒▒▒▒ ░ ▒▒▒ ",
39
- " ░▒▓▓░ ▓▓░░░ █▓ ▒ ░▒▒▒ ",
40
- " ▒▓▓▓░ ▓▓ ▓▓▓▓▓▓▓▓▓ ░░▒ ",
41
- " ▓▓▓░ ░ ▓▓▓▓▓▓▒▓▓▓▓ ▓▓▓▓▓▓▓▒░░░░ ░ ",
42
- " ▒▒▒▒ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒░░░░ ",
43
- " ▓▒▒░░ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒░░ ▓ ",
44
- " ░░░░░░░░░▒▒▒▒▒▒▒▒▒▒▒▒ ░░░ ",
45
- " ░ ░░░░░░░░░░░▒▒░░ ░ ░ ░ ▓ ",
46
- " ░░░░░▒▒▒▒░░▒░ ▒▒▒▒▒░░ ░░▒▒▒░░░░░░░░ ",
47
- " ▒▒▒▒▒░░░▒▒▒▒▒▒▒▒▒▒▒▒░░░ ▒░░▒▒▒▒▓▓▓▓░░░░ ",
48
- " ░▒▒▒▒▒░ ░░▒▒▒▒▒▒▒▒░░░ ░░▒▓▓▓▓▒▒░░ ",
49
- " ▓░░░░░░ ░ ░░░░░░░░░░░ ░░░░░░▓▒▒▒▒ ░",
50
- " ░░░▒▒▓▓▓▓▓▒░░░░░░░░░░ ░░▒▒▒▒░░░░░░░▒▒░░ ",
51
- " ░▒▒▒▓▓▓▓▓▓▓▓▓▓▒▒▒▒░░░ ░▒▒▒▓▓▒░░░ ░░░▒ ",
52
- " ▒░▒▒▒▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒░░░ ░▒▒▓▓▒░ ░ ",
53
- " ░░▒▒▒▒▒▒▓▓▓▓▓▓▒▒▒▒▒▒░░░░ ░▒▒▒▒▒ ░ ",
54
- " ▒░░░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░░░░░ ▒▒░▒ ",
55
- " ░░░░░░░░░░▒░░▒░▒▒░░░░ ░ ░░░░ ",
56
- " ░░░░ ░░░░░░░░░░░ ░░░░ ",
57
- " ░ ░░░░░░ ▓ ",
58
- " ░░░░░ ░░░░░░ ",
59
- " ░ ░ ",
25
+ " ▓▓▓▓▒ ",
26
+ " ░ ▓▓▓ ▒▓ ",
27
+ " ░░░▓▓▓ ▓▓ ",
28
+ " ▒ ▒ ▒▒ ▒ ░░ ▓▓▓▓ ░▒▓▓ ",
29
+ "▓▓▓▓▓▓▓▓░░░░░ ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒ ░░▒▓ ",
30
+ "▓▓ ▓▓▓▓▓░░░ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░ ░░▒▒ ",
31
+ "▓▓░ ▒▓▓▓▒░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▒▒▒▒▒▒▒░░ ░▒▒ ",
32
+ " ▓▒░░ ▒░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓█▓▓█▓▓▓▓▓▒▒▒░▒▒░ ",
33
+ " ▓▒░░ ░▒▒▒▒▒▓▓▓▓▓▒█▒▒▒▒▒▓▓▓▓ ░░░ ▓▓▓▓▒▒▒░░ ",
34
+ " ▒▒░░ ░▒▒▒▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▓▓ ░ ▓ ▒▒░░ ",
35
+ " ▒▒▒▒░▒▒▓▓▓▓░ ░▓▒▒▒▒▒ ░▒▒█▓ ▒▓▓▓░▒ ",
36
+ " ░ ░▒▒▓▓▒ ▓░░ ░░ ░ ▓▓▓▒ ",
37
+ " ░░▒▓░ ░▒░▓▓ ░░ ░▓▓▒ ",
38
+ " ░▒ ▒ ░▒▒▒ ▒▒▒▒ ░ ▒▒▒ ",
39
+ " ░▒▓▓░ ▓▓░░░ █▓ ▒ ░▒▒▒ ",
40
+ " ▒▓▓▓░ ▓▓ ▓▓▓▓▓▓▓▓▓ ░░▒ ",
41
+ " ▓▓▓░ ░ ▓▓▓▓▓▓▒▓▓▓▓ ▓▓▓▓▓▓▓▒░░░░ ░ ",
42
+ " ▒▒▒▒ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒░░░░ ",
43
+ " ▓▒▒░░ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒░░ ▓ ",
44
+ " ░░░░░░░░░▒▒▒▒▒▒▒▒▒▒▒▒ ░░░ ",
45
+ " ░ ░░░░░░░░░░░▒▒░░ ░ ░ ░ ▓ ",
46
+ " ░░░░░▒▒▒▒░░▒░ ▒▒▒▒▒░░ ░░▒▒▒░░░░░░░░ ",
47
+ " ▒▒▒▒▒░░░▒▒▒▒▒▒▒▒▒▒▒▒░░░ ▒░░▒▒▒▒▓▓▓▓░░░░ ",
48
+ " ░▒▒▒▒▒░ ░░▒▒▒▒▒▒▒▒░░░ ░░▒▓▓▓▓▒▒░░ ",
49
+ " ▓░░░░░░ ░ ░░░░░░░░░░░ ░░░░░░▓▒▒▒▒ ░",
50
+ " ░░░▒▒▓▓▓▓▓▒░░░░░░░░░░ ░░▒▒▒▒░░░░░░░▒▒░░ ",
51
+ " ░▒▒▒▓▓▓▓▓▓▓▓▓▓▒▒▒▒░░░ ░▒▒▒▓▓▒░░░ ░░░▒ ",
52
+ " ▒░▒▒▒▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒░░░ ░▒▒▓▓▒░ ░ ",
53
+ " ░░▒▒▒▒▒▒▓▓▓▓▓▓▒▒▒▒▒▒░░░░ ░▒▒▒▒▒ ░ ",
54
+ " ▒░░░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░░░░░ ▒▒░▒ ",
55
+ " ░░░░░░░░░░▒░░▒░▒▒░░░░ ░ ░░░░ ",
56
+ " ░░░░ ░░░░░░░░░░░ ░░░░ ",
57
+ " ░ ░░░░░░ ▓ ",
58
+ " ░░░░░ ░░░░░░ ",
59
+ " ░ ░ ",
60
60
  ] as const;
61
61
 
62
62
  const HTML_MASCOT_MAP = [
63
- " hhhhl ",
64
- " dmmhhhmmlhm ",
65
- " dmmmhhhdmmmmhh ",
66
- " ldldllddmdldmmmmhhlhddmmmlhh ",
67
- "hhhhhhhhmmmlm llllllllllllllllllmlldddmmmll ",
68
- "hhmmmmlhhhhmmmdllllllllllllllllllllllllmddmmmll ",
69
- "hhmmmddlhhhlmlllllllllllllllllllhlllllllllmmlld ",
70
- " llmmmdddlmllllllllllllllllllhbhhbhhhhhllllllm ",
71
- " dllmmmddllllllhhhhhlblllllhhhhmmmmmmhhhhlllmm ",
72
- " dllmmmlllllhhhhhhhhhhllllhhmmmmmmmmmddddhdlllm ",
73
- " lllllllhhhhmmmmmmmhllllldmdlllbhmmmmddddlhhhlldd ",
74
- " mdlllhhlmmdhmmmddmmdmmddmmmmdldddddddddmmmhhhl ",
75
- " lllhmddmlmhhmmmmmddmmmddddddddddddddddmmdmmmhhl ",
76
- " mlldldddmlllddddddddlllldmddddddddddddmmmddmlll ",
77
- " llhhmddddmmdddddddddhhmmmdbhdldddddddddmmddmlll ",
78
- " llhhmmmdddddddddddddhhddddmhhhhhhhhhmmdddddlml ",
79
- " hhhmmmmmddddddddldhhhhhhlhhhhmhhhhhhhlmmmmmm ",
80
- " llllmddmddddddddhhhhhhhhhhlhhhhhhhlllmmmm ",
81
- " hllllmddddddmhhhhhhhhhhhhhllllllmmmh ",
82
- " dmmmmmmmmlllllllllllllmdmmm ",
83
- " mmmmmmmmmmmmmmmlllmm ",
84
- " dlmmmmllllmmlmmllllllm dmllllmmmmmmmm ",
85
- " lllllmmlllllllllllllmmm lmllllllllhlmmmmm ",
86
- " mlllllmdmlllllllllmmmd mddmmmmlhhhlllmmmmm ",
87
- " hmmmmmmdmdmmmmmmmmmmm dddmmmmmmmmlllllmmdmm",
88
- " mmmlllllhllllmmmmmmmm dmmllllmmmmmmmlllmdm ",
89
- " mlllhhhhhhhhlllllllmmdddmlllhllmmmmmmlmml ",
90
- " llllllhhhhhhhllllllllmmdddmmlllllmmmmdmmd ",
91
- " mllllllllhhllllllllllmmmddmmmlllllmdddmm ",
92
- " lmllmlllllllllllllllmmmmmddmmmllllmdddd ",
93
- " lmmmmmmllllmllllllmmmdmdddddmmmmmddmd ",
94
- " dmmmmmmd dmmmmmmmmmmmmddddmmmmmdd ",
95
- " dmmmmmd dmmmmmmd h ",
96
- " mmmmmmmm dmmmmmmm ",
97
- " dmmmmmm ",
63
+ " hhhhl ",
64
+ " dmmhhhmmlhm ",
65
+ " dmmmhhhdmmmmhh ",
66
+ " ldldllddmdldmmmmhhlhddmmmlhh ",
67
+ "hhhhhhhhmmmlm llllllllllllllllllmlldddmmmll ",
68
+ "hhmmmmlhhhhmmmdllllllllllllllllllllllllmddmmmll ",
69
+ "hhmmmddlhhhlmlllllllllllllllllllhlllllllllmmlld ",
70
+ " llmmmdddlmllllllllllllllllllhbhhbhhhhhllllllm ",
71
+ " dllmmmddllllllhhhhhlblllllhhhhmmmmmmhhhhlllmm ",
72
+ " dllmmmlllllhhhhhhhhhhllllhhmmmmmmmmmddddhdlllm ",
73
+ " lllllllhhhhmmmmmmmhllllldmdlllbhmmmmddddlhhhlldd ",
74
+ " mdlllhhlmmdhmmmddmmdmmddmmmmdldddddddddmmmhhhl ",
75
+ " lllhmddmlmhhmmmmmddmmmddddddddddddddddmmdmmmhhl ",
76
+ " mlldldddmlllddddddddlllldmddddddddddddmmmddmlll ",
77
+ " llhhmddddmmdddddddddhhmmmdbhdldddddddddmmddmlll ",
78
+ " llhhmmmdddddddddddddhhddddmhhhhhhhhhmmdddddlml ",
79
+ " hhhmmmmmddddddddldhhhhhhlhhhhmhhhhhhhlmmmmmm ",
80
+ " llllmddmddddddddhhhhhhhhhhlhhhhhhhlllmmmm ",
81
+ " hllllmddddddmhhhhhhhhhhhhhllllllmmmh ",
82
+ " dmmmmmmmmlllllllllllllmdmmm ",
83
+ " mmmmmmmmmmmmmmmlllmm ",
84
+ " dlmmmmllllmmlmmllllllm dmllllmmmmmmmm ",
85
+ " lllllmmlllllllllllllmmm lmllllllllhlmmmmm ",
86
+ " mlllllmdmlllllllllmmmd mddmmmmlhhhlllmmmmm ",
87
+ " hmmmmmmdmdmmmmmmmmmmm dddmmmmmmmmlllllmmdmm",
88
+ " mmmlllllhllllmmmmmmmm dmmllllmmmmmmmlllmdm ",
89
+ " mlllhhhhhhhhlllllllmmdddmlllhllmmmmmmlmml ",
90
+ " llllllhhhhhhhllllllllmmdddmmlllllmmmmdmmd ",
91
+ " mllllllllhhllllllllllmmmddmmmlllllmdddmm ",
92
+ " lmllmlllllllllllllllmmmmmddmmmllllmdddd ",
93
+ " lmmmmmmllllmllllllmmmdmdddddmmmmmddmd ",
94
+ " dmmmmmmd dmmmmmmmmmmmmddddmmmmmdd ",
95
+ " dmmmmmd dmmmmmmd h ",
96
+ " mmmmmmmm dmmmmmmm ",
97
+ " dmmmmmm ",
98
98
  ] as const;
99
99
 
100
100
  const HEADER_CLASSIC = [
101
- "░█████╗░░██████╗██████╗░██╗░░░██╗░░░░░░██████╗░██╗",
102
- "██╔══██╗██╔════╝██╔══██╗╚██╗░██╔╝░░░░░░██╔══██╗ ║",
103
- "██║░░██║╚█████╗░██║░░██║░╚████╔╝░█████╗██████╔╝██║",
104
- "██║░░██║░╚═══██╗██║░░██║░░╚██╔╝░░╚════╝██╔═══╝░██║",
105
- "╚█████╔╝██████╔╝██████╔╝░░░██║░░░░░░░░░██║░░░░░██║",
106
- "░╚════╝░╚═════╝░╚═════╝░░░░╚═╝░░░░░░░░░╚═╝░░░░░╚═╝",
107
- " ╭━╮╱╱╱╱╱╱╭╮╱╱╱╱╱╭╮╱╱╱╱╱╭╮╱╱╭╮╭╮╱╱╱╱╭━╮",
108
- " ┃╭╋━┳━━┳━╋╋╮╭━╮╭╯┣━┳┳╮╭╯┣━╮┣╋╯┣━┳━╮┃━┫",
109
- " ┃╰┫╋┃┃┃┃╋┃┃╰┫╋╰┫╋┃╋┃╭╯┃╋┃┻┫┃┃╋┃┻┫╋╰╋━┃",
110
- " ╰━┻━┻┻┻┫╭┻┻━┻━━┻━┻━┻╯╱╰━┻━╯╰┻━┻━┻━━┻━╯",
111
- " ╱╱╱╱╱╱╱╰╯ </>",
101
+ "░█████╗░░██████╗██████╗░██╗░░░██╗░░░░░░██████╗░██╗",
102
+ "██╔══██╗██╔════╝██╔══██╗╚██╗░██╔╝░░░░░░██╔══██╗ ║",
103
+ "██║░░██║╚█████╗░██║░░██║░╚████╔╝░█████╗██████╔╝██║",
104
+ "██║░░██║░╚═══██╗██║░░██║░░╚██╔╝░░╚════╝██╔═══╝░██║",
105
+ "╚█████╔╝██████╔╝██████╔╝░░░██║░░░░░░░░░██║░░░░░██║",
106
+ "░╚════╝░╚═════╝░╚═════╝░░░░╚═╝░░░░░░░░░╚═╝░░░░░╚═╝",
107
+ " ╭━╮╱╱╱╱╱╱╭╮╱╱╱╱╱╭╮╱╱╱╱╱╭╮╱╱╭╮╭╮╱╱╱╱╭━╮",
108
+ " ┃╭╋━┳━━┳━╋╋╮╭━╮╭╯┣━┳┳╮╭╯┣━╮┣╋╯┣━┳━╮┃━┫",
109
+ " ┃╰┫╋┃┃┃┃╋┃┃╰┫╋╰┫╋┃╋┃╭╯┃╋┃┻┫┃┃╋┃┻┫╋╰╋━┃",
110
+ " ╰━┻━┻┻┻┫╭┻┻━┻━━┻━┻━┻╯╱╰━┻━╯╰┻━┻━┻━━┻━╯",
111
+ " ╱╱╱╱╱╱╱╰╯ </>",
112
112
  ] as const;
113
113
 
114
114
  const HEADER_SIMPLE = [
115
- " ███████ █████ ███████████ ███ ",
116
- " ███░░░░░███ ░░███ ░░███░░░░░███ ░░░ ",
117
- " ███ ░░███ █████ ███████ █████ ████ ░███ ░███ ████ ",
118
- "░███ ░███ ███░░ ███░░███ ░░███ ░███ ██████████ ░██████████ ░░███ ",
119
- "░███ ░███░░█████ ░███ ░███ ░███ ░███ ░░░░░░░░░░ ░███░░░░░░ ░███ ",
120
- "░░███ ███ ░░░░███░███ ░███ ░███ ░███ ░███ ░███ ",
121
- " ░░░███████░ ██████ ░░████████ ░░███████ █████ █████",
122
- " ░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░███ ░░░░░ ░░░░░ ",
123
- " ███ ░███",
124
- " ░░██████",
125
- " ░░░░░░ </>",
115
+ " ███████ █████ ███████████ ███ ",
116
+ " ███░░░░░███ ░░███ ░░███░░░░░███ ░░░ ",
117
+ " ███ ░░███ █████ ███████ █████ ████ ░███ ░███ ████ ",
118
+ "░███ ░███ ███░░ ███░░███ ░░███ ░███ ██████████ ░██████████ ░░███ ",
119
+ "░███ ░███░░█████ ░███ ░███ ░███ ░███ ░░░░░░░░░░ ░███░░░░░░ ░███ ",
120
+ "░░███ ███ ░░░░███░███ ░███ ░███ ░███ ░███ ░███ ",
121
+ " ░░░███████░ ██████ ░░████████ ░░███████ █████ █████",
122
+ " ░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░███ ░░░░░ ░░░░░ ",
123
+ " ███ ░███",
124
+ " ░░██████",
125
+ " ░░░░░░ <ideas_compiler/>",
126
126
  ] as const;
127
127
 
128
128
  type HeaderPalette = {
129
- baseColor: string;
130
- highlightColor: string;
131
- trailColor: string;
129
+ baseColor: string;
130
+ highlightColor: string;
131
+ trailColor: string;
132
132
  };
133
133
 
134
134
  export type MascotToneKey = "b" | "h" | "l" | "m" | "d" | "p" | "c" | "v";
@@ -136,203 +136,203 @@ export type MascotToneKey = "b" | "h" | "l" | "m" | "d" | "p" | "c" | "v";
136
136
  export type MascotTonePalette = Record<MascotToneKey, string>;
137
137
 
138
138
  type HeaderVariantConfig = {
139
- label: string;
140
- header: readonly string[];
141
- headerMap?: readonly string[];
142
- headerTonePalette?: MascotTonePalette;
143
- minRowsForFull?: number;
144
- fallbackHeader?: readonly string[];
145
- fallbackLinePalette?: (lineIndex: number) => HeaderPalette;
146
- mascot?: readonly string[];
147
- mascotMap?: readonly string[];
148
- linePalette: (lineIndex: number) => HeaderPalette;
149
- mascotPalette: HeaderPalette;
150
- mascotTonePalette?: MascotTonePalette;
139
+ label: string;
140
+ header: readonly string[];
141
+ headerMap?: readonly string[];
142
+ headerTonePalette?: MascotTonePalette;
143
+ minRowsForFull?: number;
144
+ fallbackHeader?: readonly string[];
145
+ fallbackLinePalette?: (lineIndex: number) => HeaderPalette;
146
+ mascot?: readonly string[];
147
+ mascotMap?: readonly string[];
148
+ linePalette: (lineIndex: number) => HeaderPalette;
149
+ mascotPalette: HeaderPalette;
150
+ mascotTonePalette?: MascotTonePalette;
151
151
  };
152
152
 
153
153
  const CLASSIC_PALETTE: HeaderPalette = {
154
- baseColor: "accent",
155
- highlightColor: "mdHeading",
156
- trailColor: "mdLink",
154
+ baseColor: "accent",
155
+ highlightColor: "mdHeading",
156
+ trailColor: "mdLink",
157
157
  };
158
158
 
159
159
  const CLASSIC_LINK_PALETTE: HeaderPalette = {
160
- baseColor: "mdLink",
161
- highlightColor: "mdHeading",
162
- trailColor: "mdLink",
160
+ baseColor: "mdLink",
161
+ highlightColor: "mdHeading",
162
+ trailColor: "mdLink",
163
163
  };
164
164
 
165
165
  const OSDY_THEME_PINK_PALETTE: HeaderPalette = {
166
- baseColor: "accent",
167
- highlightColor: "mdHeading",
168
- trailColor: "mdLink",
166
+ baseColor: "accent",
167
+ highlightColor: "mdHeading",
168
+ trailColor: "mdLink",
169
169
  };
170
170
 
171
171
  const OSDY_THEME_CYAN_PALETTE: HeaderPalette = {
172
- baseColor: "mdLink",
173
- highlightColor: "accent",
174
- trailColor: "mdHeading",
172
+ baseColor: "mdLink",
173
+ highlightColor: "accent",
174
+ trailColor: "mdHeading",
175
175
  };
176
176
 
177
177
  const OSDY_THEME_PURPLE_PALETTE: HeaderPalette = {
178
- baseColor: "mdHeading",
179
- highlightColor: "mdLink",
180
- trailColor: "accent",
178
+ baseColor: "mdHeading",
179
+ highlightColor: "mdLink",
180
+ trailColor: "accent",
181
181
  };
182
182
 
183
183
  const OSDY_THEME_MASCOT_PALETTE: HeaderPalette = {
184
- baseColor: "mdLink",
185
- highlightColor: "accent",
186
- trailColor: "mdHeading",
184
+ baseColor: "mdLink",
185
+ highlightColor: "accent",
186
+ trailColor: "mdHeading",
187
187
  };
188
188
 
189
189
  const HTML_MASCOT_TONES: MascotTonePalette = {
190
- b: "mascotBg",
191
- h: "mascotBright",
192
- l: "mascotLight",
193
- m: "mascotMid",
194
- d: "mascotDark",
195
- p: "htmlPink",
196
- c: "mdLink",
197
- v: "mdHeading",
190
+ b: "mascotBg",
191
+ h: "mascotBright",
192
+ l: "mascotLight",
193
+ m: "mascotMid",
194
+ d: "mascotDark",
195
+ p: "htmlPink",
196
+ c: "mdLink",
197
+ v: "mdHeading",
198
198
  };
199
199
 
200
200
  type MascotArt = {
201
- mascot: readonly string[];
202
- toneMap: readonly string[];
201
+ mascot: readonly string[];
202
+ toneMap: readonly string[];
203
203
  };
204
204
 
205
205
  function sampleIndex(
206
- outputIndex: number,
207
- outputCount: number,
208
- inputCount: number,
206
+ outputIndex: number,
207
+ outputCount: number,
208
+ inputCount: number,
209
209
  ): number {
210
- if (outputCount <= 1) return 0;
211
- return Math.min(
212
- inputCount - 1,
213
- Math.round((outputIndex * (inputCount - 1)) / (outputCount - 1)),
214
- );
210
+ if (outputCount <= 1) return 0;
211
+ return Math.min(
212
+ inputCount - 1,
213
+ Math.round((outputIndex * (inputCount - 1)) / (outputCount - 1)),
214
+ );
215
215
  }
216
216
 
217
217
  function sampleLine(
218
- line: string,
219
- outputWidth: number,
220
- inputWidth: number,
218
+ line: string,
219
+ outputWidth: number,
220
+ inputWidth: number,
221
221
  ): string {
222
- const chars = Array.from(line.padEnd(inputWidth, " "));
223
- return Array.from({ length: outputWidth }, (_value, outputIndex) => {
224
- const inputIndex = sampleIndex(outputIndex, outputWidth, inputWidth);
225
- return chars[inputIndex] ?? " ";
226
- }).join("");
222
+ const chars = Array.from(line.padEnd(inputWidth, " "));
223
+ return Array.from({ length: outputWidth }, (_value, outputIndex) => {
224
+ const inputIndex = sampleIndex(outputIndex, outputWidth, inputWidth);
225
+ return chars[inputIndex] ?? " ";
226
+ }).join("");
227
227
  }
228
228
 
229
229
  function scaleMascotArt(
230
- mascot: readonly string[],
231
- toneMap: readonly string[],
232
- scale: number,
230
+ mascot: readonly string[],
231
+ toneMap: readonly string[],
232
+ scale: number,
233
233
  ): MascotArt {
234
- const inputRows = Math.min(mascot.length, toneMap.length);
235
- const inputWidth = Math.max(
236
- ...mascot.slice(0, inputRows).map((line) => Array.from(line).length),
237
- ...toneMap.slice(0, inputRows).map((line) => Array.from(line).length),
238
- );
239
- const outputRows = Math.max(1, Math.round(inputRows * scale));
240
- const outputWidth = Math.max(1, Math.round(inputWidth * scale));
234
+ const inputRows = Math.min(mascot.length, toneMap.length);
235
+ const inputWidth = Math.max(
236
+ ...mascot.slice(0, inputRows).map((line) => Array.from(line).length),
237
+ ...toneMap.slice(0, inputRows).map((line) => Array.from(line).length),
238
+ );
239
+ const outputRows = Math.max(1, Math.round(inputRows * scale));
240
+ const outputWidth = Math.max(1, Math.round(inputWidth * scale));
241
241
 
242
- return Array.from({ length: outputRows }, (_value, outputIndex) => {
243
- const inputIndex = sampleIndex(outputIndex, outputRows, inputRows);
244
- return {
245
- mascot: sampleLine(mascot[inputIndex] ?? "", outputWidth, inputWidth),
246
- toneMap: sampleLine(toneMap[inputIndex] ?? "", outputWidth, inputWidth),
247
- };
248
- }).reduce<MascotArt>(
249
- (accumulator, line) => ({
250
- mascot: [...accumulator.mascot, line.mascot],
251
- toneMap: [...accumulator.toneMap, line.toneMap],
252
- }),
253
- { mascot: [], toneMap: [] },
254
- );
242
+ return Array.from({ length: outputRows }, (_value, outputIndex) => {
243
+ const inputIndex = sampleIndex(outputIndex, outputRows, inputRows);
244
+ return {
245
+ mascot: sampleLine(mascot[inputIndex] ?? "", outputWidth, inputWidth),
246
+ toneMap: sampleLine(toneMap[inputIndex] ?? "", outputWidth, inputWidth),
247
+ };
248
+ }).reduce<MascotArt>(
249
+ (accumulator, line) => ({
250
+ mascot: [...accumulator.mascot, line.mascot],
251
+ toneMap: [...accumulator.toneMap, line.toneMap],
252
+ }),
253
+ { mascot: [], toneMap: [] },
254
+ );
255
255
  }
256
256
 
257
257
  function addRightEdgeGlow(
258
- mascot: readonly string[],
259
- toneMap: readonly string[],
258
+ mascot: readonly string[],
259
+ toneMap: readonly string[],
260
260
  ): readonly string[] {
261
- return toneMap.map((lineMap, lineIndex) => {
262
- const chars = Array.from(lineMap);
263
- const mascotLine = mascot[lineIndex] ?? "";
264
- const rightEdgeIndex = Math.max(
265
- ...Array.from(mascotLine).map((char, index) =>
266
- char === " " ? -1 : index,
267
- ),
268
- );
269
- if (rightEdgeIndex < 0) return lineMap;
270
- const glowTones = ["p", "c", "v"] as const;
271
- for (let offset = 0; offset < glowTones.length; offset += 1) {
272
- const glowTone = glowTones[offset];
273
- const index = rightEdgeIndex - offset;
274
- if (
275
- glowTone &&
276
- index >= 0 &&
277
- index < chars.length &&
278
- chars[index] !== " "
279
- ) {
280
- chars[index] = glowTone;
281
- }
282
- }
283
- return chars.join("");
284
- });
261
+ return toneMap.map((lineMap, lineIndex) => {
262
+ const chars = Array.from(lineMap);
263
+ const mascotLine = mascot[lineIndex] ?? "";
264
+ const rightEdgeIndex = Math.max(
265
+ ...Array.from(mascotLine).map((char, index) =>
266
+ char === " " ? -1 : index,
267
+ ),
268
+ );
269
+ if (rightEdgeIndex < 0) return lineMap;
270
+ const glowTones = ["p", "c", "v"] as const;
271
+ for (let offset = 0; offset < glowTones.length; offset += 1) {
272
+ const glowTone = glowTones[offset];
273
+ const index = rightEdgeIndex - offset;
274
+ if (
275
+ glowTone &&
276
+ index >= 0 &&
277
+ index < chars.length &&
278
+ chars[index] !== " "
279
+ ) {
280
+ chars[index] = glowTone;
281
+ }
282
+ }
283
+ return chars.join("");
284
+ });
285
285
  }
286
286
 
287
287
  const OSDY_THEME_MASCOT_ART = scaleMascotArt(HTML_MASCOT, HTML_MASCOT_MAP, 0.9);
288
288
  const OSDY_THEME_MASCOT_MAP = addRightEdgeGlow(
289
- OSDY_THEME_MASCOT_ART.mascot,
290
- OSDY_THEME_MASCOT_ART.toneMap,
289
+ OSDY_THEME_MASCOT_ART.mascot,
290
+ OSDY_THEME_MASCOT_ART.toneMap,
291
291
  );
292
292
 
293
293
  function osdyThemePalette(lineIndex: number): HeaderPalette {
294
- if (lineIndex < 4) return OSDY_THEME_PINK_PALETTE;
295
- if (lineIndex < 8) return OSDY_THEME_CYAN_PALETTE;
296
- return OSDY_THEME_PURPLE_PALETTE;
294
+ if (lineIndex < 4) return OSDY_THEME_PINK_PALETTE;
295
+ if (lineIndex < 8) return OSDY_THEME_CYAN_PALETTE;
296
+ return OSDY_THEME_PURPLE_PALETTE;
297
297
  }
298
298
 
299
299
  export const HEADER_VARIANTS: Record<HeaderVariant, HeaderVariantConfig> = {
300
- "osdy-theme": {
301
- label: "OsdyTheme",
302
- header: HEADER_SIMPLE,
303
- mascot: OSDY_THEME_MASCOT_ART.mascot,
304
- mascotMap: OSDY_THEME_MASCOT_MAP,
305
- linePalette: osdyThemePalette,
306
- mascotPalette: OSDY_THEME_MASCOT_PALETTE,
307
- mascotTonePalette: HTML_MASCOT_TONES,
308
- },
309
- classic: {
310
- label: "Classic",
311
- header: HEADER_CLASSIC,
312
- mascot: HTML_MASCOT,
313
- mascotMap: HTML_MASCOT_MAP,
314
- linePalette: (lineIndex) =>
315
- lineIndex >= 6 ? CLASSIC_LINK_PALETTE : CLASSIC_PALETTE,
316
- mascotPalette: OSDY_THEME_MASCOT_PALETTE,
317
- mascotTonePalette: HTML_MASCOT_TONES,
318
- },
300
+ "osdy-theme": {
301
+ label: "OsdyTheme",
302
+ header: HEADER_SIMPLE,
303
+ mascot: OSDY_THEME_MASCOT_ART.mascot,
304
+ mascotMap: OSDY_THEME_MASCOT_MAP,
305
+ linePalette: osdyThemePalette,
306
+ mascotPalette: OSDY_THEME_MASCOT_PALETTE,
307
+ mascotTonePalette: HTML_MASCOT_TONES,
308
+ },
309
+ classic: {
310
+ label: "Classic",
311
+ header: HEADER_CLASSIC,
312
+ mascot: HTML_MASCOT,
313
+ mascotMap: HTML_MASCOT_MAP,
314
+ linePalette: (lineIndex) =>
315
+ lineIndex >= 6 ? CLASSIC_LINK_PALETTE : CLASSIC_PALETTE,
316
+ mascotPalette: OSDY_THEME_MASCOT_PALETTE,
317
+ mascotTonePalette: HTML_MASCOT_TONES,
318
+ },
319
319
  };
320
320
 
321
321
  export function headerWidth(variant: HeaderVariant): number {
322
- return HEADER_VARIANTS[variant].header.reduce(
323
- (maxWidth, line) => Math.max(maxWidth, visibleWidth(line)),
324
- 0,
325
- );
322
+ return HEADER_VARIANTS[variant].header.reduce(
323
+ (maxWidth, line) => Math.max(maxWidth, visibleWidth(line)),
324
+ 0,
325
+ );
326
326
  }
327
327
 
328
328
  export function mascotWidth(variant: HeaderVariant): number {
329
- return (HEADER_VARIANTS[variant].mascot ?? []).reduce(
330
- (maxWidth, line) => Math.max(maxWidth, visibleWidth(line)),
331
- 0,
332
- );
329
+ return (HEADER_VARIANTS[variant].mascot ?? []).reduce(
330
+ (maxWidth, line) => Math.max(maxWidth, visibleWidth(line)),
331
+ 0,
332
+ );
333
333
  }
334
334
 
335
335
  export const HEADER_FALLBACK = [
336
- "OSDY - PI",
337
- "</> Compilador de ideas",
336
+ "OSDY - PI",
337
+ "</> Compilador de ideas",
338
338
  ] as const;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "osdy-pi",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Osdy Pi package: themes, header, and custom editor for Pi.",
5
5
  "license": "MIT",
6
6
  "type": "module",