@teaui/react 1.3.8 → 1.4.8
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.js +17 -24
- package/.dist/components/TextReact.js.map +1 -1
- package/.dist/components.d.ts +1 -1
- package/.dist/components.js +93 -140
- package/.dist/components.js.map +1 -1
- package/.dist/index.d.ts +2 -2
- package/.dist/index.js +2 -18
- package/.dist/index.js.map +1 -1
- package/.dist/isSame.js +4 -8
- package/.dist/isSame.js.map +1 -1
- package/.dist/reconciler.d.ts +2 -2
- package/.dist/reconciler.js +61 -70
- package/.dist/reconciler.js.map +1 -1
- package/README.md +191 -21
- package/package.json +7 -4
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
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");
|
|
1
|
+
import { Container, define, Rect, Size, Style, Text, View, } from '@teaui/core';
|
|
5
2
|
// yeah I don't care about this namespace I just needed something to attach the JSDoc to
|
|
6
3
|
const DEFAULTS = {
|
|
7
4
|
alignment: 'left',
|
|
@@ -12,12 +9,12 @@ const DEFAULTS = {
|
|
|
12
9
|
* Used in the React reconciler for literal text JSX elements. They don't have any
|
|
13
10
|
* props.
|
|
14
11
|
*/
|
|
15
|
-
class TextLiteral extends
|
|
12
|
+
export class TextLiteral extends View {
|
|
16
13
|
#text;
|
|
17
14
|
constructor(text) {
|
|
18
15
|
super({});
|
|
19
16
|
this.#text = text;
|
|
20
|
-
|
|
17
|
+
define(this, 'text', { enumerable: true });
|
|
21
18
|
}
|
|
22
19
|
update({ text, ...props }) {
|
|
23
20
|
super.update(props);
|
|
@@ -38,7 +35,7 @@ class TextLiteral extends core_1.View {
|
|
|
38
35
|
}
|
|
39
36
|
}
|
|
40
37
|
if (style) {
|
|
41
|
-
return style.toSGR(
|
|
38
|
+
return style.toSGR(Style.NONE, this.#text);
|
|
42
39
|
}
|
|
43
40
|
return this.#text;
|
|
44
41
|
}
|
|
@@ -61,17 +58,16 @@ class TextLiteral extends core_1.View {
|
|
|
61
58
|
textContainer?.invalidateText();
|
|
62
59
|
}
|
|
63
60
|
naturalSize() {
|
|
64
|
-
return
|
|
61
|
+
return Size.zero;
|
|
65
62
|
}
|
|
66
63
|
render() { }
|
|
67
64
|
}
|
|
68
|
-
exports.TextLiteral = TextLiteral;
|
|
69
65
|
/**
|
|
70
66
|
* Subsequent TextLiteral nodes are grouped into a TextContainer, which handles the
|
|
71
67
|
* layout of child nodes. It gets its style, font, and alignment from the nearest
|
|
72
68
|
* parent TextProvider.
|
|
73
69
|
*/
|
|
74
|
-
class TextContainer extends
|
|
70
|
+
export class TextContainer extends Container {
|
|
75
71
|
#nodes = [];
|
|
76
72
|
constructor() {
|
|
77
73
|
super({});
|
|
@@ -111,11 +107,11 @@ class TextContainer extends core_1.Container {
|
|
|
111
107
|
let childIndex = 0;
|
|
112
108
|
for (const nextChild of this.#nodesToChildren()) {
|
|
113
109
|
const childView = this.children.at(childIndex);
|
|
114
|
-
if (nextChild instanceof
|
|
110
|
+
if (nextChild instanceof View) {
|
|
115
111
|
childIndex += 1;
|
|
116
112
|
}
|
|
117
113
|
else {
|
|
118
|
-
if (!(childView instanceof
|
|
114
|
+
if (!(childView instanceof Text)) {
|
|
119
115
|
this.#invalidateNodes();
|
|
120
116
|
return;
|
|
121
117
|
}
|
|
@@ -129,7 +125,7 @@ class TextContainer extends core_1.Container {
|
|
|
129
125
|
// remove and re-add those views.
|
|
130
126
|
super.removeAllChildren();
|
|
131
127
|
for (const child of this.#nodesToChildren()) {
|
|
132
|
-
if (child instanceof
|
|
128
|
+
if (child instanceof View) {
|
|
133
129
|
super.add(child);
|
|
134
130
|
}
|
|
135
131
|
else {
|
|
@@ -161,7 +157,7 @@ class TextContainer extends core_1.Container {
|
|
|
161
157
|
return children;
|
|
162
158
|
}
|
|
163
159
|
naturalSize(available) {
|
|
164
|
-
const size =
|
|
160
|
+
const size = Size.zero.mutableCopy();
|
|
165
161
|
const remaining = available.mutableCopy();
|
|
166
162
|
for (const child of this.children) {
|
|
167
163
|
const childSize = child.naturalSize(remaining);
|
|
@@ -181,7 +177,7 @@ class TextContainer extends core_1.Container {
|
|
|
181
177
|
const childSize = child.naturalSize(remaining).mutableCopy();
|
|
182
178
|
childSize.width = viewport.contentSize.width;
|
|
183
179
|
remaining.height -= childSize.height;
|
|
184
|
-
const childViewport = new
|
|
180
|
+
const childViewport = new Rect([0, y], childSize);
|
|
185
181
|
viewport.clipped(childViewport, inner => child.render(inner));
|
|
186
182
|
y += childSize.height;
|
|
187
183
|
}
|
|
@@ -198,7 +194,7 @@ class TextContainer extends core_1.Container {
|
|
|
198
194
|
if (textProvider) {
|
|
199
195
|
textProps = { ...textProps, ...textProvider.textProps };
|
|
200
196
|
}
|
|
201
|
-
return new
|
|
197
|
+
return new Text({
|
|
202
198
|
text,
|
|
203
199
|
...textProps,
|
|
204
200
|
});
|
|
@@ -215,7 +211,6 @@ class TextContainer extends core_1.Container {
|
|
|
215
211
|
});
|
|
216
212
|
}
|
|
217
213
|
}
|
|
218
|
-
exports.TextContainer = TextContainer;
|
|
219
214
|
/**
|
|
220
215
|
* Intended to contain a single TextContainer. Provides the styling that is used to
|
|
221
216
|
* create Text views.
|
|
@@ -223,8 +218,8 @@ exports.TextContainer = TextContainer;
|
|
|
223
218
|
* @example
|
|
224
219
|
* <Text align='left' bold>text</Text>
|
|
225
220
|
*/
|
|
226
|
-
class TextProvider extends
|
|
227
|
-
#style =
|
|
221
|
+
export class TextProvider extends Container {
|
|
222
|
+
#style = Style.NONE;
|
|
228
223
|
#font;
|
|
229
224
|
#alignment;
|
|
230
225
|
#wrap;
|
|
@@ -243,7 +238,7 @@ class TextProvider extends core_1.Container {
|
|
|
243
238
|
break;
|
|
244
239
|
}
|
|
245
240
|
}
|
|
246
|
-
return parentStyle ??
|
|
241
|
+
return parentStyle ?? Style.NONE;
|
|
247
242
|
}
|
|
248
243
|
get textProps() {
|
|
249
244
|
let parentProvider;
|
|
@@ -278,23 +273,21 @@ class TextProvider extends core_1.Container {
|
|
|
278
273
|
}
|
|
279
274
|
#update(props) {
|
|
280
275
|
const { style, alignment, wrap, font, ...styleProps } = props;
|
|
281
|
-
this.#style = new
|
|
276
|
+
this.#style = new Style(styleProps).merge(style);
|
|
282
277
|
this.#font = font;
|
|
283
278
|
this.#alignment = alignment ?? 'left';
|
|
284
279
|
this.#wrap = wrap ?? false;
|
|
285
280
|
}
|
|
286
281
|
}
|
|
287
|
-
exports.TextProvider = TextProvider;
|
|
288
282
|
/**
|
|
289
283
|
* Provides inline styles - doesn't support wrap or alignment.
|
|
290
284
|
*
|
|
291
285
|
* Also doesn't support 'font' because that's not encoded as an SGR code - but
|
|
292
286
|
* ideally it would be supported.
|
|
293
287
|
*/
|
|
294
|
-
class TextStyle extends TextProvider {
|
|
288
|
+
export class TextStyle extends TextProvider {
|
|
295
289
|
constructor(props) {
|
|
296
290
|
super(props);
|
|
297
291
|
}
|
|
298
292
|
}
|
|
299
|
-
exports.TextStyle = TextStyle;
|
|
300
293
|
//# sourceMappingURL=TextReact.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextReact.js","sourceRoot":"","sources":["../../lib/components/TextReact.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextReact.js","sourceRoot":"","sources":["../../lib/components/TextReact.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,MAAM,EAEN,IAAI,EAEJ,IAAI,EACJ,KAAK,EACL,IAAI,EAEJ,IAAI,GAEL,MAAM,aAAa,CAAA;AA8CpB,wFAAwF;AAExF,MAAM,QAAQ,GAAG;IACf,SAAS,EAAE,MAAM;IACjB,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,SAAS;CACP,CAAA;AAEV;;;GAGG;AACH,MAAM,OAAO,WAAY,SAAQ,I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AAC,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,KAAK,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;AAID;;;;;GAKG;AACH,MAAM,OAAO,SAAU,SAAQ,YAAY;IACzC,YAAY,KAAsB;QAChC,KAAK,CAAC,KAAK,CAAC,CAAA;IACd,CAAC;CACF"}
|
package/.dist/components.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
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';
|
|
3
|
+
import { TextProvider, TextStyle } from './components/TextReact.js';
|
|
4
4
|
type Children = 'children' | 'child';
|
|
5
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
6
|
type TUIContainer<T extends abstract new (arg: any, ...args: any) => any, ChildrenProps extends keyof NonNullable<ConstructorParameters<T>[0]> = Children> = TUIView<T, ChildrenProps> & {
|
package/.dist/components.js
CHANGED
|
@@ -1,167 +1,117 @@
|
|
|
1
|
-
|
|
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"));
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
49
2
|
////
|
|
50
3
|
/// Views
|
|
51
4
|
//
|
|
52
|
-
function Br() {
|
|
53
|
-
return
|
|
5
|
+
export function Br() {
|
|
6
|
+
return React.createElement("tui-br", null);
|
|
54
7
|
}
|
|
55
|
-
function Checkbox(reactProps) {
|
|
56
|
-
return
|
|
8
|
+
export function Checkbox(reactProps) {
|
|
9
|
+
return React.createElement("tui-checkbox", { ...reactProps });
|
|
57
10
|
}
|
|
58
|
-
function CollapsibleText(reactProps) {
|
|
59
|
-
return
|
|
11
|
+
export function CollapsibleText(reactProps) {
|
|
12
|
+
return React.createElement("tui-collapsible-text", { ...reactProps });
|
|
60
13
|
}
|
|
61
|
-
function ConsoleLog(reactProps) {
|
|
62
|
-
return
|
|
14
|
+
export function ConsoleLog(reactProps) {
|
|
15
|
+
return React.createElement("tui-console", { ...reactProps });
|
|
63
16
|
}
|
|
64
|
-
function Digits(reactProps) {
|
|
65
|
-
return
|
|
17
|
+
export function Digits(reactProps) {
|
|
18
|
+
return React.createElement("tui-digits", { ...reactProps });
|
|
66
19
|
}
|
|
67
|
-
function H1(reactProps) {
|
|
68
|
-
return
|
|
20
|
+
export function H1(reactProps) {
|
|
21
|
+
return React.createElement("tui-h1", { ...reactProps });
|
|
69
22
|
}
|
|
70
|
-
function H2(reactProps) {
|
|
71
|
-
return
|
|
23
|
+
export function H2(reactProps) {
|
|
24
|
+
return React.createElement("tui-h2", { ...reactProps });
|
|
72
25
|
}
|
|
73
|
-
function H3(reactProps) {
|
|
74
|
-
return
|
|
26
|
+
export function H3(reactProps) {
|
|
27
|
+
return React.createElement("tui-h3", { ...reactProps });
|
|
75
28
|
}
|
|
76
|
-
function H4(reactProps) {
|
|
77
|
-
return
|
|
29
|
+
export function H4(reactProps) {
|
|
30
|
+
return React.createElement("tui-h4", { ...reactProps });
|
|
78
31
|
}
|
|
79
|
-
function H5(reactProps) {
|
|
80
|
-
return
|
|
32
|
+
export function H5(reactProps) {
|
|
33
|
+
return React.createElement("tui-h5", { ...reactProps });
|
|
81
34
|
}
|
|
82
|
-
function H6(reactProps) {
|
|
83
|
-
return
|
|
35
|
+
export function H6(reactProps) {
|
|
36
|
+
return React.createElement("tui-h6", { ...reactProps });
|
|
84
37
|
}
|
|
85
|
-
function Input(reactProps) {
|
|
86
|
-
return
|
|
38
|
+
export function Input(reactProps) {
|
|
39
|
+
return React.createElement("tui-input", { ...reactProps });
|
|
87
40
|
}
|
|
88
|
-
const Separator = function Separator(reactProps) {
|
|
89
|
-
return
|
|
41
|
+
export const Separator = function Separator(reactProps) {
|
|
42
|
+
return React.createElement("tui-separator", { ...reactProps });
|
|
90
43
|
};
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
return react_1.default.createElement("tui-separator", { direction: "horizontal", ...reactProps });
|
|
44
|
+
Separator.horizontal = function SeparatorHorizontal(reactProps) {
|
|
45
|
+
return React.createElement("tui-separator", { direction: "horizontal", ...reactProps });
|
|
94
46
|
};
|
|
95
|
-
|
|
96
|
-
return
|
|
47
|
+
Separator.vertical = function SeparatorHorizontal(reactProps) {
|
|
48
|
+
return React.createElement("tui-separator", { direction: "vertical", ...reactProps });
|
|
97
49
|
};
|
|
98
|
-
const Slider = function Slider(reactProps) {
|
|
99
|
-
return
|
|
50
|
+
export const Slider = function Slider(reactProps) {
|
|
51
|
+
return React.createElement("tui-slider", { ...reactProps });
|
|
100
52
|
};
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return react_1.default.createElement("tui-slider", { direction: "horizontal", ...reactProps });
|
|
53
|
+
Slider.horizontal = function SliderHorizontal(reactProps) {
|
|
54
|
+
return React.createElement("tui-slider", { direction: "horizontal", ...reactProps });
|
|
104
55
|
};
|
|
105
|
-
|
|
106
|
-
return
|
|
56
|
+
Slider.vertical = function SliderHorizontal(reactProps) {
|
|
57
|
+
return React.createElement("tui-slider", { direction: "vertical", ...reactProps });
|
|
107
58
|
};
|
|
108
|
-
function Space(reactProps) {
|
|
109
|
-
return
|
|
59
|
+
export function Space(reactProps) {
|
|
60
|
+
return React.createElement("tui-space", { ...reactProps });
|
|
110
61
|
}
|
|
111
|
-
function ToggleGroup(reactProps) {
|
|
112
|
-
return
|
|
62
|
+
export function ToggleGroup(reactProps) {
|
|
63
|
+
return React.createElement("tui-toggle-group", { ...reactProps });
|
|
113
64
|
}
|
|
114
|
-
function Tree(reactProps) {
|
|
65
|
+
export function Tree(reactProps) {
|
|
115
66
|
const { title, ...props } = reactProps;
|
|
116
|
-
const titleView =
|
|
67
|
+
const titleView = useMemo(() => {
|
|
117
68
|
if (typeof title === 'string') {
|
|
118
|
-
return
|
|
69
|
+
return React.createElement("tui-text", null, title);
|
|
119
70
|
}
|
|
120
71
|
return title;
|
|
121
72
|
}, [title]);
|
|
122
|
-
return
|
|
73
|
+
return React.createElement("tui-tree", { ...props }, titleView);
|
|
123
74
|
}
|
|
124
75
|
////
|
|
125
76
|
/// "Simple" containers
|
|
126
77
|
//
|
|
127
|
-
function Box(reactProps) {
|
|
78
|
+
export function Box(reactProps) {
|
|
128
79
|
const { children, ...props } = reactProps;
|
|
129
|
-
return
|
|
80
|
+
return React.createElement("tui-box", { ...props }, children);
|
|
130
81
|
}
|
|
131
|
-
function Button(reactProps) {
|
|
82
|
+
export function Button(reactProps) {
|
|
132
83
|
const { children, ...props } = reactProps;
|
|
133
|
-
return
|
|
84
|
+
return React.createElement("tui-button", { ...props }, children);
|
|
134
85
|
}
|
|
135
|
-
function Collapsible(reactProps) {
|
|
86
|
+
export function Collapsible(reactProps) {
|
|
136
87
|
const { collapsed, expanded, ...props } = reactProps;
|
|
137
|
-
return (
|
|
88
|
+
return (React.createElement("tui-collapsible", { ...props },
|
|
138
89
|
collapsed,
|
|
139
90
|
expanded));
|
|
140
91
|
}
|
|
141
|
-
const Stack = function Stack(reactProps) {
|
|
92
|
+
export const Stack = function Stack(reactProps) {
|
|
142
93
|
const { children, ...props } = reactProps;
|
|
143
|
-
return
|
|
94
|
+
return React.createElement("tui-stack", { ...props }, children);
|
|
144
95
|
};
|
|
145
|
-
|
|
146
|
-
exports.Stack.down = function StackLeft(reactProps) {
|
|
96
|
+
Stack.down = function StackLeft(reactProps) {
|
|
147
97
|
const { children, ...props } = reactProps;
|
|
148
|
-
return (
|
|
98
|
+
return (React.createElement("tui-stack", { direction: "down", ...props }, children));
|
|
149
99
|
};
|
|
150
|
-
|
|
100
|
+
Stack.up = function StackLeft(reactProps) {
|
|
151
101
|
const { children, ...props } = reactProps;
|
|
152
|
-
return (
|
|
102
|
+
return (React.createElement("tui-stack", { direction: "up", ...props }, children));
|
|
153
103
|
};
|
|
154
|
-
|
|
104
|
+
Stack.right = function StackLeft(reactProps) {
|
|
155
105
|
const { children, ...props } = reactProps;
|
|
156
|
-
return (
|
|
106
|
+
return (React.createElement("tui-stack", { direction: "right", ...props }, children));
|
|
157
107
|
};
|
|
158
|
-
|
|
108
|
+
Stack.left = function StackLeft(reactProps) {
|
|
159
109
|
const { children, ...props } = reactProps;
|
|
160
|
-
return (
|
|
110
|
+
return (React.createElement("tui-stack", { direction: "left", ...props }, children));
|
|
161
111
|
};
|
|
162
|
-
function Scrollable(reactProps) {
|
|
112
|
+
export function Scrollable(reactProps) {
|
|
163
113
|
const { children, ...props } = reactProps;
|
|
164
|
-
return
|
|
114
|
+
return React.createElement("tui-scrollable", { ...props }, children);
|
|
165
115
|
}
|
|
166
116
|
/**
|
|
167
117
|
* <Style /> is similar to <Text/> but only allows inline styles (bold, etc).
|
|
@@ -169,62 +119,65 @@ function Scrollable(reactProps) {
|
|
|
169
119
|
* font is not encodable via SGR codes (and that's how I'm styling and
|
|
170
120
|
* concatenating the text nodes).
|
|
171
121
|
*/
|
|
172
|
-
function Style(reactProps) {
|
|
173
|
-
return
|
|
122
|
+
export function Style(reactProps) {
|
|
123
|
+
return React.createElement("tui-style", { ...reactProps });
|
|
174
124
|
}
|
|
175
125
|
/**
|
|
176
126
|
* <Text /> is a container that sets the text properties of child TextLiterals
|
|
177
127
|
* (font, style) and TextContainers (wrap, alignment)
|
|
178
128
|
*/
|
|
179
|
-
function Text(reactProps) {
|
|
180
|
-
return
|
|
129
|
+
export function Text(reactProps) {
|
|
130
|
+
return React.createElement("tui-text", { ...reactProps });
|
|
181
131
|
}
|
|
182
|
-
const Accordion = function Accordion(reactProps) {
|
|
132
|
+
export const Accordion = function Accordion(reactProps) {
|
|
183
133
|
const { children, ...props } = reactProps;
|
|
184
|
-
return
|
|
134
|
+
return React.createElement("tui-accordion", { ...props }, children);
|
|
185
135
|
};
|
|
186
|
-
|
|
187
|
-
exports.Accordion.Section = function SliderHorizontal(reactProps) {
|
|
136
|
+
Accordion.Section = function SliderHorizontal(reactProps) {
|
|
188
137
|
const { children, ...props } = reactProps;
|
|
189
|
-
return
|
|
138
|
+
return React.createElement("tui-accordion-section", { ...props }, children);
|
|
190
139
|
};
|
|
191
|
-
const Drawer = function Drawer(reactProps) {
|
|
140
|
+
export const Drawer = function Drawer(reactProps) {
|
|
192
141
|
const { children, content, drawer, ...props } = reactProps;
|
|
193
|
-
return (
|
|
142
|
+
return (React.createElement("tui-drawer", { ...props },
|
|
194
143
|
content,
|
|
195
144
|
drawer,
|
|
196
145
|
children));
|
|
197
146
|
};
|
|
198
|
-
|
|
199
|
-
exports.Drawer.top = function DrawerLeft(reactProps) {
|
|
147
|
+
Drawer.top = function DrawerLeft(reactProps) {
|
|
200
148
|
const { children, content, drawer, ...props } = reactProps;
|
|
201
|
-
return (
|
|
149
|
+
return (React.createElement("tui-drawer", { location: "top", ...props },
|
|
202
150
|
content,
|
|
203
151
|
drawer,
|
|
204
152
|
children));
|
|
205
153
|
};
|
|
206
|
-
|
|
154
|
+
Drawer.right = function DrawerLeft(reactProps) {
|
|
207
155
|
const { children, content, drawer, ...props } = reactProps;
|
|
208
|
-
return (
|
|
156
|
+
return (React.createElement("tui-drawer", { location: "right", ...props },
|
|
209
157
|
content,
|
|
210
158
|
drawer,
|
|
211
159
|
children));
|
|
212
160
|
};
|
|
213
|
-
|
|
214
|
-
const { children, ...props } = reactProps;
|
|
215
|
-
return (
|
|
161
|
+
Drawer.bottom = function DrawerBottom(reactProps) {
|
|
162
|
+
const { children, content, drawer, ...props } = reactProps;
|
|
163
|
+
return (React.createElement("tui-drawer", { location: "bottom", ...props },
|
|
164
|
+
content,
|
|
165
|
+
drawer,
|
|
166
|
+
children));
|
|
216
167
|
};
|
|
217
|
-
|
|
218
|
-
const { children, ...props } = reactProps;
|
|
219
|
-
return (
|
|
168
|
+
Drawer.left = function DrawerLeft(reactProps) {
|
|
169
|
+
const { children, content, drawer, ...props } = reactProps;
|
|
170
|
+
return (React.createElement("tui-drawer", { location: "left", ...props },
|
|
171
|
+
content,
|
|
172
|
+
drawer,
|
|
173
|
+
children));
|
|
220
174
|
};
|
|
221
|
-
const Tabs = function Tabs(reactProps) {
|
|
175
|
+
export const Tabs = function Tabs(reactProps) {
|
|
222
176
|
const { children, ...props } = reactProps;
|
|
223
|
-
return
|
|
177
|
+
return React.createElement("tui-tabs", { ...props }, children);
|
|
224
178
|
};
|
|
225
|
-
|
|
226
|
-
exports.Tabs.Section = function SliderHorizontal(reactProps) {
|
|
179
|
+
Tabs.Section = function SliderHorizontal(reactProps) {
|
|
227
180
|
const { children, ...props } = reactProps;
|
|
228
|
-
return
|
|
181
|
+
return React.createElement("tui-tabs-section", { ...props }, children);
|
|
229
182
|
};
|
|
230
183
|
//# sourceMappingURL=components.js.map
|
package/.dist/components.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sourceRoot":"","sources":["../lib/components.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../lib/components.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,OAAO,EAAC,MAAM,OAAO,CAAA;AAsHpC,IAAI;AACJ,SAAS;AACT,EAAE;AAEF,MAAM,UAAU,EAAE;IAChB,OAAO,mCAAU,CAAA;AACnB,CAAC;AACD,MAAM,UAAU,QAAQ,CAAC,UAAyB;IAChD,OAAO,yCAAkB,UAAU,GAAI,CAAA;AACzC,CAAC;AACD,MAAM,UAAU,eAAe,CAAC,UAAgC;IAC9D,OAAO,iDAA0B,UAAU,GAAI,CAAA;AACjD,CAAC;AACD,MAAM,UAAU,UAAU,CAAC,UAAwB;IACjD,OAAO,wCAAiB,UAAU,GAAI,CAAA;AACxC,CAAC;AACD,MAAM,UAAU,MAAM,CAAC,UAAuB;IAC5C,OAAO,uCAAgB,UAAU,GAAI,CAAA;AACvC,CAAC;AACD,MAAM,UAAU,EAAE,CAAC,UAAuB;IACxC,OAAO,mCAAY,UAAU,GAAI,CAAA;AACnC,CAAC;AACD,MAAM,UAAU,EAAE,CAAC,UAAuB;IACxC,OAAO,mCAAY,UAAU,GAAI,CAAA;AACnC,CAAC;AACD,MAAM,UAAU,EAAE,CAAC,UAAuB;IACxC,OAAO,mCAAY,UAAU,GAAI,CAAA;AACnC,CAAC;AACD,MAAM,UAAU,EAAE,CAAC,UAAuB;IACxC,OAAO,mCAAY,UAAU,GAAI,CAAA;AACnC,CAAC;AACD,MAAM,UAAU,EAAE,CAAC,UAAuB;IACxC,OAAO,mCAAY,UAAU,GAAI,CAAA;AACnC,CAAC;AACD,MAAM,UAAU,EAAE,CAAC,UAAuB;IACxC,OAAO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QAAQ,CACE,CACd,CAAA;AACH,CAAC,CAAA;AACD,MAAM,CAAC,IAAI,GAAG,SAAS,UAAU,CAAC,UAAyC;IACzE,MAAM,EAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,EAAC,GAAG,UAAU,CAAA;IACxD,OAAO,CACL,oCAAY,QAAQ,EAAC,MAAM,KAAK,KAAK;QAClC,OAAO;QACP,MAAM;QACN,QAAQ,CACE,CACd,CAAA;AACH,CAAC,CAAA;AAMD,MAAM,CAAC,MAAM,IAAI,GAAS,SAAS,IAAI,CAAC,UAAqB;IAC3D,MAAM,EAAC,QAAQ,EAAE,GAAG,KAAK,EAAC,GAAG,UAAU,CAAA;IACvC,OAAO,qCAAc,KAAK,IAAG,QAAQ,CAAY,CAAA;AACnD,CAAC,CAAA;AACD,IAAI,CAAC,OAAO,GAAG,SAAS,gBAAgB,CACtC,UAA+C;IAE/C,MAAM,EAAC,QAAQ,EAAE,GAAG,KAAK,EAAC,GAAG,UAAU,CAAA;IACvC,OAAO,6CAAsB,KAAK,IAAG,QAAQ,CAAoB,CAAA;AACnE,CAAC,CAAA"}
|
package/.dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './reconciler';
|
|
2
|
-
export * from './components';
|
|
1
|
+
export * from './reconciler.js';
|
|
2
|
+
export * from './components.js';
|
package/.dist/index.js
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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);
|
|
1
|
+
export * from './reconciler.js';
|
|
2
|
+
export * from './components.js';
|
|
19
3
|
//# sourceMappingURL=index.js.map
|
package/.dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA"}
|
package/.dist/isSame.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSame = isSame;
|
|
4
|
-
function isSame(lhs, rhs, depth = 0) {
|
|
1
|
+
export function isSame(lhs, rhs, depth = 0) {
|
|
5
2
|
if (depth >= 100) {
|
|
6
3
|
return false;
|
|
7
4
|
}
|
|
@@ -53,9 +50,9 @@ function isSame(lhs, rhs, depth = 0) {
|
|
|
53
50
|
}
|
|
54
51
|
// ok, better be an object
|
|
55
52
|
// 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;
|
|
53
|
+
if ('$$typeof' in lhs || '$$typeof' in rhs) {
|
|
54
|
+
const { _owner: _lhsOwner, ...lhsTrim } = lhs;
|
|
55
|
+
const { _owner: _rhsOwner, ...rhsTrim } = rhs;
|
|
59
56
|
return isSame(lhsTrim, rhsTrim, depth + 1);
|
|
60
57
|
}
|
|
61
58
|
for (const prop in lhs) {
|
|
@@ -75,7 +72,6 @@ function isSame(lhs, rhs, depth = 0) {
|
|
|
75
72
|
if (!Object.hasOwn(lhs, prop)) {
|
|
76
73
|
return false;
|
|
77
74
|
}
|
|
78
|
-
return false;
|
|
79
75
|
}
|
|
80
76
|
return true;
|
|
81
77
|
}
|
package/.dist/isSame.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isSame.js","sourceRoot":"","sources":["../lib/isSame.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"isSame.js","sourceRoot":"","sources":["../lib/isSame.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,MAAM,CAAC,GAAQ,EAAE,GAAQ,EAAE,KAAK,GAAG,CAAC;IAClD,IAAI,KAAK,IAAI,GAAG,EAAE,CAAC;QACjB,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,OAAO,GAAG,KAAK,OAAO,GAAG,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IACE,OAAO,GAAG,KAAK,QAAQ;QACvB,OAAO,GAAG,KAAK,QAAQ;QACvB,OAAO,GAAG,KAAK,WAAW;QAC1B,OAAO,GAAG,KAAK,SAAS;QACxB,OAAO,GAAG,KAAK,UAAU;QACzB,OAAO,GAAG,KAAK,QAAQ,EACvB,CAAC;QACD,OAAO,GAAG,KAAK,GAAG,CAAA;IACpB,CAAC;IAED,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QACjC,OAAO,GAAG,KAAK,GAAG,CAAA;IACpB,CAAC;IAED,IAAI,GAAG,CAAC,WAAW,KAAK,GAAG,CAAC,WAAW,EAAE,CAAC;QACxC,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE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,IAAI,UAAU,IAAI,GAAG,EAAE,CAAC;QAC3C,MAAM,EAAC,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,EAAC,GAAG,GAAG,CAAA;QAC3C,MAAM,EAAC,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,EAAC,GAAG,GAAG,CAAA;QAC3C,OAAO,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,GAAG,CAAC,CAAC,CAAA;IAC5C,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,8DAA8D;QAC9D,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,GAAG,CAAC,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;IACH,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
|
package/.dist/reconciler.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
import { Screen, type ScreenOptions, Window } from '@teaui/core';
|
|
4
|
-
export declare function render(screen: Screen, window: Window, rootNode: ReactNode): void;
|
|
5
|
-
export declare function run(component: ReactNode, options?: Partial<ScreenOptions>): Promise<[Screen, Window, React.ReactNode]>;
|
|
4
|
+
export declare function render(screen: Screen, window: Window, rootNode: ReactNode): () => void;
|
|
5
|
+
export declare function run(component: ReactNode, options?: Partial<ScreenOptions>): Promise<[Screen, Window, React.ReactNode, () => void]>;
|
package/.dist/reconciler.js
CHANGED
|
@@ -1,114 +1,108 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
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");
|
|
1
|
+
import ReactReconciler from 'react-reconciler';
|
|
2
|
+
import { DefaultEventPriority } from 'react-reconciler/constants.js';
|
|
3
|
+
import { Accordion, Box, Button, Checkbox, Collapsible, CollapsibleText, ConsoleLog, Digits, Drawer, H1, H2, H3, H4, H5, H6, Input, Screen, Scrollable, Separator, Slider, Space, Stack, Tabs, ToggleGroup, Window, } from '@teaui/core';
|
|
4
|
+
import { TextContainer, TextLiteral, TextProvider, TextStyle, } from './components/TextReact.js';
|
|
5
|
+
import { isSame } from './isSame.js';
|
|
12
6
|
function createInstance(type, props) {
|
|
13
7
|
switch (type) {
|
|
14
8
|
// views
|
|
15
9
|
case 'br':
|
|
16
10
|
case 'tui-br':
|
|
17
|
-
return new
|
|
11
|
+
return new TextLiteral('\n');
|
|
18
12
|
case 'checkbox':
|
|
19
13
|
case 'tui-checkbox':
|
|
20
|
-
return new
|
|
14
|
+
return new Checkbox(props);
|
|
21
15
|
case 'collapsible-text':
|
|
22
16
|
case 'tui-collapsible-text':
|
|
23
|
-
return new
|
|
17
|
+
return new CollapsibleText(props);
|
|
24
18
|
case 'console':
|
|
25
19
|
case 'tui-console':
|
|
26
|
-
return new
|
|
20
|
+
return new ConsoleLog(props);
|
|
27
21
|
case 'digits':
|
|
28
22
|
case 'tui-digits':
|
|
29
|
-
return new
|
|
23
|
+
return new Digits(props);
|
|
30
24
|
case 'h1':
|
|
31
25
|
case 'tui-h1':
|
|
32
|
-
return
|
|
26
|
+
return H1(props.text ?? '');
|
|
33
27
|
case 'h2':
|
|
34
28
|
case 'tui-h2':
|
|
35
|
-
return
|
|
29
|
+
return H2(props.text ?? '');
|
|
36
30
|
case 'h3':
|
|
37
31
|
case 'tui-h3':
|
|
38
|
-
return
|
|
32
|
+
return H3(props.text ?? '');
|
|
39
33
|
case 'h4':
|
|
40
34
|
case 'tui-h4':
|
|
41
|
-
return
|
|
35
|
+
return H4(props.text ?? '');
|
|
42
36
|
case 'h5':
|
|
43
37
|
case 'tui-h5':
|
|
44
|
-
return
|
|
38
|
+
return H5(props.text ?? '');
|
|
45
39
|
case 'h6':
|
|
46
40
|
case 'tui-h6':
|
|
47
|
-
return
|
|
41
|
+
return H6(props.text ?? '');
|
|
48
42
|
case 'input':
|
|
49
43
|
case 'tui-input':
|
|
50
|
-
return new
|
|
44
|
+
return new Input(props);
|
|
51
45
|
case 'separator':
|
|
52
46
|
case 'tui-separator':
|
|
53
|
-
return new
|
|
47
|
+
return new Separator(props);
|
|
54
48
|
case 'slider':
|
|
55
49
|
case 'tui-slider':
|
|
56
|
-
return new
|
|
50
|
+
return new Slider(props);
|
|
57
51
|
case 'space':
|
|
58
52
|
case 'tui-space':
|
|
59
|
-
return new
|
|
53
|
+
return new Space(props);
|
|
60
54
|
case 'toggle-group':
|
|
61
55
|
case 'tui-toggle-group':
|
|
62
|
-
return new
|
|
56
|
+
return new ToggleGroup(props);
|
|
63
57
|
// "simple" containers
|
|
64
58
|
case 'box':
|
|
65
59
|
case 'tui-box':
|
|
66
|
-
return new
|
|
60
|
+
return new Box(props);
|
|
67
61
|
case 'button':
|
|
68
62
|
case 'tui-button':
|
|
69
|
-
return new
|
|
63
|
+
return new Button(props);
|
|
70
64
|
case 'collapsible':
|
|
71
65
|
case 'tui-collapsible':
|
|
72
|
-
return new
|
|
66
|
+
return new Collapsible(props);
|
|
73
67
|
case 'stack':
|
|
74
68
|
case 'tui-stack':
|
|
75
|
-
return new
|
|
69
|
+
return new Stack(props);
|
|
76
70
|
case 'scrollable':
|
|
77
71
|
case 'tui-scrollable':
|
|
78
|
-
return new
|
|
72
|
+
return new Scrollable(props);
|
|
79
73
|
case 'style':
|
|
80
74
|
case 'tui-style':
|
|
81
|
-
return new
|
|
75
|
+
return new TextStyle(props);
|
|
82
76
|
case 'tui-text':
|
|
83
|
-
return new
|
|
77
|
+
return new TextProvider(props);
|
|
84
78
|
// "complex" containers
|
|
85
79
|
case 'accordion':
|
|
86
80
|
case 'tui-accordion':
|
|
87
|
-
return new
|
|
81
|
+
return new Accordion(props);
|
|
88
82
|
case 'accordion-section':
|
|
89
83
|
case 'tui-accordion-section':
|
|
90
|
-
return new
|
|
84
|
+
return new Accordion.Section(props);
|
|
91
85
|
case 'drawer':
|
|
92
86
|
case 'tui-drawer':
|
|
93
|
-
return new
|
|
87
|
+
return new Drawer(props);
|
|
94
88
|
case 'tabs':
|
|
95
89
|
case 'tui-tabs':
|
|
96
|
-
return new
|
|
90
|
+
return new Tabs(props);
|
|
97
91
|
case 'tabs-section':
|
|
98
92
|
case 'tui-tabs-section':
|
|
99
|
-
return new
|
|
93
|
+
return new Tabs.Section(props);
|
|
100
94
|
default:
|
|
101
95
|
throw new Error(`unknown component "${type}"`);
|
|
102
96
|
}
|
|
103
97
|
}
|
|
104
|
-
function render(screen, window, rootNode) {
|
|
98
|
+
export function render(screen, window, rootNode) {
|
|
105
99
|
function rerender() {
|
|
106
100
|
screen.render();
|
|
107
101
|
}
|
|
108
102
|
function removeFromTextContainer(container, child) {
|
|
109
103
|
// find TextContainer with child in it, and remove
|
|
110
104
|
for (const node of container.children) {
|
|
111
|
-
if (node instanceof
|
|
105
|
+
if (node instanceof TextContainer && node.children.includes(child)) {
|
|
112
106
|
node.removeChild(child);
|
|
113
107
|
if (node.children.length === 0) {
|
|
114
108
|
container.removeChild(node);
|
|
@@ -121,16 +115,16 @@ function render(screen, window, rootNode) {
|
|
|
121
115
|
if (child.parent === container) {
|
|
122
116
|
container.removeChild(child);
|
|
123
117
|
}
|
|
124
|
-
else if (child instanceof
|
|
118
|
+
else if (child instanceof TextLiteral || child instanceof TextStyle) {
|
|
125
119
|
removeFromTextContainer(container, child);
|
|
126
120
|
}
|
|
127
121
|
}
|
|
128
122
|
function appendChild(parentInstance, child, before) {
|
|
129
|
-
if (parentInstance instanceof
|
|
130
|
-
(child instanceof
|
|
123
|
+
if (parentInstance instanceof TextStyle &&
|
|
124
|
+
(child instanceof TextLiteral || child instanceof TextStyle)) {
|
|
131
125
|
// do not do the TextContainer song and dance
|
|
132
126
|
}
|
|
133
|
-
else if (child instanceof
|
|
127
|
+
else if (child instanceof TextLiteral || child instanceof TextStyle) {
|
|
134
128
|
// find the last child (checking 'before')
|
|
135
129
|
let lastChild = parentInstance.children.at(-1);
|
|
136
130
|
if (before) {
|
|
@@ -140,11 +134,11 @@ function render(screen, window, rootNode) {
|
|
|
140
134
|
}
|
|
141
135
|
}
|
|
142
136
|
let textContainer;
|
|
143
|
-
if (lastChild instanceof
|
|
137
|
+
if (lastChild instanceof TextContainer) {
|
|
144
138
|
textContainer = lastChild;
|
|
145
139
|
}
|
|
146
140
|
else {
|
|
147
|
-
textContainer = new
|
|
141
|
+
textContainer = new TextContainer();
|
|
148
142
|
parentInstance.add(textContainer);
|
|
149
143
|
}
|
|
150
144
|
textContainer.add(child);
|
|
@@ -158,11 +152,9 @@ function render(screen, window, rootNode) {
|
|
|
158
152
|
}
|
|
159
153
|
parentInstance.add(child, index);
|
|
160
154
|
}
|
|
161
|
-
const reconciler = (
|
|
162
|
-
supportsMutation: true,
|
|
155
|
+
const reconciler = ReactReconciler({
|
|
163
156
|
supportsPersistence: false,
|
|
164
157
|
supportsHydration: false,
|
|
165
|
-
noTimeout: undefined,
|
|
166
158
|
isPrimaryRenderer: true,
|
|
167
159
|
getRootHostContext(rootWindow) {
|
|
168
160
|
return { screen, window: rootWindow };
|
|
@@ -185,7 +177,7 @@ function render(screen, window, rootNode) {
|
|
|
185
177
|
return createInstance(type, props);
|
|
186
178
|
},
|
|
187
179
|
createTextInstance(text) {
|
|
188
|
-
return new
|
|
180
|
+
return new TextLiteral(text);
|
|
189
181
|
},
|
|
190
182
|
appendInitialChild(parentInstance, child) {
|
|
191
183
|
appendChild(parentInstance, child, undefined);
|
|
@@ -235,7 +227,7 @@ function render(screen, window, rootNode) {
|
|
|
235
227
|
if (!Object.hasOwn(oldProps, prop)) {
|
|
236
228
|
continue;
|
|
237
229
|
}
|
|
238
|
-
if (!
|
|
230
|
+
if (!isSame(oldProps[prop], newProps[prop])) {
|
|
239
231
|
// difference found - we just return a non-null here to indicate "difference"
|
|
240
232
|
return [];
|
|
241
233
|
}
|
|
@@ -245,7 +237,7 @@ function render(screen, window, rootNode) {
|
|
|
245
237
|
if (Object.hasOwn(oldProps, prop) || !Object.hasOwn(newProps, prop)) {
|
|
246
238
|
continue;
|
|
247
239
|
}
|
|
248
|
-
if (!
|
|
240
|
+
if (!isSame(oldProps[prop], newProps[prop])) {
|
|
249
241
|
// difference found - we just return a non-null here to indicate "difference"
|
|
250
242
|
return [];
|
|
251
243
|
}
|
|
@@ -259,20 +251,16 @@ function render(screen, window, rootNode) {
|
|
|
259
251
|
// }
|
|
260
252
|
node.update(updates);
|
|
261
253
|
},
|
|
262
|
-
|
|
263
|
-
|
|
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.');
|
|
254
|
+
supportsMutation: true,
|
|
255
|
+
getPublicInstance(instance) {
|
|
256
|
+
return instance;
|
|
273
257
|
},
|
|
258
|
+
preparePortalMount() { },
|
|
259
|
+
scheduleTimeout: setTimeout,
|
|
260
|
+
cancelTimeout: clearTimeout,
|
|
261
|
+
noTimeout: -1,
|
|
274
262
|
getCurrentEventPriority() {
|
|
275
|
-
|
|
263
|
+
return DefaultEventPriority;
|
|
276
264
|
},
|
|
277
265
|
getInstanceFromNode() {
|
|
278
266
|
throw new Error('Function not implemented.');
|
|
@@ -292,11 +280,14 @@ function render(screen, window, rootNode) {
|
|
|
292
280
|
});
|
|
293
281
|
const fiber = reconciler.createContainer(window, 0, null, false, null, '', () => { }, null);
|
|
294
282
|
reconciler.updateContainer(rootNode, fiber, null /* parentComponent */, null /* callback */);
|
|
283
|
+
return function unmount() {
|
|
284
|
+
reconciler.updateContainer(null, fiber, null, null);
|
|
285
|
+
};
|
|
295
286
|
}
|
|
296
|
-
async function run(component, options) {
|
|
297
|
-
const window = new
|
|
298
|
-
const [screen, _] = await
|
|
299
|
-
render(screen, window, component);
|
|
300
|
-
return [screen, window, component];
|
|
287
|
+
export async function run(component, options) {
|
|
288
|
+
const window = new Window();
|
|
289
|
+
const [screen, _] = await Screen.start(window, options);
|
|
290
|
+
const unmount = render(screen, window, component);
|
|
291
|
+
return [screen, window, component, unmount];
|
|
301
292
|
}
|
|
302
293
|
//# sourceMappingURL=reconciler.js.map
|
package/.dist/reconciler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reconciler.js","sourceRoot":"","sources":["../lib/reconciler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reconciler.js","sourceRoot":"","sources":["../lib/reconciler.ts"],"names":[],"mappings":"AAEA,OAAO,eAAe,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAC,oBAAoB,EAAC,MAAM,+BAA+B,CAAA;AAClE,OAAO,EACL,SAAS,EACT,GAAG,EACH,MAAM,EACN,QAAQ,EACR,WAAW,EACX,eAAe,EACf,UAAU,EAEV,MAAM,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,CAAC,CAAA;IAEvD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAA;IAEjD,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;AAC7C,CAAC"}
|
package/README.md
CHANGED
|
@@ -1,31 +1,201 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @teaui/react
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
React custom renderer for [TeaUI](https://github.com/colinta/teaui). Write fullscreen terminal UIs with React components, hooks, and JSX.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm install @teaui/core @teaui/react react
|
|
9
|
+
# TypeScript users:
|
|
10
|
+
pnpm install -D @types/react
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
5
14
|
|
|
6
15
|
```tsx
|
|
7
|
-
import {useReducer} from 'react'
|
|
16
|
+
import React, {useReducer} from 'react'
|
|
8
17
|
import {interceptConsoleLog} from '@teaui/core'
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
Button,
|
|
12
|
-
Stack,
|
|
13
|
-
run,
|
|
14
|
-
} from '@teaui/react'
|
|
15
|
-
|
|
16
|
-
// Recommended:
|
|
18
|
+
import {Box, Button, Stack, run} from '@teaui/react'
|
|
19
|
+
|
|
17
20
|
interceptConsoleLog()
|
|
18
21
|
|
|
19
22
|
function App() {
|
|
20
|
-
const [bang,
|
|
21
|
-
|
|
22
|
-
return
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
const [bang, addBang] = useReducer((s) => s + '!', '')
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Box border="single">
|
|
27
|
+
<Stack.down>
|
|
28
|
+
Hello TeaUI{bang}
|
|
29
|
+
<Button onClick={addBang}>Click me</Button>
|
|
30
|
+
</Stack.down>
|
|
31
|
+
</Box>
|
|
32
|
+
)
|
|
28
33
|
}
|
|
29
34
|
|
|
30
|
-
run()
|
|
35
|
+
run(<App />)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Compile and run:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pnpm tsc && node .dist/index.js
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## API
|
|
45
|
+
|
|
46
|
+
### `run(element, options?)`
|
|
47
|
+
|
|
48
|
+
Creates a `Window` and `Screen`, renders the React element tree, and enters fullscreen mode.
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
const [screen, window, component, unmount] = await run(<App />)
|
|
31
52
|
```
|
|
53
|
+
|
|
54
|
+
Returns `[Screen, Window, ReactNode, unmount]`. Call `unmount()` to tear down the React tree.
|
|
55
|
+
|
|
56
|
+
### `render(screen, window, element)`
|
|
57
|
+
|
|
58
|
+
Lower-level alternative — mount a React element into an existing `Screen` and `Window`.
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
import {Screen, Window} from '@teaui/core'
|
|
62
|
+
import {render} from '@teaui/react'
|
|
63
|
+
|
|
64
|
+
const window = new Window()
|
|
65
|
+
const [screen] = await Screen.start(window)
|
|
66
|
+
const unmount = render(screen, window, <App />)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Returns an `unmount()` function.
|
|
70
|
+
|
|
71
|
+
## Components
|
|
72
|
+
|
|
73
|
+
All components are typed wrappers around TeaUI core views. They accept the same props as the core constructors, with `children` mapped to React children.
|
|
74
|
+
|
|
75
|
+
### Views (leaf nodes)
|
|
76
|
+
|
|
77
|
+
| Component | Element | Description |
|
|
78
|
+
|-----------|---------|-------------|
|
|
79
|
+
| `<Br />` | `<tui-br>` | Line break in text |
|
|
80
|
+
| `<Checkbox />` | `<tui-checkbox>` | Toggle checkbox |
|
|
81
|
+
| `<CollapsibleText />` | `<tui-collapsible-text>` | Text that truncates with expand/collapse |
|
|
82
|
+
| `<ConsoleLog />` | `<tui-console>` | Displays intercepted `console.log` output |
|
|
83
|
+
| `<Digits />` | `<tui-digits>` | Large-font digit display |
|
|
84
|
+
| `<H1 />`–`<H6 />` | `<tui-h1>`–`<tui-h6>` | Header text |
|
|
85
|
+
| `<Input />` | `<tui-input>` | Text input field |
|
|
86
|
+
| `<Separator />` | `<tui-separator>` | Horizontal or vertical line |
|
|
87
|
+
| `<Slider />` | `<tui-slider>` | Value slider |
|
|
88
|
+
| `<Space />` | `<tui-space>` | Empty spacer |
|
|
89
|
+
| `<ToggleGroup />` | `<tui-toggle-group>` | Group of toggle options |
|
|
90
|
+
|
|
91
|
+
`Separator` has `.horizontal` and `.vertical` variants. `Slider` has `.horizontal` and `.vertical` variants.
|
|
92
|
+
|
|
93
|
+
### Containers
|
|
94
|
+
|
|
95
|
+
| Component | Element | Description |
|
|
96
|
+
|-----------|---------|-------------|
|
|
97
|
+
| `<Box />` | `<tui-box>` | Box with optional border and padding |
|
|
98
|
+
| `<Button />` | `<tui-button>` | Clickable button |
|
|
99
|
+
| `<Collapsible />` | `<tui-collapsible>` | Toggle between `collapsed` and `expanded` content |
|
|
100
|
+
| `<Scrollable />` | `<tui-scrollable>` | Scrollable content region |
|
|
101
|
+
| `<Stack />` | `<tui-stack>` | Linear layout |
|
|
102
|
+
| `<Text />` | `<tui-text>` | Text container (sets font, alignment, wrap) |
|
|
103
|
+
| `<Style />` | `<tui-style>` | Inline text styles (bold, italic, etc.) |
|
|
104
|
+
|
|
105
|
+
`Stack` has `.down`, `.up`, `.left`, and `.right` variants.
|
|
106
|
+
|
|
107
|
+
### Complex Containers
|
|
108
|
+
|
|
109
|
+
| Component | Element | Description |
|
|
110
|
+
|-----------|---------|-------------|
|
|
111
|
+
| `<Accordion />` | `<tui-accordion>` | Expandable section group |
|
|
112
|
+
| `<Accordion.Section />` | `<tui-accordion-section>` | Section within an accordion |
|
|
113
|
+
| `<Drawer />` | `<tui-drawer>` | Panel that slides in from an edge |
|
|
114
|
+
| `<Tabs />` | `<tui-tabs>` | Tabbed container |
|
|
115
|
+
| `<Tabs.Section />` | `<tui-tabs-section>` | Tab within tabs |
|
|
116
|
+
| `<Tree />` | `<tui-tree>` | Tree view with expandable nodes |
|
|
117
|
+
|
|
118
|
+
`Drawer` has `.top`, `.right`, `.bottom`, and `.left` variants. Each accepts `content` and `drawer` props for the two panes.
|
|
119
|
+
|
|
120
|
+
### Intrinsic Elements
|
|
121
|
+
|
|
122
|
+
You can also use the `tui-` prefixed JSX elements directly:
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
<tui-stack direction="down">
|
|
126
|
+
<tui-box border="single" width={20}>
|
|
127
|
+
<tui-text alignment="center">Hello</tui-text>
|
|
128
|
+
</tui-box>
|
|
129
|
+
</tui-stack>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Text Handling
|
|
133
|
+
|
|
134
|
+
React string literals are rendered as `TextLiteral` nodes, which are automatically grouped into `TextContainer`s for layout:
|
|
135
|
+
|
|
136
|
+
```tsx
|
|
137
|
+
<Stack.down>
|
|
138
|
+
hello {/* TextLiteral → TextContainer #1 */}
|
|
139
|
+
<Br /> {/* TextLiteral → TextContainer #1 */}
|
|
140
|
+
<Box /> {/* Box breaks the text group */}
|
|
141
|
+
goodbye {/* TextLiteral → TextContainer #2 */}
|
|
142
|
+
</Stack.down>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Use `<Text>` to control font, alignment, and word wrap. Use `<Style>` for inline formatting (bold, italic, etc.):
|
|
146
|
+
|
|
147
|
+
```tsx
|
|
148
|
+
<Text alignment="center" wrap>
|
|
149
|
+
This is <Style bold>important</Style> text.
|
|
150
|
+
</Text>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## React Features
|
|
154
|
+
|
|
155
|
+
| Feature | Status |
|
|
156
|
+
|---------|--------|
|
|
157
|
+
| Hooks (`useState`, `useReducer`, `useEffect`, etc.) | ✅ Works |
|
|
158
|
+
| Context (`useContext`, providers) | ✅ Works |
|
|
159
|
+
| Refs (`useRef`, callback refs) | ✅ Works |
|
|
160
|
+
| Suspense | ✅ Supported (timeouts delegate to `setTimeout`) |
|
|
161
|
+
| Portals | ⚠️ No-op (doesn't crash, but no portal behavior) |
|
|
162
|
+
| Error Boundaries | Not yet supported |
|
|
163
|
+
|
|
164
|
+
## Tests
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
pnpm test # run once
|
|
168
|
+
pnpm test:watch # watch mode
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Tests use [vitest](https://vitest.dev/) and cover:
|
|
172
|
+
|
|
173
|
+
- **`isSame.test.ts`** — Deep equality comparisons (primitives, arrays, Sets, Maps, Dates, objects, React fiber nodes)
|
|
174
|
+
- **`reconciler.test.ts`** — Rendering, child manipulation, text node grouping, updates, refs, unmount
|
|
175
|
+
- **`components.test.ts`** — All component wrappers render the correct view types; Drawer variants pass `content`/`drawer` props
|
|
176
|
+
|
|
177
|
+
## Architecture
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
@teaui/react
|
|
181
|
+
├── lib/
|
|
182
|
+
│ ├── index.ts # Re-exports reconciler + components
|
|
183
|
+
│ ├── reconciler.ts # react-reconciler host config, render(), run()
|
|
184
|
+
│ ├── isSame.ts # Deep equality for prepareUpdate
|
|
185
|
+
│ ├── components.tsx # Typed React wrappers + JSX IntrinsicElements
|
|
186
|
+
│ └── components/
|
|
187
|
+
│ └── TextReact.ts # TextLiteral, TextContainer, TextProvider, TextStyle
|
|
188
|
+
├── tests/
|
|
189
|
+
│ ├── isSame.test.ts
|
|
190
|
+
│ ├── reconciler.test.tsx
|
|
191
|
+
│ └── components.test.tsx
|
|
192
|
+
└── vitest.config.ts
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
**`reconciler.ts`** implements the `react-reconciler` host config. It maps JSX element types to TeaUI view constructors in `createInstance`, manages the view tree via `appendChild`/`removeChild`/`insertBefore`, and applies prop updates via `commitUpdate` (which calls `view.update()`). Text string children become `TextLiteral` instances. The `prepareUpdate` function uses `isSame` to diff old and new props — if anything changed, `commitUpdate` passes the full new props to the view.
|
|
196
|
+
|
|
197
|
+
**`components/TextReact.ts`** defines the text rendering architecture. Adjacent `TextLiteral` nodes are grouped into a `TextContainer`, which handles layout. `TextProvider` (`<Text>`) sets text properties (font, alignment, wrap) for descendant text. `TextStyle` (`<Style>`) applies inline SGR styles without affecting layout properties.
|
|
198
|
+
|
|
199
|
+
## License
|
|
200
|
+
|
|
201
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
+
"type": "module",
|
|
2
3
|
"name": "@teaui/react",
|
|
3
4
|
"description": "React Reconciler and renderer for TeaUI",
|
|
4
5
|
"author": "Colin T.A. Gray <colinta@colinta.com>",
|
|
5
6
|
"contributors": [],
|
|
6
|
-
"version": "1.
|
|
7
|
+
"version": "1.4.8",
|
|
7
8
|
"license": "MIT",
|
|
8
9
|
"preferGlobal": false,
|
|
9
10
|
"repository": {
|
|
@@ -41,15 +42,17 @@
|
|
|
41
42
|
"react-reconciler": "^0.29.0"
|
|
42
43
|
},
|
|
43
44
|
"dependencies": {
|
|
44
|
-
"@teaui/core": "1.
|
|
45
|
+
"@teaui/core": "1.4.8"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
48
|
"@types/react": "^18.2.39",
|
|
48
49
|
"@types/react-reconciler": "^0.28.8",
|
|
49
|
-
"@teaui/shared": "1.
|
|
50
|
+
"@teaui/shared": "1.4.8"
|
|
50
51
|
},
|
|
51
52
|
"scripts": {
|
|
52
53
|
"clean": "rm -rf .dist/",
|
|
53
|
-
"build": "pnpm clean && pnpm tsc"
|
|
54
|
+
"build": "pnpm clean && pnpm tsc",
|
|
55
|
+
"test": "vitest run",
|
|
56
|
+
"test:watch": "vitest"
|
|
54
57
|
}
|
|
55
58
|
}
|