@ilha/router 0.8.8 → 0.8.10

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/README.md CHANGED
@@ -645,6 +645,8 @@ Wraps a page island with a layout handler. Used internally by the Vite plugin co
645
645
 
646
646
  On client hydration, `wrapLayout` mounts the full layout island (layout child slots `p:*` and the keyed page slot `k:page`) from existing SSR DOM — it does not re-render layout markup from serialized props. Interactive components in `+layout.tsx` (state, event handlers, nested islands) hydrate the same way as the page.
647
647
 
648
+ **Nested islands under layouts are fully supported.** JSX children and callback props (`setPage`, etc.) are passed through the live slot map on every parent render — not recovered from `data-ilha-props` JSON. Compound children (e.g. Areia `<Pagination>` with `Pagination.Info` / `Controls`) mount into the slot host as real DOM; you do not need `.Static` or to lift controls into the layout.
649
+
648
650
  With **nested** layouts (codegen: `wrapLayout(outer, wrapLayout(inner, page))`), `renderHydratable()` composes layout markup by awaiting the **leaf** page’s `hydratable()` envelope and injecting that HTML into each layout’s `k:page` slot (outer slot receives the inner layout tree; the innermost slot receives the page). Page state snapshots always come from the leaf page island.
649
651
 
650
652
  ```ts
package/dist/index.d.ts CHANGED
@@ -359,8 +359,12 @@ export interface LinkInterceptionOptions {
359
359
  prefetch?: boolean;
360
360
  }
361
361
  export declare function enableLinkInterception(root?: Element | Document, options?: LinkInterceptionOptions): () => void;
362
- export declare const RouterView: Island<Record<string, unknown>, Record<never, never>>;
363
- export declare const RouterLink: Island<Record<string, unknown>, Omit<Omit<Record<never, never>, K> & Record<"href", string>, "label"> & Record<"label", string>>;
362
+ export declare const RouterView: Island<{
363
+ [x: string]: unknown;
364
+ }, {}>;
365
+ export declare const RouterLink: Island<{
366
+ [x: string]: unknown;
367
+ }, Omit<Omit<{}, K> & Record<"href", string>, "label"> & Record<"label", string>>;
364
368
  export interface IsActiveOptions {
365
369
  /**
366
370
  * When `false`, `isActive("/docs")` also matches nested paths like
@@ -395,8 +399,12 @@ declare const _default: {
395
399
  prefetch: typeof prefetch;
396
400
  beforeNavigate: typeof beforeNavigate;
397
401
  afterNavigate: typeof afterNavigate;
398
- RouterView: Island<Record<string, unknown>, Record<never, never>>;
399
- RouterLink: Island<Record<string, unknown>, Omit<Omit<Record<never, never>, K> & Record<"href", string>, "label"> & Record<"label", string>>;
402
+ RouterView: Island<{
403
+ [x: string]: unknown;
404
+ }, {}>;
405
+ RouterLink: Island<{
406
+ [x: string]: unknown;
407
+ }, Omit<Omit<{}, K> & Record<"href", string>, "label"> & Record<"label", string>>;
400
408
  loader: typeof loader;
401
409
  redirect: typeof redirect;
402
410
  error: typeof error;
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { A as wrapLayout, C as routePath, D as src_default, E as serializeHead, M as setHistoryMode, O as useRoute, S as routeParams, T as router, _ as navigating, a as RouterView, b as redirect, c as composeLoaders, d as error, f as head, g as navigate, h as loader, i as RouterLink, j as getHistoryMode, k as wrapError, l as defineLayout, m as isActive, n as LoaderError, o as afterNavigate, p as invalidate, r as Redirect, s as beforeNavigate, t as LOADER_ENDPOINT, u as enableLinkInterception, v as prefetch, w as routeSearch, x as routeHash, y as prime } from "./src-Dfq3JPRz.js";
1
+ import { A as wrapLayout, C as routePath, D as src_default, E as serializeHead, M as setHistoryMode, O as useRoute, S as routeParams, T as router, _ as navigating, a as RouterView, b as redirect, c as composeLoaders, d as error, f as head, g as navigate, h as loader, i as RouterLink, j as getHistoryMode, k as wrapError, l as defineLayout, m as isActive, n as LoaderError, o as afterNavigate, p as invalidate, r as Redirect, s as beforeNavigate, t as LOADER_ENDPOINT, u as enableLinkInterception, v as prefetch, w as routeSearch, x as routeHash, y as prime } from "./src-BKWkRtMx.js";
2
2
 
3
3
  export { LOADER_ENDPOINT, LoaderError, Redirect, RouterLink, RouterView, afterNavigate, beforeNavigate, composeLoaders, src_default as default, defineLayout, enableLinkInterception, error, getHistoryMode, head, invalidate, isActive, loader, navigate, navigating, prefetch, prime, redirect, routeHash, routeParams, routePath, routeSearch, router, serializeHead, setHistoryMode, useRoute, wrapError, wrapLayout };
@@ -333,10 +333,11 @@ function wrapLayout(layout, page) {
333
333
  const layoutInputRef = {};
334
334
  const KeyedPage = ((props) => {
335
335
  const merged = layoutInputRef.merged;
336
- return rawKeyedPage(merged && typeof merged === "object" ? {
336
+ const slotProps = merged && typeof merged === "object" ? {
337
337
  ...merged,
338
338
  ...props ?? {}
339
- } : props);
339
+ } : props;
340
+ return rawKeyedPage(slotProps);
340
341
  });
341
342
  Object.assign(KeyedPage, { toString: page.toString.bind(page) });
342
343
  KeyedPage[ISLAND_CALL] = true;
@@ -941,8 +942,11 @@ const _activeIslandSig = context("router.active", null);
941
942
  function activeIsland(value) {
942
943
  const store = activeRouteStore();
943
944
  if (arguments.length > 0) {
944
- if (store) return store.island = value ?? null;
945
- return _activeIslandSig(value ?? null), value ?? null;
945
+ const next = value ?? null;
946
+ if (store) return store.island = next;
947
+ if (next === null) _activeIslandSig(null);
948
+ else _activeIslandSig(() => next);
949
+ return next;
946
950
  }
947
951
  return store ? store.island : _activeIslandSig();
948
952
  }
package/dist/ssr.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as LOADER_ENDPOINT } from "./src-Dfq3JPRz.js";
1
+ import { t as LOADER_ENDPOINT } from "./src-BKWkRtMx.js";
2
2
  import { pageRouter, registry } from "ilha:pages/server";
3
3
  import "ilha:loaders";
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ilha/router",
3
- "version": "0.8.8",
3
+ "version": "0.8.10",
4
4
  "description": "A tiny SPA router for Ilha",
5
5
  "keywords": [
6
6
  "frontend",
@@ -64,14 +64,14 @@
64
64
  "test": "bun test"
65
65
  },
66
66
  "dependencies": {
67
- "rou3": "0.9.0",
67
+ "rou3": "0.9.1",
68
68
  "unplugin": "3.3.0"
69
69
  },
70
70
  "devDependencies": {
71
- "ilha": "0.9.4",
72
- "vite": "^8.1.3"
71
+ "ilha": "0.10.0",
72
+ "vite": "^8.1.5"
73
73
  },
74
74
  "peerDependencies": {
75
- "ilha": ">=0.9.4"
75
+ "ilha": ">=0.10.0"
76
76
  }
77
77
  }