@genesislcap/foundation-react-utils 15.46.5 → 15.46.6-alpha-606571609.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 CHANGED
@@ -47,6 +47,57 @@ 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
+ With `setupErrorMonitoring` from `@genesislcap/foundation-utils`, caught errors are reported with
57
+ their reference ID, scope, title, tile registration and component stack, and nothing else is
58
+ needed:
59
+
60
+ ```tsx
61
+ import { AppErrorBoundary, onCaughtError } from '@genesislcap/foundation-react-utils';
62
+
63
+ createRoot(el, { onCaughtError }).render(
64
+ <AppErrorBoundary>
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">
74
+ <TradeBlotter />
75
+ </TileErrorBoundary>;
76
+
77
+ export const TradeBlotterTile = withTileErrorBoundary(TradeBlotter, 'Trade Blotter', 'tradeBlotter');
78
+ ```
79
+
80
+ To handle caught errors yourself, pass `onError`. It receives an `ErrorBoundaryReport` (`error`,
81
+ `componentStack`, `referenceId`, `scope`, `title`, `tileRegistration`). `withTileErrorBoundary`
82
+ takes it as a fourth argument.
83
+
84
+ Pass `onCaughtError` to `createRoot`. By default React 19 logs every error a boundary catches to
85
+ `console.error` before the boundary runs, so a console-capturing monitoring tool reports the bare
86
+ error first and can drop or duplicate the boundary's own report. `onCaughtError` skips that log
87
+ for these boundaries, and still logs errors caught by any other boundary.
88
+
89
+ Without `onError`, a boundary logs each caught error through a foundation logger named
90
+ `ERROR_BOUNDARY_LOGGER_NAME`: the error, then an object with its reference ID, scope, title, tile
91
+ registration and component stack. A global log reporter (`addGlobalLogReporter` from
92
+ `@genesislcap/foundation-logger`) receives it, which is how `setupErrorMonitoring` reports it. With
93
+ `onError` set, the boundary doesn't log the error, so it isn't reported twice. If `onError` throws,
94
+ the boundary logs the original error and the handler's error, so neither is lost.
95
+
96
+ The fallback reads its colours and fonts from `--eb-*` CSS custom properties (`--eb-bg`,
97
+ `--eb-surface`, `--eb-text`, `--eb-text-muted`, `--eb-border`, `--eb-accent`, `--eb-error`,
98
+ `--eb-font`, and others), so set them on an ancestor to theme it. The last 20 reports are also kept
99
+ on `window.__GENESIS_ERROR_BOUNDARY_REPORTS__` for dev tooling such as the Genesis Create preview.
100
+
50
101
  ## License
51
102
 
52
103
  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",
@@ -266,23 +274,109 @@
266
274
  },
267
275
  {
268
276
  "kind": "javascript-module",
269
- "path": "src/flexlayout/index.ts",
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",
270
300
  "declarations": [],
271
301
  "exports": [
272
302
  {
273
303
  "kind": "js",
274
- "name": "*",
304
+ "name": "AppErrorBoundary",
275
305
  "declaration": {
276
- "name": "*",
277
- "package": "flexlayout-react"
306
+ "name": "AppErrorBoundary",
307
+ "module": "./error-boundary"
278
308
  }
279
309
  },
280
310
  {
281
311
  "kind": "js",
282
- "name": "installRapidFlexLayoutReactStyles",
312
+ "name": "ERROR_BOUNDARY_LOGGER_NAME",
283
313
  "declaration": {
284
- "name": "installRapidFlexLayoutReactStyles",
285
- "module": "src/flexlayout/index.ts"
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"
286
380
  }
287
381
  }
288
382
  ]
@@ -531,6 +625,29 @@
531
625
  }
532
626
  }
533
627
  ]
628
+ },
629
+ {
630
+ "kind": "javascript-module",
631
+ "path": "src/flexlayout/index.ts",
632
+ "declarations": [],
633
+ "exports": [
634
+ {
635
+ "kind": "js",
636
+ "name": "*",
637
+ "declaration": {
638
+ "name": "*",
639
+ "package": "flexlayout-react"
640
+ }
641
+ },
642
+ {
643
+ "kind": "js",
644
+ "name": "installRapidFlexLayoutReactStyles",
645
+ "declaration": {
646
+ "name": "installRapidFlexLayoutReactStyles",
647
+ "module": "src/flexlayout/index.ts"
648
+ }
649
+ }
650
+ ]
534
651
  }
535
652
  ]
536
653
  }
