@teaui/preact 1.1.4

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.
@@ -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,297 @@
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
+ }
103
+ didMount(screen) {
104
+ super.didMount(screen);
105
+ this.#invalidateNodes();
106
+ }
107
+ invalidateText() {
108
+ let childIndex = 0;
109
+ for (const nextChild of this.#nodesToChildren()) {
110
+ const childView = this.children.at(childIndex);
111
+ if (nextChild instanceof core_1.View) {
112
+ childIndex += 1;
113
+ }
114
+ else {
115
+ if (!(childView instanceof core_1.Text)) {
116
+ this.#invalidateNodes();
117
+ return;
118
+ }
119
+ childView.text = nextChild;
120
+ }
121
+ }
122
+ }
123
+ #invalidateNodes() {
124
+ // ideally, we would not remove/add views that are in children and this.#nodes,
125
+ // but in reality that turns out to be tedious, and it's hardly any trouble to
126
+ // remove and re-add those views.
127
+ super.removeAllChildren();
128
+ for (const child of this.#nodesToChildren()) {
129
+ if (child instanceof core_1.View) {
130
+ super.add(child);
131
+ }
132
+ else {
133
+ const textView = this.#createTextNode(child);
134
+ super.add(textView);
135
+ }
136
+ }
137
+ }
138
+ #nodesToChildren() {
139
+ const children = [];
140
+ let textBuffer;
141
+ const STOP = null;
142
+ const flattenedNodes = this.#flatten(this.#nodes);
143
+ for (const node of [...flattenedNodes, STOP]) {
144
+ if (node instanceof TextLiteral) {
145
+ textBuffer ??= '';
146
+ textBuffer += node.styledText();
147
+ }
148
+ else {
149
+ if (textBuffer !== undefined) {
150
+ children.push(textBuffer);
151
+ textBuffer = undefined;
152
+ }
153
+ if (node) {
154
+ children.push(node);
155
+ }
156
+ }
157
+ }
158
+ return children;
159
+ }
160
+ naturalSize(available) {
161
+ const size = core_1.Size.zero.mutableCopy();
162
+ const remaining = available.mutableCopy();
163
+ for (const child of this.children) {
164
+ const childSize = child.naturalSize(remaining);
165
+ size.width = Math.max(size.width, childSize.width);
166
+ size.height += childSize.height;
167
+ remaining.height = Math.max(0, remaining.height - childSize.height);
168
+ }
169
+ return size;
170
+ }
171
+ render(viewport) {
172
+ const remaining = viewport.contentSize.mutableCopy();
173
+ let y = 0;
174
+ for (const child of this.children) {
175
+ if (!child.isVisible) {
176
+ continue;
177
+ }
178
+ const childSize = child.naturalSize(remaining).mutableCopy();
179
+ childSize.width = viewport.contentSize.width;
180
+ remaining.height -= childSize.height;
181
+ const childViewport = new core_1.Rect([0, y], childSize);
182
+ viewport.clipped(childViewport, inner => child.render(inner));
183
+ y += childSize.height;
184
+ }
185
+ }
186
+ #createTextNode(text) {
187
+ let textProvider;
188
+ for (let ancestorView = this.parent; Boolean(ancestorView); ancestorView = ancestorView && ancestorView.parent) {
189
+ if (ancestorView instanceof TextProvider) {
190
+ textProvider = ancestorView;
191
+ break;
192
+ }
193
+ }
194
+ let textProps = DEFAULTS;
195
+ if (textProvider) {
196
+ textProps = { ...textProps, ...textProvider.textProps };
197
+ }
198
+ return new core_1.Text({
199
+ text,
200
+ ...textProps,
201
+ });
202
+ }
203
+ #flatten(nodes) {
204
+ return nodes.flatMap(node => {
205
+ if (node instanceof TextContainer) {
206
+ return this.#flatten(node.nodes);
207
+ }
208
+ if (node instanceof TextStyle) {
209
+ return this.#flatten(node.children);
210
+ }
211
+ return [node];
212
+ });
213
+ }
214
+ }
215
+ exports.TextContainer = TextContainer;
216
+ /**
217
+ * Intended to contain a single TextContainer. Provides the styling that is used to
218
+ * create Text views.
219
+ *
220
+ * @example
221
+ * <Text align='left' bold>text</Text>
222
+ */
223
+ class TextProvider extends core_1.Container {
224
+ #style = core_1.Style.NONE;
225
+ #font;
226
+ #alignment;
227
+ #wrap;
228
+ constructor(props = {}) {
229
+ super(props);
230
+ this.#update(props);
231
+ }
232
+ get style() {
233
+ return this.parentStyle.merge(this.#style);
234
+ }
235
+ get parentStyle() {
236
+ let parentStyle;
237
+ for (let ancestorView = this.parent; Boolean(ancestorView); ancestorView = ancestorView && ancestorView.parent) {
238
+ if (ancestorView instanceof TextProvider) {
239
+ parentStyle = ancestorView.style;
240
+ break;
241
+ }
242
+ }
243
+ return parentStyle ?? core_1.Style.NONE;
244
+ }
245
+ get textProps() {
246
+ let parentProvider;
247
+ for (let ancestorView = this.parent; Boolean(ancestorView); ancestorView = ancestorView && ancestorView.parent) {
248
+ if (ancestorView instanceof TextProvider) {
249
+ parentProvider = ancestorView;
250
+ break;
251
+ }
252
+ }
253
+ let retVal = {};
254
+ if (parentProvider) {
255
+ retVal = { ...parentProvider.textProps };
256
+ }
257
+ else {
258
+ retVal = {};
259
+ }
260
+ retVal.style = this.#style;
261
+ if (this.#alignment !== undefined) {
262
+ retVal.alignment = this.#alignment;
263
+ }
264
+ if (this.#wrap !== undefined) {
265
+ retVal.wrap = this.#wrap;
266
+ }
267
+ if (this.#font !== undefined) {
268
+ retVal.font = this.#font;
269
+ }
270
+ return retVal;
271
+ }
272
+ update(props) {
273
+ this.#update(props);
274
+ super.update(props);
275
+ }
276
+ #update(props) {
277
+ const { style, alignment, wrap, font, ...styleProps } = props;
278
+ this.#style = new core_1.Style(styleProps).merge(style);
279
+ this.#font = font;
280
+ this.#alignment = alignment ?? 'left';
281
+ this.#wrap = wrap ?? false;
282
+ }
283
+ }
284
+ exports.TextProvider = TextProvider;
285
+ /**
286
+ * Provides inline styles - doesn't support wrap or alignment.
287
+ *
288
+ * Also doesn't support 'font' because that's not encoded as an SGR code - but
289
+ * ideally it would be supported.
290
+ */
291
+ class TextStyle extends TextProvider {
292
+ constructor(props) {
293
+ super(props);
294
+ }
295
+ }
296
+ exports.TextStyle = TextStyle;
297
+ //# 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,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,SAAS;CACP,CAAA;AAEV;;;GAGG;AACH,MAAa,WAAY,SAAQ,WAAI;IACnC,KAAK,CAAQ;IAEb,YAAY,IAAY;QACtB,KAAK,CAAC,EAAE,CAAC,CAAA;QACT,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,IAAA,aAAM,EAAC,IAAI,EAAE,MAAM,EAAE,EAAC,UAAU,EAAE,IAAI,EAAC,CAAC,CAAA;IAC1C,CAAC;IAED,MAAM,CAAC,EAAC,IAAI,EAAE,GAAG,KAAK,EAA8B;QAClD,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACnB,IAAI,CAAC,OAAO,CAAC,EAAC,IAAI,EAAC,CAAC,CAAA;IACtB,CAAC;IAED,OAAO,CAAC,EAAC,IAAI,EAAkB;QAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,IAAI,EAAE,CAAA;IACzB,CAAC;IAED,UAAU;QACR,IAAI,KAAwB,CAAA;QAC5B,KACE,IAAI,YAAY,GAA0B,IAAI,CAAC,MAAM,EACrD,OAAO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
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
+ export type CheckboxProps = TUIView<typeof WrCheckbox>;
10
+ export type CollapsibleTextProps = TUIView<typeof WrCollapsibleText>;
11
+ export type ConsoleProps = TUIView<typeof WrConsoleLog>;
12
+ export type DigitsProps = TUIView<typeof WrDigits>;
13
+ export type HeaderProps = {
14
+ text?: string;
15
+ };
16
+ export type InputProps = TUIView<typeof WrInput>;
17
+ export type SeparatorProps = TUIView<typeof WrSeparator>;
18
+ export type SliderProps = TUIView<typeof WrSlider>;
19
+ export type SpaceProps = TUIView<typeof WrSpace>;
20
+ export type ToggleGroupProps = TUIView<typeof WrToggleGroup>;
21
+ export type BoxProps = TUIContainer<typeof WrBox>;
22
+ export type ButtonProps = TUIContainer<typeof WrButton>;
23
+ export type CollapsibleProps = TUIContainer<typeof WrCollapsible, 'collapsed' | 'expanded' | 'children'>;
24
+ export type ScrollableProps = TUIContainer<typeof WrScrollable>;
25
+ export type StackProps = TUIContainer<typeof WrStack>;
26
+ export type StyleProps = TUIContainer<typeof TextStyle>;
27
+ export type TextProps = TUIContainer<typeof TextProvider>;
28
+ export type AccordionProps = TUIContainer<typeof WrAccordion>;
29
+ export type AccordionSectionProps = TUIContainer<typeof WrAccordion.Section>;
30
+ export type DrawerProps = TUIContainer<typeof WrDrawer, 'content' | 'drawer' | 'children'>;
31
+ export type TabsProps = TUIContainer<typeof WrTabs>;
32
+ export 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(): preact.JSX.Element;
69
+ export declare function Checkbox(reactProps: CheckboxProps): preact.JSX.Element;
70
+ export declare function CollapsibleText(reactProps: CollapsibleTextProps): preact.JSX.Element;
71
+ export declare function ConsoleLog(reactProps: ConsoleProps): preact.JSX.Element;
72
+ export declare function Digits(reactProps: DigitsProps): preact.JSX.Element;
73
+ export declare function H1(reactProps: HeaderProps): preact.JSX.Element;
74
+ export declare function H2(reactProps: HeaderProps): preact.JSX.Element;
75
+ export declare function H3(reactProps: HeaderProps): preact.JSX.Element;
76
+ export declare function H4(reactProps: HeaderProps): preact.JSX.Element;
77
+ export declare function H5(reactProps: HeaderProps): preact.JSX.Element;
78
+ export declare function H6(reactProps: HeaderProps): preact.JSX.Element;
79
+ export declare function Input(reactProps: InputProps): preact.JSX.Element;
80
+ interface Separator {
81
+ (reactProps: SeparatorProps): preact.JSX.Element;
82
+ horizontal(reactProps: Omit<SeparatorProps, 'direction'>): preact.JSX.Element;
83
+ vertical(reactProps: Omit<SeparatorProps, 'direction'>): preact.JSX.Element;
84
+ }
85
+ export declare const Separator: Separator;
86
+ interface Slider {
87
+ (reactProps: SliderProps): preact.JSX.Element;
88
+ horizontal(reactProps: Omit<SliderProps, 'direction'>): preact.JSX.Element;
89
+ vertical(reactProps: Omit<SliderProps, 'direction'>): preact.JSX.Element;
90
+ }
91
+ export declare const Slider: Slider;
92
+ export declare function Space(reactProps: SpaceProps): preact.JSX.Element;
93
+ export declare function ToggleGroup(reactProps: ToggleGroupProps): preact.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>): preact.JSX.Element;
101
+ export declare function Box(reactProps: BoxProps): preact.JSX.Element;
102
+ export declare function Button(reactProps: ButtonProps): preact.JSX.Element;
103
+ export declare function Collapsible(reactProps: CollapsibleProps): preact.JSX.Element;
104
+ interface Stack {
105
+ (reactProps: StackProps): preact.JSX.Element;
106
+ down(reactProps: Omit<StackProps, 'direction'>): preact.JSX.Element;
107
+ up(reactProps: Omit<StackProps, 'direction'>): preact.JSX.Element;
108
+ left(reactProps: Omit<StackProps, 'direction'>): preact.JSX.Element;
109
+ right(reactProps: Omit<StackProps, 'direction'>): preact.JSX.Element;
110
+ }
111
+ export declare const Stack: Stack;
112
+ export declare function Scrollable(reactProps: ScrollableProps): preact.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): preact.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): preact.JSX.Element;
125
+ interface Accordion {
126
+ (reactProps: AccordionProps): preact.JSX.Element;
127
+ Section(reactProps: Omit<AccordionSectionProps, 'direction'>): preact.JSX.Element;
128
+ }
129
+ export declare const Accordion: Accordion;
130
+ interface Drawer {
131
+ (reactProps: DrawerProps): preact.JSX.Element;
132
+ top(reactProps: Omit<DrawerProps, 'location'>): preact.JSX.Element;
133
+ right(reactProps: Omit<DrawerProps, 'location'>): preact.JSX.Element;
134
+ bottom(reactProps: Omit<DrawerProps, 'location'>): preact.JSX.Element;
135
+ left(reactProps: Omit<DrawerProps, 'location'>): preact.JSX.Element;
136
+ }
137
+ export declare const Drawer: Drawer;
138
+ interface Tabs {
139
+ (reactProps: TabsProps): preact.JSX.Element;
140
+ Section(reactProps: Omit<TabsSectionProps, 'direction'>): preact.JSX.Element;
141
+ }
142
+ export declare const Tabs: Tabs;
143
+ export {};
@@ -0,0 +1,197 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Tabs = exports.Drawer = exports.Accordion = exports.Stack = exports.Slider = exports.Separator = void 0;
4
+ exports.Br = Br;
5
+ exports.Checkbox = Checkbox;
6
+ exports.CollapsibleText = CollapsibleText;
7
+ exports.ConsoleLog = ConsoleLog;
8
+ exports.Digits = Digits;
9
+ exports.H1 = H1;
10
+ exports.H2 = H2;
11
+ exports.H3 = H3;
12
+ exports.H4 = H4;
13
+ exports.H5 = H5;
14
+ exports.H6 = H6;
15
+ exports.Input = Input;
16
+ exports.Space = Space;
17
+ exports.ToggleGroup = ToggleGroup;
18
+ exports.Tree = Tree;
19
+ exports.Box = Box;
20
+ exports.Button = Button;
21
+ exports.Collapsible = Collapsible;
22
+ exports.Scrollable = Scrollable;
23
+ exports.Style = Style;
24
+ exports.Text = Text;
25
+ const jsx_runtime_1 = require("preact/jsx-runtime");
26
+ const hooks_1 = require("preact/hooks");
27
+ ////
28
+ /// Views
29
+ //
30
+ function Br() {
31
+ return (0, jsx_runtime_1.jsx)("tui-br", {});
32
+ }
33
+ function Checkbox(reactProps) {
34
+ return (0, jsx_runtime_1.jsx)("tui-checkbox", { ...reactProps });
35
+ }
36
+ function CollapsibleText(reactProps) {
37
+ return (0, jsx_runtime_1.jsx)("tui-collapsible-text", { ...reactProps });
38
+ }
39
+ function ConsoleLog(reactProps) {
40
+ return (0, jsx_runtime_1.jsx)("tui-console", { ...reactProps });
41
+ }
42
+ function Digits(reactProps) {
43
+ return (0, jsx_runtime_1.jsx)("tui-digits", { ...reactProps });
44
+ }
45
+ function H1(reactProps) {
46
+ return (0, jsx_runtime_1.jsx)("tui-h1", { ...reactProps });
47
+ }
48
+ function H2(reactProps) {
49
+ return (0, jsx_runtime_1.jsx)("tui-h2", { ...reactProps });
50
+ }
51
+ function H3(reactProps) {
52
+ return (0, jsx_runtime_1.jsx)("tui-h3", { ...reactProps });
53
+ }
54
+ function H4(reactProps) {
55
+ return (0, jsx_runtime_1.jsx)("tui-h4", { ...reactProps });
56
+ }
57
+ function H5(reactProps) {
58
+ return (0, jsx_runtime_1.jsx)("tui-h5", { ...reactProps });
59
+ }
60
+ function H6(reactProps) {
61
+ return (0, jsx_runtime_1.jsx)("tui-h6", { ...reactProps });
62
+ }
63
+ function Input(reactProps) {
64
+ return (0, jsx_runtime_1.jsx)("tui-input", { ...reactProps });
65
+ }
66
+ const Separator = function Separator(reactProps) {
67
+ return (0, jsx_runtime_1.jsx)("tui-separator", { ...reactProps });
68
+ };
69
+ exports.Separator = Separator;
70
+ exports.Separator.horizontal = function SeparatorHorizontal(reactProps) {
71
+ return (0, jsx_runtime_1.jsx)("tui-separator", { direction: "horizontal", ...reactProps });
72
+ };
73
+ exports.Separator.vertical = function SeparatorHorizontal(reactProps) {
74
+ return (0, jsx_runtime_1.jsx)("tui-separator", { direction: "vertical", ...reactProps });
75
+ };
76
+ const Slider = function Slider(reactProps) {
77
+ return (0, jsx_runtime_1.jsx)("tui-slider", { ...reactProps });
78
+ };
79
+ exports.Slider = Slider;
80
+ exports.Slider.horizontal = function SliderHorizontal(reactProps) {
81
+ return (0, jsx_runtime_1.jsx)("tui-slider", { direction: "horizontal", ...reactProps });
82
+ };
83
+ exports.Slider.vertical = function SliderHorizontal(reactProps) {
84
+ return (0, jsx_runtime_1.jsx)("tui-slider", { direction: "vertical", ...reactProps });
85
+ };
86
+ function Space(reactProps) {
87
+ return (0, jsx_runtime_1.jsx)("tui-space", { ...reactProps });
88
+ }
89
+ function ToggleGroup(reactProps) {
90
+ return (0, jsx_runtime_1.jsx)("tui-toggle-group", { ...reactProps });
91
+ }
92
+ function Tree(reactProps) {
93
+ const { title, ...props } = reactProps;
94
+ const titleView = (0, hooks_1.useMemo)(() => {
95
+ if (typeof title === 'string') {
96
+ return (0, jsx_runtime_1.jsx)("tui-text", { children: title });
97
+ }
98
+ return title;
99
+ }, [title]);
100
+ return (0, jsx_runtime_1.jsx)("tui-tree", { ...props, children: titleView });
101
+ }
102
+ ////
103
+ /// "Simple" containers
104
+ //
105
+ function Box(reactProps) {
106
+ const { children, ...props } = reactProps;
107
+ return (0, jsx_runtime_1.jsx)("tui-box", { ...props, children: children });
108
+ }
109
+ function Button(reactProps) {
110
+ const { children, ...props } = reactProps;
111
+ return (0, jsx_runtime_1.jsx)("tui-button", { ...props, children: children });
112
+ }
113
+ function Collapsible(reactProps) {
114
+ const { collapsed, expanded, ...props } = reactProps;
115
+ return ((0, jsx_runtime_1.jsxs)("tui-collapsible", { ...props, children: [collapsed, expanded] }));
116
+ }
117
+ const Stack = function Stack(reactProps) {
118
+ const { children, ...props } = reactProps;
119
+ return (0, jsx_runtime_1.jsx)("tui-stack", { ...props, children: children });
120
+ };
121
+ exports.Stack = Stack;
122
+ exports.Stack.down = function StackLeft(reactProps) {
123
+ const { children, ...props } = reactProps;
124
+ return ((0, jsx_runtime_1.jsx)("tui-stack", { direction: "down", ...props, children: children }));
125
+ };
126
+ exports.Stack.up = function StackLeft(reactProps) {
127
+ const { children, ...props } = reactProps;
128
+ return ((0, jsx_runtime_1.jsx)("tui-stack", { direction: "up", ...props, children: children }));
129
+ };
130
+ exports.Stack.right = function StackLeft(reactProps) {
131
+ const { children, ...props } = reactProps;
132
+ return ((0, jsx_runtime_1.jsx)("tui-stack", { direction: "right", ...props, children: children }));
133
+ };
134
+ exports.Stack.left = function StackLeft(reactProps) {
135
+ const { children, ...props } = reactProps;
136
+ return ((0, jsx_runtime_1.jsx)("tui-stack", { direction: "left", ...props, children: children }));
137
+ };
138
+ function Scrollable(reactProps) {
139
+ const { children, ...props } = reactProps;
140
+ return (0, jsx_runtime_1.jsx)("tui-scrollable", { ...props, children: children });
141
+ }
142
+ /**
143
+ * <Style /> is similar to <Text/> but only allows inline styles (bold, etc).
144
+ * Does not support align or wrap (block styles). Does not support 'font', because
145
+ * font is not encodable via SGR codes (and that's how I'm styling and
146
+ * concatenating the text nodes).
147
+ */
148
+ function Style(reactProps) {
149
+ return (0, jsx_runtime_1.jsx)("tui-style", { ...reactProps });
150
+ }
151
+ /**
152
+ * <Text /> is a container that sets the text properties of child TextLiterals
153
+ * (font, style) and TextContainers (wrap, alignment)
154
+ */
155
+ function Text(reactProps) {
156
+ return (0, jsx_runtime_1.jsx)("tui-text", { ...reactProps });
157
+ }
158
+ const Accordion = function Accordion(reactProps) {
159
+ const { children, ...props } = reactProps;
160
+ return (0, jsx_runtime_1.jsx)("tui-accordion", { ...props, children: children });
161
+ };
162
+ exports.Accordion = Accordion;
163
+ exports.Accordion.Section = function SliderHorizontal(reactProps) {
164
+ const { children, ...props } = reactProps;
165
+ return (0, jsx_runtime_1.jsx)("tui-accordion-section", { ...props, children: children });
166
+ };
167
+ const Drawer = function Drawer(reactProps) {
168
+ const { children, content, drawer, ...props } = reactProps;
169
+ return ((0, jsx_runtime_1.jsxs)("tui-drawer", { ...props, children: [content, drawer, children] }));
170
+ };
171
+ exports.Drawer = Drawer;
172
+ exports.Drawer.top = function DrawerLeft(reactProps) {
173
+ const { children, content, drawer, ...props } = reactProps;
174
+ return ((0, jsx_runtime_1.jsxs)("tui-drawer", { location: "top", ...props, children: [content, drawer, children] }));
175
+ };
176
+ exports.Drawer.right = function DrawerLeft(reactProps) {
177
+ const { children, content, drawer, ...props } = reactProps;
178
+ return ((0, jsx_runtime_1.jsxs)("tui-drawer", { location: "right", ...props, children: [content, drawer, children] }));
179
+ };
180
+ exports.Drawer.bottom = function DrawerLeft(reactProps) {
181
+ const { children, ...props } = reactProps;
182
+ return ((0, jsx_runtime_1.jsx)("tui-drawer", { location: "bottom", ...props, children: children }));
183
+ };
184
+ exports.Drawer.left = function DrawerLeft(reactProps) {
185
+ const { children, ...props } = reactProps;
186
+ return ((0, jsx_runtime_1.jsx)("tui-drawer", { location: "left", ...props, children: children }));
187
+ };
188
+ const Tabs = function Tabs(reactProps) {
189
+ const { children, ...props } = reactProps;
190
+ return (0, jsx_runtime_1.jsx)("tui-tabs", { ...props, children: children });
191
+ };
192
+ exports.Tabs = Tabs;
193
+ exports.Tabs.Section = function SliderHorizontal(reactProps) {
194
+ const { children, ...props } = reactProps;
195
+ return (0, jsx_runtime_1.jsx)("tui-tabs-section", { ...props, children: children });
196
+ };
197
+ //# sourceMappingURL=components.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.js","sourceRoot":"","sources":["../lib/components.tsx"],"names":[],"mappings":";;;AA2HA,gBAEC;AACD,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EAAE,GAAG,KAAK,EAAC,GAAG,UAAU,CAAA;IACvC,OAAO,CACL,uCAAY,QAAQ,EAAC,MAAM,KAAK,KAAK,YAClC,QAAQ,GACE,CACd,CAAA;AACH,CAAC,CAAA;AAMM,MAAM,IAAI,GAAS,SAAS,IAAI,CACrC,UAAqB;IAErB,MAAM,EAAC,QAAQ,EAAE,GAAG,KAAK,EAAC,GAAG,UAAU,CAAA;IACvC,OAAO,wCAAc,KAAK,YAAG,QAAQ,GAAY,CAAA;AACnD,CAAC,CAAA;AALY,QAAA,IAAI,QAKhB;AACD,YAAI,CAAC,OAAO,GAAG,SAAS,gBAAgB,CACtC,UAA+C;IAE/C,MAAM,EAAC,QAAQ,EAAE,GAAG,KAAK,EAAC,GAAG,UAAU,CAAA;IACvC,OAAO,gDAAsB,KAAK,YAAG,QAAQ,GAAoB,CAAA;AACnE,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './preact';
2
+ export * from './components';
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("./preact"), 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,2CAAwB;AACxB,+CAA4B"}
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import { ViewProps } from '@teaui/core';
3
+ import type { CheckboxProps, CollapsibleTextProps, ConsoleProps, DigitsProps, HeaderProps, InputProps, SeparatorProps, SliderProps, SpaceProps, ToggleGroupProps, BoxProps, ButtonProps, CollapsibleProps, ScrollableProps, StackProps, StyleProps, TextProps, AccordionProps, AccordionSectionProps, DrawerProps, TabsProps, TabsSectionProps } from './components';
4
+ declare module 'react' {
5
+ namespace preact.JSX {
6
+ interface IntrinsicElements {
7
+ 'tui-br': {};
8
+ 'tui-checkbox': CheckboxProps;
9
+ 'tui-collapsible-text': CollapsibleTextProps;
10
+ 'tui-console': ConsoleProps;
11
+ 'tui-digits': DigitsProps;
12
+ 'tui-h1': HeaderProps;
13
+ 'tui-h2': HeaderProps;
14
+ 'tui-h3': HeaderProps;
15
+ 'tui-h4': HeaderProps;
16
+ 'tui-h5': HeaderProps;
17
+ 'tui-h6': HeaderProps;
18
+ 'tui-input': InputProps;
19
+ 'tui-separator': SeparatorProps;
20
+ 'tui-slider': SliderProps;
21
+ 'tui-space': SpaceProps;
22
+ 'tui-toggle-group': ToggleGroupProps;
23
+ 'tui-tree': ViewProps;
24
+ 'tui-box': BoxProps;
25
+ 'tui-button': ButtonProps;
26
+ 'tui-collapsible': CollapsibleProps;
27
+ 'tui-scrollable': ScrollableProps;
28
+ 'tui-stack': StackProps;
29
+ 'tui-style': StyleProps;
30
+ 'tui-text': TextProps;
31
+ 'tui-accordion': AccordionProps;
32
+ 'tui-accordion-section': AccordionSectionProps;
33
+ 'tui-drawer': DrawerProps;
34
+ 'tui-tabs': TabsProps;
35
+ 'tui-tabs-section': TabsSectionProps;
36
+ }
37
+ }
38
+ }
39
+ export declare function run(component: React.ReactNode): Promise<void>;
@@ -0,0 +1,297 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.run = run;
4
+ const preact_1 = require("preact");
5
+ const core_1 = require("@teaui/core");
6
+ const TextReact_1 = require("./components/TextReact");
7
+ function createView(type, props) {
8
+ switch (type) {
9
+ case 'text':
10
+ return new TextReact_1.TextLiteral(String(props.text) ?? '');
11
+ case 'br':
12
+ case 'tui-br':
13
+ return new TextReact_1.TextLiteral('\n');
14
+ case 'checkbox':
15
+ case 'tui-checkbox':
16
+ return new core_1.Checkbox(props);
17
+ case 'collapsible-text':
18
+ case 'tui-collapsible-text':
19
+ return new core_1.CollapsibleText(props);
20
+ case 'console':
21
+ case 'tui-console':
22
+ return new core_1.ConsoleLog(props);
23
+ case 'digits':
24
+ case 'tui-digits':
25
+ return new core_1.Digits(props);
26
+ case 'h1':
27
+ case 'tui-h1':
28
+ return (0, core_1.H1)(props.text ?? '');
29
+ case 'h2':
30
+ case 'tui-h2':
31
+ return (0, core_1.H2)(props.text ?? '');
32
+ case 'h3':
33
+ case 'tui-h3':
34
+ return (0, core_1.H3)(props.text ?? '');
35
+ case 'h4':
36
+ case 'tui-h4':
37
+ return (0, core_1.H4)(props.text ?? '');
38
+ case 'h5':
39
+ case 'tui-h5':
40
+ return (0, core_1.H5)(props.text ?? '');
41
+ case 'h6':
42
+ case 'tui-h6':
43
+ return (0, core_1.H6)(props.text ?? '');
44
+ case 'toggle-group':
45
+ case 'tui-toggle-group':
46
+ return new core_1.ToggleGroup(props);
47
+ case 'input':
48
+ case 'tui-input':
49
+ return new core_1.Input(props);
50
+ case 'literal':
51
+ case 'tui-literal':
52
+ return new TextReact_1.TextLiteral(props.text ?? '');
53
+ case 'separator':
54
+ case 'tui-separator':
55
+ return new core_1.Separator(props);
56
+ case 'slider':
57
+ case 'tui-slider':
58
+ return new core_1.Slider(props);
59
+ case 'space':
60
+ case 'tui-space':
61
+ return new core_1.Space(props);
62
+ // case 'Tree':
63
+ // return
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 'scrollable':
74
+ case 'tui-scrollable':
75
+ return new core_1.Scrollable(props);
76
+ case 'stack':
77
+ case 'tui-stack':
78
+ return new core_1.Stack(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
+ case 'accordion':
85
+ case 'tui-accordion':
86
+ return new core_1.Accordion(props);
87
+ case 'accordion-section':
88
+ case 'tui-accordion-section':
89
+ return new core_1.Accordion.Section(props);
90
+ case 'drawer':
91
+ case 'tui-drawer':
92
+ return new core_1.Drawer(props);
93
+ case 'tabs':
94
+ case 'tui-tabs':
95
+ return new core_1.Tabs(props);
96
+ case 'tabs-section':
97
+ case 'tui-tabs-section':
98
+ return new core_1.Tabs.Section(props);
99
+ case 'window':
100
+ case 'tui-window':
101
+ return new core_1.Window(props);
102
+ default:
103
+ throw Error(`Unknown type ${type}`);
104
+ }
105
+ }
106
+ const defer = Promise.prototype.then.bind(Promise.resolve());
107
+ function removeFromTextContainer(container, child) {
108
+ // find TextContainer with child in it, and remove
109
+ for (const node of container.children) {
110
+ if (node instanceof TextReact_1.TextContainer && node.children.includes(child)) {
111
+ node.removeChild(child);
112
+ if (node.children.length === 0) {
113
+ container.removeChild(node);
114
+ }
115
+ return;
116
+ }
117
+ }
118
+ }
119
+ function removeChild(container, child) {
120
+ if (child.parent === container) {
121
+ container.removeChild(child);
122
+ }
123
+ else if (child instanceof TextReact_1.TextLiteral || child instanceof TextReact_1.TextStyle) {
124
+ removeFromTextContainer(container, child);
125
+ }
126
+ }
127
+ function appendChild(parentInstance, child, before) {
128
+ if (parentInstance instanceof TextReact_1.TextStyle &&
129
+ (child instanceof TextReact_1.TextLiteral || child instanceof TextReact_1.TextStyle)) {
130
+ // do not do the TextContainer song and dance
131
+ }
132
+ else if (child instanceof TextReact_1.TextLiteral || child instanceof TextReact_1.TextStyle) {
133
+ // find the last child (checking 'before')
134
+ let lastChild = parentInstance.children.at(-1);
135
+ if (before) {
136
+ const index = parentInstance.children.indexOf(before);
137
+ if (~index) {
138
+ lastChild = parentInstance.children.at(index - 1);
139
+ }
140
+ }
141
+ let textContainer;
142
+ if (lastChild instanceof TextReact_1.TextContainer) {
143
+ textContainer = lastChild;
144
+ }
145
+ else {
146
+ textContainer = new TextReact_1.TextContainer();
147
+ parentInstance.add(textContainer);
148
+ }
149
+ textContainer.add(child);
150
+ return;
151
+ }
152
+ let index = before
153
+ ? parentInstance.children.indexOf(before)
154
+ : -1;
155
+ if (index === -1) {
156
+ index = undefined;
157
+ }
158
+ parentInstance.add(child, index);
159
+ }
160
+ class RendererElement {
161
+ renderer;
162
+ localName;
163
+ parentNode = null;
164
+ nextSibling = null;
165
+ previousSibling = null;
166
+ firstChild = null;
167
+ lastChild = null;
168
+ props = {};
169
+ prevProps;
170
+ node;
171
+ nodeType = '';
172
+ constructor(renderer, localName) {
173
+ this.renderer = renderer;
174
+ this.localName = localName;
175
+ this._commit = this._commit.bind(this);
176
+ }
177
+ set data(text) {
178
+ this.setAttribute('text', String(text));
179
+ }
180
+ addEventListener(event, func) {
181
+ this.setAttribute(`on${event}`, (...args) => this.l[event + false](...args));
182
+ }
183
+ setAttribute(name, value) {
184
+ if (this.node && !this.prevProps) {
185
+ this.prevProps = Object.assign({}, this.props);
186
+ defer(this._commit);
187
+ }
188
+ this.props[name] = value;
189
+ }
190
+ removeAttribute(name) {
191
+ delete this.props[name];
192
+ }
193
+ _attach() {
194
+ return (this.node ||= this.renderer.create(this.localName, this.props));
195
+ }
196
+ _commit() {
197
+ const state = this.node;
198
+ const prev = this.prevProps;
199
+ if (!state || !prev)
200
+ return;
201
+ this.prevProps = undefined;
202
+ this.renderer.update(state, this.props);
203
+ }
204
+ insertBefore(child, before) {
205
+ if (child.parentNode === this)
206
+ this.removeChild(child);
207
+ if (before) {
208
+ const prev = before.previousSibling;
209
+ child.previousSibling = prev;
210
+ before.previousSibling = child;
211
+ if (prev) {
212
+ prev.nextSibling = child;
213
+ }
214
+ if (before == this.firstChild) {
215
+ this.firstChild = child;
216
+ }
217
+ }
218
+ else {
219
+ const last = this.lastChild;
220
+ child.previousSibling = last;
221
+ this.lastChild = child;
222
+ if (last)
223
+ last.nextSibling = child;
224
+ if (!this.firstChild)
225
+ this.firstChild = child;
226
+ }
227
+ child.parentNode = this;
228
+ child.nextSibling = before ?? null;
229
+ this.renderer.insert(this._attach(), child._attach(), before && before._attach());
230
+ }
231
+ appendChild(child) {
232
+ this.insertBefore(child);
233
+ }
234
+ removeChild(child) {
235
+ if (this.firstChild === child)
236
+ this.firstChild = child.nextSibling;
237
+ if (this.lastChild === child)
238
+ this.lastChild = child.previousSibling;
239
+ child.parentNode = child.nextSibling = child.previousSibling = null;
240
+ if (this.node && child.node) {
241
+ this.renderer.remove(this.node, child.node);
242
+ }
243
+ }
244
+ }
245
+ function createRendererDom(renderer) {
246
+ function createElement(type) {
247
+ return new RendererElement(renderer, type);
248
+ }
249
+ function createElementNS(_, type) {
250
+ return new RendererElement(renderer, type);
251
+ }
252
+ function createTextNode(text) {
253
+ const node = createElement('text');
254
+ node.props.text = String(text);
255
+ return node;
256
+ }
257
+ function createRoot() {
258
+ return createElement('tui-window');
259
+ }
260
+ return { createElement, createElementNS, createTextNode, createRoot };
261
+ }
262
+ const dom = createRendererDom({
263
+ create(type, props) {
264
+ return createView(type, props);
265
+ },
266
+ insert(parent, node, before) {
267
+ if (!(parent instanceof core_1.Container)) {
268
+ return;
269
+ }
270
+ appendChild(parent, node, before);
271
+ },
272
+ remove(parent, node) {
273
+ if (!(parent instanceof core_1.Container)) {
274
+ return;
275
+ }
276
+ removeChild(parent, node);
277
+ },
278
+ update(node, props) {
279
+ if (node instanceof TextReact_1.TextLiteral) {
280
+ node.update(props);
281
+ node.text = props.text ?? '';
282
+ }
283
+ else {
284
+ node.update(props);
285
+ }
286
+ },
287
+ });
288
+ Object.assign(global, { document: {} });
289
+ Object.assign(document, dom);
290
+ async function run(component) {
291
+ const root = dom.createRoot();
292
+ (0, preact_1.render)(component, root);
293
+ const window = root.node;
294
+ const start = await core_1.Screen.start(window);
295
+ const [screen, _] = start;
296
+ }
297
+ //# sourceMappingURL=preact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preact.js","sourceRoot":"","sources":["../lib/preact.tsx"],"names":[],"mappings":";;AAgaA,kBAOC;AAtaD,mCAA0C;AAC1C,sCA6BoB;AACpB,sDAK+B;AAsE/B,SAAS,UAAU,CAAC,IAAY,EAAE,KAAY;IAC5C,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,MAAM;YACT,OAAO,IAAI,uBAAW,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;QAClD,KAAK,IAAI,CAAC;QACV,KAAK,QAAQ;YACX,OAAO,IAAI,uBAAW,CAAC,IAAI,CAAC,CAAA;QAC9B,KAAK,UAAU,CAAC;QAChB,KAAK,cAAc;YACjB,OAAO,IAAI,eAAU,CAAC,KAAY,CAAC,CAAA;QACrC,KAAK,kBAAkB,CAAC;QACxB,KAAK,sBAAsB;YACzB,OAAO,IAAI,sBAAiB,CAAC,KAAY,CAAC,CAAA;QAC5C,KAAK,SAAS,CAAC;QACf,KAAK,aAAa;YAChB,OAAO,IAAI,iBAAY,CAAC,KAAY,CAAC,CAAA;QACvC,KAAK,QAAQ,CAAC;QACd,KAAK,YAAY;YACf,OAAO,IAAI,aAAQ,CAAC,KAAY,CAAC,CAAA;QACnC,KAAK,IAAI,CAAC;QACV,KAAK,QAAQ;YACX,OAAO,IAAA,SAAE,EAAG,KAAa,CAAC,IAAe,IAAI,EAAE,CAAC,CAAA;QAClD,KAAK,IAAI,CAAC;QACV,KAAK,QAAQ;YACX,OAAO,IAAA,SAAE,EAAG,KAAa,CAAC,IAAe,IAAI,EAAE,CAAC,CAAA;QAClD,KAAK,IAA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,CAAA;IACnC,CAAC;IACD,MAAM,CAAC,MAAM,EAAE,IAAI;QACjB,IAAI,CAAC,CAAC,MAAM,YAAY,gBAAS,CAAC,EAAE,CAAC;YACnC,OAAM;QACR,CAAC;QACD,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAC3B,CAAC;IACD,MAAM,CAAC,IAAI,EAAE,KAAK;QAChB,IAAI,IAAI,YAAY,uBAAW,EAAE,CAAC;YAChC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YAClB,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,EAAE,CAAA;QAC9B,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACpB,CAAC;IACH,CAAC;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,EAAE,EAAC,CAAC,CAAA;AACrC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;AAErB,KAAK,UAAU,GAAG,CAAC,SAA0B;IAClD,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,EAAE,CAAA;IAE7B,IAAA,eAAM,EAAC,SAAS,EAAE,IAAW,CAAC,CAAA;IAC9B,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAA;IACxB,MAAM,KAAK,GAAG,MAAM,aAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IACxC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,KAAK,CAAA;AAC3B,CAAC"}
package/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+ TeaUI
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 React, {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,50 @@
1
+ {
2
+ "name": "@teaui/preact",
3
+ "description": "Preact renderer for TeaUI",
4
+ "author": "Colin T.A. Gray <colinta@colinta.com>",
5
+ "contributors": [],
6
+ "version": "1.1.4",
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
+ "dependencies": {
40
+ "preact": "^10.24.3",
41
+ "@teaui/core": "^1.1.4"
42
+ },
43
+ "devDependencies": {
44
+ "@teaui/shared": "1.1.4"
45
+ },
46
+ "scripts": {
47
+ "clean": "rm -rf .dist/",
48
+ "build": "pnpm clean && pnpm tsc"
49
+ }
50
+ }