termcast 1.3.47 → 1.3.49

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 (278) hide show
  1. package/dist/apis/cache.d.ts.map +1 -1
  2. package/dist/apis/cache.js +1 -2
  3. package/dist/apis/cache.js.map +1 -1
  4. package/dist/apis/localstorage.d.ts.map +1 -1
  5. package/dist/apis/localstorage.js +1 -2
  6. package/dist/apis/localstorage.js.map +1 -1
  7. package/dist/apis/sqlite.d.ts +7 -0
  8. package/dist/apis/sqlite.d.ts.map +1 -0
  9. package/dist/apis/sqlite.js +13 -0
  10. package/dist/apis/sqlite.js.map +1 -0
  11. package/dist/build.d.ts.map +1 -1
  12. package/dist/build.js +14 -5
  13. package/dist/build.js.map +1 -1
  14. package/dist/cli.js +5 -40
  15. package/dist/cli.js.map +1 -1
  16. package/dist/colors.d.ts +7 -7
  17. package/dist/colors.js +7 -7
  18. package/dist/compile.d.ts +6 -1
  19. package/dist/compile.d.ts.map +1 -1
  20. package/dist/compile.js +46 -27
  21. package/dist/compile.js.map +1 -1
  22. package/dist/components/actions.js +1 -1
  23. package/dist/components/actions.js.map +1 -1
  24. package/dist/components/bar-chart.d.ts +38 -0
  25. package/dist/components/bar-chart.d.ts.map +1 -0
  26. package/dist/components/bar-chart.js +158 -0
  27. package/dist/components/bar-chart.js.map +1 -0
  28. package/dist/components/bar-graph.d.ts +41 -0
  29. package/dist/components/bar-graph.d.ts.map +1 -0
  30. package/dist/components/bar-graph.js +95 -0
  31. package/dist/components/bar-graph.js.map +1 -0
  32. package/dist/components/detail.d.ts.map +1 -1
  33. package/dist/components/detail.js +5 -7
  34. package/dist/components/detail.js.map +1 -1
  35. package/dist/components/footer.d.ts.map +1 -1
  36. package/dist/components/footer.js +8 -9
  37. package/dist/components/footer.js.map +1 -1
  38. package/dist/components/form/date-picker.d.ts.map +1 -1
  39. package/dist/components/form/date-picker.js +7 -1
  40. package/dist/components/form/date-picker.js.map +1 -1
  41. package/dist/components/form/dropdown.d.ts.map +1 -1
  42. package/dist/components/form/dropdown.js +10 -2
  43. package/dist/components/form/dropdown.js.map +1 -1
  44. package/dist/components/form/index.d.ts.map +1 -1
  45. package/dist/components/form/index.js +4 -5
  46. package/dist/components/form/index.js.map +1 -1
  47. package/dist/components/form/use-form-navigation.d.ts.map +1 -1
  48. package/dist/components/form/use-form-navigation.js +6 -0
  49. package/dist/components/form/use-form-navigation.js.map +1 -1
  50. package/dist/components/graph.d.ts +111 -0
  51. package/dist/components/graph.d.ts.map +1 -0
  52. package/dist/components/graph.js +392 -0
  53. package/dist/components/graph.js.map +1 -0
  54. package/dist/components/icon.js +5 -5
  55. package/dist/components/icon.js.map +1 -1
  56. package/dist/components/list.d.ts +53 -5
  57. package/dist/components/list.d.ts.map +1 -1
  58. package/dist/components/list.js +125 -71
  59. package/dist/components/list.js.map +1 -1
  60. package/dist/components/loading-bar.js +3 -3
  61. package/dist/components/loading-bar.js.map +1 -1
  62. package/dist/components/loading-text.d.ts +1 -1
  63. package/dist/components/loading-text.d.ts.map +1 -1
  64. package/dist/components/loading-text.js +3 -1
  65. package/dist/components/loading-text.js.map +1 -1
  66. package/dist/components/metadata.js +2 -2
  67. package/dist/components/metadata.js.map +1 -1
  68. package/dist/components/row.d.ts +10 -0
  69. package/dist/components/row.d.ts.map +1 -0
  70. package/dist/components/row.js +12 -0
  71. package/dist/components/row.js.map +1 -0
  72. package/dist/components/table.d.ts +57 -0
  73. package/dist/components/table.d.ts.map +1 -0
  74. package/dist/components/table.js +365 -0
  75. package/dist/components/table.js.map +1 -0
  76. package/dist/descendants.js +13 -13
  77. package/dist/descendants.js.map +1 -1
  78. package/dist/examples/bar-graph-weekly.d.ts +2 -0
  79. package/dist/examples/bar-graph-weekly.d.ts.map +1 -0
  80. package/dist/examples/bar-graph-weekly.js +95 -0
  81. package/dist/examples/bar-graph-weekly.js.map +1 -0
  82. package/dist/examples/components-weird-places.d.ts +2 -0
  83. package/dist/examples/components-weird-places.d.ts.map +1 -0
  84. package/dist/examples/components-weird-places.js +46 -0
  85. package/dist/examples/components-weird-places.js.map +1 -0
  86. package/dist/examples/graph-bar-chart.d.ts +2 -0
  87. package/dist/examples/graph-bar-chart.d.ts.map +1 -0
  88. package/dist/examples/graph-bar-chart.js +270 -0
  89. package/dist/examples/graph-bar-chart.js.map +1 -0
  90. package/dist/examples/graph-multi-series.d.ts +2 -0
  91. package/dist/examples/graph-multi-series.d.ts.map +1 -0
  92. package/dist/examples/graph-multi-series.js +23 -0
  93. package/dist/examples/graph-multi-series.js.map +1 -0
  94. package/dist/examples/graph-polymarket.d.ts +2 -0
  95. package/dist/examples/graph-polymarket.d.ts.map +1 -0
  96. package/dist/examples/graph-polymarket.js +109 -0
  97. package/dist/examples/graph-polymarket.js.map +1 -0
  98. package/dist/examples/graph-row.d.ts +2 -0
  99. package/dist/examples/graph-row.d.ts.map +1 -0
  100. package/dist/examples/graph-row.js +226 -0
  101. package/dist/examples/graph-row.js.map +1 -0
  102. package/dist/examples/graph-styles.d.ts +2 -0
  103. package/dist/examples/graph-styles.d.ts.map +1 -0
  104. package/dist/examples/graph-styles.js +316 -0
  105. package/dist/examples/graph-styles.js.map +1 -0
  106. package/dist/examples/list-accessory-table.d.ts +2 -0
  107. package/dist/examples/list-accessory-table.d.ts.map +1 -0
  108. package/dist/examples/list-accessory-table.js +46 -0
  109. package/dist/examples/list-accessory-table.js.map +1 -0
  110. package/dist/examples/list-item-accessories.d.ts +2 -0
  111. package/dist/examples/list-item-accessories.d.ts.map +1 -0
  112. package/dist/examples/list-item-accessories.js +27 -0
  113. package/dist/examples/list-item-accessories.js.map +1 -0
  114. package/dist/examples/list-no-actions.d.ts +2 -0
  115. package/dist/examples/list-no-actions.d.ts.map +1 -0
  116. package/dist/examples/list-no-actions.js +7 -0
  117. package/dist/examples/list-no-actions.js.map +1 -0
  118. package/dist/examples/simple-detail-table.d.ts +2 -0
  119. package/dist/examples/simple-detail-table.d.ts.map +1 -0
  120. package/dist/examples/simple-detail-table.js +45 -0
  121. package/dist/examples/simple-detail-table.js.map +1 -0
  122. package/dist/examples/simple-graph.d.ts +2 -0
  123. package/dist/examples/simple-graph.d.ts.map +1 -0
  124. package/dist/examples/simple-graph.js +32 -0
  125. package/dist/examples/simple-graph.js.map +1 -0
  126. package/dist/examples/simple-table-wrap.d.ts +2 -0
  127. package/dist/examples/simple-table-wrap.d.ts.map +1 -0
  128. package/dist/examples/simple-table-wrap.js +37 -0
  129. package/dist/examples/simple-table-wrap.js.map +1 -0
  130. package/dist/examples/table-edge-cases.d.ts +2 -0
  131. package/dist/examples/table-edge-cases.d.ts.map +1 -0
  132. package/dist/examples/table-edge-cases.js +70 -0
  133. package/dist/examples/table-edge-cases.js.map +1 -0
  134. package/dist/examples/table-flex-grow.d.ts +2 -0
  135. package/dist/examples/table-flex-grow.d.ts.map +1 -0
  136. package/dist/examples/table-flex-grow.js +18 -0
  137. package/dist/examples/table-flex-grow.js.map +1 -0
  138. package/dist/extensions/dev.d.ts.map +1 -1
  139. package/dist/extensions/dev.js +5 -1
  140. package/dist/extensions/dev.js.map +1 -1
  141. package/dist/globals.d.ts +1 -0
  142. package/dist/globals.d.ts.map +1 -1
  143. package/dist/globals.js +2 -0
  144. package/dist/globals.js.map +1 -1
  145. package/dist/index.d.ts +10 -0
  146. package/dist/index.d.ts.map +1 -1
  147. package/dist/index.js +10 -0
  148. package/dist/index.js.map +1 -1
  149. package/dist/internal/date-picker-widget.d.ts.map +1 -1
  150. package/dist/internal/date-picker-widget.js +4 -0
  151. package/dist/internal/date-picker-widget.js.map +1 -1
  152. package/dist/internal/providers.d.ts.map +1 -1
  153. package/dist/internal/providers.js +1 -3
  154. package/dist/internal/providers.js.map +1 -1
  155. package/dist/logger.d.ts.map +1 -1
  156. package/dist/logger.js +2 -1
  157. package/dist/logger.js.map +1 -1
  158. package/dist/markdown-utils.d.ts +22 -1
  159. package/dist/markdown-utils.d.ts.map +1 -1
  160. package/dist/markdown-utils.js +66 -1
  161. package/dist/markdown-utils.js.map +1 -1
  162. package/dist/opentui.d.ts +4 -0
  163. package/dist/opentui.d.ts.map +1 -0
  164. package/dist/opentui.js +3 -0
  165. package/dist/opentui.js.map +1 -0
  166. package/dist/release.d.ts +2 -1
  167. package/dist/release.d.ts.map +1 -1
  168. package/dist/release.js +2 -1
  169. package/dist/release.js.map +1 -1
  170. package/dist/state.d.ts +1 -0
  171. package/dist/state.d.ts.map +1 -1
  172. package/dist/state.js +1 -1
  173. package/dist/state.js.map +1 -1
  174. package/dist/swift-runtime.d.ts.map +1 -1
  175. package/dist/swift-runtime.js +20 -5
  176. package/dist/swift-runtime.js.map +1 -1
  177. package/dist/theme.d.ts +1 -0
  178. package/dist/theme.d.ts.map +1 -1
  179. package/dist/theme.js +13 -0
  180. package/dist/theme.js.map +1 -1
  181. package/dist/themes/nerv.json +227 -0
  182. package/dist/themes/termcast.json +72 -71
  183. package/dist/themes.d.ts +2 -1
  184. package/dist/themes.d.ts.map +1 -1
  185. package/dist/themes.js +7 -5
  186. package/dist/themes.js.map +1 -1
  187. package/dist/utils.d.ts.map +1 -1
  188. package/dist/utils.js +4 -1
  189. package/dist/utils.js.map +1 -1
  190. package/package.json +12 -4
  191. package/src/apis/cache.test.ts +1 -1
  192. package/src/apis/cache.tsx +1 -2
  193. package/src/apis/localstorage.tsx +1 -2
  194. package/src/apis/sqlite.ts +14 -0
  195. package/src/build.tsx +15 -5
  196. package/src/cli.tsx +5 -49
  197. package/src/colors.tsx +7 -7
  198. package/src/compile.tsx +53 -30
  199. package/src/components/actions.tsx +1 -1
  200. package/src/components/bar-chart.tsx +271 -0
  201. package/src/components/bar-graph.tsx +214 -0
  202. package/src/components/detail.tsx +7 -8
  203. package/src/components/footer.tsx +14 -15
  204. package/src/components/form/date-picker.tsx +9 -0
  205. package/src/components/form/dropdown.tsx +13 -3
  206. package/src/components/form/index.tsx +4 -6
  207. package/src/components/form/use-form-navigation.tsx +6 -0
  208. package/src/components/graph.tsx +506 -0
  209. package/src/components/icon.tsx +5 -5
  210. package/src/components/list.tsx +210 -102
  211. package/src/components/loading-bar.tsx +3 -3
  212. package/src/components/loading-text.tsx +4 -2
  213. package/src/components/metadata.tsx +2 -2
  214. package/src/components/row.tsx +31 -0
  215. package/src/components/table.tsx +511 -0
  216. package/src/descendants.tsx +13 -13
  217. package/src/examples/action-shortcut.vitest.tsx +1 -1
  218. package/src/examples/actions-context.vitest.tsx +1 -1
  219. package/src/examples/bar-graph-weekly.tsx +264 -0
  220. package/src/examples/bar-graph-weekly.vitest.tsx +275 -0
  221. package/src/examples/detail-metadata-showcase.vitest.tsx +22 -22
  222. package/src/examples/form-basic.vitest.tsx +239 -0
  223. package/src/examples/form-dropdown.vitest.tsx +29 -29
  224. package/src/examples/form-tagpicker.vitest.tsx +27 -27
  225. package/src/examples/github.vitest.tsx +4 -4
  226. package/src/examples/graph-bar-chart.tsx +408 -0
  227. package/src/examples/graph-bar-chart.vitest.tsx +283 -0
  228. package/src/examples/graph-multi-series.tsx +36 -0
  229. package/src/examples/graph-multi-series.vitest.tsx +89 -0
  230. package/src/examples/graph-polymarket.tsx +182 -0
  231. package/src/examples/graph-polymarket.vitest.tsx +130 -0
  232. package/src/examples/graph-row.tsx +347 -0
  233. package/src/examples/graph-row.vitest.tsx +295 -0
  234. package/src/examples/graph-styles.tsx +457 -0
  235. package/src/examples/graph-styles.vitest.tsx +322 -0
  236. package/src/examples/list-accessory-table.tsx +77 -0
  237. package/src/examples/list-detail-metadata.vitest.tsx +21 -21
  238. package/src/examples/list-dropdown-default.vitest.tsx +12 -12
  239. package/src/examples/list-item-accessories.tsx +106 -0
  240. package/src/examples/list-item-accessories.vitest.tsx +115 -0
  241. package/src/examples/list-no-actions.tsx +18 -0
  242. package/src/examples/list-no-actions.vitest.tsx +97 -0
  243. package/src/examples/list-spacing-mode.vitest.tsx +6 -6
  244. package/src/examples/list-with-detail.vitest.tsx +73 -73
  245. package/src/examples/list-with-dropdown.vitest.tsx +49 -6
  246. package/src/examples/list-with-sections.vitest.tsx +61 -56
  247. package/src/examples/simple-detail-markdown.vitest.tsx +21 -18
  248. package/src/examples/simple-detail-table.tsx +65 -0
  249. package/src/examples/simple-detail-table.vitest.tsx +200 -0
  250. package/src/examples/simple-graph.tsx +51 -0
  251. package/src/examples/simple-graph.vitest.tsx +124 -0
  252. package/src/examples/simple-grid.vitest.tsx +3 -3
  253. package/src/examples/simple-list-search.vitest.tsx +65 -0
  254. package/src/examples/simple-navigation.vitest.tsx +3 -3
  255. package/src/examples/simple-table-wrap.tsx +55 -0
  256. package/src/examples/simple-table-wrap.vitest.tsx +91 -0
  257. package/src/examples/store.vitest.tsx +1 -1
  258. package/src/examples/table-edge-cases.tsx +72 -0
  259. package/src/examples/table-edge-cases.vitest.tsx +307 -0
  260. package/src/examples/table-flex-grow.tsx +53 -0
  261. package/src/examples/table-flex-grow.vitest.tsx +124 -0
  262. package/src/extensions/dev.tsx +7 -1
  263. package/src/globals.ts +3 -0
  264. package/src/index.tsx +31 -0
  265. package/src/internal/date-picker-widget.tsx +4 -0
  266. package/src/internal/providers.tsx +1 -4
  267. package/src/logger.tsx +2 -1
  268. package/src/markdown-utils.tsx +82 -1
  269. package/src/opentui.tsx +5 -0
  270. package/src/release.tsx +3 -0
  271. package/src/state.tsx +2 -1
  272. package/src/swift-runtime.tsx +19 -5
  273. package/src/theme.tsx +14 -0
  274. package/src/themes/nerv.json +231 -0
  275. package/src/themes/termcast.json +75 -71
  276. package/src/themes.ts +8 -5
  277. package/src/utils.test.tsx +1 -1
  278. package/src/utils.tsx +5 -1