@@ -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,105 @@
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, followed by its
5
+ * reference ID, scope, title, tile registration and component stack, only when no `onError`
6
+ * handler is set or when the handler throws. `setupErrorMonitoring` from foundation-utils reports
7
+ * these logs, so apps using it don't need an `onError`.
8
+ * @public
9
+ */
10
+ export declare const ERROR_BOUNDARY_LOGGER_NAME = "foundation-react-utils:error-boundary";
11
+ /**
12
+ * Where a boundary sits: around the whole app, or around a single tile.
13
+ * @public
14
+ */
15
+ export type ErrorBoundaryScope = 'application' | 'tile';
16
+ /**
17
+ * What an error boundary passes to `onError` when it catches an error.
18
+ * @public
19
+ */
20
+ export type ErrorBoundaryReport = {
21
+ error: Error;
22
+ componentStack: string;
23
+ /** Shown in the fallback UI, so support can match a user's screen to a reported event. */
24
+ referenceId: string;
25
+ scope: ErrorBoundaryScope;
26
+ title: string;
27
+ tileRegistration?: string;
28
+ };
29
+ /**
30
+ * Callback that receives every error a boundary catches, for example to send it to an
31
+ * error-monitoring service.
32
+ * @public
33
+ */
34
+ export type ErrorBoundaryErrorHandler = (report: ErrorBoundaryReport) => void;
35
+ /**
36
+ * Props for {@link AppErrorBoundary}.
37
+ * @public
38
+ */
39
+ export type AppErrorBoundaryProps = {
40
+ onError?: ErrorBoundaryErrorHandler;
41
+ children: ReactNode;
42
+ };
43
+ /**
44
+ * Props for {@link TileErrorBoundary}.
45
+ * @public
46
+ */
47
+ export type TileErrorBoundaryProps = {
48
+ /** Human-readable tile name shown in the fallback UI. */
49
+ title: string;
50
+ /** The tile's key in the layout. */
51
+ tileRegistration: string;
52
+ onError?: ErrorBoundaryErrorHandler;
53
+ children: ReactNode;
54
+ };
55
+ /**
56
+ * Top-level error boundary. Wrap the whole app in one instance; use {@link TileErrorBoundary}
57
+ * inside it.
58
+ *
59
+ * @remarks
60
+ * Renders a fallback with a reference ID, copyable diagnostics and a Retry button that remounts
61
+ * the children. Each caught error is passed to `onError`. Without one, it's logged through the
62
+ * {@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
63
+ * error a second time.
64
+ *
65
+ * @example
66
+ * ```tsx
67
+ * createRoot(el, { onCaughtError }).render(
68
+ * <AppErrorBoundary onError={({ error, ...extra }) => Sentry.captureException(error, { extra })}>
69
+ * <App />
70
+ * </AppErrorBoundary>,
71
+ * );
72
+ * ```
73
+ * @public
74
+ */
75
+ export declare const AppErrorBoundary: FC<AppErrorBoundaryProps>;
76
+ /**
77
+ * Error boundary for a single tile, so a crash replaces only that tile with the fallback UI and
78
+ * the rest of the app keeps running.
79
+ * @public
80
+ */
81
+ export declare const TileErrorBoundary: FC<TileErrorBoundaryProps>;
82
+ /**
83
+ * Wraps a component in a {@link TileErrorBoundary}.
84
+ *
85
+ * @param WrappedComponent - The tile component.
86
+ * @param title - Human-readable tile name shown in the fallback UI.
87
+ * @param tileRegistration - The tile's key in the layout.
88
+ * @param onError - Optional callback for caught errors.
89
+ * @public
90
+ */
91
+ export declare const withTileErrorBoundary: <P extends object>(WrappedComponent: ComponentType<P>, title: string, tileRegistration: string, onError?: ErrorBoundaryErrorHandler) => FC<P>;
92
+ /**
93
+ * Root `onCaughtError` for `createRoot`.
94
+ *
95
+ * @remarks
96
+ * By default React 19 logs every error a boundary catches to `console.error`, before the
97
+ * boundary's `componentDidCatch` runs. Console-capturing monitoring tools then report that bare
98
+ * error first, and can drop or duplicate the boundary's own report. {@link AppErrorBoundary} and
99
+ * {@link TileErrorBoundary} report or log errors themselves, so this skips them. Errors caught by
100
+ * any other boundary are still logged to `console.error`.
101
+ *
102
+ * @public
103
+ */
104
+ export declare const onCaughtError: NonNullable<RootOptions['onCaughtError']>;
105
+ //# 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;;;;;;GAMG;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;AAwPF;;;;;;;;;;;;;;;;;;;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"}
@@ -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
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;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,YAAY,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC"}
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
+ `;