Spaces:
Running
Running
Commit ·
dbd5035
1
Parent(s): 13e8a7a
refined player.
Browse files- web/score-player.css +13 -1
- web/score-player.js +14 -3
web/score-player.css
CHANGED
|
@@ -25,6 +25,18 @@
|
|
| 25 |
}
|
| 26 |
.ls-status.ls-busy { color: #2b7; }
|
| 27 |
.ls-status.ls-err { color: #c0392b; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
.ls-svg {
|
| 30 |
background: #fff;
|
|
@@ -81,7 +93,7 @@
|
|
| 81 |
align-items: center;
|
| 82 |
gap: 10px;
|
| 83 |
padding: 8px 12px;
|
| 84 |
-
margin-
|
| 85 |
background: #f3f3f5;
|
| 86 |
border: 1px solid #e5e5e5;
|
| 87 |
border-radius: 8px;
|
|
|
|
| 25 |
}
|
| 26 |
.ls-status.ls-busy { color: #2b7; }
|
| 27 |
.ls-status.ls-err { color: #c0392b; }
|
| 28 |
+
/* multi-line parse errors: preserve the caret alignment, wrap overflow. The red
|
| 29 |
+
color needs !important to beat Gradio's `.prose * { color: ... }`, which sets
|
| 30 |
+
color directly on every descendant (so `color: inherit` from .ls-err loses). */
|
| 31 |
+
.ls-status.ls-err .ls-err-pre {
|
| 32 |
+
margin: 0;
|
| 33 |
+
font-family: ui-monospace, Consolas, Monaco, monospace;
|
| 34 |
+
font-size: 11px;
|
| 35 |
+
line-height: 1.35;
|
| 36 |
+
white-space: pre-wrap;
|
| 37 |
+
word-break: break-word;
|
| 38 |
+
color: #c0392b !important;
|
| 39 |
+
}
|
| 40 |
|
| 41 |
.ls-svg {
|
| 42 |
background: #fff;
|
|
|
|
| 93 |
align-items: center;
|
| 94 |
gap: 10px;
|
| 95 |
padding: 8px 12px;
|
| 96 |
+
margin-bottom: 8px;
|
| 97 |
background: #f3f3f5;
|
| 98 |
border: 1px solid #e5e5e5;
|
| 99 |
border-radius: 8px;
|
web/score-player.js
CHANGED
|
@@ -106,8 +106,19 @@
|
|
| 106 |
|
| 107 |
function setStatus (text, kind) {
|
| 108 |
if (!els.status) return;
|
| 109 |
-
els.status.textContent = text || '';
|
| 110 |
els.status.className = 'ls-status' + (kind ? ' ls-' + kind : '');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
}
|
| 112 |
|
| 113 |
// Render lyl -> SVG. Returns true on success. Does NOT touch the MIDI player
|
|
@@ -375,7 +386,7 @@
|
|
| 375 |
svgBox.appendChild(cursor);
|
| 376 |
wrap.appendChild(status); wrap.appendChild(svgBox);
|
| 377 |
|
| 378 |
-
// transport bar
|
| 379 |
const player = document.createElement('div'); player.className = 'ls-player'; player.style.display = 'none';
|
| 380 |
player.innerHTML =
|
| 381 |
'<button class="ls-btn ls-play" title="Play">▶</button>' +
|
|
@@ -384,7 +395,7 @@
|
|
| 384 |
'<span class="ls-time">0:00 / 0:00</span>' +
|
| 385 |
'<div class="ls-progress"><div class="ls-fill"></div></div>';
|
| 386 |
|
| 387 |
-
root.appendChild(
|
| 388 |
|
| 389 |
els.root = root; els.svg = svgBox; els.preview = wrap; els.status = status; els.player = player; els.cursor = cursor;
|
| 390 |
els.playBtn = player.querySelector('.ls-play');
|
|
|
|
| 106 |
|
| 107 |
function setStatus (text, kind) {
|
| 108 |
if (!els.status) return;
|
|
|
|
| 109 |
els.status.className = 'ls-status' + (kind ? ' ls-' + kind : '');
|
| 110 |
+
// Errors (esp. lilylet parse errors) are multi-line with a `^` caret aligned
|
| 111 |
+
// under the offending token — wrap them in <pre> so the whitespace/newlines
|
| 112 |
+
// are preserved (a plain div collapses them). textContent keeps it XSS-safe.
|
| 113 |
+
if (kind === 'err' && text) {
|
| 114 |
+
els.status.innerHTML = '';
|
| 115 |
+
const pre = document.createElement('pre');
|
| 116 |
+
pre.className = 'ls-err-pre';
|
| 117 |
+
pre.textContent = text;
|
| 118 |
+
els.status.appendChild(pre);
|
| 119 |
+
} else {
|
| 120 |
+
els.status.textContent = text || '';
|
| 121 |
+
}
|
| 122 |
}
|
| 123 |
|
| 124 |
// Render lyl -> SVG. Returns true on success. Does NOT touch the MIDI player
|
|
|
|
| 386 |
svgBox.appendChild(cursor);
|
| 387 |
wrap.appendChild(status); wrap.appendChild(svgBox);
|
| 388 |
|
| 389 |
+
// transport bar (above the score)
|
| 390 |
const player = document.createElement('div'); player.className = 'ls-player'; player.style.display = 'none';
|
| 391 |
player.innerHTML =
|
| 392 |
'<button class="ls-btn ls-play" title="Play">▶</button>' +
|
|
|
|
| 395 |
'<span class="ls-time">0:00 / 0:00</span>' +
|
| 396 |
'<div class="ls-progress"><div class="ls-fill"></div></div>';
|
| 397 |
|
| 398 |
+
root.appendChild(player); root.appendChild(wrap);
|
| 399 |
|
| 400 |
els.root = root; els.svg = svgBox; els.preview = wrap; els.status = status; els.player = player; els.cursor = cursor;
|
| 401 |
els.playBtn = player.querySelector('.ls-play');
|