@genesislcap/foundation-react-utils 15.46.5 → 15.46.6-alpha-6d1bd2f25.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 +46 -0
- package/dist/custom-elements.json +117 -0
- package/dist/dts/error-boundary/error-boundary-styles.d.ts +6 -0
- package/dist/dts/error-boundary/error-boundary-styles.d.ts.map +1 -0
- package/dist/dts/error-boundary/error-boundary.d.ts +103 -0
- package/dist/dts/error-boundary/error-boundary.d.ts.map +1 -0
- package/dist/dts/error-boundary/index.d.ts +3 -0
- package/dist/dts/error-boundary/index.d.ts.map +1 -0
- package/dist/dts/index.d.ts +3 -0
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/esm/error-boundary/error-boundary-styles.js +133 -0
- package/dist/esm/error-boundary/error-boundary.js +221 -0
- package/dist/esm/error-boundary/index.js +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/foundation-react-utils.api.json +452 -0
- package/dist/foundation-react-utils.d.ts +113 -0
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -47,6 +47,52 @@ resolving a second copy of the library, which breaks the `instanceof` checks `fl
|
|
|
47
47
|
relies on internally; the entry point logs a warning when the version it loads differs from the one
|
|
48
48
|
the theme was generated against.
|
|
49
49
|
|
|
50
|
+
## Error boundaries
|
|
51
|
+
|
|
52
|
+
`AppErrorBoundary` wraps the whole app, and `TileErrorBoundary` (or the `withTileErrorBoundary`
|
|
53
|
+
HOC) wraps a single tile, so a crash replaces only that tile. Both render a fallback with a
|
|
54
|
+
reference ID, copyable diagnostics and a Retry button that remounts the children.
|
|
55
|
+
|
|
56
|
+
Every caught error is passed to the optional `onError` callback as an `ErrorBoundaryReport`
|
|
57
|
+
(`error`, `componentStack`, `referenceId`, `scope`, `title`, `tileRegistration`). Use it to send
|
|
58
|
+
errors to a monitoring service; this package takes no dependency on one.
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
import { AppErrorBoundary, onCaughtError } from '@genesislcap/foundation-react-utils';
|
|
62
|
+
|
|
63
|
+
createRoot(el, { onCaughtError }).render(
|
|
64
|
+
<AppErrorBoundary onError={({ error, ...extra }) => Sentry.captureException(error, { extra })}>
|
|
65
|
+
<App />
|
|
66
|
+
</AppErrorBoundary>,
|
|
67
|
+
);
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
import { TileErrorBoundary, withTileErrorBoundary } from '@genesislcap/foundation-react-utils';
|
|
72
|
+
|
|
73
|
+
<TileErrorBoundary title="Trade Blotter" tileRegistration="tradeBlotter" onError={report}>
|
|
74
|
+
<TradeBlotter />
|
|
75
|
+
</TileErrorBoundary>;
|
|
76
|
+
|
|
77
|
+
export const TradeBlotterTile = withTileErrorBoundary(TradeBlotter, 'Trade Blotter', 'tradeBlotter', report);
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Pass `onCaughtError` to `createRoot`. By default React 19 logs every error a boundary catches to
|
|
81
|
+
`console.error` before the boundary runs, so a console-capturing monitoring tool reports the bare
|
|
82
|
+
error first and can drop or duplicate the boundary's own report. `onCaughtError` skips that log
|
|
83
|
+
for these boundaries, and still logs errors caught by any other boundary.
|
|
84
|
+
|
|
85
|
+
Without `onError`, a boundary logs each caught error through a foundation logger named
|
|
86
|
+
`ERROR_BOUNDARY_LOGGER_NAME`, which a global log reporter (`addGlobalLogReporter` from
|
|
87
|
+
`@genesislcap/foundation-logger`) receives. With `onError` set, the boundary doesn't log the error,
|
|
88
|
+
so an app that reports through both `onError` and a global reporter gets each error once. If
|
|
89
|
+
`onError` throws, the boundary logs the original error and the handler's error, so neither is lost.
|
|
90
|
+
|
|
91
|
+
The fallback reads its colours and fonts from `--eb-*` CSS custom properties (`--eb-bg`,
|
|
92
|
+
`--eb-surface`, `--eb-text`, `--eb-text-muted`, `--eb-border`, `--eb-accent`, `--eb-error`,
|
|
93
|
+
`--eb-font`, and others), so set them on an ancestor to theme it. The last 20 reports are also kept
|
|
94
|
+
on `window.__GENESIS_ERROR_BOUNDARY_REPORTS__` for dev tooling such as the Genesis Create preview.
|
|
95
|
+
|
|
50
96
|
## License
|
|
51
97
|
|
|
52
98
|
Note: this project provides front-end dependencies and uses licensed components listed in the next section; thus, licenses for those components are required during development. Contact [Genesis Global](https://genesis.global/contact-us/) for more details.
|
|
@@ -254,6 +254,14 @@
|
|
|
254
254
|
"module": "./create-grid-pro-cell-renderer"
|
|
255
255
|
}
|
|
256
256
|
},
|
|
257
|
+
{
|
|
258
|
+
"kind": "js",
|
|
259
|
+
"name": "*",
|
|
260
|
+
"declaration": {
|
|
261
|
+
"name": "*",
|
|
262
|
+
"package": "./error-boundary"
|
|
263
|
+
}
|
|
264
|
+
},
|
|
257
265
|
{
|
|
258
266
|
"kind": "js",
|
|
259
267
|
"name": "RendererControlProps",
|
|
@@ -264,6 +272,115 @@
|
|
|
264
272
|
}
|
|
265
273
|
]
|
|
266
274
|
},
|
|
275
|
+
{
|
|
276
|
+
"kind": "javascript-module",
|
|
277
|
+
"path": "src/error-boundary/error-boundary-styles.ts",
|
|
278
|
+
"declarations": [
|
|
279
|
+
{
|
|
280
|
+
"kind": "variable",
|
|
281
|
+
"name": "errorBoundaryStyles",
|
|
282
|
+
"default": "`\n.error-boundary {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n gap: 12px;\n align-items: flex-start;\n width: 100%;\n height: 100%;\n padding: 16px;\n background: var(--eb-bg, #f6f8fb);\n color: var(--eb-text, #18212f);\n font-family: var(--eb-font, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif);\n}\n\n.error-boundary__top,\n.error-boundary__title,\n.error-boundary__subtitle,\n.error-boundary__details,\n.error-boundary__actions,\n.error-boundary__manual-copy-help {\n width: 100%;\n}\n\n.error-boundary__top {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 10px;\n flex-wrap: wrap;\n}\n\n.error-boundary__status {\n display: inline-flex;\n align-items: center;\n border: 1px solid var(--eb-error, #c53d3d);\n border-radius: 999px;\n padding: 5px 10px;\n text-transform: uppercase;\n letter-spacing: 0.13em;\n font-size: 11px;\n font-weight: 700;\n color: var(--eb-error, #c53d3d);\n background: var(--eb-error-bg, #fff4f4);\n}\n\n.error-boundary__reference {\n font-family: var(--eb-mono-font, 'Menlo', 'Consolas', 'Liberation Mono', monospace);\n font-size: 11px;\n letter-spacing: 0.08em;\n color: var(--eb-text-muted, #5f6f84);\n text-transform: uppercase;\n}\n\n.error-boundary__title {\n margin: 0;\n font-size: clamp(22px, 3vw, 30px);\n line-height: 1.15;\n font-weight: 700;\n text-wrap: balance;\n}\n\n.error-boundary__subtitle {\n margin: 0;\n max-width: 80ch;\n line-height: 1.45;\n}\n\n.error-boundary__details {\n box-sizing: border-box;\n min-height: 190px;\n max-height: 360px;\n padding: 12px;\n border: 1px solid var(--eb-border, #d3dae6);\n border-radius: 10px;\n background: var(--eb-surface, #ffffff);\n color: inherit;\n font-family: var(--eb-mono-font, 'Menlo', 'Consolas', 'Liberation Mono', monospace);\n font-size: 12px;\n line-height: 1.5;\n resize: vertical;\n}\n\n.error-boundary__actions {\n display: flex;\n gap: 10px;\n flex-wrap: wrap;\n}\n\n.error-boundary__button {\n border: 1px solid var(--eb-accent, #2f6fed);\n border-radius: 999px;\n background: var(--eb-accent, #2f6fed);\n color: var(--eb-accent-foreground, #ffffff);\n cursor: pointer;\n padding: 9px 16px;\n font: inherit;\n font-size: 12px;\n font-weight: 700;\n letter-spacing: 0.04em;\n text-transform: uppercase;\n}\n\n.error-boundary__button:hover {\n background: var(--eb-accent-hover, #255dcc);\n}\n\n.error-boundary__button--secondary {\n border-color: var(--eb-border, #d3dae6);\n background: var(--eb-surface, #ffffff);\n color: inherit;\n}\n\n.error-boundary__button--secondary:hover {\n background: var(--eb-surface-hover, #eef2f8);\n}\n\n.error-boundary__button:focus-visible {\n outline: 2px solid var(--eb-focus, #2f6fed);\n outline-offset: 2px;\n}\n\n.error-boundary__manual-copy-help {\n margin: 2px 0 0;\n font-size: 13px;\n color: var(--eb-text-muted, #5f6f84);\n line-height: 1.4;\n}\n`",
|
|
283
|
+
"description": "Fallback UI styles. Colours and fonts read `--eb-*` custom properties, so an app can theme the\nfallback by setting them on any ancestor."
|
|
284
|
+
}
|
|
285
|
+
],
|
|
286
|
+
"exports": [
|
|
287
|
+
{
|
|
288
|
+
"kind": "js",
|
|
289
|
+
"name": "errorBoundaryStyles",
|
|
290
|
+
"declaration": {
|
|
291
|
+
"name": "errorBoundaryStyles",
|
|
292
|
+
"module": "src/error-boundary/error-boundary-styles.ts"
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
]
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
"kind": "javascript-module",
|
|
299
|
+
"path": "src/error-boundary/index.ts",
|
|
300
|
+
"declarations": [],
|
|
301
|
+
"exports": [
|
|
302
|
+
{
|
|
303
|
+
"kind": "js",
|
|
304
|
+
"name": "AppErrorBoundary",
|
|
305
|
+
"declaration": {
|
|
306
|
+
"name": "AppErrorBoundary",
|
|
307
|
+
"module": "./error-boundary"
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"kind": "js",
|
|
312
|
+
"name": "ERROR_BOUNDARY_LOGGER_NAME",
|
|
313
|
+
"declaration": {
|
|
314
|
+
"name": "ERROR_BOUNDARY_LOGGER_NAME",
|
|
315
|
+
"module": "./error-boundary"
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"kind": "js",
|
|
320
|
+
"name": "onCaughtError",
|
|
321
|
+
"declaration": {
|
|
322
|
+
"name": "onCaughtError",
|
|
323
|
+
"module": "./error-boundary"
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
"kind": "js",
|
|
328
|
+
"name": "TileErrorBoundary",
|
|
329
|
+
"declaration": {
|
|
330
|
+
"name": "TileErrorBoundary",
|
|
331
|
+
"module": "./error-boundary"
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"kind": "js",
|
|
336
|
+
"name": "withTileErrorBoundary",
|
|
337
|
+
"declaration": {
|
|
338
|
+
"name": "withTileErrorBoundary",
|
|
339
|
+
"module": "./error-boundary"
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
"kind": "js",
|
|
344
|
+
"name": "AppErrorBoundaryProps",
|
|
345
|
+
"declaration": {
|
|
346
|
+
"name": "AppErrorBoundaryProps",
|
|
347
|
+
"module": "./error-boundary"
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
"kind": "js",
|
|
352
|
+
"name": "ErrorBoundaryErrorHandler",
|
|
353
|
+
"declaration": {
|
|
354
|
+
"name": "ErrorBoundaryErrorHandler",
|
|
355
|
+
"module": "./error-boundary"
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
"kind": "js",
|
|
360
|
+
"name": "ErrorBoundaryReport",
|
|
361
|
+
"declaration": {
|
|
362
|
+
"name": "ErrorBoundaryReport",
|
|
363
|
+
"module": "./error-boundary"
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
"kind": "js",
|
|
368
|
+
"name": "ErrorBoundaryScope",
|
|
369
|
+
"declaration": {
|
|
370
|
+
"name": "ErrorBoundaryScope",
|
|
371
|
+
"module": "./error-boundary"
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
"kind": "js",
|
|
376
|
+
"name": "TileErrorBoundaryProps",
|
|
377
|
+
"declaration": {
|
|
378
|
+
"name": "TileErrorBoundaryProps",
|
|
379
|
+
"module": "./error-boundary"
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
]
|
|
383
|
+
},
|
|
267
384
|
{
|
|
268
385
|
"kind": "javascript-module",
|
|
269
386
|
"path": "src/flexlayout/index.ts",
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fallback UI styles. Colours and fonts read `--eb-*` custom properties, so an app can theme the
|
|
3
|
+
* fallback by setting them on any ancestor.
|
|
4
|
+
*/
|
|
5
|
+
export declare const errorBoundaryStyles = "\n.error-boundary {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n gap: 12px;\n align-items: flex-start;\n width: 100%;\n height: 100%;\n padding: 16px;\n background: var(--eb-bg, #f6f8fb);\n color: var(--eb-text, #18212f);\n font-family: var(--eb-font, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif);\n}\n\n.error-boundary__top,\n.error-boundary__title,\n.error-boundary__subtitle,\n.error-boundary__details,\n.error-boundary__actions,\n.error-boundary__manual-copy-help {\n width: 100%;\n}\n\n.error-boundary__top {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 10px;\n flex-wrap: wrap;\n}\n\n.error-boundary__status {\n display: inline-flex;\n align-items: center;\n border: 1px solid var(--eb-error, #c53d3d);\n border-radius: 999px;\n padding: 5px 10px;\n text-transform: uppercase;\n letter-spacing: 0.13em;\n font-size: 11px;\n font-weight: 700;\n color: var(--eb-error, #c53d3d);\n background: var(--eb-error-bg, #fff4f4);\n}\n\n.error-boundary__reference {\n font-family: var(--eb-mono-font, 'Menlo', 'Consolas', 'Liberation Mono', monospace);\n font-size: 11px;\n letter-spacing: 0.08em;\n color: var(--eb-text-muted, #5f6f84);\n text-transform: uppercase;\n}\n\n.error-boundary__title {\n margin: 0;\n font-size: clamp(22px, 3vw, 30px);\n line-height: 1.15;\n font-weight: 700;\n text-wrap: balance;\n}\n\n.error-boundary__subtitle {\n margin: 0;\n max-width: 80ch;\n line-height: 1.45;\n}\n\n.error-boundary__details {\n box-sizing: border-box;\n min-height: 190px;\n max-height: 360px;\n padding: 12px;\n border: 1px solid var(--eb-border, #d3dae6);\n border-radius: 10px;\n background: var(--eb-surface, #ffffff);\n color: inherit;\n font-family: var(--eb-mono-font, 'Menlo', 'Consolas', 'Liberation Mono', monospace);\n font-size: 12px;\n line-height: 1.5;\n resize: vertical;\n}\n\n.error-boundary__actions {\n display: flex;\n gap: 10px;\n flex-wrap: wrap;\n}\n\n.error-boundary__button {\n border: 1px solid var(--eb-accent, #2f6fed);\n border-radius: 999px;\n background: var(--eb-accent, #2f6fed);\n color: var(--eb-accent-foreground, #ffffff);\n cursor: pointer;\n padding: 9px 16px;\n font: inherit;\n font-size: 12px;\n font-weight: 700;\n letter-spacing: 0.04em;\n text-transform: uppercase;\n}\n\n.error-boundary__button:hover {\n background: var(--eb-accent-hover, #255dcc);\n}\n\n.error-boundary__button--secondary {\n border-color: var(--eb-border, #d3dae6);\n background: var(--eb-surface, #ffffff);\n color: inherit;\n}\n\n.error-boundary__button--secondary:hover {\n background: var(--eb-surface-hover, #eef2f8);\n}\n\n.error-boundary__button:focus-visible {\n outline: 2px solid var(--eb-focus, #2f6fed);\n outline-offset: 2px;\n}\n\n.error-boundary__manual-copy-help {\n margin: 2px 0 0;\n font-size: 13px;\n color: var(--eb-text-muted, #5f6f84);\n line-height: 1.4;\n}\n";
|
|
6
|
+
//# sourceMappingURL=error-boundary-styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-boundary-styles.d.ts","sourceRoot":"","sources":["../../../src/error-boundary/error-boundary-styles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,mBAAmB,o4FAgI/B,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { ComponentType, FC, ReactNode } from 'react';
|
|
2
|
+
import type { RootOptions } from 'react-dom/client';
|
|
3
|
+
/**
|
|
4
|
+
* Name of the logger the error boundaries log through. They log a caught error only when no
|
|
5
|
+
* `onError` handler is set, or when the handler throws.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare const ERROR_BOUNDARY_LOGGER_NAME = "foundation-react-utils:error-boundary";
|
|
9
|
+
/**
|
|
10
|
+
* Where a boundary sits: around the whole app, or around a single tile.
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export type ErrorBoundaryScope = 'application' | 'tile';
|
|
14
|
+
/**
|
|
15
|
+
* What an error boundary passes to `onError` when it catches an error.
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export type ErrorBoundaryReport = {
|
|
19
|
+
error: Error;
|
|
20
|
+
componentStack: string;
|
|
21
|
+
/** Shown in the fallback UI, so support can match a user's screen to a reported event. */
|
|
22
|
+
referenceId: string;
|
|
23
|
+
scope: ErrorBoundaryScope;
|
|
24
|
+
title: string;
|
|
25
|
+
tileRegistration?: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Callback that receives every error a boundary catches, for example to send it to an
|
|
29
|
+
* error-monitoring service.
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
export type ErrorBoundaryErrorHandler = (report: ErrorBoundaryReport) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Props for {@link AppErrorBoundary}.
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
export type AppErrorBoundaryProps = {
|
|
38
|
+
onError?: ErrorBoundaryErrorHandler;
|
|
39
|
+
children: ReactNode;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Props for {@link TileErrorBoundary}.
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
export type TileErrorBoundaryProps = {
|
|
46
|
+
/** Human-readable tile name shown in the fallback UI. */
|
|
47
|
+
title: string;
|
|
48
|
+
/** The tile's key in the layout. */
|
|
49
|
+
tileRegistration: string;
|
|
50
|
+
onError?: ErrorBoundaryErrorHandler;
|
|
51
|
+
children: ReactNode;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Top-level error boundary. Wrap the whole app in one instance; use {@link TileErrorBoundary}
|
|
55
|
+
* inside it.
|
|
56
|
+
*
|
|
57
|
+
* @remarks
|
|
58
|
+
* Renders a fallback with a reference ID, copyable diagnostics and a Retry button that remounts
|
|
59
|
+
* the children. Each caught error is passed to `onError`. Without one, it's logged through the
|
|
60
|
+
* {@link ERROR_BOUNDARY_LOGGER_NAME} logger instead, which a global log reporter receives. Pair with {@link onCaughtError} on the root so React doesn't log the
|
|
61
|
+
* error a second time.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```tsx
|
|
65
|
+
* createRoot(el, { onCaughtError }).render(
|
|
66
|
+
* <AppErrorBoundary onError={({ error, ...extra }) => Sentry.captureException(error, { extra })}>
|
|
67
|
+
* <App />
|
|
68
|
+
* </AppErrorBoundary>,
|
|
69
|
+
* );
|
|
70
|
+
* ```
|
|
71
|
+
* @public
|
|
72
|
+
*/
|
|
73
|
+
export declare const AppErrorBoundary: FC<AppErrorBoundaryProps>;
|
|
74
|
+
/**
|
|
75
|
+
* Error boundary for a single tile, so a crash replaces only that tile with the fallback UI and
|
|
76
|
+
* the rest of the app keeps running.
|
|
77
|
+
* @public
|
|
78
|
+
*/
|
|
79
|
+
export declare const TileErrorBoundary: FC<TileErrorBoundaryProps>;
|
|
80
|
+
/**
|
|
81
|
+
* Wraps a component in a {@link TileErrorBoundary}.
|
|
82
|
+
*
|
|
83
|
+
* @param WrappedComponent - The tile component.
|
|
84
|
+
* @param title - Human-readable tile name shown in the fallback UI.
|
|
85
|
+
* @param tileRegistration - The tile's key in the layout.
|
|
86
|
+
* @param onError - Optional callback for caught errors.
|
|
87
|
+
* @public
|
|
88
|
+
*/
|
|
89
|
+
export declare const withTileErrorBoundary: <P extends object>(WrappedComponent: ComponentType<P>, title: string, tileRegistration: string, onError?: ErrorBoundaryErrorHandler) => FC<P>;
|
|
90
|
+
/**
|
|
91
|
+
* Root `onCaughtError` for `createRoot`.
|
|
92
|
+
*
|
|
93
|
+
* @remarks
|
|
94
|
+
* By default React 19 logs every error a boundary catches to `console.error`, before the
|
|
95
|
+
* boundary's `componentDidCatch` runs. Console-capturing monitoring tools then report that bare
|
|
96
|
+
* error first, and can drop or duplicate the boundary's own report. {@link AppErrorBoundary} and
|
|
97
|
+
* {@link TileErrorBoundary} report or log errors themselves, so this skips them. Errors caught by
|
|
98
|
+
* any other boundary are still logged to `console.error`.
|
|
99
|
+
*
|
|
100
|
+
* @public
|
|
101
|
+
*/
|
|
102
|
+
export declare const onCaughtError: NonNullable<RootOptions['onCaughtError']>;
|
|
103
|
+
//# sourceMappingURL=error-boundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-boundary.d.ts","sourceRoot":"","sources":["../../../src/error-boundary/error-boundary.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAa,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGpD;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,0CAA0C,CAAC;AAIlF;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG,MAAM,CAAC;AAExD;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,KAAK,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,0FAA0F;IAC1F,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,kBAAkB,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAC;AAE9E;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,CAAC,EAAE,yBAAyB,CAAC;IACpC,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,yBAAyB,CAAC;IACpC,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAsPF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAItD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAcxD,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,MAAM,EACpD,kBAAkB,aAAa,CAAC,CAAC,CAAC,EAClC,OAAO,MAAM,EACb,kBAAkB,MAAM,EACxB,UAAU,yBAAyB,KAClC,EAAE,CAAC,CAAC,CAUN,CAAC;AAOF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,WAAW,CAAC,eAAe,CAAC,CAKnE,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { AppErrorBoundary, ERROR_BOUNDARY_LOGGER_NAME, onCaughtError, TileErrorBoundary, withTileErrorBoundary, } from './error-boundary';
|
|
2
|
+
export type { AppErrorBoundaryProps, ErrorBoundaryErrorHandler, ErrorBoundaryReport, ErrorBoundaryScope, TileErrorBoundaryProps, } from './error-boundary';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/error-boundary/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,0BAA0B,EAC1B,aAAa,EACb,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,qBAAqB,EACrB,yBAAyB,EACzB,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC"}
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
* grid's `gridComponents` property).
|
|
13
13
|
* - `reactFactory` / `reactFactoryWithProvider` — mount React component trees into
|
|
14
14
|
* Genesis Foundation layout regions.
|
|
15
|
+
* - `AppErrorBoundary` / `TileErrorBoundary` / `withTileErrorBoundary` — error boundaries with a
|
|
16
|
+
* fallback UI and an `onError` reporting hook; pair with `onCaughtError` on the React root.
|
|
15
17
|
*
|
|
16
18
|
* Subpath entry points:
|
|
17
19
|
* - `./flexlayout` — `flexlayout-react` at the version this package pins, re-exported with the
|
|
@@ -25,5 +27,6 @@ export { createGridProCellRenderer } from './create-grid-pro-cell-renderer';
|
|
|
25
27
|
export { createGridProCellPortals } from './create-grid-pro-cell-portals';
|
|
26
28
|
export type { GridProCellPortals } from './create-grid-pro-cell-portals';
|
|
27
29
|
export type { GridProCellRendererOptions, GridProCellRendererProps, GridProReactCellRenderer, } from './create-grid-pro-cell-renderer';
|
|
30
|
+
export * from './error-boundary';
|
|
28
31
|
export type { RendererControlProps } from '@genesislcap/foundation-forms';
|
|
29
32
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/dts/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,YAAY,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACzE,YAAY,EACV,0BAA0B,EAC1B,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,iCAAiC,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,YAAY,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fallback UI styles. Colours and fonts read `--eb-*` custom properties, so an app can theme the
|
|
3
|
+
* fallback by setting them on any ancestor.
|
|
4
|
+
*/
|
|
5
|
+
export const errorBoundaryStyles = `
|
|
6
|
+
.error-boundary {
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
gap: 12px;
|
|
11
|
+
align-items: flex-start;
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: 100%;
|
|
14
|
+
padding: 16px;
|
|
15
|
+
background: var(--eb-bg, #f6f8fb);
|
|
16
|
+
color: var(--eb-text, #18212f);
|
|
17
|
+
font-family: var(--eb-font, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.error-boundary__top,
|
|
21
|
+
.error-boundary__title,
|
|
22
|
+
.error-boundary__subtitle,
|
|
23
|
+
.error-boundary__details,
|
|
24
|
+
.error-boundary__actions,
|
|
25
|
+
.error-boundary__manual-copy-help {
|
|
26
|
+
width: 100%;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.error-boundary__top {
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: space-between;
|
|
33
|
+
gap: 10px;
|
|
34
|
+
flex-wrap: wrap;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.error-boundary__status {
|
|
38
|
+
display: inline-flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
border: 1px solid var(--eb-error, #c53d3d);
|
|
41
|
+
border-radius: 999px;
|
|
42
|
+
padding: 5px 10px;
|
|
43
|
+
text-transform: uppercase;
|
|
44
|
+
letter-spacing: 0.13em;
|
|
45
|
+
font-size: 11px;
|
|
46
|
+
font-weight: 700;
|
|
47
|
+
color: var(--eb-error, #c53d3d);
|
|
48
|
+
background: var(--eb-error-bg, #fff4f4);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.error-boundary__reference {
|
|
52
|
+
font-family: var(--eb-mono-font, 'Menlo', 'Consolas', 'Liberation Mono', monospace);
|
|
53
|
+
font-size: 11px;
|
|
54
|
+
letter-spacing: 0.08em;
|
|
55
|
+
color: var(--eb-text-muted, #5f6f84);
|
|
56
|
+
text-transform: uppercase;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.error-boundary__title {
|
|
60
|
+
margin: 0;
|
|
61
|
+
font-size: clamp(22px, 3vw, 30px);
|
|
62
|
+
line-height: 1.15;
|
|
63
|
+
font-weight: 700;
|
|
64
|
+
text-wrap: balance;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.error-boundary__subtitle {
|
|
68
|
+
margin: 0;
|
|
69
|
+
max-width: 80ch;
|
|
70
|
+
line-height: 1.45;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.error-boundary__details {
|
|
74
|
+
box-sizing: border-box;
|
|
75
|
+
min-height: 190px;
|
|
76
|
+
max-height: 360px;
|
|
77
|
+
padding: 12px;
|
|
78
|
+
border: 1px solid var(--eb-border, #d3dae6);
|
|
79
|
+
border-radius: 10px;
|
|
80
|
+
background: var(--eb-surface, #ffffff);
|
|
81
|
+
color: inherit;
|
|
82
|
+
font-family: var(--eb-mono-font, 'Menlo', 'Consolas', 'Liberation Mono', monospace);
|
|
83
|
+
font-size: 12px;
|
|
84
|
+
line-height: 1.5;
|
|
85
|
+
resize: vertical;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.error-boundary__actions {
|
|
89
|
+
display: flex;
|
|
90
|
+
gap: 10px;
|
|
91
|
+
flex-wrap: wrap;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.error-boundary__button {
|
|
95
|
+
border: 1px solid var(--eb-accent, #2f6fed);
|
|
96
|
+
border-radius: 999px;
|
|
97
|
+
background: var(--eb-accent, #2f6fed);
|
|
98
|
+
color: var(--eb-accent-foreground, #ffffff);
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
padding: 9px 16px;
|
|
101
|
+
font: inherit;
|
|
102
|
+
font-size: 12px;
|
|
103
|
+
font-weight: 700;
|
|
104
|
+
letter-spacing: 0.04em;
|
|
105
|
+
text-transform: uppercase;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.error-boundary__button:hover {
|
|
109
|
+
background: var(--eb-accent-hover, #255dcc);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.error-boundary__button--secondary {
|
|
113
|
+
border-color: var(--eb-border, #d3dae6);
|
|
114
|
+
background: var(--eb-surface, #ffffff);
|
|
115
|
+
color: inherit;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.error-boundary__button--secondary:hover {
|
|
119
|
+
background: var(--eb-surface-hover, #eef2f8);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.error-boundary__button:focus-visible {
|
|
123
|
+
outline: 2px solid var(--eb-focus, #2f6fed);
|
|
124
|
+
outline-offset: 2px;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.error-boundary__manual-copy-help {
|
|
128
|
+
margin: 2px 0 0;
|
|
129
|
+
font-size: 13px;
|
|
130
|
+
color: var(--eb-text-muted, #5f6f84);
|
|
131
|
+
line-height: 1.4;
|
|
132
|
+
}
|
|
133
|
+
`;
|