@braccato/core 2.0.0-beta.10 → 2.0.0-beta.12

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 CHANGED
@@ -45,7 +45,8 @@ under `@braccato/core/styles/` are 1.x's own. What is different underneath:
45
45
  - `setTheme` always returns false: the renderer keeps the lyrics and rebuilds them itself.
46
46
  - Lyrics given with the `songKey` of the song on screen are swapped in: lines the two share keep their
47
47
  elements, state and decorations, a changed line is rebuilt in its old element, the line in view
48
- holds still and the others slide.
48
+ holds still and the others slide. A line keeps what was hung on it only while it is the same lyric:
49
+ one retimed keeps it, one whose words or own decorations changed starts bare.
49
50
  - A view can live in another window (Document Picture-in-Picture): it draws on that window's frames
50
51
  and resolves fonts against its document.
51
52
 
@@ -128,7 +129,29 @@ Sustain do with chains of sibling selectors, is instead two lists:
128
129
  `--blyrics-line-opacity` and `--blyrics-line-blur` apply to both sides, and `-before` / `-after`
129
130
  replace one side: lines already sung, or still to come. Values between whole lines are interpolated,
130
131
  the last value holds past the end, and blurs are the standard deviation, as CSS `blur()` takes it.
131
- The distance follows the scroll smoothly, and the effects ease off while the reader scrolls.
132
+ The distance follows the scroll smoothly, over the sung line's glide (see the line-scroll settings
133
+ below), and the effects ease off while the reader scrolls.
134
+
135
+ Autoscroll's glide takes the line-scroll comment settings the DOM renderer took:
136
+ `blyrics-line-scroll-duration` and its `-above-`, `-active-` and `-below-` versions,
137
+ `blyrics-line-scroll-timing-function`, and `blyrics-line-scroll-start-easing` and its side versions.
138
+ Lines ahead of the motion are `above`, the line the scroll is for is `active`, and lines behind it
139
+ are `below`. By default `above` lines move a little faster than the active one and `below` lines a
140
+ little slower, so the lines spread apart and settle. Under reduced motion the side versions are
141
+ ignored. As before, a duration can be a `calc()` of `--blyrics-line-scroll-abs-relative-index`,
142
+ `--blyrics-line-scroll-relative-index` and `--blyrics-line-scroll-side`. The settings are worked out
143
+ once per theme for lines up to 32 away from the active one, and lines further away take the 32nd
144
+ line's timing. Giving every side the same duration makes the lines move together:
145
+
146
+ ```css
147
+ /* blyrics-line-scroll-duration = 750ms;
148
+ blyrics-line-scroll-above-duration = 750ms;
149
+ blyrics-line-scroll-below-duration = 750ms;
150
+ blyrics-line-scroll-timing-function = cubic-bezier(0.22, 1, 0.36, 1); */
151
+ ```
152
+
153
+ The `translate-y` and `end-easing` settings, and `--blyrics-line-scroll-index`, `-active-index`,
154
+ `-delta-px` and `-distance-px`, are not read.
132
155
 
133
156
  The line under the mouse can look different, as a `:hover` rule made it in the DOM renderer. Each
134
157
  value the theme sets replaces the line's own while the pointer is on it, and leaving it unset keeps
@@ -183,10 +206,26 @@ A few more properties stand in for rules that styled lines and words by state:
183
206
  /* a border inside the box's edge */
184
207
  --blyrics-line-border-color: rgb(255 255 255 / 0.1);
185
208
  --blyrics-line-border-width: 1px;
209
+ /* what the box eases to while the line is sung, over its scale transition */
210
+ --blyrics-line-active-bg-color: rgb(255 255 255 / 0.12);
211
+ --blyrics-line-active-border-color: rgb(255 255 255 / 0.2);
186
212
  border-radius: 1rem;
187
213
  }
