@elurjs/kit 2.4.6 → 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/CHANGELOG.md CHANGED
@@ -1,10 +1,23 @@
1
1
  # Changelog
2
2
 
3
- All notable changes to Nix.js Kit are documented in this file.
3
+ All notable changes to Elur Kit are documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.4.7]
9
+
10
+ ### Changed
11
+
12
+ - **Client entry now defers hydration with `requestIdleCallback`** — the
13
+ auto-generated `entry-client.ts` wraps `hydrateIslands(registry)` in
14
+ `requestIdleCallback(hydrate, { timeout: 2000 })` (with a `setTimeout`
15
+ fallback) so the browser can paint the server-rendered HTML before
16
+ hydrating islands. This reduces LCP element render delay on mobile
17
+ devices where the main thread was blocked by synchronous hydration.
18
+ Islands with directive `"load"` already have SSR-rendered DOM, so
19
+ users see content immediately — hydration only adds interactivity.
20
+
8
21
  ## [2.4.6]
9
22
 
10
23
  ### Fixed
package/dist/lib/cli.cjs 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);