@opentui/solid 0.2.13 → 0.2.15
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/README.md +2 -0
- package/chunk-7fkmdv3h.js +110 -0
- package/components.d.ts +2 -0
- package/components.js +9 -0
- package/dist/chunk-7fkmdv3h.d.ts +81 -0
- package/dist/index.d.ts +16 -83
- package/index.js +15 -112
- package/package.json +7 -2
- package/src/elements/catalogue.d.ts +69 -0
- package/src/elements/index.d.ts +1 -69
package/README.md
CHANGED
|
@@ -165,6 +165,8 @@ import { Dynamic } from "@opentui/solid"
|
|
|
165
165
|
- `scrollbox`: scrollable container
|
|
166
166
|
- `ascii_font`: ASCII art text renderer
|
|
167
167
|
|
|
168
|
+
QR code support is available from `@opentui/qrcode/solid` and must be registered explicitly with `registerQRCode()`.
|
|
169
|
+
|
|
168
170
|
### Input
|
|
169
171
|
|
|
170
172
|
- `input`: single-line text input
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/elements/catalogue.ts
|
|
3
|
+
import {
|
|
4
|
+
ASCIIFontRenderable,
|
|
5
|
+
BoxRenderable,
|
|
6
|
+
CodeRenderable,
|
|
7
|
+
DiffRenderable,
|
|
8
|
+
InputRenderable,
|
|
9
|
+
LineNumberRenderable,
|
|
10
|
+
MarkdownRenderable,
|
|
11
|
+
ScrollBoxRenderable,
|
|
12
|
+
SelectRenderable,
|
|
13
|
+
TabSelectRenderable,
|
|
14
|
+
TextareaRenderable,
|
|
15
|
+
TextAttributes,
|
|
16
|
+
TextNodeRenderable,
|
|
17
|
+
TextRenderable
|
|
18
|
+
} from "@opentui/core";
|
|
19
|
+
|
|
20
|
+
class SpanRenderable extends TextNodeRenderable {
|
|
21
|
+
_ctx;
|
|
22
|
+
constructor(_ctx, options) {
|
|
23
|
+
super(options);
|
|
24
|
+
this._ctx = _ctx;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
var textNodeKeys = ["span", "b", "strong", "i", "em", "u", "a"];
|
|
28
|
+
|
|
29
|
+
class TextModifierRenderable extends SpanRenderable {
|
|
30
|
+
constructor(options, modifier) {
|
|
31
|
+
super(null, options);
|
|
32
|
+
if (modifier === "b" || modifier === "strong") {
|
|
33
|
+
this.attributes = (this.attributes || 0) | TextAttributes.BOLD;
|
|
34
|
+
} else if (modifier === "i" || modifier === "em") {
|
|
35
|
+
this.attributes = (this.attributes || 0) | TextAttributes.ITALIC;
|
|
36
|
+
} else if (modifier === "u") {
|
|
37
|
+
this.attributes = (this.attributes || 0) | TextAttributes.UNDERLINE;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
class BoldSpanRenderable extends TextModifierRenderable {
|
|
43
|
+
constructor(options) {
|
|
44
|
+
super(options, "b");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
class ItalicSpanRenderable extends TextModifierRenderable {
|
|
49
|
+
constructor(options) {
|
|
50
|
+
super(options, "i");
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
class UnderlineSpanRenderable extends TextModifierRenderable {
|
|
55
|
+
constructor(options) {
|
|
56
|
+
super(options, "u");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
class LineBreakRenderable extends SpanRenderable {
|
|
61
|
+
constructor(_ctx, options) {
|
|
62
|
+
super(null, options);
|
|
63
|
+
this.add();
|
|
64
|
+
}
|
|
65
|
+
add() {
|
|
66
|
+
return super.add(`
|
|
67
|
+
`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
class LinkRenderable extends SpanRenderable {
|
|
72
|
+
constructor(_ctx, options) {
|
|
73
|
+
const linkOptions = {
|
|
74
|
+
...options,
|
|
75
|
+
link: { url: options.href }
|
|
76
|
+
};
|
|
77
|
+
super(null, linkOptions);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
var baseComponents = {
|
|
81
|
+
box: BoxRenderable,
|
|
82
|
+
text: TextRenderable,
|
|
83
|
+
input: InputRenderable,
|
|
84
|
+
select: SelectRenderable,
|
|
85
|
+
textarea: TextareaRenderable,
|
|
86
|
+
ascii_font: ASCIIFontRenderable,
|
|
87
|
+
tab_select: TabSelectRenderable,
|
|
88
|
+
scrollbox: ScrollBoxRenderable,
|
|
89
|
+
code: CodeRenderable,
|
|
90
|
+
diff: DiffRenderable,
|
|
91
|
+
line_number: LineNumberRenderable,
|
|
92
|
+
markdown: MarkdownRenderable,
|
|
93
|
+
span: SpanRenderable,
|
|
94
|
+
strong: BoldSpanRenderable,
|
|
95
|
+
b: BoldSpanRenderable,
|
|
96
|
+
em: ItalicSpanRenderable,
|
|
97
|
+
i: ItalicSpanRenderable,
|
|
98
|
+
u: UnderlineSpanRenderable,
|
|
99
|
+
br: LineBreakRenderable,
|
|
100
|
+
a: LinkRenderable
|
|
101
|
+
};
|
|
102
|
+
var componentCatalogue = { ...baseComponents };
|
|
103
|
+
function extend(objects) {
|
|
104
|
+
Object.assign(componentCatalogue, objects);
|
|
105
|
+
}
|
|
106
|
+
function getComponentCatalogue() {
|
|
107
|
+
return componentCatalogue;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export { textNodeKeys, BoldSpanRenderable, ItalicSpanRenderable, UnderlineSpanRenderable, LineBreakRenderable, LinkRenderable, baseComponents, componentCatalogue, extend, getComponentCatalogue };
|
package/components.d.ts
ADDED
package/components.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export var textNodeKeys: string[];
|
|
2
|
+
export class BoldSpanRenderable extends TextModifierRenderable {
|
|
3
|
+
constructor(options: any);
|
|
4
|
+
}
|
|
5
|
+
export class ItalicSpanRenderable extends TextModifierRenderable {
|
|
6
|
+
constructor(options: any);
|
|
7
|
+
}
|
|
8
|
+
export class UnderlineSpanRenderable extends TextModifierRenderable {
|
|
9
|
+
constructor(options: any);
|
|
10
|
+
}
|
|
11
|
+
export class LineBreakRenderable extends SpanRenderable {
|
|
12
|
+
add(): number;
|
|
13
|
+
}
|
|
14
|
+
export class LinkRenderable extends SpanRenderable {
|
|
15
|
+
}
|
|
16
|
+
export namespace baseComponents {
|
|
17
|
+
export { BoxRenderable as box };
|
|
18
|
+
export { TextRenderable as text };
|
|
19
|
+
export { InputRenderable as input };
|
|
20
|
+
export { SelectRenderable as select };
|
|
21
|
+
export { TextareaRenderable as textarea };
|
|
22
|
+
export { ASCIIFontRenderable as ascii_font };
|
|
23
|
+
export { TabSelectRenderable as tab_select };
|
|
24
|
+
export { ScrollBoxRenderable as scrollbox };
|
|
25
|
+
export { CodeRenderable as code };
|
|
26
|
+
export { DiffRenderable as diff };
|
|
27
|
+
export { LineNumberRenderable as line_number };
|
|
28
|
+
export { MarkdownRenderable as markdown };
|
|
29
|
+
export { SpanRenderable as span };
|
|
30
|
+
export { BoldSpanRenderable as strong };
|
|
31
|
+
export { BoldSpanRenderable as b };
|
|
32
|
+
export { ItalicSpanRenderable as em };
|
|
33
|
+
export { ItalicSpanRenderable as i };
|
|
34
|
+
export { UnderlineSpanRenderable as u };
|
|
35
|
+
export { LineBreakRenderable as br };
|
|
36
|
+
export { LinkRenderable as a };
|
|
37
|
+
}
|
|
38
|
+
export namespace componentCatalogue { }
|
|
39
|
+
export function extend(objects: any): void;
|
|
40
|
+
export function getComponentCatalogue(): {
|
|
41
|
+
box: typeof BoxRenderable;
|
|
42
|
+
text: typeof TextRenderable;
|
|
43
|
+
input: typeof InputRenderable;
|
|
44
|
+
select: typeof SelectRenderable;
|
|
45
|
+
textarea: typeof TextareaRenderable;
|
|
46
|
+
ascii_font: typeof ASCIIFontRenderable;
|
|
47
|
+
tab_select: typeof TabSelectRenderable;
|
|
48
|
+
scrollbox: typeof ScrollBoxRenderable;
|
|
49
|
+
code: typeof CodeRenderable;
|
|
50
|
+
diff: typeof DiffRenderable;
|
|
51
|
+
line_number: typeof LineNumberRenderable;
|
|
52
|
+
markdown: typeof MarkdownRenderable;
|
|
53
|
+
span: typeof SpanRenderable;
|
|
54
|
+
strong: typeof BoldSpanRenderable;
|
|
55
|
+
b: typeof BoldSpanRenderable;
|
|
56
|
+
em: typeof ItalicSpanRenderable;
|
|
57
|
+
i: typeof ItalicSpanRenderable;
|
|
58
|
+
u: typeof UnderlineSpanRenderable;
|
|
59
|
+
br: typeof LineBreakRenderable;
|
|
60
|
+
a: typeof LinkRenderable;
|
|
61
|
+
};
|
|
62
|
+
declare class TextModifierRenderable extends SpanRenderable {
|
|
63
|
+
}
|
|
64
|
+
declare class SpanRenderable extends TextNodeRenderable {
|
|
65
|
+
constructor(_ctx: any, options: any);
|
|
66
|
+
_ctx: any;
|
|
67
|
+
}
|
|
68
|
+
import { BoxRenderable } from "@opentui/core";
|
|
69
|
+
import { TextRenderable } from "@opentui/core";
|
|
70
|
+
import { InputRenderable } from "@opentui/core";
|
|
71
|
+
import { SelectRenderable } from "@opentui/core";
|
|
72
|
+
import { TextareaRenderable } from "@opentui/core";
|
|
73
|
+
import { ASCIIFontRenderable } from "@opentui/core";
|
|
74
|
+
import { TabSelectRenderable } from "@opentui/core";
|
|
75
|
+
import { ScrollBoxRenderable } from "@opentui/core";
|
|
76
|
+
import { CodeRenderable } from "@opentui/core";
|
|
77
|
+
import { DiffRenderable } from "@opentui/core";
|
|
78
|
+
import { LineNumberRenderable } from "@opentui/core";
|
|
79
|
+
import { MarkdownRenderable } from "@opentui/core";
|
|
80
|
+
import { TextNodeRenderable } from "@opentui/core";
|
|
81
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export function usePaste(callback: any): void;
|
|
|
10
10
|
export function useKeyboard(callback: any, options: any): void;
|
|
11
11
|
export function useKeyHandler(callback: any, options: any): void;
|
|
12
12
|
export function use(fn: any, element: any, arg: any): any;
|
|
13
|
-
|
|
13
|
+
import { textNodeKeys } from "./chunk-7fkmdv3h.js";
|
|
14
14
|
export function testRender(node: any, renderConfig?: {}): Promise<{
|
|
15
15
|
renderer: import("@opentui/core/testing").TestRenderer;
|
|
16
16
|
mockInput: import("@opentui/core/testing").MockInput;
|
|
@@ -30,29 +30,8 @@ declare var mergeProps3: typeof mergeProps;
|
|
|
30
30
|
declare function memo2(fn: any): import("solid-js").Accessor<any>;
|
|
31
31
|
export var insertNode: any;
|
|
32
32
|
export function insert(parent: any, accessor: any, marker: any, initial: any): any;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
text: typeof TextRenderable3;
|
|
36
|
-
input: typeof InputRenderable2;
|
|
37
|
-
select: typeof SelectRenderable2;
|
|
38
|
-
textarea: typeof TextareaRenderable;
|
|
39
|
-
ascii_font: typeof ASCIIFontRenderable;
|
|
40
|
-
tab_select: typeof TabSelectRenderable2;
|
|
41
|
-
scrollbox: typeof ScrollBoxRenderable2;
|
|
42
|
-
code: typeof CodeRenderable;
|
|
43
|
-
diff: typeof DiffRenderable;
|
|
44
|
-
line_number: typeof LineNumberRenderable;
|
|
45
|
-
markdown: typeof MarkdownRenderable;
|
|
46
|
-
span: typeof SpanRenderable;
|
|
47
|
-
strong: typeof BoldSpanRenderable;
|
|
48
|
-
b: typeof BoldSpanRenderable;
|
|
49
|
-
em: typeof ItalicSpanRenderable;
|
|
50
|
-
i: typeof ItalicSpanRenderable;
|
|
51
|
-
u: typeof UnderlineSpanRenderable;
|
|
52
|
-
br: typeof LineBreakRenderable;
|
|
53
|
-
a: typeof LinkRenderable;
|
|
54
|
-
};
|
|
55
|
-
export function extend(objects: any): void;
|
|
33
|
+
import { getComponentCatalogue } from "./chunk-7fkmdv3h.js";
|
|
34
|
+
import { extend } from "./chunk-7fkmdv3h.js";
|
|
56
35
|
export var effect: typeof createRenderEffect;
|
|
57
36
|
export var createTextNode: any;
|
|
58
37
|
export function createSolidSlotRegistry(renderer: any, context: any, options?: {}): import("@opentui/core").SlotRegistry<any, object, any>;
|
|
@@ -70,35 +49,12 @@ export function createScrollbackWriter(node: any, options?: {}): (ctx: any) => {
|
|
|
70
49
|
export var createElement: any;
|
|
71
50
|
export function createDynamic(component: any, props: any): import("solid-js").Accessor<any>;
|
|
72
51
|
declare var createComponent2: typeof createComponent;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
export { TextRenderable3 as text };
|
|
76
|
-
export { InputRenderable2 as input };
|
|
77
|
-
export { SelectRenderable2 as select };
|
|
78
|
-
export { TextareaRenderable as textarea };
|
|
79
|
-
export { ASCIIFontRenderable as ascii_font };
|
|
80
|
-
export { TabSelectRenderable2 as tab_select };
|
|
81
|
-
export { ScrollBoxRenderable2 as scrollbox };
|
|
82
|
-
export { CodeRenderable as code };
|
|
83
|
-
export { DiffRenderable as diff };
|
|
84
|
-
export { LineNumberRenderable as line_number };
|
|
85
|
-
export { MarkdownRenderable as markdown };
|
|
86
|
-
export { SpanRenderable as span };
|
|
87
|
-
export { BoldSpanRenderable as strong };
|
|
88
|
-
export { BoldSpanRenderable as b };
|
|
89
|
-
export { ItalicSpanRenderable as em };
|
|
90
|
-
export { ItalicSpanRenderable as i };
|
|
91
|
-
export { UnderlineSpanRenderable as u };
|
|
92
|
-
export { LineBreakRenderable as br };
|
|
93
|
-
export { LinkRenderable as a };
|
|
94
|
-
}
|
|
95
|
-
export namespace baseComponents { }
|
|
52
|
+
import { componentCatalogue } from "./chunk-7fkmdv3h.js";
|
|
53
|
+
import { baseComponents } from "./chunk-7fkmdv3h.js";
|
|
96
54
|
export function _render(code: any, element: any): undefined;
|
|
97
|
-
|
|
98
|
-
constructor(options: any);
|
|
99
|
-
}
|
|
55
|
+
import { UnderlineSpanRenderable } from "./chunk-7fkmdv3h.js";
|
|
100
56
|
export function TimeToFirstDraw(props: any): any;
|
|
101
|
-
export class TextSlotRenderable extends
|
|
57
|
+
export class TextSlotRenderable extends TextNodeRenderable {
|
|
102
58
|
constructor(id: any, parent: any);
|
|
103
59
|
slotParent: any;
|
|
104
60
|
destroyed: boolean;
|
|
@@ -113,7 +69,7 @@ export class SlotRenderable extends SlotBaseRenderable {
|
|
|
113
69
|
textNodeCount: number;
|
|
114
70
|
get layoutNode(): any;
|
|
115
71
|
get textNode(): any;
|
|
116
|
-
isTextSlotParent(parent: any): parent is
|
|
72
|
+
isTextSlotParent(parent: any): parent is TextRenderable | TextNodeRenderable;
|
|
117
73
|
getCurrentSlotChild(nodesByParent: any): any;
|
|
118
74
|
getTextNodeForParent(parent: any): any;
|
|
119
75
|
getLayoutNodeForParent(parent: any): any;
|
|
@@ -130,11 +86,8 @@ export class SlotRenderable extends SlotBaseRenderable {
|
|
|
130
86
|
export function Slot(props: any): import("solid-js").Accessor<any>;
|
|
131
87
|
export var RendererContext: import("solid-js").Context<any>;
|
|
132
88
|
export function Portal(props: any): SlotRenderable;
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
export class LineBreakRenderable extends SpanRenderable {
|
|
136
|
-
add(): number;
|
|
137
|
-
}
|
|
89
|
+
import { LinkRenderable } from "./chunk-7fkmdv3h.js";
|
|
90
|
+
import { LineBreakRenderable } from "./chunk-7fkmdv3h.js";
|
|
138
91
|
export class LayoutSlotRenderable extends SlotBaseRenderable {
|
|
139
92
|
constructor(id: any, parent: any, layoutParent: any);
|
|
140
93
|
yogaNode: any;
|
|
@@ -151,36 +104,15 @@ export class LayoutSlotRenderable extends SlotBaseRenderable {
|
|
|
151
104
|
freeYogaNode(): void;
|
|
152
105
|
disposeWithoutSlotCascade(): void;
|
|
153
106
|
}
|
|
154
|
-
|
|
155
|
-
constructor(options: any);
|
|
156
|
-
}
|
|
107
|
+
import { ItalicSpanRenderable } from "./chunk-7fkmdv3h.js";
|
|
157
108
|
export function Dynamic(props: any): import("solid-js").Accessor<any>;
|
|
158
|
-
|
|
159
|
-
constructor(options: any);
|
|
160
|
-
}
|
|
109
|
+
import { BoldSpanRenderable } from "./chunk-7fkmdv3h.js";
|
|
161
110
|
import { Timeline } from "@opentui/core";
|
|
162
111
|
import { mergeProps } from "solid-js";
|
|
163
|
-
import { BoxRenderable } from "@opentui/core";
|
|
164
|
-
import { TextRenderable as TextRenderable3 } from "@opentui/core";
|
|
165
|
-
import { InputRenderable as InputRenderable2 } from "@opentui/core";
|
|
166
|
-
import { SelectRenderable as SelectRenderable2 } from "@opentui/core";
|
|
167
|
-
import { TextareaRenderable } from "@opentui/core";
|
|
168
|
-
import { ASCIIFontRenderable } from "@opentui/core";
|
|
169
|
-
import { TabSelectRenderable as TabSelectRenderable2 } from "@opentui/core";
|
|
170
|
-
import { ScrollBoxRenderable as ScrollBoxRenderable2 } from "@opentui/core";
|
|
171
|
-
import { CodeRenderable } from "@opentui/core";
|
|
172
|
-
import { DiffRenderable } from "@opentui/core";
|
|
173
|
-
import { LineNumberRenderable } from "@opentui/core";
|
|
174
|
-
import { MarkdownRenderable } from "@opentui/core";
|
|
175
|
-
declare class SpanRenderable extends TextNodeRenderable3 {
|
|
176
|
-
constructor(_ctx: any, options: any);
|
|
177
|
-
_ctx: any;
|
|
178
|
-
}
|
|
179
112
|
import { createRenderEffect } from "solid-js";
|
|
113
|
+
import { BoxRenderable } from "@opentui/core";
|
|
180
114
|
import { createComponent } from "solid-js";
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
import { TextNodeRenderable as TextNodeRenderable3 } from "@opentui/core";
|
|
115
|
+
import { TextNodeRenderable } from "@opentui/core";
|
|
184
116
|
declare class SlotBaseRenderable extends BaseRenderable {
|
|
185
117
|
constructor(id: any);
|
|
186
118
|
add(obj: any, index: any): void;
|
|
@@ -189,5 +121,6 @@ declare class SlotBaseRenderable extends BaseRenderable {
|
|
|
189
121
|
getRenderable(id: any): void;
|
|
190
122
|
findDescendantById(id: any): void;
|
|
191
123
|
}
|
|
124
|
+
import { TextRenderable } from "@opentui/core";
|
|
192
125
|
import { BaseRenderable } from "@opentui/core";
|
|
193
|
-
export { mergeProps3 as mergeProps, memo2 as memo, createComponent2 as createComponent };
|
|
126
|
+
export { textNodeKeys, mergeProps3 as mergeProps, memo2 as memo, getComponentCatalogue, extend, createComponent2 as createComponent, componentCatalogue, baseComponents, UnderlineSpanRenderable, LinkRenderable, LineBreakRenderable, ItalicSpanRenderable, BoldSpanRenderable };
|
package/index.js
CHANGED
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
import {
|
|
3
|
+
BoldSpanRenderable,
|
|
4
|
+
ItalicSpanRenderable,
|
|
5
|
+
LineBreakRenderable,
|
|
6
|
+
LinkRenderable,
|
|
7
|
+
UnderlineSpanRenderable,
|
|
8
|
+
baseComponents,
|
|
9
|
+
componentCatalogue,
|
|
10
|
+
extend,
|
|
11
|
+
getComponentCatalogue,
|
|
12
|
+
textNodeKeys
|
|
13
|
+
} from "./chunk-7fkmdv3h.js";
|
|
14
|
+
|
|
2
15
|
// index.ts
|
|
3
16
|
import { CliRenderer, createCliRenderer, engine as engine2 } from "@opentui/core";
|
|
4
17
|
import { createTestRenderer } from "@opentui/core/testing";
|
|
5
|
-
|
|
6
|
-
// src/elements/index.ts
|
|
7
|
-
import {
|
|
8
|
-
ASCIIFontRenderable,
|
|
9
|
-
BoxRenderable,
|
|
10
|
-
CodeRenderable,
|
|
11
|
-
DiffRenderable,
|
|
12
|
-
InputRenderable as InputRenderable2,
|
|
13
|
-
LineNumberRenderable,
|
|
14
|
-
MarkdownRenderable,
|
|
15
|
-
ScrollBoxRenderable as ScrollBoxRenderable2,
|
|
16
|
-
SelectRenderable as SelectRenderable2,
|
|
17
|
-
TabSelectRenderable as TabSelectRenderable2,
|
|
18
|
-
TextareaRenderable,
|
|
19
|
-
TextAttributes,
|
|
20
|
-
TextNodeRenderable as TextNodeRenderable3,
|
|
21
|
-
TextRenderable as TextRenderable3
|
|
22
|
-
} from "@opentui/core";
|
|
23
|
-
|
|
24
18
|
// src/elements/hooks.ts
|
|
25
19
|
import {
|
|
26
20
|
engine,
|
|
@@ -1067,100 +1061,9 @@ class SlotRenderable extends SlotBaseRenderable {
|
|
|
1067
1061
|
}
|
|
1068
1062
|
}
|
|
1069
1063
|
}
|
|
1070
|
-
|
|
1071
|
-
// src/elements/index.ts
|
|
1072
|
-
class SpanRenderable extends TextNodeRenderable3 {
|
|
1073
|
-
_ctx;
|
|
1074
|
-
constructor(_ctx, options) {
|
|
1075
|
-
super(options);
|
|
1076
|
-
this._ctx = _ctx;
|
|
1077
|
-
}
|
|
1078
|
-
}
|
|
1079
|
-
var textNodeKeys = ["span", "b", "strong", "i", "em", "u", "a"];
|
|
1080
|
-
|
|
1081
|
-
class TextModifierRenderable extends SpanRenderable {
|
|
1082
|
-
constructor(options, modifier) {
|
|
1083
|
-
super(null, options);
|
|
1084
|
-
if (modifier === "b" || modifier === "strong") {
|
|
1085
|
-
this.attributes = (this.attributes || 0) | TextAttributes.BOLD;
|
|
1086
|
-
} else if (modifier === "i" || modifier === "em") {
|
|
1087
|
-
this.attributes = (this.attributes || 0) | TextAttributes.ITALIC;
|
|
1088
|
-
} else if (modifier === "u") {
|
|
1089
|
-
this.attributes = (this.attributes || 0) | TextAttributes.UNDERLINE;
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
class BoldSpanRenderable extends TextModifierRenderable {
|
|
1095
|
-
constructor(options) {
|
|
1096
|
-
super(options, "b");
|
|
1097
|
-
}
|
|
1098
|
-
}
|
|
1099
|
-
|
|
1100
|
-
class ItalicSpanRenderable extends TextModifierRenderable {
|
|
1101
|
-
constructor(options) {
|
|
1102
|
-
super(options, "i");
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
|
-
|
|
1106
|
-
class UnderlineSpanRenderable extends TextModifierRenderable {
|
|
1107
|
-
constructor(options) {
|
|
1108
|
-
super(options, "u");
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
|
-
class LineBreakRenderable extends SpanRenderable {
|
|
1113
|
-
constructor(_ctx, options) {
|
|
1114
|
-
super(null, options);
|
|
1115
|
-
this.add();
|
|
1116
|
-
}
|
|
1117
|
-
add() {
|
|
1118
|
-
return super.add(`
|
|
1119
|
-
`);
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
|
-
class LinkRenderable extends SpanRenderable {
|
|
1124
|
-
constructor(_ctx, options) {
|
|
1125
|
-
const linkOptions = {
|
|
1126
|
-
...options,
|
|
1127
|
-
link: { url: options.href }
|
|
1128
|
-
};
|
|
1129
|
-
super(null, linkOptions);
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
var baseComponents = {
|
|
1133
|
-
box: BoxRenderable,
|
|
1134
|
-
text: TextRenderable3,
|
|
1135
|
-
input: InputRenderable2,
|
|
1136
|
-
select: SelectRenderable2,
|
|
1137
|
-
textarea: TextareaRenderable,
|
|
1138
|
-
ascii_font: ASCIIFontRenderable,
|
|
1139
|
-
tab_select: TabSelectRenderable2,
|
|
1140
|
-
scrollbox: ScrollBoxRenderable2,
|
|
1141
|
-
code: CodeRenderable,
|
|
1142
|
-
diff: DiffRenderable,
|
|
1143
|
-
line_number: LineNumberRenderable,
|
|
1144
|
-
markdown: MarkdownRenderable,
|
|
1145
|
-
span: SpanRenderable,
|
|
1146
|
-
strong: BoldSpanRenderable,
|
|
1147
|
-
b: BoldSpanRenderable,
|
|
1148
|
-
em: ItalicSpanRenderable,
|
|
1149
|
-
i: ItalicSpanRenderable,
|
|
1150
|
-
u: UnderlineSpanRenderable,
|
|
1151
|
-
br: LineBreakRenderable,
|
|
1152
|
-
a: LinkRenderable
|
|
1153
|
-
};
|
|
1154
|
-
var componentCatalogue = { ...baseComponents };
|
|
1155
|
-
function extend(objects) {
|
|
1156
|
-
Object.assign(componentCatalogue, objects);
|
|
1157
|
-
}
|
|
1158
|
-
function getComponentCatalogue() {
|
|
1159
|
-
return componentCatalogue;
|
|
1160
|
-
}
|
|
1161
1064
|
// src/scrollback.ts
|
|
1162
1065
|
import {
|
|
1163
|
-
BoxRenderable
|
|
1066
|
+
BoxRenderable,
|
|
1164
1067
|
RootRenderable
|
|
1165
1068
|
} from "@opentui/core";
|
|
1166
1069
|
import { createSignal as createSignal2 } from "solid-js";
|
|
@@ -1257,7 +1160,7 @@ function createScrollbackWriter(node, options = {}) {
|
|
|
1257
1160
|
const startOnNewLine = options.startOnNewLine ?? true;
|
|
1258
1161
|
const firstLineWidth = !startOnNewLine && ctx.tailColumn > 0 && ctx.tailColumn < ctx.width ? Math.min(width, ctx.width - ctx.tailColumn) : width;
|
|
1259
1162
|
const firstLineOffset = width - firstLineWidth;
|
|
1260
|
-
const root = new
|
|
1163
|
+
const root = new BoxRenderable(ctx.renderContext, {
|
|
1261
1164
|
id: `solid-scrollback-root-${solidScrollbackRootCounter++}`,
|
|
1262
1165
|
position: "absolute",
|
|
1263
1166
|
left: 0,
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"version": "0.2.
|
|
7
|
+
"version": "0.2.15",
|
|
8
8
|
"description": "SolidJS renderer for OpenTUI",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
@@ -33,13 +33,18 @@
|
|
|
33
33
|
"types": "./scripts/runtime-plugin-support-configure.d.ts",
|
|
34
34
|
"import": "./scripts/runtime-plugin-support-configure.ts"
|
|
35
35
|
},
|
|
36
|
+
"./components": {
|
|
37
|
+
"types": "./components.d.ts",
|
|
38
|
+
"import": "./components.js",
|
|
39
|
+
"require": "./components.js"
|
|
40
|
+
},
|
|
36
41
|
"./jsx-runtime": "./jsx-runtime.d.ts",
|
|
37
42
|
"./jsx-dev-runtime": "./jsx-runtime.d.ts"
|
|
38
43
|
},
|
|
39
44
|
"dependencies": {
|
|
40
45
|
"@babel/core": "7.28.0",
|
|
41
46
|
"@babel/preset-typescript": "7.27.1",
|
|
42
|
-
"@opentui/core": "0.2.
|
|
47
|
+
"@opentui/core": "0.2.15",
|
|
43
48
|
"babel-plugin-module-resolver": "5.0.2",
|
|
44
49
|
"babel-preset-solid": "1.9.12",
|
|
45
50
|
"entities": "7.0.1",
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ASCIIFontRenderable, BoxRenderable, CodeRenderable, DiffRenderable, InputRenderable, LineNumberRenderable, MarkdownRenderable, ScrollBoxRenderable, SelectRenderable, TabSelectRenderable, TextareaRenderable, TextNodeRenderable, TextRenderable, type RenderContext, type TextNodeOptions } from "@opentui/core";
|
|
2
|
+
import type { RenderableConstructor } from "../types/elements.js";
|
|
3
|
+
declare class SpanRenderable extends TextNodeRenderable {
|
|
4
|
+
private readonly _ctx;
|
|
5
|
+
constructor(_ctx: RenderContext | null, options: TextNodeOptions);
|
|
6
|
+
}
|
|
7
|
+
export declare const textNodeKeys: readonly ["span", "b", "strong", "i", "em", "u", "a"];
|
|
8
|
+
export type TextNodeKey = (typeof textNodeKeys)[number];
|
|
9
|
+
declare class TextModifierRenderable extends SpanRenderable {
|
|
10
|
+
constructor(options: any, modifier?: TextNodeKey);
|
|
11
|
+
}
|
|
12
|
+
export declare class BoldSpanRenderable extends TextModifierRenderable {
|
|
13
|
+
constructor(options: any);
|
|
14
|
+
}
|
|
15
|
+
export declare class ItalicSpanRenderable extends TextModifierRenderable {
|
|
16
|
+
constructor(options: any);
|
|
17
|
+
}
|
|
18
|
+
export declare class UnderlineSpanRenderable extends TextModifierRenderable {
|
|
19
|
+
constructor(options: any);
|
|
20
|
+
}
|
|
21
|
+
export declare class LineBreakRenderable extends SpanRenderable {
|
|
22
|
+
constructor(_ctx: RenderContext | null, options: TextNodeOptions);
|
|
23
|
+
add(): number;
|
|
24
|
+
}
|
|
25
|
+
export interface LinkOptions extends TextNodeOptions {
|
|
26
|
+
href: string;
|
|
27
|
+
}
|
|
28
|
+
export declare class LinkRenderable extends SpanRenderable {
|
|
29
|
+
constructor(_ctx: RenderContext | null, options: LinkOptions);
|
|
30
|
+
}
|
|
31
|
+
export declare const baseComponents: {
|
|
32
|
+
box: typeof BoxRenderable;
|
|
33
|
+
text: typeof TextRenderable;
|
|
34
|
+
input: typeof InputRenderable;
|
|
35
|
+
select: typeof SelectRenderable;
|
|
36
|
+
textarea: typeof TextareaRenderable;
|
|
37
|
+
ascii_font: typeof ASCIIFontRenderable;
|
|
38
|
+
tab_select: typeof TabSelectRenderable;
|
|
39
|
+
scrollbox: typeof ScrollBoxRenderable;
|
|
40
|
+
code: typeof CodeRenderable;
|
|
41
|
+
diff: typeof DiffRenderable;
|
|
42
|
+
line_number: typeof LineNumberRenderable;
|
|
43
|
+
markdown: typeof MarkdownRenderable;
|
|
44
|
+
span: typeof SpanRenderable;
|
|
45
|
+
strong: typeof BoldSpanRenderable;
|
|
46
|
+
b: typeof BoldSpanRenderable;
|
|
47
|
+
em: typeof ItalicSpanRenderable;
|
|
48
|
+
i: typeof ItalicSpanRenderable;
|
|
49
|
+
u: typeof UnderlineSpanRenderable;
|
|
50
|
+
br: typeof LineBreakRenderable;
|
|
51
|
+
a: typeof LinkRenderable;
|
|
52
|
+
};
|
|
53
|
+
type ComponentCatalogue = Record<string, RenderableConstructor>;
|
|
54
|
+
export declare const componentCatalogue: ComponentCatalogue;
|
|
55
|
+
/**
|
|
56
|
+
* Extend the component catalogue with new renderable components
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```tsx
|
|
60
|
+
* // Extend with an object of components
|
|
61
|
+
* extend({
|
|
62
|
+
* consoleButton: ButtonRenderable,
|
|
63
|
+
* customBox: CustomBoxRenderable
|
|
64
|
+
* })
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare function extend<T extends ComponentCatalogue>(objects: T): void;
|
|
68
|
+
export declare function getComponentCatalogue(): ComponentCatalogue;
|
|
69
|
+
export type { ExtendedComponentProps, ExtendedIntrinsicElements, RenderableConstructor } from "../types/elements.js";
|
package/src/elements/index.d.ts
CHANGED
|
@@ -1,72 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import type { RenderableConstructor } from "../types/elements.js";
|
|
1
|
+
export * from "./catalogue.js";
|
|
3
2
|
export * from "./hooks.js";
|
|
4
3
|
export * from "./extras.js";
|
|
5
4
|
export * from "./slot.js";
|
|
6
|
-
declare class SpanRenderable extends TextNodeRenderable {
|
|
7
|
-
private readonly _ctx;
|
|
8
|
-
constructor(_ctx: RenderContext | null, options: TextNodeOptions);
|
|
9
|
-
}
|
|
10
|
-
export declare const textNodeKeys: readonly ["span", "b", "strong", "i", "em", "u", "a"];
|
|
11
|
-
export type TextNodeKey = (typeof textNodeKeys)[number];
|
|
12
|
-
declare class TextModifierRenderable extends SpanRenderable {
|
|
13
|
-
constructor(options: any, modifier?: TextNodeKey);
|
|
14
|
-
}
|
|
15
|
-
export declare class BoldSpanRenderable extends TextModifierRenderable {
|
|
16
|
-
constructor(options: any);
|
|
17
|
-
}
|
|
18
|
-
export declare class ItalicSpanRenderable extends TextModifierRenderable {
|
|
19
|
-
constructor(options: any);
|
|
20
|
-
}
|
|
21
|
-
export declare class UnderlineSpanRenderable extends TextModifierRenderable {
|
|
22
|
-
constructor(options: any);
|
|
23
|
-
}
|
|
24
|
-
export declare class LineBreakRenderable extends SpanRenderable {
|
|
25
|
-
constructor(_ctx: RenderContext | null, options: TextNodeOptions);
|
|
26
|
-
add(): number;
|
|
27
|
-
}
|
|
28
|
-
export interface LinkOptions extends TextNodeOptions {
|
|
29
|
-
href: string;
|
|
30
|
-
}
|
|
31
|
-
export declare class LinkRenderable extends SpanRenderable {
|
|
32
|
-
constructor(_ctx: RenderContext | null, options: LinkOptions);
|
|
33
|
-
}
|
|
34
|
-
export declare const baseComponents: {
|
|
35
|
-
box: typeof BoxRenderable;
|
|
36
|
-
text: typeof TextRenderable;
|
|
37
|
-
input: typeof InputRenderable;
|
|
38
|
-
select: typeof SelectRenderable;
|
|
39
|
-
textarea: typeof TextareaRenderable;
|
|
40
|
-
ascii_font: typeof ASCIIFontRenderable;
|
|
41
|
-
tab_select: typeof TabSelectRenderable;
|
|
42
|
-
scrollbox: typeof ScrollBoxRenderable;
|
|
43
|
-
code: typeof CodeRenderable;
|
|
44
|
-
diff: typeof DiffRenderable;
|
|
45
|
-
line_number: typeof LineNumberRenderable;
|
|
46
|
-
markdown: typeof MarkdownRenderable;
|
|
47
|
-
span: typeof SpanRenderable;
|
|
48
|
-
strong: typeof BoldSpanRenderable;
|
|
49
|
-
b: typeof BoldSpanRenderable;
|
|
50
|
-
em: typeof ItalicSpanRenderable;
|
|
51
|
-
i: typeof ItalicSpanRenderable;
|
|
52
|
-
u: typeof UnderlineSpanRenderable;
|
|
53
|
-
br: typeof LineBreakRenderable;
|
|
54
|
-
a: typeof LinkRenderable;
|
|
55
|
-
};
|
|
56
|
-
type ComponentCatalogue = Record<string, RenderableConstructor>;
|
|
57
|
-
export declare const componentCatalogue: ComponentCatalogue;
|
|
58
|
-
/**
|
|
59
|
-
* Extend the component catalogue with new renderable components
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* ```tsx
|
|
63
|
-
* // Extend with an object of components
|
|
64
|
-
* extend({
|
|
65
|
-
* consoleButton: ConsoleButtonRenderable,
|
|
66
|
-
* customBox: CustomBoxRenderable
|
|
67
|
-
* })
|
|
68
|
-
* ```
|
|
69
|
-
*/
|
|
70
|
-
export declare function extend<T extends ComponentCatalogue>(objects: T): void;
|
|
71
|
-
export declare function getComponentCatalogue(): ComponentCatalogue;
|
|
72
|
-
export type { ExtendedComponentProps, ExtendedIntrinsicElements, RenderableConstructor } from "../types/elements.js";
|