@braccato/core 1.16.7 → 1.16.9
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/README.md +2 -0
- package/dist/README.md +2 -0
- package/dist/inject.js +10 -3
- package/dist/styles/image-highlights.css +5 -0
- package/dist/styles/lyrics.css +6 -0
- package/dist/text.d.ts +1 -0
- package/dist/text.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -586,5 +586,7 @@ For real-browser regression checks, build the package, serve the repository root
|
|
|
586
586
|
`tooling/browser/image-highlights.html`. Import `image-highlights-checks.js` from that page and
|
|
587
587
|
call `runImageHighlightChecks(testView)`. The default fixture uses an SDR image; a `theme` query
|
|
588
588
|
parameter can point at a consumer's HDR stylesheet for physical-display testing.
|
|
589
|
+
`runLetterInkChecks(testView)` in the same module checks that letter masks cover glyph overhang,
|
|
590
|
+
such as a `j`'s hook or an italic `f`, without moving any letter.
|
|
589
591
|
|
|
590
592
|
Words that mix RTL characters with LTR letters or numbers retain native text shaping instead of per-letter motion. Image glow, letter masks and letter motion retain their current paint during the line exit fade.
|
package/dist/README.md
CHANGED
|
@@ -586,5 +586,7 @@ For real-browser regression checks, build the package, serve the repository root
|
|
|
586
586
|
`tooling/browser/image-highlights.html`. Import `image-highlights-checks.js` from that page and
|
|
587
587
|
call `runImageHighlightChecks(testView)`. The default fixture uses an SDR image; a `theme` query
|
|
588
588
|
parameter can point at a consumer's HDR stylesheet for physical-display testing.
|
|
589
|
+
`runLetterInkChecks(testView)` in the same module checks that letter masks cover glyph overhang,
|
|
590
|
+
such as a `j`'s hook or an italic `f`, without moving any letter.
|
|
589
591
|
|
|
590
592
|
Words that mix RTL characters with LTR letters or numbers retain native text shaping instead of per-letter motion. Image glow, letter masks and letter motion retain their current paint during the line exit fade.
|
package/dist/inject.js
CHANGED
|
@@ -15,7 +15,7 @@ import { alignImageGlowRun, wrapImageHighlight } from "./imageHighlights.js";
|
|
|
15
15
|
import { normalizeLanguage } from "./language.js";
|
|
16
16
|
import { BACKGROUND_LINE_CLASS, BACKGROUND_LYRIC_CLASS, BIDI_RUN_CLASS, BIDI_SENSITIVE_CLASS, CONTENT_LINE_CLASS, EXPLICIT_WORD_CLASS, HIGHLIGHT_RUN_CLASS, LETTER_CLASS, LINE_MAIN_CLASS, LINE_SYNCED_WORD_CLASS, LONG_WORD_GROUP_CLASS, ROMANIZED_LYRICS_CLASS, RTL_CLASS, TRANSLATED_LYRICS_CLASS, WORD_CLASS, WORD_GROUP_CLASS, WORD_HIGHLIGHT_CLASS, WORD_HIGHLIGHT_LETTERED_CLASS, WORD_STATE_ATTR, WORD_STATE_UPCOMING, ZERO_DURATION_ANIMATION_CLASS, } from "./constants.js";
|
|
17
17
|
import { getSeekTimeFromClick } from "./seek.js";
|
|
18
|
-
import { testJoiningScript, testRtl } from "./text.js";
|
|
18
|
+
import { isSameText, testJoiningScript, testRtl } from "./text.js";
|
|
19
19
|
import { registerThemeSetting } from "./themeSettings.js";
|
|
20
20
|
export let disableRichsync = registerThemeSetting("blyrics-disable-richsync", false, true);
|
|
21
21
|
let lineSyncedAnimationDelay = registerThemeSetting("blyrics-line-synced-animation-delay", 50, true);
|
|
@@ -414,8 +414,15 @@ export function addSeekHandler(seek, lyricElement, allZero) {
|
|
|
414
414
|
seek(seekTime);
|
|
415
415
|
});
|
|
416
416
|
}
|
|
417
|
+
function repeatsLine(lyricElement, text) {
|
|
418
|
+
const mainRun = [
|
|
419
|
+
...(lyricElement.querySelector(`:scope > .${LINE_MAIN_CLASS}`)?.querySelectorAll(`:scope > .${BIDI_RUN_CLASS}`) ??
|
|
420
|
+
[]),
|
|
421
|
+
].find(run => !run.classList.contains(HIGHLIGHT_RUN_CLASS));
|
|
422
|
+
return mainRun?.textContent != null && isSameText(mainRun.textContent, text);
|
|
423
|
+
}
|
|
417
424
|
export function injectRomanization(doc, lyricElement, lineData, text, timedRomanization = null) {
|
|
418
|
-
if (lyricElement.querySelector(`.${ROMANIZED_LYRICS_CLASS}`))
|
|
425
|
+
if (lyricElement.querySelector(`.${ROMANIZED_LYRICS_CLASS}`) || repeatsLine(lyricElement, text))
|
|
419
426
|
return;
|
|
420
427
|
const romanizedLine = doc.createElement("div");
|
|
421
428
|
romanizedLine.classList.add(ROMANIZED_LYRICS_CLASS, CONTENT_LINE_CLASS);
|
|
@@ -433,7 +440,7 @@ export function injectRomanization(doc, lyricElement, lineData, text, timedRoman
|
|
|
433
440
|
lyricElement.insertBefore(romanizedLine, translation);
|
|
434
441
|
}
|
|
435
442
|
export function injectTranslation(doc, lyricElement, text, language) {
|
|
436
|
-
if (lyricElement.querySelector(`.${TRANSLATED_LYRICS_CLASS}`))
|
|
443
|
+
if (lyricElement.querySelector(`.${TRANSLATED_LYRICS_CLASS}`) || repeatsLine(lyricElement, text))
|
|
437
444
|
return;
|
|
438
445
|
const translatedLine = doc.createElement("div");
|
|
439
446
|
translatedLine.classList.add(TRANSLATED_LYRICS_CLASS, CONTENT_LINE_CLASS);
|
|
@@ -17,6 +17,11 @@
|
|
|
17
17
|
color: transparent;
|
|
18
18
|
-webkit-text-fill-color: transparent;
|
|
19
19
|
}
|
|
20
|
+
/* The content-box copy keeps each letter's image; the padding-box copy carries it under glyph overhang. */
|
|
21
|
+
.blyrics-word-highlight.blyrics-image-highlight .blyrics--letter {
|
|
22
|
+
background-image: var(--blyrics-highlight-image, none), var(--blyrics-highlight-image, none);
|
|
23
|
+
background-origin: content-box, padding-box;
|
|
24
|
+
}
|
|
20
25
|
.blyrics-image-highlight:not(.blyrics-word-highlight--lettered) .blyrics-image-fill {
|
|
21
26
|
--blyrics-image-sweep-angle: 90deg;
|
|
22
27
|
mask-image: linear-gradient(var(--blyrics-image-sweep-angle),
|
package/dist/styles/lyrics.css
CHANGED
|
@@ -186,7 +186,13 @@
|
|
|
186
186
|
background-image: none;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
+
/* A mask clips to the border box, cutting off glyph overhang (a j's hook, italics). The padding
|
|
190
|
+
widens that clip without moving layout, and the content-box origin keeps the sweep geometry. */
|
|
189
191
|
.blyrics-word-highlight .blyrics--letter {
|
|
192
|
+
padding-inline: 0.25em;
|
|
193
|
+
margin-inline: -0.25em;
|
|
194
|
+
-webkit-mask-origin: content-box;
|
|
195
|
+
mask-origin: content-box;
|
|
190
196
|
color: var(--blyrics-lyric-active-color);
|
|
191
197
|
-webkit-mask-image: linear-gradient(90deg, #000 0, #000 50%, #0000 calc(50% + var(--mask-fade, 3%)));
|
|
192
198
|
mask-image: linear-gradient(90deg, #000 0, #000 50%, #0000 calc(50% + var(--mask-fade, 3%)));
|
package/dist/text.d.ts
CHANGED
|
@@ -9,4 +9,5 @@ export declare function containsNonLatin(text: string): boolean;
|
|
|
9
9
|
declare const SCRIPT_TO_LANG: readonly [readonly [RegExp, "ja"], readonly [RegExp, "ko"], readonly [RegExp, "zh"], readonly [RegExp, "ru"], readonly [RegExp, "hi"], readonly [RegExp, "ar"], readonly [RegExp, "th"], readonly [RegExp, "el"], readonly [RegExp, "he"], readonly [RegExp, "bn"], readonly [RegExp, "ta"], readonly [RegExp, "te"], readonly [RegExp, "ml"], readonly [RegExp, "kn"], readonly [RegExp, "gu"], readonly [RegExp, "pa"], readonly [RegExp, "si"], readonly [RegExp, "my"], readonly [RegExp, "ka"], readonly [RegExp, "km"], readonly [RegExp, "lo"]];
|
|
10
10
|
type NonLatinLanguageCode = (typeof SCRIPT_TO_LANG)[number][1];
|
|
11
11
|
export declare function detectNonLatinLanguage(text: string): NonLatinLanguageCode | null;
|
|
12
|
+
export declare const isSameText: (a: string, b: string) => boolean;
|
|
12
13
|
export {};
|
package/dist/text.js
CHANGED