@gaulatti/giorgia 0.1.94 → 0.1.95

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gaulatti/giorgia",
3
3
  "description": "Server-side Handlebars renderer and templates for ModoItaliano pages.",
4
- "version": "0.1.94",
4
+ "version": "0.1.95",
5
5
  "license": "MIT",
6
6
  "author": "ModoItaliano",
7
7
  "repository": {
@@ -108,9 +108,17 @@
108
108
  to { opacity: 1; transform: translateY(0); }
109
109
  }
110
110
 
111
+ .radio-now-playing-swap { animation: radio-now-playing-swap 420ms ease-out; }
112
+
113
+ @keyframes radio-now-playing-swap {
114
+ from { opacity: 0; transform: translateY(8px) scale(0.985); }
115
+ to { opacity: 1; transform: translateY(0) scale(1); }
116
+ }
117
+
111
118
  @media (prefers-reduced-motion: reduce) {
112
119
  [data-radio-slide].is-active { animation: none; transform: scale(1.05); }
113
120
  .radio-weather-swap { animation: none; }
121
+ .radio-now-playing-swap { animation: none; }
114
122
  }
115
123
 
116
124
  @media (max-width: 639px) {
@@ -222,7 +230,7 @@
222
230
  </div>
223
231
  <img data-now-playing-artwork alt='' class='hidden h-full w-full object-cover' />
224
232
  <div class='absolute inset-x-0 bottom-0 h-[42%] bg-linear-to-t from-black/80 to-transparent'></div>
225
- <div class='absolute bottom-3.75 left-3.75 right-16.25'>
233
+ <div data-now-playing-copy class='absolute bottom-3.75 left-3.75 right-16.25'>
226
234
  <p class='flex items-center gap-2 text-[10px] font-bold uppercase tracking-wide text-white/80'><span class='h-2 w-2 rounded-full bg-cyan-300'></span><span data-now-playing-status>En directo</span></p>
227
235
  <h2 data-now-playing-title class='radio-display mt-1 line-clamp-1 text-2xl font-semibold uppercase leading-none tracking-[0.02em] text-white'>ModoItaliano</h2>
228
236
  <p data-now-playing-artist class='radio-display mt-1 line-clamp-1 text-xl font-medium uppercase leading-none tracking-[0.02em] text-white/85'>Radio en vivo</p>
@@ -365,13 +365,15 @@
365
365
  var status = root.querySelector('[data-now-playing-status]');
366
366
  var title = root.querySelector('[data-now-playing-title]');
367
367
  var artist = root.querySelector('[data-now-playing-artist]');
368
- if (!endpoint || !(artwork instanceof HTMLImageElement) || !(brand instanceof HTMLElement) || !(status instanceof HTMLElement) || !(title instanceof HTMLElement) || !(artist instanceof HTMLElement)) return;
368
+ var copy = root.querySelector('[data-now-playing-copy]');
369
+ if (!endpoint || !(artwork instanceof HTMLImageElement) || !(brand instanceof HTMLElement) || !(status instanceof HTMLElement) || !(title instanceof HTMLElement) || !(artist instanceof HTMLElement) || !(copy instanceof HTMLElement)) return;
369
370
 
370
371
  var fallback = {
371
372
  title: (title.textContent || '').trim() || 'ModoItaliano',
372
373
  artist: (artist.textContent || '').trim() || 'Radio en vivo',
373
374
  isPlaceholder: true
374
375
  };
376
+ var lastSignature = JSON.stringify([fallback.title, fallback.artist, '', true]);
375
377
 
376
378
  function setText(element, value, fallbackValue) {
377
379
  element.textContent = typeof value === 'string' && value.trim() ? value.trim() : fallbackValue;
@@ -391,11 +393,22 @@
391
393
  brand.classList.add('hidden');
392
394
  }
393
395
 
396
+ function animateUpdate() {
397
+ artwork.classList.remove('radio-now-playing-swap');
398
+ brand.classList.remove('radio-now-playing-swap');
399
+ copy.classList.remove('radio-now-playing-swap');
400
+ void root.offsetWidth;
401
+ (brand.classList.contains('hidden') ? artwork : brand).classList.add('radio-now-playing-swap');
402
+ copy.classList.add('radio-now-playing-swap');
403
+ }
404
+
394
405
  function applyNowPlaying(item) {
395
406
  var displayTitle = typeof item.title === 'string' && item.title.trim() ? item.title.trim() : fallback.title;
396
407
  var displayArtist = typeof item.artist === 'string' && item.artist.trim() ? item.artist.trim() : fallback.artist;
397
408
  var artworkUrl = typeof item.artworkUrl === 'string' ? item.artworkUrl.trim() : '';
398
409
  var isPlaceholder = item.isPlaceholder === true;
410
+ var nextSignature = JSON.stringify([displayTitle, displayArtist, artworkUrl, isPlaceholder]);
411
+ var changed = nextSignature !== lastSignature;
399
412
 
400
413
  setText(title, displayTitle, fallback.title);
401
414
  setText(artist, displayArtist, fallback.artist);
@@ -407,6 +420,9 @@
407
420
  showBrand();
408
421
  }
409
422
 
423
+ if (changed) animateUpdate();
424
+ lastSignature = nextSignature;
425
+
410
426
  window.__brokawNowPlaying = item;
411
427
  document.dispatchEvent(new CustomEvent('brokaw:now-playing', { detail: item }));
412
428
  }
@@ -438,7 +454,7 @@
438
454
 
439
455
  root.dataset.nowPlayingBound = 'true';
440
456
  fetchNowPlaying();
441
- window.setInterval(fetchNowPlaying, 45000);
457
+ window.setInterval(fetchNowPlaying, 5000);
442
458
  }
443
459
 
444
460
  function initAllNowPlaying() {