@ilha/router 0.2.0 → 0.2.2

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
@@ -145,7 +145,7 @@ No-op with a console warning when called outside a browser environment.
145
145
  Resolves the given URL against the route registry and returns a synchronous HTML string. Accepts a path string, full URL string, or `URL` object. Populates all route signals identically to the browser.
146
146
 
147
147
  ```ts
148
- const html = router().route("/", homePage).route("/**", notFound).render("/");
148
+ const html = router().route("/", HomePage).route("/**", notFound).render("/");
149
149
  // → '<div data-router-view><p>home</p></div>'
150
150
  ```
151
151
 
@@ -158,8 +158,8 @@ Renders `<div data-router-empty></div>` when no route matches.
158
158
  Async variant of `.render()` that outputs HTML with `data-ilha` hydration markers so the client can rehydrate without a full re-render. If a loader is registered for the matched route, it runs first and its return value is serialized into `data-ilha-props`.
159
159
 
160
160
  ```ts
161
- const html = await router().route("/", homePage).renderHydratable("/", registry);
162
- // → '<div data-router-view><div data-ilha="home">…</div></div>'
161
+ const html = await router().route("/", HomePage).renderHydratable("/", registry);
162
+ // → '<div data-router-view><div data-ilha="Home">…</div></div>'
163
163
  ```
164
164
 
165
165
  If the active island is not found in the registry, falls back to plain SSR and emits a `console.warn`.
package/dist/index.js CHANGED
@@ -54,7 +54,7 @@ function wrapLayout(layout, page) {
54
54
  return layout(page);
55
55
  }
56
56
  function wrapError(handler, page) {
57
- const wrapper = ilha.render(() => {
57
+ const Wrapper = ilha.render(() => {
58
58
  try {
59
59
  return page.toString();
60
60
  } catch (e) {
@@ -71,7 +71,7 @@ function wrapError(handler, page) {
71
71
  }, route).toString();
72
72
  }
73
73
  });
74
- wrapper.mount = (host, props) => {
74
+ Wrapper.mount = (host, props) => {
75
75
  try {
76
76
  return page.mount(host, props);
77
77
  } catch (e) {
@@ -90,7 +90,7 @@ function wrapError(handler, page) {
90
90
  return errorIsland.mount(host, props);
91
91
  }
92
92
  };
93
- return wrapper;
93
+ return Wrapper;
94
94
  }
95
95
  function defineLayout(layout) {
96
96
  return layout;
@@ -425,7 +425,7 @@ function router() {
425
425
  let currentMountedIsland = activeIsland();
426
426
  const reverseRegistry = registry ? buildReverseRegistry(registry) : void 0;
427
427
  let navVersion = 0;
428
- const navHandler = ilha.render(() => {
428
+ const NavHandler = ilha.render(() => {
429
429
  const current = activeIsland();
430
430
  if (current !== currentMountedIsland) {
431
431
  const thisNav = ++navVersion;
@@ -449,7 +449,7 @@ function router() {
449
449
  const navHost = document.createElement("div");
450
450
  navHost.style.display = "none";
451
451
  host.appendChild(navHost);
452
- const unmountNavHandler = navHandler.mount(navHost);
452
+ const unmountNavHandler = NavHandler.mount(navHost);
453
453
  return () => {
454
454
  ++navVersion;
455
455
  navAbort?.abort();
@@ -493,7 +493,7 @@ function router() {
493
493
  }
494
494
  navAbort = new AbortController();
495
495
  mountActiveIsland(activeIsland(), navAbort.signal);
496
- const navHandler = ilha.render(() => {
496
+ const NavHandler = ilha.render(() => {
497
497
  const current = activeIsland();
498
498
  if (current !== currentMountedIsland) {
499
499
  const thisNav = ++navVersion;
@@ -510,7 +510,7 @@ function router() {
510
510
  const navHost = document.createElement("div");
511
511
  navHost.style.display = "none";
512
512
  host.appendChild(navHost);
513
- const unmountNavHandler = navHandler.mount(navHost);
513
+ const unmountNavHandler = NavHandler.mount(navHost);
514
514
  return () => {
515
515
  ++navVersion;
516
516
  navAbort?.abort();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ilha/router",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "A tiny SPA router for Ilha",
5
5
  "license": "MIT",
6
6
  "author": "Ryuz <ryuzer@proton.me>",
@@ -27,7 +27,7 @@
27
27
  "test": "bun test"
28
28
  },
29
29
  "dependencies": {
30
- "ilha": "0.2.0",
30
+ "ilha": "0.3.0",
31
31
  "rou3": "0.8.1"
32
32
  },
33
33
  "devDependencies": {