@bebranded/bb-contents 1.0.107 → 1.0.108

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.
Files changed (2) hide show
  1. package/bb-contents.js +34 -4
  2. package/package.json +1 -1
package/bb-contents.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * BeBranded Contents
3
3
  * Contenus additionnels français pour Webflow
4
- * @version 1.0.107
4
+ * @version 1.0.108
5
5
  * @author BeBranded
6
6
  * @license MIT
7
7
  * @website https://www.bebranded.xyz
@@ -32,11 +32,11 @@
32
32
  window._bbContentsInitialized = true;
33
33
 
34
34
  // Log de démarrage simple (une seule fois)
35
- console.log('bb-contents | v1.0.107');
35
+ console.log('bb-contents | v1.0.108');
36
36
 
37
37
  // Configuration
38
38
  const config = {
39
- version: '1.0.107',
39
+ version: '1.0.108',
40
40
  debug: false, // Debug désactivé pour rendu propre
41
41
  prefix: 'bb-', // utilisé pour générer les sélecteurs (data-bb-*)
42
42
  youtubeEndpoint: null, // URL du worker YouTube (à définir par l'utilisateur)
@@ -438,13 +438,22 @@
438
438
  const waitForImages = () => {
439
439
  waitTimeout += 100;
440
440
 
441
- if (imagesLoaded >= totalImages || imagesLoaded === 0 || waitTimeout >= maxWaitTime) {
441
+ // Attendre que TOUTES les images soient chargées (ou s'il n'y a pas d'images, attendre un minimum)
442
+ if (totalImages === 0) {
443
+ // Pas d'images, démarrer après un court délai
444
+ const renderDelay = isMobile ? 500 : 100;
445
+ setTimeout(() => {
446
+ startSafariAnimation();
447
+ }, renderDelay);
448
+ } else if (imagesLoaded >= totalImages || waitTimeout >= maxWaitTime) {
449
+ // Toutes les images sont chargées OU timeout atteint
442
450
  // Attendre plus longtemps sur mobile pour le rendu visuel
443
451
  const renderDelay = isMobile ? 1000 : 200;
444
452
  setTimeout(() => {
445
453
  startSafariAnimation();
446
454
  }, renderDelay);
447
455
  } else {
456
+ // Continuer à attendre
448
457
  setTimeout(waitForImages, 100);
449
458
  }
450
459
  };
@@ -462,6 +471,27 @@
462
471
  });
463
472
  }
464
473
 
474
+ // CORRECTION: Appliquer les styles CSS aux images dans les copies également
475
+ // pour éviter les images floues ou mal cadrées
476
+ const allImages = scrollContainer.querySelectorAll('img');
477
+ allImages.forEach(img => {
478
+ // Vérifier si l'image a déjà des styles inline
479
+ if (!img.style.objectFit) {
480
+ const computedStyle = getComputedStyle(img);
481
+ const objectFit = computedStyle.objectFit;
482
+ const objectPosition = computedStyle.objectPosition;
483
+
484
+ // Appliquer object-fit si défini dans le CSS
485
+ if (objectFit && objectFit !== 'none' && objectFit !== 'fill') {
486
+ img.style.objectFit = objectFit;
487
+ }
488
+ // Appliquer object-position si défini dans le CSS
489
+ if (objectPosition && objectPosition !== 'initial' && objectPosition !== '50% 50%') {
490
+ img.style.objectPosition = objectPosition;
491
+ }
492
+ }
493
+ });
494
+
465
495
  // Vérifier que les images ont une taille visible
466
496
  let imagesWithSize = 0;
467
497
  images.forEach(img => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bebranded/bb-contents",
3
- "version": "1.0.107",
3
+ "version": "1.0.108",
4
4
  "description": "Contenus additionnels français pour Webflow",
5
5
  "main": "bb-contents.js",
6
6
  "scripts": {