@bebranded/bb-contents 1.0.67-beta → 1.0.68-beta

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 +29 -9
  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.67-beta
4
+ * @version 1.0.68-beta
5
5
  * @author BeBranded
6
6
  * @license MIT
7
7
  * @website https://www.bebranded.xyz
@@ -34,7 +34,7 @@
34
34
 
35
35
  // Configuration
36
36
  const config = {
37
- version: '1.0.67-beta',
37
+ version: '1.0.68-beta',
38
38
  debug: true, // Debug activé pour diagnostic
39
39
  prefix: 'bb-', // utilisé pour générer les sélecteurs (data-bb-*)
40
40
  youtubeEndpoint: null, // URL du worker YouTube (à définir par l'utilisateur)
@@ -382,7 +382,9 @@
382
382
  initSafariAnimation: function(element, scrollContainer, mainBlock, options) {
383
383
  const { speed, direction, gap, isVertical, useAutoHeight, contentSize, gapSize } = options;
384
384
 
385
- // Créer les keyframes CSS pour Safari
385
+ console.log(`🔍 [MARQUEE] Safari Animation - direction: ${direction}, isVertical: ${isVertical}`);
386
+
387
+ // Créer les keyframes CSS pour Safari avec direction
386
388
  const totalSize = contentSize * 3 + gapSize * 2;
387
389
  const animationName = `marquee-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
388
390
 
@@ -393,14 +395,28 @@
393
395
  scrollContainer.style.width = totalSize + 'px';
394
396
  }
395
397
 
396
- // Créer les keyframes CSS
398
+ // Calculer les positions selon la direction
399
+ let startPos, endPos;
400
+ const moveDistance = contentSize + gapSize;
401
+
402
+ if (direction === (isVertical ? 'bottom' : 'right')) {
403
+ // Direction bottom/right : commence en bas/à droite, va vers le haut/à gauche
404
+ startPos = isVertical ? `translateY(${moveDistance}px)` : `translateX(${moveDistance}px)`;
405
+ endPos = isVertical ? 'translateY(0px)' : 'translateX(0px)';
406
+ } else {
407
+ // Direction top/left : commence en haut/à gauche, va vers le bas/à droite
408
+ startPos = isVertical ? 'translateY(0px)' : 'translateX(0px)';
409
+ endPos = isVertical ? `translateY(-${moveDistance}px)` : `translateX(-${moveDistance}px)`;
410
+ }
411
+
412
+ // Créer les keyframes CSS avec direction
397
413
  const keyframes = `
398
414
  @keyframes ${animationName} {
399
415
  0% {
400
- transform: ${isVertical ? 'translateY(0px)' : 'translateX(0px)'};
416
+ transform: ${startPos};
401
417
  }
402
418
  100% {
403
- transform: ${isVertical ? `translateY(-${contentSize + gapSize}px)` : `translateX(-${contentSize + gapSize}px)`};
419
+ transform: ${endPos};
404
420
  }
405
421
  }
406
422
  `;
@@ -410,10 +426,14 @@
410
426
  style.textContent = keyframes;
411
427
  document.head.appendChild(style);
412
428
 
413
- // Configuration de l'animation
414
- const duration = (contentSize + gapSize) / ((parseFloat(speed) * (isVertical ? 1.5 : 0.8)) / 60);
429
+ // Configuration de l'animation avec durée calculée correctement
430
+ const speedValue = parseFloat(speed);
431
+ const baseSpeed = isVertical ? 1.5 : 0.8;
432
+ const duration = Math.max(1, moveDistance / ((speedValue * baseSpeed) / 60));
433
+
415
434
  scrollContainer.style.animation = `${animationName} ${duration}s linear infinite`;
416
-
435
+
436
+ console.log(`🔍 [MARQUEE] Safari - duration: ${duration}s, moveDistance: ${moveDistance}px`);
417
437
  console.log('✅ [MARQUEE] Animation Safari démarrée avec keyframes CSS');
418
438
 
419
439
  // Pause au survol pour Safari
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bebranded/bb-contents",
3
- "version": "1.0.67-beta",
3
+ "version": "1.0.68-beta",
4
4
  "description": "Contenus additionnels français pour Webflow",
5
5
  "main": "bb-contents.js",
6
6
  "scripts": {