@cascadetui/react 0.1.6 → 0.1.7
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/{chunk-f2fbffqp.js → chunk-c79msnsf.js} +11 -15
- package/index.js +1 -3
- package/package.json +2 -2
- package/src/components/text.d.ts +1 -1
- package/src/reconciler/renderer.d.ts +1 -2
- package/test-utils.js +1 -1
|
@@ -129,6 +129,7 @@ var useAppContext = () => {
|
|
|
129
129
|
// src/reconciler/renderer.ts
|
|
130
130
|
import { CliRenderEvents, engine } from "@cascadetui/core";
|
|
131
131
|
import React2 from "react";
|
|
132
|
+
import { ConcurrentRoot as ConcurrentRoot2 } from "react-reconciler/constants";
|
|
132
133
|
|
|
133
134
|
// src/components/error-boundary.tsx
|
|
134
135
|
import React from "react";
|
|
@@ -154,7 +155,7 @@ class ErrorBoundary extends React.Component {
|
|
|
154
155
|
style: { flexDirection: "column", padding: 2 },
|
|
155
156
|
children: /* @__PURE__ */ jsxDEV("text", {
|
|
156
157
|
fg: "red",
|
|
157
|
-
|
|
158
|
+
content: this.state.error.stack || this.state.error.message
|
|
158
159
|
}, undefined, false, undefined, this)
|
|
159
160
|
}, undefined, false, undefined, this);
|
|
160
161
|
}
|
|
@@ -171,7 +172,7 @@ import { ASCIIFont, TextNodeRenderable as TextNodeRenderable2, instantiate } fro
|
|
|
171
172
|
// package.json
|
|
172
173
|
var package_default = {
|
|
173
174
|
name: "@cascadetui/react",
|
|
174
|
-
version: "0.1.
|
|
175
|
+
version: "0.1.7",
|
|
175
176
|
description: "React renderer for building terminal user interfaces using Cascade core",
|
|
176
177
|
license: "MIT",
|
|
177
178
|
repository: {
|
|
@@ -500,12 +501,9 @@ var hostConfig = {
|
|
|
500
501
|
},
|
|
501
502
|
startSuspendingCommit() {},
|
|
502
503
|
suspendInstance() {},
|
|
503
|
-
waitForCommitToBeReady() {
|
|
504
|
-
return null;
|
|
505
|
-
},
|
|
506
504
|
detachDeletedInstance(instance) {
|
|
507
505
|
if (!instance.parent) {
|
|
508
|
-
instance.
|
|
506
|
+
instance.destroy();
|
|
509
507
|
}
|
|
510
508
|
},
|
|
511
509
|
getPublicInstance(instance) {
|
|
@@ -548,16 +546,10 @@ $ bun add react-devtools-core@7 -d
|
|
|
548
546
|
}
|
|
549
547
|
}
|
|
550
548
|
reconciler.injectIntoDevTools();
|
|
551
|
-
function _render(element, root) {
|
|
552
|
-
const container = reconciler.createContainer(root, ConcurrentRoot, null, false, null, "", console.error, console.error, console.error, console.error, null);
|
|
553
|
-
reconciler.updateContainer(element, container, null, () => {});
|
|
554
|
-
return container;
|
|
555
|
-
}
|
|
556
549
|
|
|
557
550
|
// src/reconciler/renderer.ts
|
|
558
551
|
var _r = reconciler;
|
|
559
552
|
var flushSync = _r.flushSyncFromReconciler ?? _r.flushSync;
|
|
560
|
-
var { createPortal } = reconciler;
|
|
561
553
|
function createRoot(renderer) {
|
|
562
554
|
let container = null;
|
|
563
555
|
const cleanup = () => {
|
|
@@ -571,16 +563,20 @@ function createRoot(renderer) {
|
|
|
571
563
|
return {
|
|
572
564
|
render: (node) => {
|
|
573
565
|
engine.attach(renderer);
|
|
574
|
-
|
|
566
|
+
const element = React2.createElement(AppContext.Provider, { value: { keyHandler: renderer.keyInput, renderer } }, React2.createElement(ErrorBoundary, {
|
|
575
567
|
onCrash: (error, info) => {
|
|
576
568
|
renderer.reportCrash(error, "react-error-boundary", {
|
|
577
569
|
componentStack: info.componentStack
|
|
578
570
|
});
|
|
579
571
|
}
|
|
580
|
-
}, node))
|
|
572
|
+
}, node));
|
|
573
|
+
if (!container) {
|
|
574
|
+
container = reconciler.createContainer(renderer.root, ConcurrentRoot2, null, false, null, "", console.error, console.error, console.error, console.error, null);
|
|
575
|
+
}
|
|
576
|
+
reconciler.updateContainer(element, container, null, () => {});
|
|
581
577
|
},
|
|
582
578
|
unmount: cleanup
|
|
583
579
|
};
|
|
584
580
|
}
|
|
585
581
|
|
|
586
|
-
export { baseComponents, componentCatalogue, extend, getComponentCatalogue, AppContext, useAppContext, flushSync,
|
|
582
|
+
export { baseComponents, componentCatalogue, extend, getComponentCatalogue, AppContext, useAppContext, flushSync, createRoot };
|
package/index.js
CHANGED
|
@@ -3,13 +3,12 @@ import {
|
|
|
3
3
|
AppContext,
|
|
4
4
|
baseComponents,
|
|
5
5
|
componentCatalogue,
|
|
6
|
-
createPortal,
|
|
7
6
|
createRoot,
|
|
8
7
|
extend,
|
|
9
8
|
flushSync,
|
|
10
9
|
getComponentCatalogue,
|
|
11
10
|
useAppContext
|
|
12
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-c79msnsf.js";
|
|
13
12
|
import"./chunk-e11q5a3p.js";
|
|
14
13
|
// src/hooks/use-keyboard.ts
|
|
15
14
|
import { useEffect } from "react";
|
|
@@ -109,7 +108,6 @@ export {
|
|
|
109
108
|
flushSync,
|
|
110
109
|
extend,
|
|
111
110
|
createRoot,
|
|
112
|
-
createPortal,
|
|
113
111
|
createElement,
|
|
114
112
|
componentCatalogue,
|
|
115
113
|
baseComponents,
|
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.
|
|
7
|
+
"version": "0.1.7",
|
|
8
8
|
"description": "React renderer for building terminal user interfaces using Cascade core",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@cascadetui/core": "0.1.
|
|
43
|
+
"@cascadetui/core": "0.1.7",
|
|
44
44
|
"react-reconciler": "^0.32.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
package/src/components/text.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare class LineBreakRenderable extends SpanRenderable {
|
|
|
21
21
|
constructor(_ctx: RenderContext | null, options: TextNodeOptions);
|
|
22
22
|
add(): number;
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
interface LinkOptions extends TextNodeOptions {
|
|
25
25
|
href: string;
|
|
26
26
|
}
|
|
27
27
|
export declare class LinkRenderable extends SpanRenderable {
|
|
@@ -4,7 +4,6 @@ declare const flushSync: {
|
|
|
4
4
|
(): void;
|
|
5
5
|
<R>(fn: () => R): R;
|
|
6
6
|
};
|
|
7
|
-
declare const createPortal: (children: ReactNode, containerInfo: any, implementation: any, key?: string | null) => import("react-reconciler").ReactPortal;
|
|
8
7
|
export type Root = {
|
|
9
8
|
render: (node: ReactNode) => void;
|
|
10
9
|
unmount: () => void;
|
|
@@ -20,4 +19,4 @@ export type Root = {
|
|
|
20
19
|
* ```
|
|
21
20
|
*/
|
|
22
21
|
export declare function createRoot(renderer: CliRenderer): Root;
|
|
23
|
-
export {
|
|
22
|
+
export { flushSync };
|