@elurjs/kit 2.4.5 → 2.4.7

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.
package/dist/lib/cli.js CHANGED
@@ -211,7 +211,15 @@ function buildEntrySource(islands, outFile, hydrateImport = "@elurjs/kit/island"
211
211
  const islandHydration = registryLines ? `const registry = {
212
212
  ${registryLines}
213
213
  };
214
- hydrateIslands(registry);
214
+ // Defer hydration until the browser is idle so the first paint is not
215
+ // blocked. Islands with directive "load" already have SSR-rendered DOM,
216
+ // so the user sees content immediately — hydration only adds interactivity.
217
+ const hydrate = () => hydrateIslands(registry);
218
+ if ("requestIdleCallback" in window) {
219
+ requestIdleCallback(hydrate, { timeout: 2000 });
220
+ } else {
221
+ setTimeout(hydrate, 0);
222
+ }
215
223
  document.addEventListener("elur:rendered", () => {
216
224
  cleanupHydratedIslands();
217
225
  hydrateIslands(registry);