@taui-standard/ink-adapter 0.0.1 → 1.0.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.
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "name": "example-dashboard",
3
3
  "version": "1.0.0",
4
+ "author": "Tariq Shams",
5
+ "license": "Apache-2.0",
4
6
  "private": true,
5
7
  "type": "module",
6
8
  "scripts": {
7
9
  "start": "tsx index.ts"
8
10
  },
9
11
  "dependencies": {
10
- "@taui-standard/core": "0.0.1",
11
- "@taui-standard/ink-adapter": "0.0.1",
12
- "@taui-standard/validator": "0.0.1",
12
+ "@taui-standard/core": "1.0.2",
13
+ "@taui-standard/ink-adapter": "1.0.2",
14
+ "@taui-standard/validator": "1.0.2",
13
15
  "tsx": "^4.7.0"
14
16
  }
15
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taui-standard/ink-adapter",
3
- "version": "0.0.1",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "description": "Ink adapter for Terminal Agent UI (TAUI)",
6
6
  "main": "dist/index.js",
@@ -14,8 +14,8 @@
14
14
  "author": "Tariq Shams",
15
15
  "license": "Apache-2.0",
16
16
  "dependencies": {
17
- "@taui-standard/core": "^0.0.1",
18
- "@taui-standard/validator": "^0.0.1",
17
+ "@taui-standard/core": "^1.0.2",
18
+ "@taui-standard/validator": "^1.0.2",
19
19
  "ink": "^5.0.0",
20
20
  "ink-text-input": "^6.0.0",
21
21
  "react": "^18.2.0"
package/src/renderer.tsx CHANGED
@@ -29,14 +29,24 @@ export const TAUIBox: React.FC<RendererProps> = ({ node, runtime }) => {
29
29
  if (!['Box', 'Row', 'Column', 'Grid', 'Panel'].includes(node.type)) return null;
30
30
 
31
31
  const flexDirection = node.type === 'Row' ? 'row' : 'column';
32
- const borderStyle = node.type === 'Panel' ? (node.borderStyle || 'single') : undefined;
32
+ let borderStyle: any = node.type === 'Panel' ? (node.borderStyle || 'single') : undefined;
33
+
34
+ // Map TAUI spec names to Ink names
35
+ if (borderStyle === 'rounded') borderStyle = 'round';
36
+ if (borderStyle === 'none') borderStyle = undefined;
37
+
38
+ // Ensure it's a valid Ink border style string
39
+ const validStyles = ['single', 'double', 'round', 'bold', 'singleDouble', 'doubleSingle', 'classic'];
40
+ if (borderStyle && !validStyles.includes(borderStyle)) {
41
+ borderStyle = 'single';
42
+ }
33
43
 
34
44
  return (
35
45
  <Box
36
46
  flexDirection={flexDirection}
37
47
  padding={typeof node.padding === 'number' ? node.padding : undefined}
38
48
  gap={node.gap}
39
- borderStyle={borderStyle === 'none' ? undefined : borderStyle as any}
49
+ borderStyle={borderStyle as any}
40
50
  >
41
51
  {node.type === 'Panel' && node.title && (
42
52
  <Box position="absolute" marginTop={-1} marginLeft={1} paddingX={1}>
@@ -143,6 +153,45 @@ export const TAUIKeyBinding: React.FC<RendererProps> = ({ node, runtime }) => {
143
153
  return null;
144
154
  };
145
155
 
156
+ export const TAUITable: React.FC<RendererProps> = ({ node }) => {
157
+ if (node.type !== 'Table') return null;
158
+ const headers = node.headers || [];
159
+ const rows = node.rows || [];
160
+
161
+ return (
162
+ <Box flexDirection="column" borderStyle="single" paddingX={1}>
163
+ <Box flexDirection="row" borderStyle="single" borderBottom>
164
+ {headers.map((h: string, i: number) => (
165
+ <Box key={i} flexGrow={1} minWidth={10}>
166
+ <Text bold color="cyan">{h}</Text>
167
+ </Box>
168
+ ))}
169
+ </Box>
170
+ {rows.map((row: string[], i: number) => (
171
+ <Box key={i} flexDirection="row">
172
+ {row.map((cell: string, j: number) => (
173
+ <Box key={j} flexGrow={1} minWidth={10}>
174
+ <Text>{cell}</Text>
175
+ </Box>
176
+ ))}
177
+ </Box>
178
+ ))}
179
+ </Box>
180
+ );
181
+ };
182
+
183
+ export const TAUILog: React.FC<RendererProps> = ({ node }) => {
184
+ if (node.type !== 'Log') return null;
185
+ const lines = node.lines || [];
186
+ return (
187
+ <Box flexDirection="column" borderStyle="single" paddingX={1}>
188
+ {lines.slice(-(node.maxLines || 100)).map((line: string, i: number) => (
189
+ <Text key={i}>{line}</Text>
190
+ ))}
191
+ </Box>
192
+ );
193
+ };
194
+
146
195
  export const TAUIRenderer: React.FC<RendererProps> = (props) => {
147
196
  const { node } = props;
148
197
  switch (node.type) {
@@ -160,6 +209,10 @@ export const TAUIRenderer: React.FC<RendererProps> = (props) => {
160
209
  return <TAUIInput {...props} />;
161
210
  case 'Progress':
162
211
  return <TAUIProgress {...props} />;
212
+ case 'Table':
213
+ return <TAUITable {...props} />;
214
+ case 'Log':
215
+ return <TAUILog {...props} />;
163
216
  case 'KeyBinding':
164
217
  return <TAUIKeyBinding {...props} />;
165
218
  default: