Skip to content

Commit 3e45636

Browse files
bajrangCoderclaude
andcommitted
feat: replace header spinner with a thin progress line
The icon-sized spinner was too heavy for the console header. Use a 2px indeterminate progress line along the bottom edge of the header in the theme's active color instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 2cf09be commit 3e45636

4 files changed

Lines changed: 45 additions & 6 deletions

File tree

‎changelog.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
- Errors written to stderr are now shown in red
88
- Console output can now be selected and copied
99
- Header button to toggle line wrap in the console (remembered between sessions)
10-
- Loading indicator in the console header while Python loads or code is running
10+
- Thin progress line under the console header while Python loads or code is running
1111
- Fixed Python failing to load (or staying on "loading...") on some devices
1212
- Clear error message when Python fails to load, with automatic retry on the next run
1313
- Smaller plugin size (removed stale Pyodide files)

‎plugin.zip‎

468 Bytes
Binary file not shown.

‎src/main.js‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ class Python {
7878
attr: { action: "toggle-wrap", role: "button" },
7979
onclick: () => this.#setWrap(!this.$page.classList.contains("wrap")),
8080
});
81-
// Acode's spinner, shown while Python loads or code runs
82-
this.$status = tag("span", { className: "icon hidden" });
81+
// thin progress line along the header while Python loads or code runs
82+
this.$status = tag("div", { className: "py-progress" });
8383
this.$page.header?.append(this.$status, this.$wrapBtn);
8484
this.#setWrap(loadWrap());
8585
this.$style = tag("style", { textContent: style });
@@ -182,14 +182,13 @@ class Python {
182182
}
183183
}
184184

185-
/** Spinner while Python is busy, hidden while it waits for input() */
185+
/** Progress line while Python is busy, hidden while it waits for input() */
186186
#updateStatus() {
187187
if (!this.$status) return;
188188
const busy =
189189
(this.#state === this.INITIALIZING || this.#running > 0) &&
190190
!this.#isInput;
191-
this.$status.classList.toggle("loading", busy);
192-
this.$status.classList.toggle("hidden", !busy);
191+
this.$status.classList.toggle("running", busy);
193192
}
194193

195194
destroy() {

‎src/style.css‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,36 @@
55
user-select: text;
66
}
77

8+
> header {
9+
position: relative;
10+
}
11+
12+
.py-progress {
13+
display: none;
14+
position: absolute;
15+
left: 0;
16+
right: 0;
17+
bottom: 0;
18+
height: 2px;
19+
overflow: hidden;
20+
pointer-events: none;
21+
22+
&.running {
23+
display: block;
24+
}
25+
26+
&::before {
27+
content: "";
28+
position: absolute;
29+
top: 0;
30+
bottom: 0;
31+
left: 0;
32+
width: 40%;
33+
background-color: var(--active-color);
34+
animation: py-progress 1.2s ease-in-out infinite;
35+
}
36+
}
37+
838
textarea {
939
background-color: transparent;
1040
color: inherit;
@@ -52,6 +82,16 @@
5282
}
5383
}
5484

85+
@keyframes py-progress {
86+
from {
87+
transform: translateX(-100%);
88+
}
89+
90+
to {
91+
transform: translateX(250%);
92+
}
93+
}
94+
5595
@font-face {
5696
font-family: "acode-plugin-python-icon";
5797
src: url("./icon.ttf") format("truetype");

0 commit comments

Comments
 (0)