@opentui/react 0.1.69 → 0.1.71

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
@@ -207,7 +207,7 @@ var useTimeline = (options = {}) => {
207
207
  return timeline;
208
208
  };
209
209
  // src/reconciler/renderer.ts
210
- import { engine as engine2 } from "@opentui/core";
210
+ import { CliRenderEvents, engine as engine2 } from "@opentui/core";
211
211
  import React2 from "react";
212
212
 
213
213
  // src/components/error-boundary.tsx
@@ -248,7 +248,7 @@ import { TextNodeRenderable as TextNodeRenderable2 } from "@opentui/core";
248
248
  // package.json
249
249
  var package_default = {
250
250
  name: "@opentui/react",
251
- version: "0.1.69",
251
+ version: "0.1.71",
252
252
  description: "React renderer for building terminal user interfaces using OpenTUI core",
253
253
  license: "MIT",
254
254
  repository: {
@@ -634,19 +634,20 @@ var flushSync = _r.flushSyncFromReconciler ?? _r.flushSync;
634
634
  var { createPortal } = reconciler;
635
635
  function createRoot(renderer) {
636
636
  let container = null;
637
+ const cleanup = () => {
638
+ if (container) {
639
+ reconciler.updateContainer(null, container, null, () => {});
640
+ reconciler.flushSyncWork();
641
+ container = null;
642
+ }
643
+ };
644
+ renderer.once(CliRenderEvents.DESTROY, cleanup);
637
645
  return {
638
646
  render: (node) => {
639
647
  engine2.attach(renderer);
640
648
  container = _render(React2.createElement(AppContext.Provider, { value: { keyHandler: renderer.keyInput, renderer } }, React2.createElement(ErrorBoundary, null, node)), renderer.root);
641
649
  },
642
- unmount: () => {
643
- if (!container) {
644
- return;
645
- }
646
- reconciler.updateContainer(null, container, null, () => {});
647
- reconciler.flushSyncWork();
648
- container = null;
649
- }
650
+ unmount: cleanup
650
651
  };
651
652
  }
652
653
 
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.1.69",
7
+ "version": "0.1.71",
8
8
  "description": "React renderer for building terminal user interfaces using OpenTUI core",
9
9
  "license": "MIT",
10
10
  "repository": {
@@ -40,7 +40,7 @@
40
40
  }
41
41
  },
42
42
  "dependencies": {
43
- "@opentui/core": "0.1.69",
43
+ "@opentui/core": "0.1.71",
44
44
  "react-reconciler": "^0.32.0"
45
45
  },
46
46
  "devDependencies": {
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-e11q5a3p.js";
6
6
 
7
7
  // src/reconciler/renderer.ts
8
- import { engine } from "@opentui/core";
8
+ import { CliRenderEvents, engine } from "@opentui/core";
9
9
  import React2 from "react";
10
10
 
11
11
  // src/components/app.tsx
@@ -53,7 +53,7 @@ import { TextNodeRenderable as TextNodeRenderable2 } from "@opentui/core";
53
53
  // package.json
54
54
  var package_default = {
55
55
  name: "@opentui/react",
56
- version: "0.1.69",
56
+ version: "0.1.71",
57
57
  description: "React renderer for building terminal user interfaces using OpenTUI core",
58
58
  license: "MIT",
59
59
  repository: {
@@ -545,19 +545,20 @@ var flushSync = _r.flushSyncFromReconciler ?? _r.flushSync;
545
545
  var { createPortal } = reconciler;
546
546
  function createRoot(renderer) {
547
547
  let container = null;
548
+ const cleanup = () => {
549
+ if (container) {
550
+ reconciler.updateContainer(null, container, null, () => {});
551
+ reconciler.flushSyncWork();
552
+ container = null;
553
+ }
554
+ };
555
+ renderer.once(CliRenderEvents.DESTROY, cleanup);
548
556
  return {
549
557
  render: (node) => {
550
558
  engine.attach(renderer);
551
559
  container = _render(React2.createElement(AppContext.Provider, { value: { keyHandler: renderer.keyInput, renderer } }, React2.createElement(ErrorBoundary, null, node)), renderer.root);
552
560
  },
553
- unmount: () => {
554
- if (!container) {
555
- return;
556
- }
557
- reconciler.updateContainer(null, container, null, () => {});
558
- reconciler.flushSyncWork();
559
- container = null;
560
- }
561
+ unmount: cleanup
561
562
  };
562
563
  }
563
564
  export {
@@ -9,7 +9,7 @@ import { createTestRenderer } from "@opentui/core/testing";
9
9
  import { act } from "react";
10
10
 
11
11
  // src/reconciler/renderer.ts
12
- import { engine } from "@opentui/core";
12
+ import { CliRenderEvents, engine } from "@opentui/core";
13
13
  import React2 from "react";
14
14
 
15
15
  // src/components/app.tsx
@@ -57,7 +57,7 @@ import { TextNodeRenderable as TextNodeRenderable2 } from "@opentui/core";
57
57
  // package.json
58
58
  var package_default = {
59
59
  name: "@opentui/react",
60
- version: "0.1.69",
60
+ version: "0.1.71",
61
61
  description: "React renderer for building terminal user interfaces using OpenTUI core",
62
62
  license: "MIT",
63
63
  repository: {
@@ -548,19 +548,20 @@ var _r = reconciler;
548
548
  var flushSync = _r.flushSyncFromReconciler ?? _r.flushSync;
549
549
  function createRoot(renderer) {
550
550
  let container = null;
551
+ const cleanup = () => {
552
+ if (container) {
553
+ reconciler.updateContainer(null, container, null, () => {});
554
+ reconciler.flushSyncWork();
555
+ container = null;
556
+ }
557
+ };
558
+ renderer.once(CliRenderEvents.DESTROY, cleanup);
551
559
  return {
552
560
  render: (node) => {
553
561
  engine.attach(renderer);
554
562
  container = _render(React2.createElement(AppContext.Provider, { value: { keyHandler: renderer.keyInput, renderer } }, React2.createElement(ErrorBoundary, null, node)), renderer.root);
555
563
  },
556
- unmount: () => {
557
- if (!container) {
558
- return;
559
- }
560
- reconciler.updateContainer(null, container, null, () => {});
561
- reconciler.flushSyncWork();
562
- container = null;
563
- }
564
+ unmount: cleanup
564
565
  };
565
566
  }
566
567