@opentuah/react 0.1.80 → 0.1.84
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.
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
MarkdownRenderable,
|
|
15
15
|
ScrollBoxRenderable,
|
|
16
16
|
SelectRenderable,
|
|
17
|
+
StatelessTerminalRenderable,
|
|
17
18
|
TabSelectRenderable,
|
|
18
19
|
TextareaRenderable,
|
|
19
20
|
TextRenderable
|
|
@@ -94,6 +95,7 @@ var baseComponents = {
|
|
|
94
95
|
select: SelectRenderable,
|
|
95
96
|
textarea: TextareaRenderable,
|
|
96
97
|
scrollbox: ScrollBoxRenderable,
|
|
98
|
+
"stateless-terminal": StatelessTerminalRenderable,
|
|
97
99
|
"ascii-font": ASCIIFontRenderable,
|
|
98
100
|
"tab-select": TabSelectRenderable,
|
|
99
101
|
"line-number": LineNumberRenderable,
|
|
@@ -163,7 +165,7 @@ import { TextNodeRenderable as TextNodeRenderable2 } from "@opentuah/core";
|
|
|
163
165
|
// package.json
|
|
164
166
|
var package_default = {
|
|
165
167
|
name: "@opentuah/react",
|
|
166
|
-
version: "0.1.
|
|
168
|
+
version: "0.1.84",
|
|
167
169
|
description: "React renderer for building terminal user interfaces using OpenTUI core",
|
|
168
170
|
license: "MIT",
|
|
169
171
|
repository: {
|
|
@@ -252,8 +254,25 @@ import {
|
|
|
252
254
|
SelectRenderable as SelectRenderable2,
|
|
253
255
|
SelectRenderableEvents,
|
|
254
256
|
TabSelectRenderable as TabSelectRenderable2,
|
|
255
|
-
TabSelectRenderableEvents
|
|
257
|
+
TabSelectRenderableEvents,
|
|
258
|
+
TextareaRenderable as TextareaRenderable2
|
|
256
259
|
} from "@opentuah/core";
|
|
260
|
+
var textareaInputListeners = new WeakMap;
|
|
261
|
+
function setTextareaInputListener(instance, listener) {
|
|
262
|
+
const prevListener = textareaInputListeners.get(instance);
|
|
263
|
+
if (prevListener) {
|
|
264
|
+
instance.editBuffer.off("content-changed", prevListener);
|
|
265
|
+
textareaInputListeners.delete(instance);
|
|
266
|
+
}
|
|
267
|
+
if (!listener) {
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
const inputListener = () => {
|
|
271
|
+
listener(instance.plainText);
|
|
272
|
+
};
|
|
273
|
+
textareaInputListeners.set(instance, inputListener);
|
|
274
|
+
instance.editBuffer.on("content-changed", inputListener);
|
|
275
|
+
}
|
|
257
276
|
function initEventListeners(instance, eventName, listener, previousListener) {
|
|
258
277
|
if (previousListener) {
|
|
259
278
|
instance.off(eventName, previousListener);
|
|
@@ -298,6 +317,8 @@ function setProperty(instance, type, propKey, propValue, oldPropValue) {
|
|
|
298
317
|
case "onInput":
|
|
299
318
|
if (instance instanceof InputRenderable2) {
|
|
300
319
|
initEventListeners(instance, InputRenderableEvents.INPUT, propValue, oldPropValue);
|
|
320
|
+
} else if (instance instanceof TextareaRenderable2) {
|
|
321
|
+
setTextareaInputListener(instance, propValue);
|
|
301
322
|
}
|
|
302
323
|
break;
|
|
303
324
|
case "onSubmit":
|
package/index.js
CHANGED
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.84",
|
|
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
|
-
"@opentuah/core": "0.1.
|
|
43
|
+
"@opentuah/core": "0.1.84",
|
|
44
44
|
"react-reconciler": "^0.32.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ASCIIFontRenderable, BoxRenderable, CodeRenderable, DiffRenderable, InputRenderable, LineNumberRenderable, MarkdownRenderable, ScrollBoxRenderable, SelectRenderable, TabSelectRenderable, TextareaRenderable, TextRenderable } from "@opentuah/core";
|
|
1
|
+
import { ASCIIFontRenderable, BoxRenderable, CodeRenderable, DiffRenderable, InputRenderable, LineNumberRenderable, MarkdownRenderable, ScrollBoxRenderable, SelectRenderable, StatelessTerminalRenderable, TabSelectRenderable, TextareaRenderable, TextRenderable } from "@opentuah/core";
|
|
2
2
|
import type { RenderableConstructor } from "../types/components";
|
|
3
3
|
import { BoldSpanRenderable, ItalicSpanRenderable, LineBreakRenderable, LinkRenderable, SpanRenderable, UnderlineSpanRenderable } from "./text";
|
|
4
4
|
export declare const baseComponents: {
|
|
@@ -11,6 +11,7 @@ export declare const baseComponents: {
|
|
|
11
11
|
select: typeof SelectRenderable;
|
|
12
12
|
textarea: typeof TextareaRenderable;
|
|
13
13
|
scrollbox: typeof ScrollBoxRenderable;
|
|
14
|
+
"stateless-terminal": typeof StatelessTerminalRenderable;
|
|
14
15
|
"ascii-font": typeof ASCIIFontRenderable;
|
|
15
16
|
"tab-select": typeof TabSelectRenderable;
|
|
16
17
|
"line-number": typeof LineNumberRenderable;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ASCIIFontOptions, ASCIIFontRenderable, BaseRenderable, BoxOptions, BoxRenderable, CodeOptions, CodeRenderable, DiffRenderable, DiffRenderableOptions, InputRenderable, InputRenderableOptions, LineNumberOptions, LineNumberRenderable, MarkdownOptions, MarkdownRenderable, RenderableOptions, RenderContext, ScrollBoxOptions, ScrollBoxRenderable, SelectOption, SelectRenderable, SelectRenderableOptions, TabSelectOption, TabSelectRenderable, TabSelectRenderableOptions, TextareaOptions, TextareaRenderable, TextNodeOptions, TextNodeRenderable, TextOptions, TextRenderable } from "@opentuah/core";
|
|
1
|
+
import type { ASCIIFontOptions, ASCIIFontRenderable, BaseRenderable, BoxOptions, BoxRenderable, CodeOptions, CodeRenderable, DiffRenderable, DiffRenderableOptions, InputRenderable, InputRenderableOptions, LineNumberOptions, LineNumberRenderable, MarkdownOptions, MarkdownRenderable, RenderableOptions, RenderContext, ScrollBoxOptions, ScrollBoxRenderable, SelectOption, SelectRenderable, SelectRenderableOptions, StatelessTerminalOptions, StatelessTerminalRenderable, TabSelectOption, TabSelectRenderable, TabSelectRenderableOptions, TextareaOptions, TextareaRenderable, TextNodeOptions, TextNodeRenderable, TextOptions, TextRenderable } from "@opentuah/core";
|
|
2
2
|
import type React from "react";
|
|
3
3
|
/** Properties that should not be included in the style prop */
|
|
4
4
|
export type NonStyledProps = "id" | "buffered" | "live" | "enableLayout" | "selectable" | "renderAfter" | "renderBefore" | `on${string}`;
|
|
@@ -46,10 +46,12 @@ export type InputProps = ComponentProps<InputRenderableOptions, InputRenderable>
|
|
|
46
46
|
};
|
|
47
47
|
export type TextareaProps = ComponentProps<TextareaOptions, TextareaRenderable> & {
|
|
48
48
|
focused?: boolean;
|
|
49
|
+
onInput?: (value: string) => void;
|
|
49
50
|
};
|
|
50
51
|
export type CodeProps = ComponentProps<CodeOptions, CodeRenderable>;
|
|
51
52
|
export type MarkdownProps = ComponentProps<MarkdownOptions, MarkdownRenderable>;
|
|
52
53
|
export type DiffProps = ComponentProps<DiffRenderableOptions, DiffRenderable>;
|
|
54
|
+
export type StatelessTerminalProps = ComponentProps<StatelessTerminalOptions, StatelessTerminalRenderable>;
|
|
53
55
|
export type SelectProps = ComponentProps<SelectRenderableOptions, SelectRenderable> & {
|
|
54
56
|
focused?: boolean;
|
|
55
57
|
onChange?: (index: number, option: SelectOption | null) => void;
|