@atolljs/react-island 0.1.14 → 0.1.15
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/{chunk-Q7NIXFLZ.js → chunk-FMZWTAST.js} +5 -1
- package/dist/index.d.ts +11 -2
- package/dist/index.js +1 -1
- package/dist/worker.js +1 -1
- package/package.json +3 -3
- package/src/index.tsx +14 -0
|
@@ -21,6 +21,7 @@ function Island({
|
|
|
21
21
|
slots,
|
|
22
22
|
onReady,
|
|
23
23
|
onError,
|
|
24
|
+
boundary,
|
|
24
25
|
ref,
|
|
25
26
|
...rest
|
|
26
27
|
}) {
|
|
@@ -92,7 +93,8 @@ function Island({
|
|
|
92
93
|
props: propsRef.current ?? {},
|
|
93
94
|
onEvent: (name, payload) => onEventRef.current?.(name, payload),
|
|
94
95
|
onActivity: () => onActivityRef.current?.(),
|
|
95
|
-
slots: slotProxy
|
|
96
|
+
slots: slotProxy,
|
|
97
|
+
boundary
|
|
96
98
|
});
|
|
97
99
|
if (cancelled) {
|
|
98
100
|
handle.destroy();
|
|
@@ -139,6 +141,7 @@ var SHELL_PROP_KEYS = /* @__PURE__ */ new Set([
|
|
|
139
141
|
"onError",
|
|
140
142
|
"slots",
|
|
141
143
|
"fallback",
|
|
144
|
+
"boundary",
|
|
142
145
|
"containerProps"
|
|
143
146
|
]);
|
|
144
147
|
var splitProxyProps = (raw) => {
|
|
@@ -201,6 +204,7 @@ function ProxyIsland({
|
|
|
201
204
|
setReady(true);
|
|
202
205
|
},
|
|
203
206
|
onError: shell.onError,
|
|
207
|
+
boundary: shell.boundary,
|
|
204
208
|
...shell.containerProps
|
|
205
209
|
}
|
|
206
210
|
)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HTMLAttributes, ReactElement, ReactNode, Ref } from 'react';
|
|
2
|
-
import type { IslandAppLike, IslandAppProps, IslandClient, IslandContract, IslandContractEventHandler, IslandContractProps, IslandHandle, IslandWorkerOptions, Mode } from '@atolljs/islands';
|
|
2
|
+
import type { IslandAppLike, IslandAppProps, IslandBoundary, IslandClient, IslandContract, IslandContractEventHandler, IslandContractProps, IslandHandle, IslandWorkerOptions, Mode } from '@atolljs/islands';
|
|
3
3
|
export type { IslandAppLike, IslandAppProps, IslandHandle };
|
|
4
4
|
/** What `app` accepts: the registry name, or a component/def to resolve. */
|
|
5
5
|
export type IslandAppRef<A> = A | string;
|
|
@@ -53,10 +53,17 @@ export interface IslandProps<A = string> extends Omit<HTMLAttributes<HTMLDivElem
|
|
|
53
53
|
onReady?: (island: IslandHandle) => void;
|
|
54
54
|
/** Mount/update errors surface here instead of an unhandled rejection. */
|
|
55
55
|
onError?: (err: unknown) => void;
|
|
56
|
+
/**
|
|
57
|
+
* Error boundary — `loading`/`error` render functions (DOM nodes) plus a
|
|
58
|
+
* retry policy covering mount failures and runtime worker crashes. The
|
|
59
|
+
* render fns are framework-free; to fall back to JSX, render into a
|
|
60
|
+
* detached node with createRoot or portal it in yourself.
|
|
61
|
+
*/
|
|
62
|
+
boundary?: IslandBoundary;
|
|
56
63
|
/** The container div (React 19 ref-as-prop). */
|
|
57
64
|
ref?: Ref<HTMLDivElement>;
|
|
58
65
|
}
|
|
59
|
-
export declare function Island<A = string>({ app, worker, client: clientProp, workerOptions, mode, framework, props, onEvent, onActivity, slots, onReady, onError, ref, ...rest }: IslandProps<A>): ReactElement;
|
|
66
|
+
export declare function Island<A = string>({ app, worker, client: clientProp, workerOptions, mode, framework, props, onEvent, onActivity, slots, onReady, onError, boundary, ref, ...rest }: IslandProps<A>): ReactElement;
|
|
60
67
|
/**
|
|
61
68
|
* Props consumed by a proxy component itself — everything else forwards to
|
|
62
69
|
* the island as its props.
|
|
@@ -83,6 +90,8 @@ export interface IslandShellProps {
|
|
|
83
90
|
onError?: (err: unknown) => void;
|
|
84
91
|
/** Transclusion slots — see IslandProps.slots. */
|
|
85
92
|
slots?: Record<string, ReactNode>;
|
|
93
|
+
/** Error boundary — see IslandProps.boundary. */
|
|
94
|
+
boundary?: IslandBoundary;
|
|
86
95
|
/** Rendered while the worker mounts — the lazy-side fallback. */
|
|
87
96
|
fallback?: ReactNode;
|
|
88
97
|
/**
|
package/dist/index.js
CHANGED
package/dist/worker.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atolljs/react-island",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "React shell components for atoll-islands islands — <Island/>, islandComponent, lazyIsland",
|
|
5
5
|
"homepage": "https://jwhenry3.github.io/atolljs/consumer/quickstart/",
|
|
6
6
|
"type": "module",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"registry": "https://registry.npmjs.org"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@atolljs/core": "^0.1.
|
|
30
|
-
"@atolljs/islands": "^0.1.
|
|
29
|
+
"@atolljs/core": "^0.1.15",
|
|
30
|
+
"@atolljs/islands": "^0.1.15",
|
|
31
31
|
"react": "^19.3.0",
|
|
32
32
|
"react-dom": "^19.3.0",
|
|
33
33
|
"react-reconciler": "^0.34.0"
|
package/src/index.tsx
CHANGED
|
@@ -62,6 +62,7 @@ import {
|
|
|
62
62
|
import type {
|
|
63
63
|
IslandAppLike,
|
|
64
64
|
IslandAppProps,
|
|
65
|
+
IslandBoundary,
|
|
65
66
|
IslandClient,
|
|
66
67
|
IslandContract,
|
|
67
68
|
IslandContractEventHandler,
|
|
@@ -127,6 +128,13 @@ export interface IslandProps<A = string>
|
|
|
127
128
|
onReady?: (island: IslandHandle) => void;
|
|
128
129
|
/** Mount/update errors surface here instead of an unhandled rejection. */
|
|
129
130
|
onError?: (err: unknown) => void;
|
|
131
|
+
/**
|
|
132
|
+
* Error boundary — `loading`/`error` render functions (DOM nodes) plus a
|
|
133
|
+
* retry policy covering mount failures and runtime worker crashes. The
|
|
134
|
+
* render fns are framework-free; to fall back to JSX, render into a
|
|
135
|
+
* detached node with createRoot or portal it in yourself.
|
|
136
|
+
*/
|
|
137
|
+
boundary?: IslandBoundary;
|
|
130
138
|
/** The container div (React 19 ref-as-prop). */
|
|
131
139
|
ref?: Ref<HTMLDivElement>;
|
|
132
140
|
}
|
|
@@ -144,6 +152,7 @@ export function Island<A = string>({
|
|
|
144
152
|
slots,
|
|
145
153
|
onReady,
|
|
146
154
|
onError,
|
|
155
|
+
boundary,
|
|
147
156
|
ref,
|
|
148
157
|
...rest
|
|
149
158
|
}: IslandProps<A>): ReactElement {
|
|
@@ -242,6 +251,7 @@ export function Island<A = string>({
|
|
|
242
251
|
onEvent: (name, payload) => onEventRef.current?.(name, payload),
|
|
243
252
|
onActivity: () => onActivityRef.current?.(),
|
|
244
253
|
slots: slotProxy,
|
|
254
|
+
boundary,
|
|
245
255
|
});
|
|
246
256
|
if (cancelled) {
|
|
247
257
|
handle.destroy();
|
|
@@ -322,6 +332,8 @@ export interface IslandShellProps {
|
|
|
322
332
|
onError?: (err: unknown) => void;
|
|
323
333
|
/** Transclusion slots — see IslandProps.slots. */
|
|
324
334
|
slots?: Record<string, ReactNode>;
|
|
335
|
+
/** Error boundary — see IslandProps.boundary. */
|
|
336
|
+
boundary?: IslandBoundary;
|
|
325
337
|
/** Rendered while the worker mounts — the lazy-side fallback. */
|
|
326
338
|
fallback?: ReactNode;
|
|
327
339
|
/**
|
|
@@ -343,6 +355,7 @@ const SHELL_PROP_KEYS: ReadonlySet<string> = new Set([
|
|
|
343
355
|
'onError',
|
|
344
356
|
'slots',
|
|
345
357
|
'fallback',
|
|
358
|
+
'boundary',
|
|
346
359
|
'containerProps',
|
|
347
360
|
]);
|
|
348
361
|
|
|
@@ -445,6 +458,7 @@ function ProxyIsland({
|
|
|
445
458
|
setReady(true);
|
|
446
459
|
}}
|
|
447
460
|
onError={shell.onError}
|
|
461
|
+
boundary={shell.boundary}
|
|
448
462
|
{...shell.containerProps}
|
|
449
463
|
/>
|
|
450
464
|
</>
|