package/src/logger.tsx CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as fs from 'fs'
2
2
  import * as path from 'path'
3
+ import util from 'node:util'
3
4
  import { useEffect } from 'react'
4
5
 
5
6
  const LOG_FILE = path.join(process.cwd(), 'app.log')
@@ -16,7 +17,7 @@ function serialize(msg: any): string {
16
17
  if (typeof msg === 'string') {
17
18
  return msg
18
19
  }
19
- return Bun.inspect(msg, { depth: 3 })
20
+ return util.inspect(msg, { depth: 3 })
20
21
  }
21
22
 
22
23
  export const logger = {
@@ -18,9 +18,12 @@ import {
18
18
  createTextAttributes,
19
19
  type Renderable,
20
20
  type RenderContext,
21
+ type SyntaxStyle,
21
22
  } from '@opentui/core'
23
+ import { Lexer } from 'marked'
22
24
  import { getResolvedTheme } from './themes'
23
25
  import { useStore } from './state'
26
+ import { TableRenderable, type TableCellContent } from 'termcast/src/components/table'
24
27
 
25
28
  // Minimal token types from marked (dependency of opentui, not termcast directly)
26
29
  interface Token {
@@ -29,10 +32,19 @@ interface Token {
29
32
  raw?: string
30
33
  href?: string
31
34
  tokens?: Token[]
35
+ // Table-specific fields (from marked Tokens.Table)
36
+ header?: TableCell[]
37
+ rows?: TableCell[][]
38
+ }
39
+
40
+ interface TableCell {
41
+ text: string
42
+ tokens: Token[]
32
43
  }
33
44
 
34
45
  // Matches RenderNodeContext from @opentui/core/renderables/Markdown
35
46
  interface RenderNodeContext {
47
+ syntaxStyle: SyntaxStyle
36
48
  defaultRender: () => Renderable | null
37
49
  }
38
50
 
@@ -53,7 +65,9 @@ function hasLinks(token: Token): boolean {
53
65
 
54
66
  // Recursively flatten inline tokens into chunks, stripping link URLs.
55
67
  // Handles nested structures like **[link](url)** or *[link](url)*.
56
- function flattenInlineTokens({
68
+ // Exported so the standalone <Table> component can reuse this for
69
+ // parsing inline markdown in cell strings.
70
+ export function flattenInlineTokens({
57
71
  tokens,
58
72
  chunks,
59
73
  links,
@@ -150,6 +164,51 @@ export function createMarkdownRenderNode(renderer: RenderContext): (token: Token
150
164
  let nodeCounter = 0
151
165
 
152
166
  return (token: Token, context: RenderNodeContext) => {
167
+ // Override table tokens with our custom borderless TableRenderable
168
+ // (header background + alternating row stripes instead of ASCII borders).
169
+ // Converts inline markdown tokens (bold, italic, code, links) into
170
+ // StyledText so formatting is preserved in table cells.
171
+ if (token.type === 'table' && token.header && token.rows) {
172
+ const themeName = useStore.getState().currentThemeName
173
+ const theme = getResolvedTheme(themeName)
174
+ const primaryColor = parseColor(theme.primary)
175
+ const linkColor = parseColor(theme.markdownLinkText)
176
+ const textColor = parseColor(theme.text)
177
+
178
+ const cellToStyledText = (tokens: Token[] | undefined): TableCellContent => {
179
+ if (!tokens || tokens.length === 0) {
180
+ return new StyledText([{ __isChunk: true, text: ' ', fg: textColor }])
181
+ }
182
+ const chunks: TextChunk[] = []
183
+ const links: LinkInfo[] = []
184
+ flattenInlineTokens({ tokens, chunks, links, primaryColor, linkColor, textColor })
185
+ if (chunks.length === 0) {
186
+ return new StyledText([{ __isChunk: true, text: ' ', fg: textColor }])
187
+ }
188
+ return new StyledText(chunks)
189
+ }
190
+
191
+ const headers = token.header.map((cell) => {
192
+ return cellToStyledText(cell.tokens)
193
+ })
194
+ const rows = token.rows.map((row) => {
195
+ return row.map((cell) => {
196
+ return cellToStyledText(cell.tokens)
197
+ })
198
+ })
199
+ if (headers.length === 0 || rows.length === 0) {
200
+ return undefined
201
+ }
202
+ return new TableRenderable(renderer, {
203
+ id: `table-${nodeCounter++}`,
204
+ headers,
205
+ rows,
206
+ syntaxStyle: context.syntaxStyle,
207
+ width: '100%',
208
+ marginBottom: 1,
209
+ })
210
+ }
211
+
153
212
  // Only override paragraphs that contain links (including nested)
154
213
  if (token.type !== 'paragraph' || !hasLinks(token)) {
155
214
  return undefined // use default rendering
@@ -180,3 +239,25 @@ export function createMarkdownRenderNode(renderer: RenderContext): (token: Token
180
239
  })
181
240
  }
182
241
  }
242
+
243
+ // Parse a raw string containing inline markdown (bold, italic, code,
244
+ // links, strikethrough) into a StyledText. Uses marked's inline lexer
245
+ // to tokenize, then flattenInlineTokens to produce styled chunks.
246
+ // If the string contains no markdown syntax, returns a plain StyledText.
247
+ export function parseInlineMarkdown(text: string): StyledText {
248
+ const themeName = useStore.getState().currentThemeName
249
+ const theme = getResolvedTheme(themeName)
250
+ const primaryColor = parseColor(theme.primary)
251
+ const linkColor = parseColor(theme.markdownLinkText)
252
+ const textColor = parseColor(theme.text)
253
+
254
+ const tokens = new Lexer().inlineTokens(text) as Token[]
255
+ const chunks: TextChunk[] = []
256
+ const links: LinkInfo[] = []
257
+ flattenInlineTokens({ tokens, chunks, links, primaryColor, linkColor, textColor })
258
+
259
+ if (chunks.length === 0) {
260
+ return new StyledText([{ __isChunk: true, text: ' ', fg: textColor }])
261
+ }
262
+ return new StyledText(chunks)
263
+ }
@@ -0,0 +1,5 @@
1
+ export * from '@opentui/core'
2
+ export * from '@opentui/react'
3
+ // Disambiguate names exported by both core and react (type-only to avoid
4
+ // runtime errors when the JS bundle doesn't actually export the name)
5
+ export type { RenderableConstructor } from '@opentui/core'
package/src/release.tsx CHANGED
@@ -15,6 +15,7 @@ import {
15
15
  export interface ReleaseOptions {
16
16
  extensionPath: string
17
17
  single?: boolean
18
+ entry?: string
18
19
  }
19
20
 
20
21
  export interface ReleaseResult {
@@ -27,6 +28,7 @@ export interface ReleaseResult {
27
28
  export async function releaseExtension({
28
29
  extensionPath,
29
30
  single = false,
31
+ entry,
30
32
  }: ReleaseOptions): Promise<ReleaseResult> {
31
33
  const resolvedPath = path.resolve(extensionPath)
32
34
 
@@ -127,6 +129,7 @@ export async function releaseExtension({
127
129
  minify: true,
128
130
  target,
129
131
  version: tag,
132
+ entry,
130
133
  })
131
134
 
132
135
  console.log(` ✓ ${path.basename(result.outfile)}`)
package/src/state.tsx CHANGED
@@ -45,6 +45,7 @@ export interface NavigationStackItem {
45
45
  element: ReactNode
46
46
  onPop?: () => void
47
47
  selectedListIndex?: number
48
+ searchText?: string
48
49
  }
49
50
 
50
51
  interface AppState {
@@ -109,7 +110,7 @@ export const useStore = create<AppState>(() => ({
109
110
  showActionsDialog: false,
110
111
  actionsPortalTarget: null,
111
112
  // Theme state
112
- currentThemeName: 'termcast',
113
+ currentThemeName: 'nerv',
113
114
  // Active search input ref
114
115
  activeSearchInputRef: null,
115
116
  // Registered action shortcuts
@@ -1,3 +1,4 @@
1
+ import childProcess from 'node:child_process'
1
2
  import { logger } from './logger'
2
3
 
3
4
  export async function runSwiftFunction(
@@ -9,14 +10,27 @@ export async function runSwiftFunction(
9
10
 
10
11
  logger.log(`Swift: calling ${functionName} with args:`, jsonArgs)
11
12
 
12
- const proc = Bun.spawn([binaryPath, functionName, ...jsonArgs], {
13
- stdout: 'pipe',
14
- stderr: 'inherit',
13
+ const proc = childProcess.spawn(binaryPath, [functionName, ...jsonArgs], {
14
+ stdio: ['ignore', 'pipe', 'inherit'],
15
15
  })
16
16
 
17
17
  const [stdout, exitCode] = await Promise.all([
18
- new Response(proc.stdout).text(),
19
- proc.exited,
18
+ new Promise<string>((resolve, reject) => {
19
+ const chunks: Buffer[] = []
20
+ proc.stdout!.on('data', (chunk) => { chunks.push(chunk) })
21
+ proc.stdout!.on('error', reject)
22
+ proc.stdout!.on('end', () => { resolve(Buffer.concat(chunks).toString()) })
23
+ }),
24
+ new Promise<number | null>((resolve, reject) => {
25
+ proc.on('error', reject)
26
+ proc.on('close', (code, signal) => {
27
+ if (signal) {
28
+ reject(new Error(`Swift function "${functionName}" was killed by signal ${signal}`))
29
+ } else {
30
+ resolve(code)
31
+ }
32
+ })
33
+ }),
20
34
  ])
21
35
 
22
36
  if (exitCode !== 0) {
package/src/theme.tsx CHANGED
@@ -58,6 +58,20 @@ export function getMarkdownSyntaxStyle(): SyntaxStyle {
58
58
  return SyntaxStyle.fromStyles(getSyntaxTheme(themeName))
59
59
  }
60
60
 
61
+ // Shared color palette for all chart components (Graph, BarChart, BarGraph).
62
+ // Order: accent, info, success, warning, error, secondary, primary (cycles with %).
63
+ export function getThemePalette(theme: ResolvedTheme): string[] {
64
+ return [
65
+ theme.accent,
66
+ theme.info,
67
+ theme.success,
68
+ theme.warning,
69
+ theme.error,
70
+ theme.secondary,
71
+ theme.primary,
72
+ ]
73
+ }
74
+
61
75
  // For backward compatibility - some code imports markdownSyntaxStyle directly
62
76
  // This is a getter that returns the current theme's syntax style
63
77
  export const markdownSyntaxStyle = new Proxy({} as SyntaxStyle, {
@@ -0,0 +1,231 @@
1
+ {
2
+ "$schema": "https://opencode.ai/theme.json",
3
+ "defs": {
4
+ "darkStep1": "#181818",
5
+ "darkStep2": "#181818",
6
+ "darkStep3": "#282828",
7
+ "darkStep4": "#333333",
8
+ "darkStep5": "#404040",
9
+ "darkStep6": "#505050",
10
+ "darkStep7": "#606060",
11
+ "darkStep8": "#808080",
12
+ "darkStep11": "#999999",
13
+ "darkStep12": "#FFFFFF",
14
+
15
+ "darkOrange": "#E89500",
16
+ "darkOrangeBright": "#FFAA15",
17
+ "darkOrangeDim": "#C07800",
18
+ "darkOrangeDeep": "#A05C00",
19
+ "darkOrangeWash": "#FFBB50",
20
+
21
+ "darkGreen": "#2BBD50",
22
+ "darkGreenBright": "#44DD66",
23
+ "darkGreenDim": "#1F9940",
24
+ "darkGreenDeep": "#167030",
25
+
26
+ "darkSalmon": "#F7768E"
27
+ },
28
+
29
+ "theme": {
30
+ "primary": {
31
+ "dark": "darkOrange",
32
+ "light": "darkOrange"
33
+ },
34
+ "secondary": {
35
+ "dark": "darkOrangeDim",
36
+ "light": "darkOrangeDim"
37
+ },
38
+ "accent": {
39
+ "dark": "darkOrangeBright",
40
+ "light": "darkOrangeBright"
41
+ },
42
+ "error": {
43
+ "dark": "darkSalmon",
44
+ "light": "darkSalmon"
45
+ },
46
+ "warning": {
47
+ "dark": "darkOrangeWash",
48
+ "light": "darkOrangeWash"
49
+ },
50
+ "success": {
51
+ "dark": "darkGreen",
52
+ "light": "darkGreen"
53
+ },
54
+ "info": {
55
+ "dark": "darkGreenBright",
56
+ "light": "darkGreenBright"
57
+ },
58
+ "text": {
59
+ "dark": "darkStep12",
60
+ "light": "darkStep12"
61
+ },
62
+ "textMuted": {
63
+ "dark": "darkStep11",
64
+ "light": "darkStep11"
65
+ },
66
+ "background": {
67
+ "dark": "darkStep1",
68
+ "light": "darkStep1"
69
+ },
70
+ "backgroundPanel": {
71
+ "dark": "darkStep2",
72
+ "light": "darkStep2"
73
+ },
74
+ "backgroundElement": {
75
+ "dark": "darkStep3",
76
+ "light": "darkStep3"
77
+ },
78
+ "border": {
79
+ "dark": "darkStep4",
80
+ "light": "darkStep4"
81
+ },
82
+ "borderActive": {
83
+ "dark": "darkOrange",
84
+ "light": "darkOrange"
85
+ },
86
+ "borderSubtle": {
87
+ "dark": "#252525",
88
+ "light": "#252525"
89
+ },
90
+ "diffAdded": {
91
+ "dark": "darkGreen",
92
+ "light": "darkGreen"
93
+ },
94
+ "diffRemoved": {
95
+ "dark": "darkSalmon",
96
+ "light": "darkSalmon"
97
+ },
98
+ "diffContext": {
99
+ "dark": "darkStep11",
100
+ "light": "darkStep11"
101
+ },
102
+ "diffHunkHeader": {
103
+ "dark": "darkStep11",
104
+ "light": "darkStep11"
105
+ },
106
+ "diffHighlightAdded": {
107
+ "dark": "darkGreenBright",
108
+ "light": "darkGreenBright"
109
+ },
110
+ "diffHighlightRemoved": {
111
+ "dark": "darkSalmon",
112
+ "light": "darkSalmon"
113
+ },
114
+ "diffAddedBg": {
115
+ "dark": "#1A2B1E",
116
+ "light": "#1A2B1E"
117
+ },
118
+ "diffRemovedBg": {
119
+ "dark": "#37222c",
120
+ "light": "#37222c"
121
+ },
122
+ "diffContextBg": {
123
+ "dark": "darkStep2",
124
+ "light": "darkStep2"
125
+ },
126
+ "diffLineNumber": {
127
+ "dark": "darkStep4",
128
+ "light": "darkStep4"
129
+ },
130
+ "diffAddedLineNumberBg": {
131
+ "dark": "#162518",
132
+ "light": "#162518"
133
+ },
134
+ "diffRemovedLineNumberBg": {
135
+ "dark": "#2d1f26",
136
+ "light": "#2d1f26"
137
+ },
138
+ "markdownText": {
139
+ "dark": "darkStep12",
140
+ "light": "darkStep12"
141
+ },
142
+ "markdownHeading": {
143
+ "dark": "darkOrange",
144
+ "light": "darkOrange"
145
+ },
146
+ "markdownLink": {
147
+ "dark": "darkGreen",
148
+ "light": "darkGreen"
149
+ },
150
+ "markdownLinkText": {
151
+ "dark": "darkGreen",
152
+ "light": "darkGreen"
153
+ },
154
+ "markdownCode": {
155
+ "dark": "darkGreenDim",
156
+ "light": "darkGreenDim"
157
+ },
158
+ "markdownBlockQuote": {
159
+ "dark": "darkStep11",
160
+ "light": "darkStep11"
161
+ },
162
+ "markdownEmph": {
163
+ "dark": "darkOrangeWash",
164
+ "light": "darkOrangeWash"
165
+ },
166
+ "markdownStrong": {
167
+ "dark": "darkOrangeBright",
168
+ "light": "darkOrangeBright"
169
+ },
170
+ "markdownHorizontalRule": {
171
+ "dark": "darkStep11",
172
+ "light": "darkStep11"
173
+ },
174
+ "markdownListItem": {
175
+ "dark": "darkOrange",
176
+ "light": "darkOrange"
177
+ },
178
+ "markdownListEnumeration": {
179
+ "dark": "darkOrange",
180
+ "light": "darkOrange"
181
+ },
182
+ "markdownImage": {
183
+ "dark": "darkOrange",
184
+ "light": "darkOrange"
185
+ },
186
+ "markdownImageText": {
187
+ "dark": "darkGreen",
188
+ "light": "darkGreen"
189
+ },
190
+ "markdownCodeBlock": {
191
+ "dark": "darkStep12",
192
+ "light": "darkStep12"
193
+ },
194
+ "syntaxComment": {
195
+ "dark": "darkStep11",
196
+ "light": "darkStep11"
197
+ },
198
+ "syntaxKeyword": {
199
+ "dark": "darkOrange",
200
+ "light": "darkOrange"
201
+ },
202
+ "syntaxFunction": {
203
+ "dark": "darkOrangeBright",
204
+ "light": "darkOrangeBright"
205
+ },
206
+ "syntaxVariable": {
207
+ "dark": "darkSalmon",
208
+ "light": "darkSalmon"
209
+ },
210
+ "syntaxString": {
211
+ "dark": "darkGreenDim",
212
+ "light": "darkGreenDim"
213
+ },
214
+ "syntaxNumber": {
215
+ "dark": "darkOrangeWash",
216
+ "light": "darkOrangeWash"
217
+ },
218
+ "syntaxType": {
219
+ "dark": "darkGreenBright",
220
+ "light": "darkGreenBright"
221
+ },
222
+ "syntaxOperator": {
223
+ "dark": "darkGreen",
224
+ "light": "darkGreen"
225
+ },
226
+ "syntaxPunctuation": {
227
+ "dark": "darkStep12",
228
+ "light": "darkStep12"
229
+ }
230
+ }
231
+ }