@opentui/solid 0.4.1 → 0.4.2

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/components.js CHANGED
@@ -1,111 +1 @@
1
- // src/elements/catalogue.ts
2
- import {
3
- ASCIIFontRenderable,
4
- BoxRenderable,
5
- CodeRenderable,
6
- DiffRenderable,
7
- InputRenderable,
8
- LineNumberRenderable,
9
- MarkdownRenderable,
10
- ScrollBoxRenderable,
11
- SelectRenderable,
12
- TabSelectRenderable,
13
- TextareaRenderable,
14
- TextAttributes,
15
- TextNodeRenderable,
16
- TextRenderable
17
- } from "@opentui/core";
18
-
19
- class SpanRenderable extends TextNodeRenderable {
20
- _ctx;
21
- constructor(_ctx, options) {
22
- super(options);
23
- this._ctx = _ctx;
24
- }
25
- }
26
- class TextModifierRenderable extends SpanRenderable {
27
- constructor(options, modifier) {
28
- super(null, options);
29
- if (modifier === "b" || modifier === "strong") {
30
- this.attributes = (this.attributes || 0) | TextAttributes.BOLD;
31
- } else if (modifier === "i" || modifier === "em") {
32
- this.attributes = (this.attributes || 0) | TextAttributes.ITALIC;
33
- } else if (modifier === "u") {
34
- this.attributes = (this.attributes || 0) | TextAttributes.UNDERLINE;
35
- }
36
- }
37
- }
38
-
39
- class BoldSpanRenderable extends TextModifierRenderable {
40
- constructor(options) {
41
- super(options, "b");
42
- }
43
- }
44
-
45
- class ItalicSpanRenderable extends TextModifierRenderable {
46
- constructor(options) {
47
- super(options, "i");
48
- }
49
- }
50
-
51
- class UnderlineSpanRenderable extends TextModifierRenderable {
52
- constructor(options) {
53
- super(options, "u");
54
- }
55
- }
56
-
57
- class LineBreakRenderable extends SpanRenderable {
58
- constructor(_ctx, options) {
59
- super(null, options);
60
- this.add();
61
- }
62
- add() {
63
- return super.add(`
64
- `);
65
- }
66
- }
67
-
68
- class LinkRenderable extends SpanRenderable {
69
- constructor(_ctx, options) {
70
- const linkOptions = {
71
- ...options,
72
- link: { url: options.href }
73
- };
74
- super(null, linkOptions);
75
- }
76
- }
77
- var baseComponents = {
78
- box: BoxRenderable,
79
- text: TextRenderable,
80
- input: InputRenderable,
81
- select: SelectRenderable,
82
- textarea: TextareaRenderable,
83
- ascii_font: ASCIIFontRenderable,
84
- tab_select: TabSelectRenderable,
85
- scrollbox: ScrollBoxRenderable,
86
- code: CodeRenderable,
87
- diff: DiffRenderable,
88
- line_number: LineNumberRenderable,
89
- markdown: MarkdownRenderable,
90
- span: SpanRenderable,
91
- strong: BoldSpanRenderable,
92
- b: BoldSpanRenderable,
93
- em: ItalicSpanRenderable,
94
- i: ItalicSpanRenderable,
95
- u: UnderlineSpanRenderable,
96
- br: LineBreakRenderable,
97
- a: LinkRenderable
98
- };
99
- var componentCatalogue = { ...baseComponents };
100
- function extend(objects) {
101
- Object.assign(componentCatalogue, objects);
102
- }
103
- function getComponentCatalogue() {
104
- return componentCatalogue;
105
- }
106
- export {
107
- getComponentCatalogue,
108
- extend
109
- };
110
-
111
- //# debugId=4D3EF7806518248664756E2164756E21
1
+ export { extend, getComponentCatalogue } from "@opentui/solid"
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.4.1",
7
+ "version": "0.4.2",
8
8
  "description": "SolidJS renderer for OpenTUI",
9
9
  "license": "MIT",
10
10
  "repository": {
@@ -62,7 +62,7 @@
62
62
  "dependencies": {
63
63
  "@babel/core": "7.28.0",
64
64
  "@babel/preset-typescript": "7.27.1",
65
- "@opentui/core": "0.4.1",
65
+ "@opentui/core": "0.4.2",
66
66
  "babel-plugin-module-resolver": "5.0.2",
67
67
  "babel-preset-solid": "1.9.12",
68
68
  "entities": "7.0.1",
package/components.js.map DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["src/elements/catalogue.ts"],
4
- "sourcesContent": [
5
- "import {\n ASCIIFontRenderable,\n BoxRenderable,\n CodeRenderable,\n DiffRenderable,\n InputRenderable,\n LineNumberRenderable,\n MarkdownRenderable,\n ScrollBoxRenderable,\n SelectRenderable,\n TabSelectRenderable,\n TextareaRenderable,\n TextAttributes,\n TextNodeRenderable,\n TextRenderable,\n type RenderContext,\n type TextNodeOptions,\n} from \"@opentui/core\"\nimport type { RenderableConstructor } from \"../types/elements.js\"\n\nclass SpanRenderable extends TextNodeRenderable {\n constructor(\n private readonly _ctx: RenderContext | null,\n options: TextNodeOptions,\n ) {\n super(options)\n }\n}\n\nexport const textNodeKeys = [\"span\", \"b\", \"strong\", \"i\", \"em\", \"u\", \"a\"] as const\nexport type TextNodeKey = (typeof textNodeKeys)[number]\n\nclass TextModifierRenderable extends SpanRenderable {\n constructor(options: any, modifier?: TextNodeKey) {\n super(null, options)\n\n // Set appropriate attributes based on modifier type\n if (modifier === \"b\" || modifier === \"strong\") {\n this.attributes = (this.attributes || 0) | TextAttributes.BOLD\n } else if (modifier === \"i\" || modifier === \"em\") {\n this.attributes = (this.attributes || 0) | TextAttributes.ITALIC\n } else if (modifier === \"u\") {\n this.attributes = (this.attributes || 0) | TextAttributes.UNDERLINE\n }\n }\n}\n\nexport class BoldSpanRenderable extends TextModifierRenderable {\n constructor(options: any) {\n super(options, \"b\")\n }\n}\n\nexport class ItalicSpanRenderable extends TextModifierRenderable {\n constructor(options: any) {\n super(options, \"i\")\n }\n}\n\nexport class UnderlineSpanRenderable extends TextModifierRenderable {\n constructor(options: any) {\n super(options, \"u\")\n }\n}\n\nexport class LineBreakRenderable extends SpanRenderable {\n constructor(_ctx: RenderContext | null, options: TextNodeOptions) {\n super(null, options)\n this.add()\n }\n\n public override add(): number {\n return super.add(\"\\n\")\n }\n}\n\nexport interface LinkOptions extends TextNodeOptions {\n href: string\n}\n\nexport class LinkRenderable extends SpanRenderable {\n constructor(_ctx: RenderContext | null, options: LinkOptions) {\n const linkOptions: TextNodeOptions = {\n ...options,\n link: { url: options.href },\n }\n super(null, linkOptions)\n }\n}\n\nexport const baseComponents = {\n box: BoxRenderable,\n text: TextRenderable,\n input: InputRenderable,\n select: SelectRenderable,\n textarea: TextareaRenderable,\n ascii_font: ASCIIFontRenderable,\n tab_select: TabSelectRenderable,\n scrollbox: ScrollBoxRenderable,\n code: CodeRenderable,\n diff: DiffRenderable,\n line_number: LineNumberRenderable,\n markdown: MarkdownRenderable,\n\n span: SpanRenderable,\n strong: BoldSpanRenderable,\n b: BoldSpanRenderable,\n em: ItalicSpanRenderable,\n i: ItalicSpanRenderable,\n u: UnderlineSpanRenderable,\n br: LineBreakRenderable,\n a: LinkRenderable,\n}\n\ntype ComponentCatalogue = Record<string, RenderableConstructor>\n\nexport const componentCatalogue: ComponentCatalogue = { ...baseComponents }\n\n/**\n * Extend the component catalogue with new renderable components\n *\n * @example\n * ```tsx\n * // Extend with an object of components\n * extend({\n * consoleButton: ButtonRenderable,\n * customBox: CustomBoxRenderable\n * })\n * ```\n */\nexport function extend<T extends ComponentCatalogue>(objects: T): void {\n Object.assign(componentCatalogue, objects)\n}\n\nexport function getComponentCatalogue(): ComponentCatalogue {\n return componentCatalogue\n}\n\nexport type { ExtendedComponentProps, ExtendedIntrinsicElements, RenderableConstructor } from \"../types/elements.js\"\n"
6
- ],
7
- "mappings": ";AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBA,MAAM,uBAAuB,mBAAmB;AAAA,EAE3B;AAAA,EADnB,WAAW,CACQ,MACjB,SACA;AAAA,IACA,MAAM,OAAO;AAAA,IAHI;AAAA;AAKrB;AAKA,MAAM,+BAA+B,eAAe;AAAA,EAClD,WAAW,CAAC,SAAc,UAAwB;AAAA,IAChD,MAAM,MAAM,OAAO;AAAA,IAGnB,IAAI,aAAa,OAAO,aAAa,UAAU;AAAA,MAC7C,KAAK,cAAc,KAAK,cAAc,KAAK,eAAe;AAAA,IAC5D,EAAO,SAAI,aAAa,OAAO,aAAa,MAAM;AAAA,MAChD,KAAK,cAA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