@opentui/react 0.0.0-20251001-d57654da → 0.0.0-20251008-63d6b70d

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/index.js CHANGED
@@ -177,7 +177,7 @@ var useTimeline = (options = {}) => {
177
177
  };
178
178
  // src/reconciler/renderer.ts
179
179
  import { createCliRenderer, engine as engine2 } from "@opentui/core";
180
- import React from "react";
180
+ import React2 from "react";
181
181
 
182
182
  // src/reconciler/reconciler.ts
183
183
  import ReactReconciler from "react-reconciler";
@@ -472,11 +472,40 @@ function _render(element, root) {
472
472
  reconciler.updateContainer(element, container, null, () => {});
473
473
  }
474
474
 
475
+ // src/components/error-boundary.tsx
476
+ import React from "react";
477
+
478
+ // jsx-dev-runtime.js
479
+ import { Fragment, jsxDEV } from "react/jsx-dev-runtime";
480
+
481
+ // src/components/error-boundary.tsx
482
+ class ErrorBoundary extends React.Component {
483
+ constructor(props) {
484
+ super(props);
485
+ this.state = { hasError: false, error: null };
486
+ }
487
+ static getDerivedStateFromError(error) {
488
+ return { hasError: true, error };
489
+ }
490
+ render() {
491
+ if (this.state.hasError && this.state.error) {
492
+ return /* @__PURE__ */ jsxDEV("box", {
493
+ style: { flexDirection: "column", padding: 2 },
494
+ children: /* @__PURE__ */ jsxDEV("text", {
495
+ fg: "red",
496
+ children: this.state.error.stack || this.state.error.message
497
+ }, undefined, false, undefined, this)
498
+ }, undefined, false, undefined, this);
499
+ }
500
+ return this.props.children;
501
+ }
502
+ }
503
+
475
504
  // src/reconciler/renderer.ts
476
505
  async function render(node, rendererConfig = {}) {
477
506
  const renderer = await createCliRenderer(rendererConfig);
478
507
  engine2.attach(renderer);
479
- _render(React.createElement(AppContext.Provider, { value: { keyHandler: renderer.keyInput, renderer } }, node), renderer.root);
508
+ _render(React2.createElement(AppContext.Provider, { value: { keyHandler: renderer.keyInput, renderer } }, React2.createElement(ErrorBoundary, null, node)), renderer.root);
480
509
  }
481
510
  export {
482
511
  useTimeline,
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "main": "index.js",
5
5
  "types": "src/index.d.ts",
6
6
  "type": "module",
7
- "version": "0.0.0-20251001-d57654da",
7
+ "version": "0.0.0-20251008-63d6b70d",
8
8
  "description": "React renderer for building terminal user interfaces using OpenTUI core",
9
9
  "license": "MIT",
10
10
  "repository": {
@@ -35,7 +35,7 @@
35
35
  }
36
36
  },
37
37
  "dependencies": {
38
- "@opentui/core": "0.0.0-20251001-d57654da",
38
+ "@opentui/core": "0.0.0-20251008-63d6b70d",
39
39
  "react-reconciler": "^0.32.0"
40
40
  },
41
41
  "devDependencies": {
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ export declare class ErrorBoundary extends React.Component<{
3
+ children: React.ReactNode;
4
+ }, {
5
+ hasError: boolean;
6
+ error: Error | null;
7
+ }> {
8
+ constructor(props: {
9
+ children: React.ReactNode;
10
+ });
11
+ static getDerivedStateFromError(error: Error): {
12
+ hasError: boolean;
13
+ error: Error;
14
+ };
15
+ render(): any;
16
+ }
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  // src/reconciler/renderer.ts
3
3
  import { createCliRenderer, engine } from "@opentui/core";
4
- import React from "react";
4
+ import React2 from "react";
5
5
 
6
6
  // src/components/app.tsx
7
7
  import { createContext, useContext } from "react";
@@ -390,11 +390,40 @@ function _render(element, root) {
390
390
  reconciler.updateContainer(element, container, null, () => {});
391
391
  }
392
392
 
393
+ // src/components/error-boundary.tsx
394
+ import React from "react";
395
+
396
+ // jsx-dev-runtime.js
397
+ import { Fragment, jsxDEV } from "react/jsx-dev-runtime";
398
+
399
+ // src/components/error-boundary.tsx
400
+ class ErrorBoundary extends React.Component {
401
+ constructor(props) {
402
+ super(props);
403
+ this.state = { hasError: false, error: null };
404
+ }
405
+ static getDerivedStateFromError(error) {
406
+ return { hasError: true, error };
407
+ }
408
+ render() {
409
+ if (this.state.hasError && this.state.error) {
410
+ return /* @__PURE__ */ jsxDEV("box", {
411
+ style: { flexDirection: "column", padding: 2 },
412
+ children: /* @__PURE__ */ jsxDEV("text", {
413
+ fg: "red",
414
+ children: this.state.error.stack || this.state.error.message
415
+ }, undefined, false, undefined, this)
416
+ }, undefined, false, undefined, this);
417
+ }
418
+ return this.props.children;
419
+ }
420
+ }
421
+
393
422
  // src/reconciler/renderer.ts
394
423
  async function render(node, rendererConfig = {}) {
395
424
  const renderer = await createCliRenderer(rendererConfig);
396
425
  engine.attach(renderer);
397
- _render(React.createElement(AppContext.Provider, { value: { keyHandler: renderer.keyInput, renderer } }, node), renderer.root);
426
+ _render(React2.createElement(AppContext.Provider, { value: { keyHandler: renderer.keyInput, renderer } }, React2.createElement(ErrorBoundary, null, node)), renderer.root);
398
427
  }
399
428
  export {
400
429
  render