react-native-nitro-markdown 0.2.1 → 0.3.0

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.
Files changed (138) hide show
  1. package/README.md +217 -101
  2. package/lib/commonjs/MarkdownContext.js +3 -7
  3. package/lib/commonjs/MarkdownContext.js.map +1 -1
  4. package/lib/commonjs/default-markdown-renderer.js +4 -7
  5. package/lib/commonjs/default-markdown-renderer.js.map +1 -1
  6. package/lib/commonjs/headless.js +12 -1
  7. package/lib/commonjs/headless.js.map +1 -1
  8. package/lib/commonjs/index.js +35 -0
  9. package/lib/commonjs/index.js.map +1 -1
  10. package/lib/commonjs/markdown.js +88 -37
  11. package/lib/commonjs/markdown.js.map +1 -1
  12. package/lib/commonjs/renderers/blockquote.js +1 -1
  13. package/lib/commonjs/renderers/blockquote.js.map +1 -1
  14. package/lib/commonjs/renderers/code.js +15 -8
  15. package/lib/commonjs/renderers/code.js.map +1 -1
  16. package/lib/commonjs/renderers/heading.js +2 -1
  17. package/lib/commonjs/renderers/heading.js.map +1 -1
  18. package/lib/commonjs/renderers/horizontal-rule.js +4 -2
  19. package/lib/commonjs/renderers/horizontal-rule.js.map +1 -1
  20. package/lib/commonjs/renderers/image.js +13 -9
  21. package/lib/commonjs/renderers/image.js.map +1 -1
  22. package/lib/commonjs/renderers/link.js +1 -3
  23. package/lib/commonjs/renderers/link.js.map +1 -1
  24. package/lib/commonjs/renderers/list.js +11 -7
  25. package/lib/commonjs/renderers/list.js.map +1 -1
  26. package/lib/commonjs/renderers/math.js +23 -47
  27. package/lib/commonjs/renderers/math.js.map +1 -1
  28. package/lib/commonjs/renderers/paragraph.js +0 -5
  29. package/lib/commonjs/renderers/paragraph.js.map +1 -1
  30. package/lib/commonjs/renderers/table.js +127 -120
  31. package/lib/commonjs/renderers/table.js.map +1 -1
  32. package/lib/commonjs/theme.js +146 -13
  33. package/lib/commonjs/theme.js.map +1 -1
  34. package/lib/module/MarkdownContext.js +3 -8
  35. package/lib/module/MarkdownContext.js.map +1 -1
  36. package/lib/module/default-markdown-renderer.js +1 -4
  37. package/lib/module/default-markdown-renderer.js.map +1 -1
  38. package/lib/module/headless.js +10 -0
  39. package/lib/module/headless.js.map +1 -1
  40. package/lib/module/index.js +2 -20
  41. package/lib/module/index.js.map +1 -1
  42. package/lib/module/markdown.js +89 -38
  43. package/lib/module/markdown.js.map +1 -1
  44. package/lib/module/renderers/blockquote.js +1 -1
  45. package/lib/module/renderers/blockquote.js.map +1 -1
  46. package/lib/module/renderers/code.js +15 -8
  47. package/lib/module/renderers/code.js.map +1 -1
  48. package/lib/module/renderers/heading.js +2 -1
  49. package/lib/module/renderers/heading.js.map +1 -1
  50. package/lib/module/renderers/horizontal-rule.js +4 -2
  51. package/lib/module/renderers/horizontal-rule.js.map +1 -1
  52. package/lib/module/renderers/image.js +13 -9
  53. package/lib/module/renderers/image.js.map +1 -1
  54. package/lib/module/renderers/link.js +1 -3
  55. package/lib/module/renderers/link.js.map +1 -1
  56. package/lib/module/renderers/list.js +11 -7
  57. package/lib/module/renderers/list.js.map +1 -1
  58. package/lib/module/renderers/math.js +24 -48
  59. package/lib/module/renderers/math.js.map +1 -1
  60. package/lib/module/renderers/paragraph.js +0 -5
  61. package/lib/module/renderers/paragraph.js.map +1 -1
  62. package/lib/module/renderers/table.js +128 -121
  63. package/lib/module/renderers/table.js.map +1 -1
  64. package/lib/module/theme.js +144 -12
  65. package/lib/module/theme.js.map +1 -1
  66. package/lib/typescript/commonjs/MarkdownContext.d.ts +45 -6
  67. package/lib/typescript/commonjs/MarkdownContext.d.ts.map +1 -1
  68. package/lib/typescript/commonjs/default-markdown-renderer.d.ts +1 -1
  69. package/lib/typescript/commonjs/default-markdown-renderer.d.ts.map +1 -1
  70. package/lib/typescript/commonjs/headless.d.ts +8 -1
  71. package/lib/typescript/commonjs/headless.d.ts.map +1 -1
  72. package/lib/typescript/commonjs/index.d.ts +4 -16
  73. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  74. package/lib/typescript/commonjs/markdown.d.ts +20 -2
  75. package/lib/typescript/commonjs/markdown.d.ts.map +1 -1
  76. package/lib/typescript/commonjs/renderers/code.d.ts +6 -2
  77. package/lib/typescript/commonjs/renderers/code.d.ts.map +1 -1
  78. package/lib/typescript/commonjs/renderers/heading.d.ts.map +1 -1
  79. package/lib/typescript/commonjs/renderers/horizontal-rule.d.ts +6 -1
  80. package/lib/typescript/commonjs/renderers/horizontal-rule.d.ts.map +1 -1
  81. package/lib/typescript/commonjs/renderers/image.d.ts +2 -0
  82. package/lib/typescript/commonjs/renderers/image.d.ts.map +1 -1
  83. package/lib/typescript/commonjs/renderers/link.d.ts.map +1 -1
  84. package/lib/typescript/commonjs/renderers/list.d.ts +4 -0
  85. package/lib/typescript/commonjs/renderers/list.d.ts.map +1 -1
  86. package/lib/typescript/commonjs/renderers/math.d.ts +3 -4
  87. package/lib/typescript/commonjs/renderers/math.d.ts.map +1 -1
  88. package/lib/typescript/commonjs/renderers/paragraph.d.ts +0 -5
  89. package/lib/typescript/commonjs/renderers/paragraph.d.ts.map +1 -1
  90. package/lib/typescript/commonjs/renderers/table.d.ts +2 -0
  91. package/lib/typescript/commonjs/renderers/table.d.ts.map +1 -1
  92. package/lib/typescript/commonjs/theme.d.ts +41 -28
  93. package/lib/typescript/commonjs/theme.d.ts.map +1 -1
  94. package/lib/typescript/module/MarkdownContext.d.ts +45 -6
  95. package/lib/typescript/module/MarkdownContext.d.ts.map +1 -1
  96. package/lib/typescript/module/default-markdown-renderer.d.ts +1 -1
  97. package/lib/typescript/module/default-markdown-renderer.d.ts.map +1 -1
  98. package/lib/typescript/module/headless.d.ts +8 -1
  99. package/lib/typescript/module/headless.d.ts.map +1 -1
  100. package/lib/typescript/module/index.d.ts +4 -16
  101. package/lib/typescript/module/index.d.ts.map +1 -1
  102. package/lib/typescript/module/markdown.d.ts +20 -2
  103. package/lib/typescript/module/markdown.d.ts.map +1 -1
  104. package/lib/typescript/module/renderers/code.d.ts +6 -2
  105. package/lib/typescript/module/renderers/code.d.ts.map +1 -1
  106. package/lib/typescript/module/renderers/heading.d.ts.map +1 -1
  107. package/lib/typescript/module/renderers/horizontal-rule.d.ts +6 -1
  108. package/lib/typescript/module/renderers/horizontal-rule.d.ts.map +1 -1
  109. package/lib/typescript/module/renderers/image.d.ts +2 -0
  110. package/lib/typescript/module/renderers/image.d.ts.map +1 -1
  111. package/lib/typescript/module/renderers/link.d.ts.map +1 -1
  112. package/lib/typescript/module/renderers/list.d.ts +4 -0
  113. package/lib/typescript/module/renderers/list.d.ts.map +1 -1
  114. package/lib/typescript/module/renderers/math.d.ts +3 -4
  115. package/lib/typescript/module/renderers/math.d.ts.map +1 -1
  116. package/lib/typescript/module/renderers/paragraph.d.ts +0 -5
  117. package/lib/typescript/module/renderers/paragraph.d.ts.map +1 -1
  118. package/lib/typescript/module/renderers/table.d.ts +2 -0
  119. package/lib/typescript/module/renderers/table.d.ts.map +1 -1
  120. package/lib/typescript/module/theme.d.ts +41 -28
  121. package/lib/typescript/module/theme.d.ts.map +1 -1
  122. package/package.json +1 -1
  123. package/src/MarkdownContext.ts +66 -9
  124. package/src/default-markdown-renderer.tsx +1 -6
  125. package/src/headless.ts +11 -1
  126. package/src/index.ts +24 -19
  127. package/src/markdown.tsx +125 -43
  128. package/src/renderers/blockquote.tsx +1 -2
  129. package/src/renderers/code.tsx +36 -12
  130. package/src/renderers/heading.tsx +1 -1
  131. package/src/renderers/horizontal-rule.tsx +7 -4
  132. package/src/renderers/image.tsx +24 -9
  133. package/src/renderers/link.tsx +1 -6
  134. package/src/renderers/list.tsx +11 -5
  135. package/src/renderers/math.tsx +20 -43
  136. package/src/renderers/paragraph.tsx +0 -6
  137. package/src/renderers/table.tsx +185 -160
  138. package/src/theme.ts +203 -12
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  useMemo,
3
3
  useRef,
