@rhavenside/baseline-ui 1.0.4 → 1.0.5

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.
@@ -50,10 +50,18 @@ function autoInit() {
50
50
  }
51
51
 
52
52
  // Initialize when DOM is ready
53
+ // Use requestAnimationFrame for better timing with ES modules
53
54
  if (document.readyState === 'loading') {
54
- document.addEventListener('DOMContentLoaded', autoInit);
55
+ document.addEventListener('DOMContentLoaded', () => {
56
+ // Wait for next frame to ensure all elements are rendered
57
+ requestAnimationFrame(() => {
58
+ requestAnimationFrame(autoInit);
59
+ });
60
+ });
55
61
  } else {
56
- // Use setTimeout to ensure DOM is fully ready
57
- setTimeout(autoInit, 0);
62
+ // DOM already loaded, but wait for next frame to ensure everything is ready
63
+ requestAnimationFrame(() => {
64
+ requestAnimationFrame(autoInit);
65
+ });
58
66
  }
59
67