@teaui/react 1.1.5
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/.dist/components/TextReact.d.ts +72 -0
- package/.dist/components/TextReact.js +300 -0
- package/.dist/components/TextReact.js.map +1 -0
- package/.dist/components.d.ts +143 -0
- package/.dist/components.js +230 -0
- package/.dist/components.js.map +1 -0
- package/.dist/index.d.ts +2 -0
- package/.dist/index.js +19 -0
- package/.dist/index.js.map +1 -0
- package/.dist/isSame.d.ts +1 -0
- package/.dist/isSame.js +82 -0
- package/.dist/isSame.js.map +1 -0
- package/.dist/reconciler.d.ts +5 -0
- package/.dist/reconciler.js +303 -0
- package/.dist/reconciler.js.map +1 -0
- package/LICENSE +24 -0
- package/README.md +31 -0
- package/package.json +54 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Alignment, Container, FontFamily, Screen, Size, Style, type ViewProps, View, Viewport } from '@teaui/core';
|
|
2
|
+
/**
|
|
3
|
+
* Used in the React reconciler for literal text JSX elements. They don't have any
|
|
4
|
+
* props.
|
|
5
|
+
*/
|
|
6
|
+
export declare class TextLiteral extends View {
|
|
7
|
+
#private;
|
|
8
|
+
constructor(text: string);
|
|
9
|
+
update({ text, ...props }: ViewProps & {
|
|
10
|
+
text?: string;
|
|
11
|
+
}): void;
|
|
12
|
+
styledText(): string;
|
|
13
|
+
get text(): string;
|
|
14
|
+
set text(value: string);
|
|
15
|
+
naturalSize(): Size;
|
|
16
|
+
render(): void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Subsequent TextLiteral nodes are grouped into a TextContainer, which handles the
|
|
20
|
+
* layout of child nodes. It gets its style, font, and alignment from the nearest
|
|
21
|
+
* parent TextProvider.
|
|
22
|
+
*/
|
|
23
|
+
export declare class TextContainer extends Container {
|
|
24
|
+
#private;
|
|
25
|
+
constructor();
|
|
26
|
+
get nodes(): View[];
|
|
27
|
+
add(child: View, at?: number): void;
|
|
28
|
+
removeChild(child: View): void;
|
|
29
|
+
didMount(screen: Screen): void;
|
|
30
|
+
invalidateText(): void;
|
|
31
|
+
naturalSize(available: Size): Size;
|
|
32
|
+
render(viewport: Viewport): void;
|
|
33
|
+
}
|
|
34
|
+
interface TextProviderProps {
|
|
35
|
+
style?: Partial<Style>;
|
|
36
|
+
font?: FontFamily;
|
|
37
|
+
alignment?: Alignment;
|
|
38
|
+
wrap?: boolean;
|
|
39
|
+
}
|
|
40
|
+
type TextProps = Omit<TextProviderProps, 'style'> & {
|
|
41
|
+
style?: Style;
|
|
42
|
+
};
|
|
43
|
+
type ProviderProps = TextProviderProps & ViewProps & Partial<Style>;
|
|
44
|
+
/**
|
|
45
|
+
* Intended to contain a single TextContainer. Provides the styling that is used to
|
|
46
|
+
* create Text views.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* <Text align='left' bold>text</Text>
|
|
50
|
+
*/
|
|
51
|
+
export declare class TextProvider extends Container {
|
|
52
|
+
#private;
|
|
53
|
+
wrap: FontFamily;
|
|
54
|
+
font: FontFamily;
|
|
55
|
+
alignment: Alignment;
|
|
56
|
+
constructor(props?: ProviderProps);
|
|
57
|
+
get style(): Style;
|
|
58
|
+
get parentStyle(): Style;
|
|
59
|
+
get textProps(): TextProps;
|
|
60
|
+
update(props: ProviderProps): void;
|
|
61
|
+
}
|
|
62
|
+
type StyledTextProps = Omit<ProviderProps, 'alignment' | 'wrap' | 'font'>;
|
|
63
|
+
/**
|
|
64
|
+
* Provides inline styles - doesn't support wrap or alignment.
|
|
65
|
+
*
|
|
66
|
+
* Also doesn't support 'font' because that's not encoded as an SGR code - but
|
|
67
|
+
* ideally it would be supported.
|
|
68
|
+
*/
|
|
69
|
+
export declare class TextStyle extends TextProvider {
|
|
70
|
+
constructor(props: StyledTextProps);
|
|
71
|
+
}
|
|
72
|
+
export {};
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextStyle = exports.TextProvider = exports.TextContainer = exports.TextLiteral = void 0;
|
|
4
|
+
const core_1 = require("@teaui/core");
|
|
5
|
+
// yeah I don't care about this namespace I just needed something to attach the JSDoc to
|
|
6
|
+
const DEFAULTS = {
|
|
7
|
+
alignment: 'left',
|
|
8
|
+
wrap: true,
|
|
9
|
+
font: 'default',
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Used in the React reconciler for literal text JSX elements. They don't have any
|
|
13
|
+
* props.
|
|
14
|
+
*/
|
|
15
|
+
class TextLiteral extends core_1.View {
|
|
16
|
+
#text;
|
|
17
|
+
constructor(text) {
|
|
18
|
+
super({});
|
|
19
|
+
this.#text = text;
|
|
20
|
+
(0, core_1.define)(this, 'text', { enumerable: true });
|
|
21
|
+
}
|
|
22
|
+
update({ text, ...props }) {
|
|
23
|
+
super.update(props);
|
|
24
|
+
this.#update({ text });
|
|
25
|
+
}
|
|
26
|
+
#update({ text }) {
|
|
27
|
+
this.#text = text ?? '';
|
|
28
|
+
}
|
|
29
|
+
styledText() {
|
|
30
|
+
let style;
|
|
31
|
+
for (let ancestorView = this.parent; Boolean(ancestorView); ancestorView = ancestorView && ancestorView.parent) {
|
|
32
|
+
if (ancestorView instanceof TextStyle) {
|
|
33
|
+
style = ancestorView.style;
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
if (ancestorView instanceof TextContainer) {
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (style) {
|
|
41
|
+
return style.toSGR(core_1.Style.NONE, this.#text);
|
|
42
|
+
}
|
|
43
|
+
return this.#text;
|
|
44
|
+
}
|
|
45
|
+
get text() {
|
|
46
|
+
return this.#text;
|
|
47
|
+
}
|
|
48
|
+
set text(value) {
|
|
49
|
+
this.#text = String(value);
|
|
50
|
+
this.#invalidateTextContainer();
|
|
51
|
+
this.invalidateSize();
|
|
52
|
+
}
|
|
53
|
+
#invalidateTextContainer() {
|
|
54
|
+
let textContainer;
|
|
55
|
+
for (let ancestorView = this.parent; Boolean(ancestorView); ancestorView = ancestorView && ancestorView.parent) {
|
|
56
|
+
if (ancestorView instanceof TextContainer) {
|
|
57
|
+
textContainer = ancestorView;
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
textContainer?.invalidateText();
|
|
62
|
+
}
|
|
63
|
+
naturalSize() {
|
|
64
|
+
return core_1.Size.zero;
|
|
65
|
+
}
|
|
66
|
+
render() { }
|
|
67
|
+
}
|
|
68
|
+
exports.TextLiteral = TextLiteral;
|
|
69
|
+
/**
|
|
70
|
+
* Subsequent TextLiteral nodes are grouped into a TextContainer, which handles the
|
|
71
|
+
* layout of child nodes. It gets its style, font, and alignment from the nearest
|
|
72
|
+
* parent TextProvider.
|
|
73
|
+
*/
|
|
74
|
+
class TextContainer extends core_1.Container {
|
|
75
|
+
#nodes = [];
|
|
76
|
+
constructor() {
|
|
77
|
+
super({});
|
|
78
|
+
}
|
|
79
|
+
get nodes() {
|
|
80
|
+
return this.#nodes;
|
|
81
|
+
}
|
|
82
|
+
add(child, at) {
|
|
83
|
+
if (child instanceof TextLiteral || child instanceof TextStyle) {
|
|
84
|
+
child.parent = this;
|
|
85
|
+
}
|
|
86
|
+
this.#nodes.splice(at ?? this.#nodes.length, 0, child);
|
|
87
|
+
if (this.screen) {
|
|
88
|
+
this.#invalidateNodes();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
removeChild(child) {
|
|
92
|
+
if (child instanceof TextLiteral) {
|
|
93
|
+
child.parent = undefined;
|
|
94
|
+
}
|
|
95
|
+
const index = this.#nodes.indexOf(child);
|
|
96
|
+
if (~index && index >= 0 && index < this.#nodes.length) {
|
|
97
|
+
this.#nodes.splice(index, 1);
|
|
98
|
+
if (this.screen) {
|
|
99
|
+
this.#invalidateNodes();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
super.removeChild(child);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
didMount(screen) {
|
|
107
|
+
super.didMount(screen);
|
|
108
|
+
this.#invalidateNodes();
|
|
109
|
+
}
|
|
110
|
+
invalidateText() {
|
|
111
|
+
let childIndex = 0;
|
|
112
|
+
for (const nextChild of this.#nodesToChildren()) {
|
|
113
|
+
const childView = this.children.at(childIndex);
|
|
114
|
+
if (nextChild instanceof core_1.View) {
|
|
115
|
+
childIndex += 1;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
if (!(childView instanceof core_1.Text)) {
|
|
119
|
+
this.#invalidateNodes();
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
childView.text = nextChild;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
#invalidateNodes() {
|
|
127
|
+
// ideally, we would not remove/add views that are in children and this.#nodes,
|
|
128
|
+
// but in reality that turns out to be tedious, and it's hardly any trouble to
|
|
129
|
+
// remove and re-add those views.
|
|
130
|
+
super.removeAllChildren();
|
|
131
|
+
for (const child of this.#nodesToChildren()) {
|
|
132
|
+
if (child instanceof core_1.View) {
|
|
133
|
+
super.add(child);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
const textView = this.#createTextNode(child);
|
|
137
|
+
super.add(textView);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
#nodesToChildren() {
|
|
142
|
+
const children = [];
|
|
143
|
+
let textBuffer;
|
|
144
|
+
const STOP = null;
|
|
145
|
+
const flattenedNodes = this.#flatten(this.#nodes);
|
|
146
|
+
for (const node of [...flattenedNodes, STOP]) {
|
|
147
|
+
if (node instanceof TextLiteral) {
|
|
148
|
+
textBuffer ??= '';
|
|
149
|
+
textBuffer += node.styledText();
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
if (textBuffer !== undefined) {
|
|
153
|
+
children.push(textBuffer);
|
|
154
|
+
textBuffer = undefined;
|
|
155
|
+
}
|
|
156
|
+
if (node) {
|
|
157
|
+
children.push(node);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return children;
|
|
162
|
+
}
|
|
163
|
+
naturalSize(available) {
|
|
164
|
+
const size = core_1.Size.zero.mutableCopy();
|
|
165
|
+
const remaining = available.mutableCopy();
|
|
166
|
+
for (const child of this.children) {
|
|
167
|
+
const childSize = child.naturalSize(remaining);
|
|
168
|
+
size.width = Math.max(size.width, childSize.width);
|
|
169
|
+
size.height += childSize.height;
|
|
170
|
+
remaining.height = Math.max(0, remaining.height - childSize.height);
|
|
171
|
+
}
|
|
172
|
+
return size;
|
|
173
|
+
}
|
|
174
|
+
render(viewport) {
|
|
175
|
+
const remaining = viewport.contentSize.mutableCopy();
|
|
176
|
+
let y = 0;
|
|
177
|
+
for (const child of this.children) {
|
|
178
|
+
if (!child.isVisible) {
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
const childSize = child.naturalSize(remaining).mutableCopy();
|
|
182
|
+
childSize.width = viewport.contentSize.width;
|
|
183
|
+
remaining.height -= childSize.height;
|
|
184
|
+
const childViewport = new core_1.Rect([0, y], childSize);
|
|
185
|
+
viewport.clipped(childViewport, inner => child.render(inner));
|
|
186
|
+
y += childSize.height;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
#createTextNode(text) {
|
|
190
|
+
let textProvider;
|
|
191
|
+
for (let ancestorView = this.parent; Boolean(ancestorView); ancestorView = ancestorView && ancestorView.parent) {
|
|
192
|
+
if (ancestorView instanceof TextProvider) {
|
|
193
|
+
textProvider = ancestorView;
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
let textProps = DEFAULTS;
|
|
198
|
+
if (textProvider) {
|
|
199
|
+
textProps = { ...textProps, ...textProvider.textProps };
|
|
200
|
+
}
|
|
201
|
+
return new core_1.Text({
|
|
202
|
+
text,
|
|
203
|
+
...textProps,
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
#flatten(nodes) {
|
|
207
|
+
return nodes.flatMap(node => {
|
|
208
|
+
if (node instanceof TextContainer) {
|
|
209
|
+
return this.#flatten(node.nodes);
|
|
210
|
+
}
|
|
211
|
+
if (node instanceof TextStyle) {
|
|
212
|
+
return this.#flatten(node.children);
|
|
213
|
+
}
|
|
214
|
+
return [node];
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
exports.TextContainer = TextContainer;
|
|
219
|
+
/**
|
|
220
|
+
* Intended to contain a single TextContainer. Provides the styling that is used to
|
|
221
|
+
* create Text views.
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* <Text align='left' bold>text</Text>
|
|
225
|
+
*/
|
|
226
|
+
class TextProvider extends core_1.Container {
|
|
227
|
+
#style = core_1.Style.NONE;
|
|
228
|
+
#font;
|
|
229
|
+
#alignment;
|
|
230
|
+
#wrap;
|
|
231
|
+
constructor(props = {}) {
|
|
232
|
+
super(props);
|
|
233
|
+
this.#update(props);
|
|
234
|
+
}
|
|
235
|
+
get style() {
|
|
236
|
+
return this.parentStyle.merge(this.#style);
|
|
237
|
+
}
|
|
238
|
+
get parentStyle() {
|
|
239
|
+
let parentStyle;
|
|
240
|
+
for (let ancestorView = this.parent; Boolean(ancestorView); ancestorView = ancestorView && ancestorView.parent) {
|
|
241
|
+
if (ancestorView instanceof TextProvider) {
|
|
242
|
+
parentStyle = ancestorView.style;
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return parentStyle ?? core_1.Style.NONE;
|
|
247
|
+
}
|
|
248
|
+
get textProps() {
|
|
249
|
+
let parentProvider;
|
|
250
|
+
for (let ancestorView = this.parent; Boolean(ancestorView); ancestorView = ancestorView && ancestorView.parent) {
|
|
251
|
+
if (ancestorView instanceof TextProvider) {
|
|
252
|
+
parentProvider = ancestorView;
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
let retVal = {};
|
|
257
|
+
if (parentProvider) {
|
|
258
|
+
retVal = { ...parentProvider.textProps };
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
retVal = {};
|
|
262
|
+
}
|
|
263
|
+
retVal.style = this.#style;
|
|
264
|
+
if (this.#alignment !== undefined) {
|
|
265
|
+
retVal.alignment = this.#alignment;
|
|
266
|
+
}
|
|
267
|
+
if (this.#wrap !== undefined) {
|
|
268
|
+
retVal.wrap = this.#wrap;
|
|
269
|
+
}
|
|
270
|
+
if (this.#font !== undefined) {
|
|
271
|
+
retVal.font = this.#font;
|
|
272
|
+
}
|
|
273
|
+
return retVal;
|
|
274
|
+
}
|
|
275
|
+
update(props) {
|
|
276
|
+
this.#update(props);
|
|
277
|
+
super.update(props);
|
|
278
|
+
}
|
|
279
|
+
#update(props) {
|
|
280
|
+
const { style, alignment, wrap, font, ...styleProps } = props;
|
|
281
|
+
this.#style = new core_1.Style(styleProps).merge(style);
|
|
282
|
+
this.#font = font;
|
|
283
|
+
this.#alignment = alignment ?? 'left';
|
|
284
|
+
this.#wrap = wrap ?? false;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
exports.TextProvider = TextProvider;
|
|
288
|
+
/**
|
|
289
|
+
* Provides inline styles - doesn't support wrap or alignment.
|
|
290
|
+
*
|
|
291
|
+
* Also doesn't support 'font' because that's not encoded as an SGR code - but
|
|
292
|
+
* ideally it would be supported.
|
|
293
|
+
*/
|
|
294
|
+
class TextStyle extends TextProvider {
|
|
295
|
+
constructor(props) {
|
|
296
|
+
super(props);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
exports.TextStyle = TextStyle;
|
|
300
|
+
//# sourceMappingURL=TextReact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextReact.js","sourceRoot":"","sources":["../../lib/components/TextReact.ts"],"names":[],"mappings":";;;AAAA,sCAaoB;AA8CpB,wFAAwF;AAExF,MAAM,QAAQ,GAAG;IACf,SAAS,EAAE,MAAM;IACjB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AAI,CAAC,KAAK,CAAA;QAC1B,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC;IAED,MAAM,CAAC,KAAoB;QACzB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QACnB,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACrB,CAAC;IAED,OAAO,CAAC,KAAoB;QAC1B,MAAM,EAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,UAAU,EAAC,GAAG,KAAK,CAAA;QAC3D,IAAI,CAAC,MAAM,GAAG,IAAI,YAAK,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QAChD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,IAAI,CAAC,UAAU,GAAG,SAAS,IAAI,MAAM,CAAA;QACrC,IAAI,CAAC,KAAK,GAAG,IAAI,IAAI,KAAK,CAAA;IAC5B,CAAC;CACF;AArFD,oCAqFC;AAID;;;;;GAKG;AACH,MAAa,SAAU,SAAQ,YAAY;IACzC,YAAY,KAAsB;QAChC,KAAK,CAAC,KAAK,CAAC,CAAA;IACd,CAAC;CACF;AAJD,8BAIC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Accordion as WrAccordion, Box as WrBox, Button as WrButton, Checkbox as WrCheckbox, Collapsible as WrCollapsible, CollapsibleText as WrCollapsibleText, ConsoleLog as WrConsoleLog, Digits as WrDigits, Drawer as WrDrawer, Stack as WrStack, Input as WrInput, Scrollable as WrScrollable, Separator as WrSeparator, Slider as WrSlider, Space as WrSpace, Tabs as WrTabs, ToggleGroup as WrToggleGroup, ViewProps } from '@teaui/core';
|
|
3
|
+
import { TextProvider, TextStyle } from './components/TextReact';
|
|
4
|
+
type Children = 'children' | 'child';
|
|
5
|
+
type TUIView<T extends abstract new (arg: any, ...args: any) => any, OmitProps extends keyof ConstructorParameters<T>[0] = Children> = Omit<NonNullable<ConstructorParameters<T>[0]>, OmitProps>;
|
|
6
|
+
type TUIContainer<T extends abstract new (arg: any, ...args: any) => any, ChildrenProps extends keyof NonNullable<ConstructorParameters<T>[0]> = Children> = TUIView<T, ChildrenProps> & {
|
|
7
|
+
[Key in ChildrenProps]?: React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
type CheckboxProps = TUIView<typeof WrCheckbox>;
|
|
10
|
+
type CollapsibleTextProps = TUIView<typeof WrCollapsibleText>;
|
|
11
|
+
type ConsoleProps = TUIView<typeof WrConsoleLog>;
|
|
12
|
+
type DigitsProps = TUIView<typeof WrDigits>;
|
|
13
|
+
type HeaderProps = {
|
|
14
|
+
text?: string;
|
|
15
|
+
};
|
|
16
|
+
type InputProps = TUIView<typeof WrInput>;
|
|
17
|
+
type SeparatorProps = TUIView<typeof WrSeparator>;
|
|
18
|
+
type SliderProps = TUIView<typeof WrSlider>;
|
|
19
|
+
type SpaceProps = TUIView<typeof WrSpace>;
|
|
20
|
+
type ToggleGroupProps = TUIView<typeof WrToggleGroup>;
|
|
21
|
+
type BoxProps = TUIContainer<typeof WrBox>;
|
|
22
|
+
type ButtonProps = TUIContainer<typeof WrButton>;
|
|
23
|
+
type CollapsibleProps = TUIContainer<typeof WrCollapsible, 'collapsed' | 'expanded' | 'children'>;
|
|
24
|
+
type ScrollableProps = TUIContainer<typeof WrScrollable>;
|
|
25
|
+
type StackProps = TUIContainer<typeof WrStack>;
|
|
26
|
+
type StyleProps = TUIContainer<typeof TextStyle>;
|
|
27
|
+
type TextProps = TUIContainer<typeof TextProvider>;
|
|
28
|
+
type AccordionProps = TUIContainer<typeof WrAccordion>;
|
|
29
|
+
type AccordionSectionProps = TUIContainer<typeof WrAccordion.Section>;
|
|
30
|
+
type DrawerProps = TUIContainer<typeof WrDrawer, 'content' | 'drawer' | 'children'>;
|
|
31
|
+
type TabsProps = TUIContainer<typeof WrTabs>;
|
|
32
|
+
type TabsSectionProps = TUIContainer<typeof WrTabs.Section>;
|
|
33
|
+
declare module 'react' {
|
|
34
|
+
namespace JSX {
|
|
35
|
+
interface IntrinsicElements {
|
|
36
|
+
'tui-br': {};
|
|
37
|
+
'tui-checkbox': CheckboxProps;
|
|
38
|
+
'tui-collapsible-text': CollapsibleTextProps;
|
|
39
|
+
'tui-console': ConsoleProps;
|
|
40
|
+
'tui-digits': DigitsProps;
|
|
41
|
+
'tui-h1': HeaderProps;
|
|
42
|
+
'tui-h2': HeaderProps;
|
|
43
|
+
'tui-h3': HeaderProps;
|
|
44
|
+
'tui-h4': HeaderProps;
|
|
45
|
+
'tui-h5': HeaderProps;
|
|
46
|
+
'tui-h6': HeaderProps;
|
|
47
|
+
'tui-input': InputProps;
|
|
48
|
+
'tui-separator': SeparatorProps;
|
|
49
|
+
'tui-slider': SliderProps;
|
|
50
|
+
'tui-space': SpaceProps;
|
|
51
|
+
'tui-toggle-group': ToggleGroupProps;
|
|
52
|
+
'tui-tree': ViewProps;
|
|
53
|
+
'tui-box': BoxProps;
|
|
54
|
+
'tui-button': ButtonProps;
|
|
55
|
+
'tui-collapsible': CollapsibleProps;
|
|
56
|
+
'tui-scrollable': ScrollableProps;
|
|
57
|
+
'tui-stack': StackProps;
|
|
58
|
+
'tui-style': StyleProps;
|
|
59
|
+
'tui-text': TextProps;
|
|
60
|
+
'tui-accordion': AccordionProps;
|
|
61
|
+
'tui-accordion-section': AccordionSectionProps;
|
|
62
|
+
'tui-drawer': DrawerProps;
|
|
63
|
+
'tui-tabs': TabsProps;
|
|
64
|
+
'tui-tabs-section': TabsSectionProps;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
export declare function Br(): JSX.Element;
|
|
69
|
+
export declare function Checkbox(reactProps: CheckboxProps): JSX.Element;
|
|
70
|
+
export declare function CollapsibleText(reactProps: CollapsibleTextProps): JSX.Element;
|
|
71
|
+
export declare function ConsoleLog(reactProps: ConsoleProps): JSX.Element;
|
|
72
|
+
export declare function Digits(reactProps: DigitsProps): JSX.Element;
|
|
73
|
+
export declare function H1(reactProps: HeaderProps): JSX.Element;
|
|
74
|
+
export declare function H2(reactProps: HeaderProps): JSX.Element;
|
|
75
|
+
export declare function H3(reactProps: HeaderProps): JSX.Element;
|
|
76
|
+
export declare function H4(reactProps: HeaderProps): JSX.Element;
|
|
77
|
+
export declare function H5(reactProps: HeaderProps): JSX.Element;
|
|
78
|
+
export declare function H6(reactProps: HeaderProps): JSX.Element;
|
|
79
|
+
export declare function Input(reactProps: InputProps): JSX.Element;
|
|
80
|
+
interface Separator {
|
|
81
|
+
(reactProps: SeparatorProps): JSX.Element;
|
|
82
|
+
horizontal(reactProps: Omit<SeparatorProps, 'direction'>): JSX.Element;
|
|
83
|
+
vertical(reactProps: Omit<SeparatorProps, 'direction'>): JSX.Element;
|
|
84
|
+
}
|
|
85
|
+
export declare const Separator: Separator;
|
|
86
|
+
interface Slider {
|
|
87
|
+
(reactProps: SliderProps): JSX.Element;
|
|
88
|
+
horizontal(reactProps: Omit<SliderProps, 'direction'>): JSX.Element;
|
|
89
|
+
vertical(reactProps: Omit<SliderProps, 'direction'>): JSX.Element;
|
|
90
|
+
}
|
|
91
|
+
export declare const Slider: Slider;
|
|
92
|
+
export declare function Space(reactProps: SpaceProps): JSX.Element;
|
|
93
|
+
export declare function ToggleGroup(reactProps: ToggleGroupProps): JSX.Element;
|
|
94
|
+
interface TreeProps<T> extends ViewProps {
|
|
95
|
+
data: T[];
|
|
96
|
+
render: (datum: T) => React.ReactNode;
|
|
97
|
+
getChildren?: (datum: T) => T[] | undefined;
|
|
98
|
+
title: React.ReactNode | string;
|
|
99
|
+
}
|
|
100
|
+
export declare function Tree<T>(reactProps: TreeProps<T>): JSX.Element;
|
|
101
|
+
export declare function Box(reactProps: BoxProps): JSX.Element;
|
|
102
|
+
export declare function Button(reactProps: ButtonProps): JSX.Element;
|
|
103
|
+
export declare function Collapsible(reactProps: CollapsibleProps): JSX.Element;
|
|
104
|
+
interface Stack {
|
|
105
|
+
(reactProps: StackProps): JSX.Element;
|
|
106
|
+
down(reactProps: Omit<StackProps, 'direction'>): JSX.Element;
|
|
107
|
+
up(reactProps: Omit<StackProps, 'direction'>): JSX.Element;
|
|
108
|
+
left(reactProps: Omit<StackProps, 'direction'>): JSX.Element;
|
|
109
|
+
right(reactProps: Omit<StackProps, 'direction'>): JSX.Element;
|
|
110
|
+
}
|
|
111
|
+
export declare const Stack: Stack;
|
|
112
|
+
export declare function Scrollable(reactProps: ScrollableProps): JSX.Element;
|
|
113
|
+
/**
|
|
114
|
+
* <Style /> is similar to <Text/> but only allows inline styles (bold, etc).
|
|
115
|
+
* Does not support align or wrap (block styles). Does not support 'font', because
|
|
116
|
+
* font is not encodable via SGR codes (and that's how I'm styling and
|
|
117
|
+
* concatenating the text nodes).
|
|
118
|
+
*/
|
|
119
|
+
export declare function Style(reactProps: StyleProps): JSX.Element;
|
|
120
|
+
/**
|
|
121
|
+
* <Text /> is a container that sets the text properties of child TextLiterals
|
|
122
|
+
* (font, style) and TextContainers (wrap, alignment)
|
|
123
|
+
*/
|
|
124
|
+
export declare function Text(reactProps: TextProps): JSX.Element;
|
|
125
|
+
interface Accordion {
|
|
126
|
+
(reactProps: AccordionProps): JSX.Element;
|
|
127
|
+
Section(reactProps: Omit<AccordionSectionProps, 'direction'>): JSX.Element;
|
|
128
|
+
}
|
|
129
|
+
export declare const Accordion: Accordion;
|
|
130
|
+
interface Drawer {
|
|
131
|
+
(reactProps: DrawerProps): JSX.Element;
|
|
132
|
+
top(reactProps: Omit<DrawerProps, 'location'>): JSX.Element;
|
|
133
|
+
right(reactProps: Omit<DrawerProps, 'location'>): JSX.Element;
|
|
134
|
+
bottom(reactProps: Omit<DrawerProps, 'location'>): JSX.Element;
|
|
135
|
+
left(reactProps: Omit<DrawerProps, 'location'>): JSX.Element;
|
|
136
|
+
}
|
|
137
|
+
export declare const Drawer: Drawer;
|
|
138
|
+
interface Tabs {
|
|
139
|
+
(reactProps: TabsProps): JSX.Element;
|
|
140
|
+
Section(reactProps: Omit<TabsSectionProps, 'direction'>): JSX.Element;
|
|
141
|
+
}
|
|
142
|
+
export declare const Tabs: Tabs;
|
|
143
|
+
export {};
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Tabs = exports.Drawer = exports.Accordion = exports.Stack = exports.Slider = exports.Separator = void 0;
|
|
27
|
+
exports.Br = Br;
|
|
28
|
+
exports.Checkbox = Checkbox;
|
|
29
|
+
exports.CollapsibleText = CollapsibleText;
|
|
30
|
+
exports.ConsoleLog = ConsoleLog;
|
|
31
|
+
exports.Digits = Digits;
|
|
32
|
+
exports.H1 = H1;
|
|
33
|
+
exports.H2 = H2;
|
|
34
|
+
exports.H3 = H3;
|
|
35
|
+
exports.H4 = H4;
|
|
36
|
+
exports.H5 = H5;
|
|
37
|
+
exports.H6 = H6;
|
|
38
|
+
exports.Input = Input;
|
|
39
|
+
exports.Space = Space;
|
|
40
|
+
exports.ToggleGroup = ToggleGroup;
|
|
41
|
+
exports.Tree = Tree;
|
|
42
|
+
exports.Box = Box;
|
|
43
|
+
exports.Button = Button;
|
|
44
|
+
exports.Collapsible = Collapsible;
|
|
45
|
+
exports.Scrollable = Scrollable;
|
|
46
|
+
exports.Style = Style;
|
|
47
|
+
exports.Text = Text;
|
|
48
|
+
const react_1 = __importStar(require("react"));
|
|
49
|
+
////
|
|
50
|
+
/// Views
|
|
51
|
+
//
|
|
52
|
+
function Br() {
|
|
53
|
+
return react_1.default.createElement("tui-br", null);
|
|
54
|
+
}
|
|
55
|
+
function Checkbox(reactProps) {
|
|
56
|
+
return react_1.default.createElement("tui-checkbox", { ...reactProps });
|
|
57
|
+
}
|
|
58
|
+
function CollapsibleText(reactProps) {
|
|
59
|
+
return react_1.default.createElement("tui-collapsible-text", { ...reactProps });
|
|
60
|
+
}
|
|
61
|
+
function ConsoleLog(reactProps) {
|
|
62
|
+
return react_1.default.createElement("tui-console", { ...reactProps });
|
|
63
|
+
}
|
|
64
|
+
function Digits(reactProps) {
|
|
65
|
+
return react_1.default.createElement("tui-digits", { ...reactProps });
|
|
66
|
+
}
|
|
67
|
+
function H1(reactProps) {
|
|
68
|
+
return react_1.default.createElement("tui-h1", { ...reactProps });
|
|
69
|
+
}
|
|
70
|
+
function H2(reactProps) {
|
|
71
|
+
return react_1.default.createElement("tui-h2", { ...reactProps });
|
|
72
|
+
}
|
|
73
|
+
function H3(reactProps) {
|
|
74
|
+
return react_1.default.createElement("tui-h3", { ...reactProps });
|
|
75
|
+
}
|
|
76
|
+
function H4(reactProps) {
|
|
77
|
+
return react_1.default.createElement("tui-h4", { ...reactProps });
|
|
78
|
+
}
|
|
79
|
+
function H5(reactProps) {
|
|
80
|
+
return react_1.default.createElement("tui-h5", { ...reactProps });
|
|
81
|
+
}
|
|
82
|
+
function H6(reactProps) {
|
|
83
|
+
return react_1.default.createElement("tui-h6", { ...reactProps });
|
|
84
|
+
}
|
|
85
|
+
function Input(reactProps) {
|
|
86
|
+
return react_1.default.createElement("tui-input", { ...reactProps });
|
|
87
|
+
}
|
|
88
|
+
const Separator = function Separator(reactProps) {
|
|
89
|
+
return react_1.default.createElement("tui-separator", { ...reactProps });
|
|
90
|
+
};
|
|
91
|
+
exports.Separator = Separator;
|
|
92
|
+
exports.Separator.horizontal = function SeparatorHorizontal(reactProps) {
|
|
93
|
+
return react_1.default.createElement("tui-separator", { direction: "horizontal", ...reactProps });
|
|
94
|
+
};
|
|
95
|
+
exports.Separator.vertical = function SeparatorHorizontal(reactProps) {
|
|
96
|
+
return react_1.default.createElement("tui-separator", { direction: "vertical", ...reactProps });
|
|
97
|
+
};
|
|
98
|
+
const Slider = function Slider(reactProps) {
|
|
99
|
+
return react_1.default.createElement("tui-slider", { ...reactProps });
|
|
100
|
+
};
|
|
101
|
+
exports.Slider = Slider;
|
|
102
|
+
exports.Slider.horizontal = function SliderHorizontal(reactProps) {
|
|
103
|
+
return react_1.default.createElement("tui-slider", { direction: "horizontal", ...reactProps });
|
|
104
|
+
};
|
|
105
|
+
exports.Slider.vertical = function SliderHorizontal(reactProps) {
|
|
106
|
+
return react_1.default.createElement("tui-slider", { direction: "vertical", ...reactProps });
|
|
107
|
+
};
|
|
108
|
+
function Space(reactProps) {
|
|
109
|
+
return react_1.default.createElement("tui-space", { ...reactProps });
|
|
110
|
+
}
|
|
111
|
+
function ToggleGroup(reactProps) {
|
|
112
|
+
return react_1.default.createElement("tui-toggle-group", { ...reactProps });
|
|
113
|
+
}
|
|
114
|
+
function Tree(reactProps) {
|
|
115
|
+
const { title, ...props } = reactProps;
|
|
116
|
+
const titleView = (0, react_1.useMemo)(() => {
|
|
117
|
+
if (typeof title === 'string') {
|
|
118
|
+
return react_1.default.createElement("tui-text", null, title);
|
|
119
|
+
}
|
|
120
|
+
return title;
|
|
121
|
+
}, [title]);
|
|
122
|
+
return react_1.default.createElement("tui-tree", { ...props }, titleView);
|
|
123
|
+
}
|
|
124
|
+
////
|
|
125
|
+
/// "Simple" containers
|
|
126
|
+
//
|
|
127
|
+
function Box(reactProps) {
|
|
128
|
+
const { children, ...props } = reactProps;
|
|
129
|
+
return react_1.default.createElement("tui-box", { ...props }, children);
|
|
130
|
+
}
|
|
131
|
+
function Button(reactProps) {
|
|
132
|
+
const { children, ...props } = reactProps;
|
|
133
|
+
return react_1.default.createElement("tui-button", { ...props }, children);
|
|
134
|
+
}
|
|
135
|
+
function Collapsible(reactProps) {
|
|
136
|
+
const { collapsed, expanded, ...props } = reactProps;
|
|
137
|
+
return (react_1.default.createElement("tui-collapsible", { ...props },
|
|
138
|
+
collapsed,
|
|
139
|
+
expanded));
|
|
140
|
+
}
|
|
141
|
+
const Stack = function Stack(reactProps) {
|
|
142
|
+
const { children, ...props } = reactProps;
|
|
143
|
+
return react_1.default.createElement("tui-stack", { ...props }, children);
|
|
144
|
+
};
|
|
145
|
+
exports.Stack = Stack;
|
|
146
|
+
exports.Stack.down = function StackLeft(reactProps) {
|
|
147
|
+
const { children, ...props } = reactProps;
|
|
148
|
+
return (react_1.default.createElement("tui-stack", { direction: "down", ...props }, children));
|
|
149
|
+
};
|
|
150
|
+
exports.Stack.up = function StackLeft(reactProps) {
|
|
151
|
+
const { children, ...props } = reactProps;
|
|
152
|
+
return (react_1.default.createElement("tui-stack", { direction: "up", ...props }, children));
|
|
153
|
+
};
|
|
154
|
+
exports.Stack.right = function StackLeft(reactProps) {
|
|
155
|
+
const { children, ...props } = reactProps;
|
|
156
|
+
return (react_1.default.createElement("tui-stack", { direction: "right", ...props }, children));
|
|
157
|
+
};
|
|
158
|
+
exports.Stack.left = function StackLeft(reactProps) {
|
|
159
|
+
const { children, ...props } = reactProps;
|
|
160
|
+
return (react_1.default.createElement("tui-stack", { direction: "left", ...props }, children));
|
|
161
|
+
};
|
|
162
|
+
function Scrollable(reactProps) {
|
|
163
|
+
const { children, ...props } = reactProps;
|
|
164
|
+
return react_1.default.createElement("tui-scrollable", { ...props }, children);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* <Style /> is similar to <Text/> but only allows inline styles (bold, etc).
|
|
168
|
+
* Does not support align or wrap (block styles). Does not support 'font', because
|
|
169
|
+
* font is not encodable via SGR codes (and that's how I'm styling and
|
|
170
|
+
* concatenating the text nodes).
|
|
171
|
+
*/
|
|
172
|
+
function Style(reactProps) {
|
|
173
|
+
return react_1.default.createElement("tui-style", { ...reactProps });
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* <Text /> is a container that sets the text properties of child TextLiterals
|
|
177
|
+
* (font, style) and TextContainers (wrap, alignment)
|
|
178
|
+
*/
|
|
179
|
+
function Text(reactProps) {
|
|
180
|
+
return react_1.default.createElement("tui-text", { ...reactProps });
|
|
181
|
+
}
|
|
182
|
+
const Accordion = function Accordion(reactProps) {
|
|
183
|
+
const { children, ...props } = reactProps;
|
|
184
|
+
return react_1.default.createElement("tui-accordion", { ...props }, children);
|
|
185
|
+
};
|
|
186
|
+
exports.Accordion = Accordion;
|
|
187
|
+
exports.Accordion.Section = function SliderHorizontal(reactProps) {
|
|
188
|
+
const { children, ...props } = reactProps;
|
|
189
|
+
return react_1.default.createElement("tui-accordion-section", { ...props }, children);
|
|
190
|
+
};
|
|
191
|
+
const Drawer = function Drawer(reactProps) {
|
|
192
|
+
const { children, content, drawer, ...props } = reactProps;
|
|
193
|
+
return (react_1.default.createElement("tui-drawer", { ...props },
|
|
194
|
+
content,
|
|
195
|
+
drawer,
|
|
196
|
+
children));
|
|
197
|
+
};
|
|
198
|
+
exports.Drawer = Drawer;
|
|
199
|
+
exports.Drawer.top = function DrawerLeft(reactProps) {
|
|
200
|
+
const { children, content, drawer, ...props } = reactProps;
|
|
201
|
+
return (react_1.default.createElement("tui-drawer", { location: "top", ...props },
|
|
202
|
+
content,
|
|
203
|
+
drawer,
|
|
204
|
+
children));
|
|
205
|
+
};
|
|
206
|
+
exports.Drawer.right = function DrawerLeft(reactProps) {
|
|
207
|
+
const { children, content, drawer, ...props } = reactProps;
|
|
208
|
+
return (react_1.default.createElement("tui-drawer", { location: "right", ...props },
|
|
209
|
+
content,
|
|
210
|
+
drawer,
|
|
211
|
+
children));
|
|
212
|
+
};
|
|
213
|
+
exports.Drawer.bottom = function DrawerLeft(reactProps) {
|
|
214
|
+
const { children, ...props } = reactProps;
|
|
215
|
+
return (react_1.default.createElement("tui-drawer", { location: "bottom", ...props }, children));
|
|
216
|
+
};
|
|
217
|
+
exports.Drawer.left = function DrawerLeft(reactProps) {
|
|
218
|
+
const { children, ...props } = reactProps;
|
|
219
|
+
return (react_1.default.createElement("tui-drawer", { location: "left", ...props }, children));
|
|
220
|
+
};
|
|
221
|
+
const Tabs = function Tabs(reactProps) {
|
|
222
|
+
const { children, ...props } = reactProps;
|
|
223
|
+
return react_1.default.createElement("tui-tabs", { ...props }, children);
|
|
224
|
+
};
|
|
225
|
+
exports.Tabs = Tabs;
|
|
226
|
+
exports.Tabs.Section = function SliderHorizontal(reactProps) {
|
|
227
|
+
const { children, ...props } = reactProps;
|
|
228
|
+
return react_1.default.createElement("tui-tabs-section", { ...props }, children);
|
|
229
|
+
};
|
|
230
|
+
//# sourceMappingURL=components.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../lib/components.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0HA,gBAEC;AACD,4BAEC;AACD,0CAEC;AACD,gCAEC;AACD,wBAEC;AACD,gBAEC;AACD,gBAEC;AACD,gBAEC;AACD,gBAEC;AACD,gBAEC;AACD,gBAEC;AACD,sBAEC;AA4CD,sBAEC;AACD,kCAEC;AAQD,oBASC;AAMD,kBAGC;AACD,wBAGC;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C3D,MAAM,EAAC,QAAQ,EAAE,GAAG,KAAK,EAAC,GAAG,UAAU,CAAA;IACvC,OAAO,+CAAc,KAAK,IAAG,QAAQ,CAAY,CAAA;AACnD,CAAC,CAAA;AAHY,QAAA,IAAI,QAGhB;AACD,YAAI,CAAC,OAAO,GAAG,SAAS,gBAAgB,CACtC,UAA+C;IAE/C,MAAM,EAAC,QAAQ,EAAE,GAAG,KAAK,EAAC,GAAG,UAAU,CAAA;IACvC,OAAO,uDAAsB,KAAK,IAAG,QAAQ,CAAoB,CAAA;AACnE,CAAC,CAAA"}
|
package/.dist/index.d.ts
ADDED
package/.dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./reconciler"), exports);
|
|
18
|
+
__exportStar(require("./components"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,+CAA4B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isSame(lhs: any, rhs: any, depth?: number): boolean;
|
package/.dist/isSame.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSame = isSame;
|
|
4
|
+
function isSame(lhs, rhs, depth = 0) {
|
|
5
|
+
if (depth >= 100) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
if (typeof lhs !== typeof rhs) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
if (typeof lhs === 'symbol' ||
|
|
12
|
+
typeof lhs === 'string' ||
|
|
13
|
+
typeof lhs === 'undefined' ||
|
|
14
|
+
typeof lhs === 'boolean' ||
|
|
15
|
+
typeof lhs === 'function' ||
|
|
16
|
+
typeof lhs === 'number') {
|
|
17
|
+
return lhs === rhs;
|
|
18
|
+
}
|
|
19
|
+
if (lhs === null || rhs === null) {
|
|
20
|
+
return lhs === rhs;
|
|
21
|
+
}
|
|
22
|
+
if (lhs.constructor !== rhs.constructor) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
if (Array.isArray(lhs)) {
|
|
26
|
+
return (lhs.length === rhs.length &&
|
|
27
|
+
lhs.every((value, index) => isSame(value, rhs[index], depth + 1)));
|
|
28
|
+
}
|
|
29
|
+
if (lhs instanceof Set) {
|
|
30
|
+
if (lhs.size !== rhs.size) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
for (const value of lhs) {
|
|
34
|
+
if (!rhs.has(value)) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
if (lhs instanceof Map) {
|
|
41
|
+
if (lhs.size !== rhs.size) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
for (const [key, value] of lhs) {
|
|
45
|
+
if (!rhs.has(key) || !isSame(value, rhs.get(key), depth + 1)) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
if (lhs instanceof Date) {
|
|
52
|
+
return lhs.getTime() === rhs.getTime();
|
|
53
|
+
}
|
|
54
|
+
// ok, better be an object
|
|
55
|
+
// and if it's a FiberNode, skip the _owner, it's too huge
|
|
56
|
+
if ('$$typeof' in lhs || '$$typeof in rhs') {
|
|
57
|
+
const { _owner: _lhsOwner, lhsTrim } = lhs;
|
|
58
|
+
const { _owner: _rhsOwner, rhsTrim } = rhs;
|
|
59
|
+
return isSame(lhsTrim, rhsTrim, depth + 1);
|
|
60
|
+
}
|
|
61
|
+
for (const prop in lhs) {
|
|
62
|
+
if (!Object.hasOwn(lhs, prop)) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
// if rhs doesn't have the prop, or the values aren't the same
|
|
66
|
+
if (!Object.hasOwn(rhs, prop) || !isSame(lhs[prop], rhs[prop], depth + 1)) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
for (const prop in rhs) {
|
|
71
|
+
if (!Object.hasOwn(rhs, prop)) {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
// only need to check if lhs doesn't have the prop
|
|
75
|
+
if (!Object.hasOwn(lhs, prop)) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=isSame.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isSame.js","sourceRoot":"","sources":["../lib/isSame.ts"],"names":[],"mappings":";;AAAA,wBAoGC;AApGD,SAAgB,MAAM,CAAC,GAAQ,EAAE,GAAQ,EAAE,KAAK,GAAG,CAAC;IAClD,IAAI,KAAK,IAAI,GAAG,EAAE,CAAC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AC,CAAC,EAAE,CAAC;YAC1E,OAAO,KAAK,CAAA;QACd,CAAC;IACH,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC;YAC9B,SAAQ;QACV,CAAC;QAED,kDAAkD;QAClD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC;YAC9B,OAAO,KAAK,CAAA;QACd,CAAC;QAED,OAAO,KAAK,CAAA;IACd,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import { Screen, Window } from '@teaui/core';
|
|
4
|
+
export declare function render(screen: Screen, window: Window, rootNode: ReactNode): void;
|
|
5
|
+
export declare function run(component: ReactNode): Promise<[Screen, Window, React.ReactNode]>;
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.render = render;
|
|
7
|
+
exports.run = run;
|
|
8
|
+
const react_reconciler_1 = __importDefault(require("react-reconciler"));
|
|
9
|
+
const core_1 = require("@teaui/core");
|
|
10
|
+
const TextReact_1 = require("./components/TextReact");
|
|
11
|
+
const isSame_1 = require("./isSame");
|
|
12
|
+
function createInstance(type, props) {
|
|
13
|
+
switch (type) {
|
|
14
|
+
// views
|
|
15
|
+
case 'br':
|
|
16
|
+
case 'tui-br':
|
|
17
|
+
return new TextReact_1.TextLiteral('\n');
|
|
18
|
+
case 'checkbox':
|
|
19
|
+
case 'tui-checkbox':
|
|
20
|
+
return new core_1.Checkbox(props);
|
|
21
|
+
case 'collapsible-text':
|
|
22
|
+
case 'tui-collapsible-text':
|
|
23
|
+
return new core_1.CollapsibleText(props);
|
|
24
|
+
case 'console':
|
|
25
|
+
case 'tui-console':
|
|
26
|
+
return new core_1.ConsoleLog(props);
|
|
27
|
+
case 'digits':
|
|
28
|
+
case 'tui-digits':
|
|
29
|
+
return new core_1.Digits(props);
|
|
30
|
+
case 'h1':
|
|
31
|
+
case 'tui-h1':
|
|
32
|
+
return (0, core_1.H1)(props.text ?? '');
|
|
33
|
+
case 'h2':
|
|
34
|
+
case 'tui-h2':
|
|
35
|
+
return (0, core_1.H2)(props.text ?? '');
|
|
36
|
+
case 'h3':
|
|
37
|
+
case 'tui-h3':
|
|
38
|
+
return (0, core_1.H3)(props.text ?? '');
|
|
39
|
+
case 'h4':
|
|
40
|
+
case 'tui-h4':
|
|
41
|
+
return (0, core_1.H4)(props.text ?? '');
|
|
42
|
+
case 'h5':
|
|
43
|
+
case 'tui-h5':
|
|
44
|
+
return (0, core_1.H5)(props.text ?? '');
|
|
45
|
+
case 'h6':
|
|
46
|
+
case 'tui-h6':
|
|
47
|
+
return (0, core_1.H6)(props.text ?? '');
|
|
48
|
+
case 'input':
|
|
49
|
+
case 'tui-input':
|
|
50
|
+
return new core_1.Input(props);
|
|
51
|
+
case 'separator':
|
|
52
|
+
case 'tui-separator':
|
|
53
|
+
return new core_1.Separator(props);
|
|
54
|
+
case 'slider':
|
|
55
|
+
case 'tui-slider':
|
|
56
|
+
return new core_1.Slider(props);
|
|
57
|
+
case 'space':
|
|
58
|
+
case 'tui-space':
|
|
59
|
+
return new core_1.Space(props);
|
|
60
|
+
case 'toggle-group':
|
|
61
|
+
case 'tui-toggle-group':
|
|
62
|
+
return new core_1.ToggleGroup(props);
|
|
63
|
+
// "simple" containers
|
|
64
|
+
case 'box':
|
|
65
|
+
case 'tui-box':
|
|
66
|
+
return new core_1.Box(props);
|
|
67
|
+
case 'button':
|
|
68
|
+
case 'tui-button':
|
|
69
|
+
return new core_1.Button(props);
|
|
70
|
+
case 'collapsible':
|
|
71
|
+
case 'tui-collapsible':
|
|
72
|
+
return new core_1.Collapsible(props);
|
|
73
|
+
case 'stack':
|
|
74
|
+
case 'tui-stack':
|
|
75
|
+
return new core_1.Stack(props);
|
|
76
|
+
case 'scrollable':
|
|
77
|
+
case 'tui-scrollable':
|
|
78
|
+
return new core_1.Scrollable(props);
|
|
79
|
+
case 'style':
|
|
80
|
+
case 'tui-style':
|
|
81
|
+
return new TextReact_1.TextStyle(props);
|
|
82
|
+
case 'tui-text':
|
|
83
|
+
return new TextReact_1.TextProvider(props);
|
|
84
|
+
// "complex" containers
|
|
85
|
+
case 'accordion':
|
|
86
|
+
case 'tui-accordion':
|
|
87
|
+
return new core_1.Accordion(props);
|
|
88
|
+
case 'accordion-section':
|
|
89
|
+
case 'tui-accordion-section':
|
|
90
|
+
return new core_1.Accordion.Section(props);
|
|
91
|
+
case 'drawer':
|
|
92
|
+
case 'tui-drawer':
|
|
93
|
+
return new core_1.Drawer(props);
|
|
94
|
+
case 'tabs':
|
|
95
|
+
case 'tui-tabs':
|
|
96
|
+
return new core_1.Tabs(props);
|
|
97
|
+
case 'tabs-section':
|
|
98
|
+
case 'tui-tabs-section':
|
|
99
|
+
return new core_1.Tabs.Section(props);
|
|
100
|
+
default:
|
|
101
|
+
throw new Error(`unknown component "${type}"`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function render(screen, window, rootNode) {
|
|
105
|
+
function rerender() {
|
|
106
|
+
screen.render();
|
|
107
|
+
}
|
|
108
|
+
function removeFromTextContainer(container, child) {
|
|
109
|
+
// find TextContainer with child in it, and remove
|
|
110
|
+
for (const node of container.children) {
|
|
111
|
+
if (node instanceof TextReact_1.TextContainer && node.children.includes(child)) {
|
|
112
|
+
node.removeChild(child);
|
|
113
|
+
if (node.children.length === 0) {
|
|
114
|
+
container.removeChild(node);
|
|
115
|
+
}
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function removeChild(container, child) {
|
|
121
|
+
if (child.parent === container) {
|
|
122
|
+
container.removeChild(child);
|
|
123
|
+
}
|
|
124
|
+
else if (child instanceof TextReact_1.TextLiteral || child instanceof TextReact_1.TextStyle) {
|
|
125
|
+
removeFromTextContainer(container, child);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function appendChild(parentInstance, child, before) {
|
|
129
|
+
if (parentInstance instanceof TextReact_1.TextStyle &&
|
|
130
|
+
(child instanceof TextReact_1.TextLiteral || child instanceof TextReact_1.TextStyle)) {
|
|
131
|
+
// do not do the TextContainer song and dance
|
|
132
|
+
}
|
|
133
|
+
else if (child instanceof TextReact_1.TextLiteral || child instanceof TextReact_1.TextStyle) {
|
|
134
|
+
// find the last child (checking 'before')
|
|
135
|
+
let lastChild = parentInstance.children.at(-1);
|
|
136
|
+
if (before) {
|
|
137
|
+
const index = parentInstance.children.indexOf(before);
|
|
138
|
+
if (~index) {
|
|
139
|
+
lastChild = parentInstance.children.at(index - 1);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
let textContainer;
|
|
143
|
+
if (lastChild instanceof TextReact_1.TextContainer) {
|
|
144
|
+
textContainer = lastChild;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
textContainer = new TextReact_1.TextContainer();
|
|
148
|
+
parentInstance.add(textContainer);
|
|
149
|
+
}
|
|
150
|
+
textContainer.add(child);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
let index = before
|
|
154
|
+
? parentInstance.children.indexOf(before)
|
|
155
|
+
: -1;
|
|
156
|
+
if (index === -1) {
|
|
157
|
+
index = undefined;
|
|
158
|
+
}
|
|
159
|
+
parentInstance.add(child, index);
|
|
160
|
+
}
|
|
161
|
+
const reconciler = (0, react_reconciler_1.default)({
|
|
162
|
+
supportsMutation: true,
|
|
163
|
+
supportsPersistence: false,
|
|
164
|
+
supportsHydration: false,
|
|
165
|
+
noTimeout: undefined,
|
|
166
|
+
isPrimaryRenderer: true,
|
|
167
|
+
getRootHostContext(rootWindow) {
|
|
168
|
+
return { screen, window: rootWindow };
|
|
169
|
+
},
|
|
170
|
+
getChildHostContext(_parentHostContext, type, _rootWindow) {
|
|
171
|
+
return { type };
|
|
172
|
+
},
|
|
173
|
+
clearContainer(rootWindow) {
|
|
174
|
+
rootWindow.removeAllChildren();
|
|
175
|
+
},
|
|
176
|
+
createInstance(type, props, _rootWindow, _hostContext, _internalInstanceHandle) {
|
|
177
|
+
if ('children' in props) {
|
|
178
|
+
const { children, ...remainder } = props;
|
|
179
|
+
props = remainder;
|
|
180
|
+
}
|
|
181
|
+
if ('child' in props) {
|
|
182
|
+
const { child, ...remainder } = props;
|
|
183
|
+
props = remainder;
|
|
184
|
+
}
|
|
185
|
+
return createInstance(type, props);
|
|
186
|
+
},
|
|
187
|
+
createTextInstance(text) {
|
|
188
|
+
return new TextReact_1.TextLiteral(text);
|
|
189
|
+
},
|
|
190
|
+
appendInitialChild(parentInstance, child) {
|
|
191
|
+
appendChild(parentInstance, child, undefined);
|
|
192
|
+
},
|
|
193
|
+
appendChild(parentInstance, child) {
|
|
194
|
+
appendChild(parentInstance, child, undefined);
|
|
195
|
+
},
|
|
196
|
+
insertBefore(parentInstance, child, beforeChild) {
|
|
197
|
+
appendChild(parentInstance, child, beforeChild);
|
|
198
|
+
},
|
|
199
|
+
appendChildToContainer(rootWindow, child) {
|
|
200
|
+
appendChild(rootWindow, child);
|
|
201
|
+
},
|
|
202
|
+
insertInContainerBefore(rootWindow, child, beforeChild) {
|
|
203
|
+
appendChild(rootWindow, child, beforeChild);
|
|
204
|
+
},
|
|
205
|
+
removeChild(container, child) {
|
|
206
|
+
removeChild(container, child);
|
|
207
|
+
},
|
|
208
|
+
removeChildFromContainer(container, child) {
|
|
209
|
+
removeChild(container, child);
|
|
210
|
+
},
|
|
211
|
+
detachDeletedInstance(node) { },
|
|
212
|
+
finalizeInitialChildren(instance) {
|
|
213
|
+
return false;
|
|
214
|
+
},
|
|
215
|
+
prepareForCommit() {
|
|
216
|
+
return null;
|
|
217
|
+
},
|
|
218
|
+
resetAfterCommit() {
|
|
219
|
+
rerender();
|
|
220
|
+
},
|
|
221
|
+
commitMount(_instance, _type, _newProps, _internalInstanceHandle) {
|
|
222
|
+
// not needed as long as finalizeInitialChildren returns `false`
|
|
223
|
+
},
|
|
224
|
+
commitTextUpdate(textInstance, _oldText, newText) {
|
|
225
|
+
textInstance.text = newText;
|
|
226
|
+
},
|
|
227
|
+
resetTextContent(instance) {
|
|
228
|
+
instance.text = '';
|
|
229
|
+
},
|
|
230
|
+
shouldSetTextContent(type, _props) {
|
|
231
|
+
return false;
|
|
232
|
+
},
|
|
233
|
+
prepareUpdate(_instance, _type, oldProps, newProps, _rootContainer, _hostContext) {
|
|
234
|
+
for (const prop in oldProps) {
|
|
235
|
+
if (!Object.hasOwn(oldProps, prop)) {
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
if (!(0, isSame_1.isSame)(oldProps[prop], newProps[prop])) {
|
|
239
|
+
// difference found - we just return a non-null here to indicate "difference"
|
|
240
|
+
return [];
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
for (const prop in newProps) {
|
|
244
|
+
// if we already checked it, or it isn't an own-prop on newProps, continue
|
|
245
|
+
if (Object.hasOwn(oldProps, prop) || !Object.hasOwn(newProps, prop)) {
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
if (!(0, isSame_1.isSame)(oldProps[prop], newProps[prop])) {
|
|
249
|
+
// difference found - we just return a non-null here to indicate "difference"
|
|
250
|
+
return [];
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return null;
|
|
254
|
+
},
|
|
255
|
+
commitUpdate(node, _updatePayload, _type, _oldProps, newProps, _internalInstanceHandle) {
|
|
256
|
+
const { children, ...updates } = newProps;
|
|
257
|
+
// if (children !== undefined && node instanceof TextLiteral) {
|
|
258
|
+
// updates.text = childrenToText(children)
|
|
259
|
+
// }
|
|
260
|
+
node.update(updates);
|
|
261
|
+
},
|
|
262
|
+
getPublicInstance(_instance) {
|
|
263
|
+
throw new Error('Function not implemented.');
|
|
264
|
+
},
|
|
265
|
+
preparePortalMount(_containerInfo) {
|
|
266
|
+
throw new Error('Function not implemented.');
|
|
267
|
+
},
|
|
268
|
+
scheduleTimeout(_fn, _delay) {
|
|
269
|
+
throw new Error('Function not implemented.');
|
|
270
|
+
},
|
|
271
|
+
cancelTimeout(_id) {
|
|
272
|
+
throw new Error('Function not implemented.');
|
|
273
|
+
},
|
|
274
|
+
getCurrentEventPriority() {
|
|
275
|
+
throw new Error('Function not implemented.');
|
|
276
|
+
},
|
|
277
|
+
getInstanceFromNode() {
|
|
278
|
+
throw new Error('Function not implemented.');
|
|
279
|
+
},
|
|
280
|
+
beforeActiveInstanceBlur() {
|
|
281
|
+
throw new Error('Function not implemented.');
|
|
282
|
+
},
|
|
283
|
+
afterActiveInstanceBlur() {
|
|
284
|
+
throw new Error('Function not implemented.');
|
|
285
|
+
},
|
|
286
|
+
prepareScopeUpdate() {
|
|
287
|
+
throw new Error('Function not implemented.');
|
|
288
|
+
},
|
|
289
|
+
getInstanceFromScope() {
|
|
290
|
+
throw new Error('Function not implemented.');
|
|
291
|
+
},
|
|
292
|
+
});
|
|
293
|
+
const fiber = reconciler.createContainer(window, 0, null, false, null, '', () => { }, null);
|
|
294
|
+
reconciler.updateContainer(rootNode, fiber, null /* parentComponent */, null /* callback */);
|
|
295
|
+
}
|
|
296
|
+
async function run(component) {
|
|
297
|
+
const window = new core_1.Window();
|
|
298
|
+
const start = await core_1.Screen.start(window);
|
|
299
|
+
const [screen, _] = start;
|
|
300
|
+
render(screen, window, component);
|
|
301
|
+
return [screen, window, component];
|
|
302
|
+
}
|
|
303
|
+
//# sourceMappingURL=reconciler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reconciler.js","sourceRoot":"","sources":["../lib/reconciler.ts"],"names":[],"m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AE,MAAM,EAAE,SAAS,CAAC,CAAA;IAEjC,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAA;AACpC,CAAC"}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
TeaUI + React
|
|
2
|
+
Copyright (c) 2023, Colin T.A. Gray
|
|
3
|
+
https://github.com/colinta/
|
|
4
|
+
|
|
5
|
+
With code from Blessed
|
|
6
|
+
https://npmjs.com/packages/blessed
|
|
7
|
+
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
in the Software without restriction, including without limitation the rights
|
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
furnished to do so, subject to the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be included in
|
|
16
|
+
all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
24
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# TeaUI + React
|
|
2
|
+
|
|
3
|
+
See [TeaUI](https://github.com/colinta/teaui) for more info about
|
|
4
|
+
TeaUI itself. This library adds a React renderer/reconciler.
|
|
5
|
+
|
|
6
|
+
```tsx
|
|
7
|
+
import {useReducer} from 'react'
|
|
8
|
+
import {interceptConsoleLog} from '@teaui/core'
|
|
9
|
+
import {
|
|
10
|
+
Box,
|
|
11
|
+
Button,
|
|
12
|
+
Stack,
|
|
13
|
+
run,
|
|
14
|
+
} from '@teaui/react'
|
|
15
|
+
|
|
16
|
+
// Recommended:
|
|
17
|
+
interceptConsoleLog()
|
|
18
|
+
|
|
19
|
+
function App() {
|
|
20
|
+
const [bang, goto10] = useReducer((state) => state + '!', '')
|
|
21
|
+
|
|
22
|
+
return <Box border="single">
|
|
23
|
+
<Stack.down>
|
|
24
|
+
First there was Ncurses{bang}
|
|
25
|
+
<Button onClick={goto10}>Tell me more!</Button>
|
|
26
|
+
</Stack.down>
|
|
27
|
+
</Box>
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
run()
|
|
31
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@teaui/react",
|
|
3
|
+
"description": "React Reconciler and renderer for TeaUI",
|
|
4
|
+
"author": "Colin T.A. Gray <colinta@colinta.com>",
|
|
5
|
+
"contributors": [],
|
|
6
|
+
"version": "1.1.5",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"preferGlobal": false,
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git://github.com/colinta/teaui.git"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/colinta/teaui",
|
|
14
|
+
"main": ".dist/index.js",
|
|
15
|
+
"types": ".dist/index.d.ts",
|
|
16
|
+
"files": [
|
|
17
|
+
".dist/"
|
|
18
|
+
],
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "http://github.com/colinta/teaui/issues"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"react",
|
|
24
|
+
"curses",
|
|
25
|
+
"tui",
|
|
26
|
+
"terminal",
|
|
27
|
+
"terminal-ui"
|
|
28
|
+
],
|
|
29
|
+
"tags": [
|
|
30
|
+
"react",
|
|
31
|
+
"curses",
|
|
32
|
+
"tui",
|
|
33
|
+
"terminal"
|
|
34
|
+
],
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">= 18.12.0"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"react": "^18.2.0",
|
|
40
|
+
"react-reconciler": "^0.29.0"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@teaui/core": "^1.1.5"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/react": "^18.2.39",
|
|
47
|
+
"@types/react-reconciler": "^0.28.8",
|
|
48
|
+
"@teaui/shared": "1.1.4"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"clean": "rm -rf .dist/",
|
|
52
|
+
"build": "pnpm clean && pnpm tsc"
|
|
53
|
+
}
|
|
54
|
+
}
|