@superleapai/flow-ui 2.2.3 → 2.2.4

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.
@@ -6,7 +6,7 @@
6
6
  * Licensed under MIT
7
7
  *
8
8
  * Build: development
9
- * Date: 2026-02-12T07:58:50.601Z
9
+ * Date: 2026-02-12T08:47:06.944Z
10
10
  *
11
11
  * For documentation and examples, visit:
12
12
  * https://github.com/superleap/superleap-flow
@@ -16794,8 +16794,8 @@
16794
16794
 
16795
16795
  // Dispatch custom event when library is ready
16796
16796
  if (typeof CustomEvent !== "undefined" && typeof document !== "undefined") {
16797
- // Use setTimeout to ensure this runs after all IIFEs have executed
16798
- setTimeout(function() {
16797
+ // Function to dispatch the ready event
16798
+ function dispatchReady() {
16799
16799
  const event = new CustomEvent("superleap-flow:ready", {
16800
16800
  detail: {
16801
16801
  FlowUI: window.FlowUI,
@@ -16805,7 +16805,16 @@
16805
16805
  });
16806
16806
  document.dispatchEvent(event);
16807
16807
  console.log("[Superleap-Flow] Library ready - v2.2.2");
16808
- }, 0);
16808
+ }
16809
+
16810
+ // Wait for DOM to be ready before dispatching event
16811
+ if (document.readyState === "loading") {
16812
+ // DOM is still loading, wait for DOMContentLoaded
16813
+ document.addEventListener("DOMContentLoaded", dispatchReady);
16814
+ } else {
16815
+ // DOM is already ready, dispatch immediately (but async)
16816
+ setTimeout(dispatchReady, 0);
16817
+ }
16809
16818
  }
16810
16819
  }
16811
16820