@braccato/core 1.6.2 → 1.6.4

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.
package/dist/engine.js CHANGED
@@ -1442,6 +1442,8 @@ export function setupLineCullObserver(engine) {
1442
1442
  engine.lineCullObserver = null;
1443
1443
  return;
1444
1444
  }
1445
+ // Scroll anchoring would compensate residual cull height-shifts with a scroll the engine misreads as the user's (Firefox); the engine owns scrollTop, so disable it.
1446
+ engine.host.getScrollElement()?.style.setProperty("overflow-anchor", "none");
1445
1447
  // Pin each line's skipped placeholder to its last rendered size, so skipping a line never shifts the
1446
1448
  // container's scroll height, which the engine would misread as a user scroll.
1447
1449
  const restingHeights = engine.lines.map(line => line.lyricElement.offsetHeight);
package/dist/inject.js CHANGED
@@ -298,6 +298,15 @@ function createHighlightRun(doc, text) {
298
298
  run.setAttribute("aria-hidden", "true");
299
299
  return run;
300
300
  }
301
+ // A background gap must carry the background size too, or it renders full-size and the gap looks oversized.
302
+ function createSpaceNode(doc, text, isBackground) {
303
+ if (!isBackground)
304
+ return doc.createTextNode(text);
305
+ const span = doc.createElement("span");
306
+ span.classList.add(BACKGROUND_LYRIC_CLASS);
307
+ span.textContent = text;
308
+ return span;
309
+ }
301
310
  export function createLyricsLine(doc, parts, line, lyricElement, options = { splitBackgroundLine: true }) {
302
311
  const lineText = parts.map(part => part.words).join("");
303
312
  const mainText = options.splitBackgroundLine
@@ -336,8 +345,8 @@ export function createLyricsLine(doc, parts, line, lyricElement, options = { spl
336
345
  const highlightRun = shouldUseBackgroundLine ? backgroundHighlightRun : mainHighlightRun;
337
346
  const pendingSpace = shouldUseBackgroundLine ? pendingBackgroundSpace : pendingForegroundSpace;
338
347
  if (target.childNodes.length > 0 && pendingSpace.length > 0) {
339
- target.appendChild(doc.createTextNode(pendingSpace));
340
- highlightRun.appendChild(doc.createTextNode(pendingSpace));
348
+ target.appendChild(createSpaceNode(doc, pendingSpace, shouldUseBackgroundLine));
349
+ highlightRun.appendChild(createSpaceNode(doc, pendingSpace, shouldUseBackgroundLine));
341
350
  }
342
351
  const { lyricGroup, highlightGroup } = createWordGroup(doc, item, line);
343
352
  target.appendChild(lyricGroup);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@braccato/core",
3
- "version": "1.6.2",
3
+ "version": "1.6.4",
4
4
  "description": "Synchronized lyrics renderer with word-by-word animations",
5
5
  "type": "module",
6
6
  "license": "MIT",