4
- useState,
4
+ useReducer,
5
5
  useCallback,
6
- useEffect,
7
6
  type FC,
8
7
  type ComponentType,
8
+ type ReactNode,
9
9
  } from "react";
10
10
  import {
11
11
  View,
@@ -14,6 +14,8 @@ import {
14
14
  ScrollView,
15
15
  type StyleProp,
16
16
  type TextStyle,
17
+ type ViewStyle,
18
+ type LayoutChangeEvent,
17
19
  } from "react-native";
18
20
 
19
21
  import type { MarkdownNode } from "../headless";
@@ -31,33 +33,28 @@ const extractTableData = (node: MarkdownNode): TableData => {
31
33
  const rows: MarkdownNode[][] = [];
32
34
  const alignments: (string | undefined)[] = [];
33
35
 
34
- const head = node.children?.find((c) => c.type === "table_head");
35
- const body = node.children?.find((c) => c.type === "table_body");
36
-
37
- // Extract Headers
38
- head?.children?.forEach((row) => {
39
- if (row.type === "table_row") {
40
- row.children?.forEach((cell) => {
41
- if (cell.type === "table_cell") {
42
- headers.push(cell);
43
- alignments.push(cell.align);
36
+ for (const child of node.children ?? []) {
37
+ if (child.type === "table_head") {
38
+ for (const row of child.children ?? []) {
39
+ if (row.type === "table_row") {
40
+ for (const cell of row.children ?? []) {
41
+ headers.push(cell);
42
+ alignments.push(cell.align);
43
+ }
44
44
  }
45
- });
46
- }
47
- });
48
-
49
- // Extract Body Rows
50
- body?.children?.forEach((row) => {
51
- if (row.type === "table_row") {
52
- const rowCells: MarkdownNode[] = [];
53
- row.children?.forEach((cell) => {
54
- if (cell.type === "table_cell") {
55
- rowCells.push(cell);
45
+ }
46
+ } else if (child.type === "table_body") {
47
+ for (const row of child.children ?? []) {
48
+ if (row.type === "table_row") {
49
+ const rowCells: MarkdownNode[] = [];
50
+ for (const cell of row.children ?? []) {
51
+ rowCells.push(cell);
52
+ }
53
+ rows.push(rowCells);
56
54
  }
57
- });
58
- if (rowCells.length > 0) rows.push(rowCells);
55
+ }
59
56
  }
60
- });
57
+ }
61
58
 
62
59
  return { headers, rows, alignments };
63
60
  };
@@ -65,11 +62,23 @@ const extractTableData = (node: MarkdownNode): TableData => {
65
62
  interface TableRendererProps {
66
63
  node: MarkdownNode;
67
64
  Renderer: ComponentType<NodeRendererProps>;
65
+ style?: ViewStyle;
68
66
  }
69
67
 
68
+ type ColumnWidthsAction = {
69
+ type: "SET_WIDTHS";
70
+ payload: number[];
71
+ };
72
+
73
+ const columnWidthsReducer = (state: number[], action: ColumnWidthsAction) => {
74
+ if (action.type === "SET_WIDTHS") return action.payload;
75
+ return state;
76
+ };
77
+
70
78
  export const TableRenderer: FC<TableRendererProps> = ({
71
79
  node,
72
80
  Renderer,
81
+ style,
73
82
  }) => {
74
83
  const { theme } = useMarkdownContext();
75
84
  const { headers, rows, alignments } = useMemo(
@@ -80,159 +89,169 @@ export const TableRenderer: FC<TableRendererProps> = ({
80
89
  const columnCount = headers.length;
81
90
  const styles = useMemo(() => createTableStyles(theme), [theme]);
82
91
 
83
- const [columnWidths, setColumnWidths] = useState<number[]>([]);
92
+ const [columnWidths, dispatch] = useReducer(columnWidthsReducer, []);
84
93
  const measuredWidths = useRef<Map<string, number>>(new Map());
85
- const hasAppliedWidths = useRef(false);
94
+ const measuredCells = useRef<Set<string>>(new Set());
95
+ const widthsCalculated = useRef(false);
86
96
 
87
- const calculateAndApplyWidths = useCallback(() => {
88
- if (columnCount === 0) return;
97
+ const onCellLayout = useCallback(
98
+ (cellKey: string, width: number) => {
99
+ measuredWidths.current.set(cellKey, width);
100
+ measuredCells.current.add(cellKey);
89
101
 
90
- const finalWidths = new Array(columnCount).fill(0);
91
- for (let col = 0; col < columnCount; col++) {
92
- let maxWidth = measuredWidths.current.get(`h-${col}`) || 0;
102
+ const expectedCells = new Set<string>();
103
+ for (let col = 0; col < columnCount; col++) {
104
+ expectedCells.add(`header-${col}`);
105
+ }
93
106
  for (let row = 0; row < rows.length; row++) {
94
- const cellWidth = measuredWidths.current.get(`c-${row}-${col}`) || 0;
95
- if (cellWidth > maxWidth) maxWidth = cellWidth;
107
+ for (let col = 0; col < columnCount; col++) {
108
+ expectedCells.add(`cell-${row}-${col}`);
109
+ }
96
110
  }
97
- // Apply padding and min-width
98
- finalWidths[col] = Math.max(maxWidth + 32, 100);
99
- }
100
111
 
101
- setColumnWidths(finalWidths);
102
- hasAppliedWidths.current = true;
103
- }, [columnCount, rows.length]);
112
+ const allCellsMeasured = [...expectedCells].every((key) =>
113
+ measuredCells.current.has(key)
114
+ );
115
+ if (!allCellsMeasured || widthsCalculated.current) return;
104
116
 
105
- useEffect(() => {
106
- if (columnCount === 0) return;
117
+ const maxWidths: number[] = new Array(columnCount).fill(0);
107
118
 
108
- const timer = setTimeout(() => {
109
- if (!hasAppliedWidths.current) {
110
- calculateAndApplyWidths();
111
- }
112
- }, 400);
119
+ for (let col = 0; col < columnCount; col++) {
120
+ const headerWidth = measuredWidths.current.get(`header-${col}`);
121
+ if (headerWidth && headerWidth > 0) {
122
+ maxWidths[col] = Math.max(maxWidths[col], headerWidth);
123
+ }
113
124
 
114
- return () => clearTimeout(timer);
115
- }, [columnCount, rows.length, calculateAndApplyWidths]);
125
+ for (let row = 0; row < rows.length; row++) {
126
+ const cellWidth = measuredWidths.current.get(`cell-${row}-${col}`);
127
+ if (cellWidth && cellWidth > 0) {
128
+ maxWidths[col] = Math.max(maxWidths[col], cellWidth);
129
+ }
130
+ }
116
131
 
117
- const onLayout = (key: string, width: number) => {
118
- if (hasAppliedWidths.current) return;
119
- measuredWidths.current.set(key, width);
132
+ maxWidths[col] = Math.max(maxWidths[col] + 8, 60);
133
+ }
120
134
 
121
- const expectedCount = columnCount + rows.length * columnCount;
122
- if (measuredWidths.current.size >= expectedCount) {
123
- calculateAndApplyWidths();
124
- }
125
- };
135
+ widthsCalculated.current = true;
136
+ dispatch({ type: "SET_WIDTHS", payload: maxWidths });
137
+ },
138
+ [columnCount, rows.length]
139
+ );
126
140
 
127
- const getAlignStyle = (index: number) => {
141
+ const getAlignment = (
142
+ index: number
143
+ ): "flex-start" | "center" | "flex-end" => {
128
144
  const align = alignments[index];
129
- if (align === "center")
130
- return { alignItems: "center", textAlign: "center" } as const;
131
- if (align === "right")
132
- return { alignItems: "flex-end", textAlign: "right" } as const;
133
- return { alignItems: "flex-start", textAlign: "left" } as const;
145
+ if (align === "center") return "center";
146
+ if (align === "right") return "flex-end";
147
+ return "flex-start";
134
148
  };
135
149
 
136
150
  if (columnCount === 0) return null;
137
151
 
152
+ const hasWidths = columnWidths.length === columnCount;
153
+
138
154
  return (
139
- <View style={styles.container}>
140
- {!hasAppliedWidths.current && (
141
- <View style={styles.measurementWrapper} pointerEvents="none">
142
- <View style={styles.row}>
143
- {headers.map((cell, i) => (
155
+ <View style={[styles.container, style]}>
156
+ <View style={styles.measurementContainer}>
157
+ <View style={styles.measurementRow}>
158
+ {headers.map((cell, colIndex) => (
159
+ <View
160
+ key={`measure-header-${colIndex}`}
161
+ style={styles.measurementCell}
162
+ onLayout={(e: LayoutChangeEvent) => {
163
+ onCellLayout(`header-${colIndex}`, e.nativeEvent.layout.width);
164
+ }}
165
+ >
166
+ <CellContent node={cell} Renderer={Renderer} styles={styles} />
167
+ </View>
168
+ ))}
169
+ </View>
170
+ {rows.map((row, rowIndex) => (
171
+ <View key={`measure-row-${rowIndex}`} style={styles.measurementRow}>
172
+ {row.map((cell, colIndex) => (
144
173
  <View
145
- key={`m-h-${i}`}
146
- onLayout={(e) => onLayout(`h-${i}`, e.nativeEvent.layout.width)}
147
- style={styles.measuringCell}
174
+ key={`measure-cell-${rowIndex}-${colIndex}`}
175
+ style={styles.measurementCell}
176
+ onLayout={(e: LayoutChangeEvent) => {
177
+ onCellLayout(
178
+ `cell-${rowIndex}-${colIndex}`,
179
+ e.nativeEvent.layout.width
180
+ );
181
+ }}
148
182
  >
149
183
  <CellContent node={cell} Renderer={Renderer} styles={styles} />
150
184
  </View>
151
185
  ))}
152
186
  </View>
153
- {rows.map((row, ri) => (
154
- <View key={`m-r-${ri}`} style={styles.row}>
155
- {row.map((cell, ci) => (
187
+ ))}
188
+ </View>
189
+
190
+ {hasWidths && (
191
+ <ScrollView
192
+ horizontal
193
+ showsHorizontalScrollIndicator
194
+ style={styles.tableScroll}
195
+ bounces={false}
196
+ >
197
+ <View style={styles.table}>
198
+ <View style={styles.headerRow}>
199
+ {headers.map((cell, colIndex) => (
156
200
  <View
157
- key={`m-c-${ri}-${ci}`}
158
- onLayout={(e) =>
159
- onLayout(`c-${ri}-${ci}`, e.nativeEvent.layout.width)
160
- }
161
- style={styles.measuringCell}
201
+ key={`header-${colIndex}`}
202
+ style={[
203
+ styles.headerCell,
204
+ {
205
+ width: columnWidths[colIndex],
206
+ alignItems: getAlignment(colIndex),
207
+ },
208
+ colIndex === columnCount - 1 && styles.lastCell,
209
+ ]}
162
210
  >
163
211
  <CellContent
164
212
  node={cell}
165
213
  Renderer={Renderer}
166
214
  styles={styles}
215
+ textStyle={styles.headerText}
167
216
  />
168
217
  </View>
169
218
  ))}
170
219
  </View>
171
- ))}
172
- </View>
173
- )}
174
220
 
175
- <ScrollView
176
- horizontal
177
- showsHorizontalScrollIndicator={true}
178
- bounces={false}
179
- style={styles.tableScroll}
180
- >
181
- <View style={styles.table}>
182
- {/* Header */}
183
- <View style={styles.headerRow}>
184
- {headers.map((cell, i) => (
221
+ {rows.map((row, rowIndex) => (
185
222
  <View
186
- key={`h-${i}`}
223
+ key={`row-${rowIndex}`}
187
224
  style={[
188
- styles.headerCell,
189
- { width: columnWidths[i] || 120 },
190
- getAlignStyle(i),
191
- i === columnCount - 1 && styles.lastCell,
225
+ styles.bodyRow,
226
+ rowIndex === rows.length - 1 && styles.lastRow,
227
+ rowIndex % 2 === 1 && styles.oddRow,
192
228
  ]}
193
229
  >
194
- <CellContent
195
- node={cell}
196
- Renderer={Renderer}
197
- styles={styles}
198
- textStyle={styles.headerText}
199
- />
230
+ {row.map((cell, colIndex) => (
231
+ <View
232
+ key={`cell-${rowIndex}-${colIndex}`}
233
+ style={[
234
+ styles.bodyCell,
235
+ {
236
+ width: columnWidths[colIndex],
237
+ alignItems: getAlignment(colIndex),
238
+ },
239
+ colIndex === columnCount - 1 && styles.lastCell,
240
+ ]}
241
+ >
242
+ <CellContent
243
+ node={cell}
244
+ Renderer={Renderer}
245
+ styles={styles}
246
+ textStyle={styles.cellText}
247
+ />
248
+ </View>
249
+ ))}
200
250
  </View>
201
251
  ))}
202
252
  </View>
203
-
204
- {/* Body */}
205
- {rows.map((row, ri) => (
206
- <View
207
- key={`r-${ri}`}
208
- style={[
209
- styles.bodyRow,
210
- ri === rows.length - 1 && styles.lastRow,
211
- ri % 2 === 1 && styles.oddRow,
212
- ]}
213
- >
214
- {row.map((cell, ci) => (
215
- <View
216
- key={`c-${ri}-${ci}`}
217
- style={[
218
- styles.bodyCell,
219
- { width: columnWidths[ci] || 120 },
220
- getAlignStyle(ci),
221
- ci === columnCount - 1 && styles.lastCell,
222
- ]}
223
- >
224
- <CellContent
225
- node={cell}
226
- Renderer={Renderer}
227
- styles={styles}
228
- textStyle={styles.cellText}
229
- />
230
- </View>
231
- ))}
232
- </View>
233
- ))}
234
- </View>
235
- </ScrollView>
253
+ </ScrollView>
254
+ )}
236
255
  </View>
237
256
  );
238
257
  };
@@ -264,37 +283,39 @@ const CellContent: FC<{
264
283
 
265
284
  const createTableStyles = (theme: MarkdownTheme) => {
266
285
  const colors = theme?.colors || {};
286
+ const borderRadius = theme?.borderRadius || { m: 8 };
287
+
267
288
  return StyleSheet.create({
268
289
  container: {
269
- marginVertical: 12,
290
+ marginVertical: theme.spacing.s,
270
291
  },
271
- measurementWrapper: {
292
+ measurementContainer: {
272
293
  position: "absolute",
273
- top: 0,
274
- left: 0,
275
294
  opacity: 0,
276
- zIndex: -1,
295
+ pointerEvents: "none",
296
+ left: -9999,
297
+ },
298
+ measurementRow: {
299
+ flexDirection: "row",
277
300
  },
278
- measuringCell: {
279
- paddingHorizontal: 16,
280
- paddingVertical: 12,
281
- alignSelf: "flex-start",
301
+ measurementCell: {
302
+ paddingVertical: 10,
303
+ paddingHorizontal: 12,
282
304
  },
283
305
  tableScroll: {
284
- borderRadius: 12,
285
- borderWidth: 1,
286
- borderColor: colors.tableBorder || "#374151",
306
+ flexGrow: 0,
287
307
  },
288
308
  table: {
309
+ borderRadius: borderRadius.m,
310
+ overflow: "hidden",
311
+ borderWidth: 1,
312
+ borderColor: colors.tableBorder || "#374151",
289
313
  backgroundColor: colors.surface || "#111827",
290
314
  },
291
- row: {
292
- flexDirection: "row",
293
- },
294
315
  headerRow: {
295
316
  flexDirection: "row",
296
317
  backgroundColor: colors.tableHeader || "#1f2937",
297
- borderBottomWidth: 2,
318
+ borderBottomWidth: 1,
298
319
  borderBottomColor: colors.tableBorder || "#374151",
299
320
  },
300
321
  bodyRow: {
@@ -309,14 +330,18 @@ const createTableStyles = (theme: MarkdownTheme) => {
309
330
  borderBottomWidth: 0,
310
331
  },
311
332
  headerCell: {
312
- paddingVertical: 14,
313
- paddingHorizontal: 16,
333
+ flexShrink: 0,
334
+ paddingVertical: 10,
335
+ paddingHorizontal: 12,
336
+ minWidth: 60,
314
337
  borderRightWidth: 1,
315
338
  borderRightColor: colors.tableBorder || "#374151",
316
339
  },
317
340
  bodyCell: {
318
- paddingVertical: 12,
319
- paddingHorizontal: 16,
341
+ flexShrink: 0,
342
+ paddingVertical: 10,
343
+ paddingHorizontal: 12,
344
+ minWidth: 60,
320
345
  borderRightWidth: 1,
321
346
  borderRightColor: colors.tableBorder || "#374151",
322
347
  justifyContent: "center",
@@ -327,14 +352,14 @@ const createTableStyles = (theme: MarkdownTheme) => {
327
352
  headerText: {
328
353
  color: colors.tableHeaderText || "#9ca3af",
329
354
  fontSize: 12,
330
- fontWeight: "700",
331
- textTransform: "uppercase",
332
- letterSpacing: 1,
355
+ fontWeight: "600",
356
+ fontFamily: theme.fontFamilies?.regular,
333
357
  },
334
358
  cellText: {
335
359
  color: colors.text || "#e5e7eb",
336
360
  fontSize: 14,
337
361
  lineHeight: 20,
362
+ fontFamily: theme.fontFamilies?.regular,
338
363
  },
339
364
  cellContentWrapper: {
340
365
  flexDirection: "row",