@ilha/astro 0.1.9 → 0.2.0
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 +2 -2
- package/dist/client.js +1 -1
- package/dist/index.js +2 -2
- package/dist/server.js +2 -5
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -49,11 +49,11 @@ import { Counter } from "../islands/counter";
|
|
|
49
49
|
## How it works
|
|
50
50
|
|
|
51
51
|
- **Server-side:** the component is rendered with [`.hydratable()`](https://github.com/ilhajs/ilha), which wraps the island's SSR output in a `[data-ilha]` element carrying serialized props and a state snapshot.
|
|
52
|
-
- **Client-side:** on hydration, the renderer finds that `[data-ilha]` element inside Astro's island wrapper and calls the island's own `.mount()` — no re-render, no flicker,
|
|
52
|
+
- **Client-side:** on hydration, the renderer finds that `[data-ilha]` element inside Astro's island wrapper and calls the island's own `.mount()` — no re-render, no flicker, no post-mount setup needed since the snapshot already matches the DOM.
|
|
53
53
|
|
|
54
54
|
Because hydration is driven entirely by Ilha's own `data-ilha-*` attributes, every [Astro client directive](https://docs.astro.build/en/reference/directives-reference/#client-directives) (`client:load`, `client:idle`, `client:visible`, `client:media`, `client:only`) works as expected.
|
|
55
55
|
|
|
56
56
|
## Notes
|
|
57
57
|
|
|
58
|
-
- Ilha islands don't support Astro's `<slot />` / children forwarding — render everything through the island
|
|
58
|
+
- Ilha islands don't support Astro's `<slot />` / children forwarding — render everything through the island component and its props (via `Island.toString()` / `.hydratable()` on the server).
|
|
59
59
|
- `client:only` skips SSR entirely and mounts fresh in the browser, matching Astro's usual behavior for other framework renderers.
|
package/dist/client.js
CHANGED
|
@@ -9,7 +9,7 @@ function isRawHtml(value) {
|
|
|
9
9
|
return !!(value && typeof value === "object" && RAW in value);
|
|
10
10
|
}
|
|
11
11
|
function wrapPlainAsIsland(Component, merged) {
|
|
12
|
-
return ilha
|
|
12
|
+
return ilha(() => {
|
|
13
13
|
const result = Component(merged);
|
|
14
14
|
if (result == null) return raw("");
|
|
15
15
|
if (typeof result === "string") return raw(result);
|
package/dist/index.js
CHANGED
|
@@ -41,8 +41,8 @@ function optionsPlugin(options) {
|
|
|
41
41
|
function getRenderer() {
|
|
42
42
|
return {
|
|
43
43
|
name: "@ilha/astro",
|
|
44
|
-
clientEntrypoint: "@ilha/astro/client
|
|
45
|
-
serverEntrypoint: "@ilha/astro/server
|
|
44
|
+
clientEntrypoint: "@ilha/astro/client",
|
|
45
|
+
serverEntrypoint: "@ilha/astro/server"
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
/**
|
package/dist/server.js
CHANGED
|
@@ -27,7 +27,7 @@ function hasNestedIslandSlots(html) {
|
|
|
27
27
|
* when the shell hydrates on the client.
|
|
28
28
|
*/
|
|
29
29
|
function wrapPlainAsIsland(Component, merged) {
|
|
30
|
-
return ilha
|
|
30
|
+
return ilha(() => {
|
|
31
31
|
const result = Component(merged);
|
|
32
32
|
if (result == null) return raw("");
|
|
33
33
|
if (typeof result === "string") return raw(result);
|
|
@@ -36,10 +36,7 @@ function wrapPlainAsIsland(Component, merged) {
|
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
function toRawHtml(value) {
|
|
39
|
-
return
|
|
40
|
-
[RAW]: true,
|
|
41
|
-
value: String(value)
|
|
42
|
-
};
|
|
39
|
+
return raw(String(value));
|
|
43
40
|
}
|
|
44
41
|
function isAstroRenderable(value) {
|
|
45
42
|
return !!value && typeof value === "object" && !isRawHtml(value) && typeof value.render === "function";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ilha/astro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Astro integration for Ilha islands",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astro-component",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"types": "./dist/index.d.ts",
|
|
35
35
|
"import": "./dist/index.js"
|
|
36
36
|
},
|
|
37
|
-
"./client
|
|
37
|
+
"./client": {
|
|
38
38
|
"types": "./dist/client.d.ts",
|
|
39
39
|
"import": "./dist/client.js"
|
|
40
40
|
},
|
|
41
|
-
"./server
|
|
41
|
+
"./server": {
|
|
42
42
|
"types": "./dist/server.d.ts",
|
|
43
43
|
"import": "./dist/server.js"
|
|
44
44
|
}
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"astro": "^7.2.4",
|
|
56
|
-
"ilha": "^0.
|
|
56
|
+
"ilha": "^0.12.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"astro": "^7.2.4",
|
|
60
|
-
"ilha": ">=0.
|
|
60
|
+
"ilha": ">=0.12.0"
|
|
61
61
|
}
|
|
62
62
|
}
|