@bebranded/bb-contents 1.0.33-beta → 1.0.34-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 +22 -7
  2. package/package.json +1 -1
package/bb-contents.js CHANGED
@@ -17,7 +17,7 @@
17
17
 
18
18
  // Configuration
19
19
  const config = {
20
- version: '1.0.33-beta',
20
+ version: '1.0.34-beta',
21
21
  debug: false, // Désactivé par défaut pour une console propre
22
22
  prefix: 'bb-', // utilisé pour générer les sélecteurs (data-bb-*)
23
23
  i18n: {
@@ -33,6 +33,7 @@
33
33
  _reinitScheduled: false,
34
34
  _initRetryCount: 0,
35
35
  _maxInitRetries: 3,
36
+ _performanceBoostDetected: false,
36
37
 
37
38
  // Utilitaires
38
39
  utils: {
@@ -83,6 +84,12 @@
83
84
 
84
85
  this.utils.log('Initialisation v' + this.config.version);
85
86
 
87
+ // Détection du bb-performance-boost
88
+ this._performanceBoostDetected = document.body.hasAttribute('bb-performance-boost');
89
+ if (this._performanceBoostDetected) {
90
+ this.utils.log('bb-performance-boost détecté - mode de compatibilité activé');
91
+ }
92
+
86
93
  // Déterminer la portée
87
94
  const scope = document.querySelector('[data-bb-scope]') || document;
88
95
 
@@ -133,9 +140,10 @@
133
140
  this._initRetryCount++;
134
141
  bbContents.utils.log('Tentative de réinitialisation', this._initRetryCount, '/', this._maxInitRetries);
135
142
 
143
+ const delay = this._performanceBoostDetected ? 1000 * this._initRetryCount : 500 * this._initRetryCount;
136
144
  setTimeout(() => {
137
145
  this.init();
138
- }, 500 * this._initRetryCount); // Délai progressif
146
+ }, delay); // Délai progressif adaptatif
139
147
  }
140
148
  },
141
149
 
@@ -173,10 +181,11 @@
173
181
 
174
182
  if (shouldReinit && !this._reinitScheduled) {
175
183
  this._reinitScheduled = true;
184
+ const delay = this._performanceBoostDetected ? 200 : 100;
176
185
  setTimeout(() => {
177
186
  this.init();
178
187
  this._reinitScheduled = false;
179
- }, 100);
188
+ }, delay);
180
189
  }
181
190
  });
182
191
 
@@ -580,7 +589,10 @@
580
589
  };
581
590
 
582
591
  // Démarrer l'initialisation avec délai adaptatif
583
- const initDelay = isVertical ? 300 : 100;
592
+ let initDelay = isVertical ? 300 : 100;
593
+ if (bbContents._performanceBoostDetected) {
594
+ initDelay = isVertical ? 600 : 300; // Délais plus longs avec bb-performance-boost
595
+ }
584
596
  setTimeout(() => initAnimation(0), initDelay);
585
597
  });
586
598
 
@@ -974,19 +986,22 @@
974
986
  if (document.readyState === 'loading') {
975
987
  document.addEventListener('DOMContentLoaded', function() {
976
988
  // Délai pour éviter le blocage du rendu
989
+ const delay = document.body.hasAttribute('bb-performance-boost') ? 300 : 100;
977
990
  setTimeout(function() {
978
991
  bbContents.init();
979
- }, 100);
992
+ }, delay);
980
993
  });
981
994
  } else {
982
995
  // Délai pour éviter le blocage du rendu
996
+ const delay = document.body.hasAttribute('bb-performance-boost') ? 300 : 100;
983
997
  setTimeout(function() {
984
998
  bbContents.init();
985
- }, 100);
999
+ }, delay);
986
1000
  }
987
1001
 
988
1002
  // Initialisation différée supplémentaire pour les cas difficiles
989
1003
  window.addEventListener('load', function() {
1004
+ const loadDelay = document.body.hasAttribute('bb-performance-boost') ? 2000 : 1000;
990
1005
  setTimeout(function() {
991
1006
  // Vérifier s'il y a des éléments non initialisés
992
1007
  const unprocessedMarquees = document.querySelectorAll('[bb-marquee]:not([data-bb-marquee-processed])');
@@ -994,7 +1009,7 @@
994
1009
  bbContents.utils.log('Éléments marquee non initialisés détectés après load, réinitialisation...');
995
1010
  bbContents.reinit();
996
1011
  }
997
- }, 1000);
1012
+ }, loadDelay);
998
1013
  });
999
1014
  }
1000
1015
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bebranded/bb-contents",
3
- "version": "1.0.33-beta",
3
+ "version": "1.0.34-beta",
4
4
  "description": "Contenus additionnels français pour Webflow",
5
5
  "main": "bb-contents.js",
6
6
  "scripts": {