214
+
215
+ .blyrics--translated {
216
+ /* the translation's colour while its line is sung; the romanization's falls back to it */
217
+ --blyrics-translated-active-color: rgb(255 255 255 / 0.85);
218
+ }
219
+
220
+ .blyrics--romanized {
221
+ --blyrics-romanized-active-color: rgb(255 255 255 / 0.7);
222
+ }
188
223
  ```
189
224
 
225
+ The sung looks stand in for rules on `.blyrics--active`, which the renderer never sets: the box
226
+ goes from its own colours to the sung ones and then to the hovered ones, and the translation and
227
+ romanization ease to theirs on the line scale's timing.
228
+
190
229
  The shadows, the box, the past opacity and the rest pose are read from each element, so selectors
191
230
  scope them as they do colours: `[data-layout="stage"] > .blyrics--line` gives only the stage view's
192
231
  lines a box, for instance. The box's corner is the line's `border-radius` as a length (a percentage
@@ -205,6 +244,13 @@ take these instead:
205
244
  /* swells to this scale and back once a period while the instrumental plays */
206
245
  --blyrics-instrumental-pulse-scale: 1.14;
207
246
  --blyrics-instrumental-pulse-duration: 3s;
247
+ /* the icon's opacity at the swell, which breathes with it (1, the default, for none) */
248
+ --blyrics-instrumental-pulse-opacity: 0.6;
249
+ /* the icon's opacity while its break is not playing, easing to 1 as it starts (default 1) */
250
+ --blyrics-instrumental-idle-opacity: 0;
251
+ /* how the note's fill fades in as the break starts */
252
+ --blyrics-instrumental-fill-fade-duration: 150ms;
253
+ --blyrics-instrumental-fill-fade-easing: ease;
208
254
  /* in place of the host's message when there are no lyrics, and text drawn above it */
209
255
  --blyrics-no-lyrics-text: "No lyrics found";
210
256
  --blyrics-no-lyrics-icon: "♫";
@@ -245,6 +291,25 @@ The glow peak brightens a glow up to its colour fully opaque, so it shows on a t
245
291
  colour such as the default. A word's text-shadow moves with the word, but not with each letter's
246
292
  wave.
247
293
 
294
+ Some of what a stylesheet says to the DOM renderer's elements is read back and drawn:
295
+
296
+ - **Romanization box:** the background a theme gives `.blyrics--romanized` fills the box, and
297
+ `background: none` takes the box away. `--blyrics-romanized-bg-color` wins over both. A gradient
298
+ keeps the default box.
299
+ - **Alignment:** a line's `text-align` (`left`, `right`, `center`, `start`, `end`) is the theme's
300
+ to change at any specificity. Lines scale about the side their text is aligned to.
301
+ - **Translations and romanizations:** each keeps its own colour, and their `opacity` is drawn.
302
+ `display: none` drops them.
303
+ - **Spacing:** a theme's padding and margins on lines and translations apply as they did in the DOM
304
+ renderer.
305
+ - **Instrumental note:** a `.blyrics--instrumental-icon` rule sizes it, as it sized the DOM
306
+ renderer's icon.
307
+ - **Glow colour:** a glow colour set on a word's `::after`, where the DOM renderer drew the glow,
308
+ is read, so `.blyrics--word[data-long-word]::after { --blyrics-glow-color: … }` still makes only
309
+ held words glow.
310
+ - **Credits:** their colour can follow `[data-credits-focused]` on the container, as their opacity
311
+ does, and eases with it.
312
+
248
313
  ## How it works
249
314
 
250
315
  The lines are laid out by the browser in an invisible copy of `@braccato/core`'s markup, inside the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@braccato/core",
3
- "version": "2.0.0-beta.10",
3
+ "version": "2.0.0-beta.12",
4
4
  "description": "Synchronized lyrics renderer with word-by-word animations, in Rust and WebGL2",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -779,6 +779,10 @@ function __wbg_get_imports() {
779
779
  const ret = arg0.getComputedStyle(arg1);
780
780
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
781
781
  }, arguments); },
782
+ __wbg_getComputedStyle_b06b6770f2666501: function() { return handleError(function (arg0, arg1, arg2, arg3) {
783
+ const ret = arg0.getComputedStyle(arg1, getStringFromWasm0(arg2, arg3));
784
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
785
+ }, arguments); },
782
786
  __wbg_getContext_9d32151c28a36ed6: function() { return handleError(function (arg0, arg1, arg2, arg3) {
783
787
  const ret = arg0.getContext(getStringFromWasm0(arg1, arg2), arg3);
784
788
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
@@ -1331,6 +1335,10 @@ function __wbg_get_imports() {
1331
1335
  const ret = arg0.then(arg1, arg2);
1332
1336
  return ret;
1333
1337
  },
1338
+ __wbg_toggle_4ad9c24ed28f124e: function() { return handleError(function (arg0, arg1, arg2, arg3) {
1339
+ const ret = arg0.toggle(getStringFromWasm0(arg1, arg2), arg3 !== 0);
1340
+ return ret;
1341
+ }, arguments); },
1334
1342
  __wbg_top_2d45cda4e060d8bf: function(arg0) {
1335
1343
  const ret = arg0.top;
1336
1344
  return ret;
Binary file