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.
- package/dist/apis/cache.d.ts.map +1 -1
- package/dist/apis/cache.js +1 -2
- package/dist/apis/cache.js.map +1 -1
- package/dist/apis/localstorage.d.ts.map +1 -1
- package/dist/apis/localstorage.js +1 -2
- package/dist/apis/localstorage.js.map +1 -1
- package/dist/apis/sqlite.d.ts +7 -0
- package/dist/apis/sqlite.d.ts.map +1 -0
- package/dist/apis/sqlite.js +13 -0
- package/dist/apis/sqlite.js.map +1 -0
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +14 -5
- package/dist/build.js.map +1 -1
- package/dist/cli.js +5 -40
- package/dist/cli.js.map +1 -1
- package/dist/colors.d.ts +7 -7
- package/dist/colors.js +7 -7
- package/dist/compile.d.ts +6 -1
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +46 -27
- package/dist/compile.js.map +1 -1
- package/dist/components/actions.js +1 -1
- package/dist/components/actions.js.map +1 -1
- package/dist/components/bar-chart.d.ts +38 -0
- package/dist/components/bar-chart.d.ts.map +1 -0
- package/dist/components/bar-chart.js +158 -0
- package/dist/components/bar-chart.js.map +1 -0
- package/dist/components/bar-graph.d.ts +41 -0
- package/dist/components/bar-graph.d.ts.map +1 -0
- package/dist/components/bar-graph.js +95 -0
- package/dist/components/bar-graph.js.map +1 -0
- package/dist/components/detail.d.ts.map +1 -1
- package/dist/components/detail.js +5 -7
- package/dist/components/detail.js.map +1 -1
- package/dist/components/footer.d.ts.map +1 -1
- package/dist/components/footer.js +8 -9
- package/dist/components/footer.js.map +1 -1
- package/dist/components/form/date-picker.d.ts.map +1 -1
- package/dist/components/form/date-picker.js +7 -1
- package/dist/components/form/date-picker.js.map +1 -1
- package/dist/components/form/dropdown.d.ts.map +1 -1
- package/dist/components/form/dropdown.js +10 -2
- package/dist/components/form/dropdown.js.map +1 -1
- package/dist/components/form/index.d.ts.map +1 -1
- package/dist/components/form/index.js +4 -5
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/form/use-form-navigation.d.ts.map +1 -1
- package/dist/components/form/use-form-navigation.js +6 -0
- package/dist/components/form/use-form-navigation.js.map +1 -1
- package/dist/components/graph.d.ts +111 -0
- package/dist/components/graph.d.ts.map +1 -0
- package/dist/components/graph.js +392 -0
- package/dist/components/graph.js.map +1 -0
- package/dist/components/icon.js +5 -5
- package/dist/components/icon.js.map +1 -1
- package/dist/components/list.d.ts +53 -5
- package/dist/components/list.d.ts.map +1 -1
- package/dist/components/list.js +125 -71
- package/dist/components/list.js.map +1 -1
- package/dist/components/loading-bar.js +3 -3
- package/dist/components/loading-bar.js.map +1 -1
- package/dist/components/loading-text.d.ts +1 -1
- package/dist/components/loading-text.d.ts.map +1 -1
- package/dist/components/loading-text.js +3 -1
- package/dist/components/loading-text.js.map +1 -1
- package/dist/components/metadata.js +2 -2
- package/dist/components/metadata.js.map +1 -1
- package/dist/components/row.d.ts +10 -0
- package/dist/components/row.d.ts.map +1 -0
- package/dist/components/row.js +12 -0
- package/dist/components/row.js.map +1 -0
- package/dist/components/table.d.ts +57 -0
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/table.js +365 -0
- package/dist/components/table.js.map +1 -0
- package/dist/descendants.js +13 -13
- package/dist/descendants.js.map +1 -1
- package/dist/examples/bar-graph-weekly.d.ts +2 -0
- package/dist/examples/bar-graph-weekly.d.ts.map +1 -0
- package/dist/examples/bar-graph-weekly.js +95 -0
- package/dist/examples/bar-graph-weekly.js.map +1 -0
- package/dist/examples/components-weird-places.d.ts +2 -0
- package/dist/examples/components-weird-places.d.ts.map +1 -0
- package/dist/examples/components-weird-places.js +46 -0
- package/dist/examples/components-weird-places.js.map +1 -0
- package/dist/examples/graph-bar-chart.d.ts +2 -0
- package/dist/examples/graph-bar-chart.d.ts.map +1 -0
- package/dist/examples/graph-bar-chart.js +270 -0
- package/dist/examples/graph-bar-chart.js.map +1 -0
- package/dist/examples/graph-multi-series.d.ts +2 -0
- package/dist/examples/graph-multi-series.d.ts.map +1 -0
- package/dist/examples/graph-multi-series.js +23 -0
- package/dist/examples/graph-multi-series.js.map +1 -0
- package/dist/examples/graph-polymarket.d.ts +2 -0
- package/dist/examples/graph-polymarket.d.ts.map +1 -0
- package/dist/examples/graph-polymarket.js +109 -0
- package/dist/examples/graph-polymarket.js.map +1 -0
- package/dist/examples/graph-row.d.ts +2 -0
- package/dist/examples/graph-row.d.ts.map +1 -0
- package/dist/examples/graph-row.js +226 -0
- package/dist/examples/graph-row.js.map +1 -0
- package/dist/examples/graph-styles.d.ts +2 -0
- package/dist/examples/graph-styles.d.ts.map +1 -0
- package/dist/examples/graph-styles.js +316 -0
- package/dist/examples/graph-styles.js.map +1 -0
- package/dist/examples/list-accessory-table.d.ts +2 -0
- package/dist/examples/list-accessory-table.d.ts.map +1 -0
- package/dist/examples/list-accessory-table.js +46 -0
- package/dist/examples/list-accessory-table.js.map +1 -0
- package/dist/examples/list-item-accessories.d.ts +2 -0
- package/dist/examples/list-item-accessories.d.ts.map +1 -0
- package/dist/examples/list-item-accessories.js +27 -0
- package/dist/examples/list-item-accessories.js.map +1 -0
- package/dist/examples/list-no-actions.d.ts +2 -0
- package/dist/examples/list-no-actions.d.ts.map +1 -0
- package/dist/examples/list-no-actions.js +7 -0
- package/dist/examples/list-no-actions.js.map +1 -0
- package/dist/examples/simple-detail-table.d.ts +2 -0
- package/dist/examples/simple-detail-table.d.ts.map +1 -0
- package/dist/examples/simple-detail-table.js +45 -0
- package/dist/examples/simple-detail-table.js.map +1 -0
- package/dist/examples/simple-graph.d.ts +2 -0
- package/dist/examples/simple-graph.d.ts.map +1 -0
- package/dist/examples/simple-graph.js +32 -0
- package/dist/examples/simple-graph.js.map +1 -0
- package/dist/examples/simple-table-wrap.d.ts +2 -0
- package/dist/examples/simple-table-wrap.d.ts.map +1 -0
- package/dist/examples/simple-table-wrap.js +37 -0
- package/dist/examples/simple-table-wrap.js.map +1 -0
- package/dist/examples/table-edge-cases.d.ts +2 -0
- package/dist/examples/table-edge-cases.d.ts.map +1 -0
- package/dist/examples/table-edge-cases.js +70 -0
- package/dist/examples/table-edge-cases.js.map +1 -0
- package/dist/examples/table-flex-grow.d.ts +2 -0
- package/dist/examples/table-flex-grow.d.ts.map +1 -0
- package/dist/examples/table-flex-grow.js +18 -0
- package/dist/examples/table-flex-grow.js.map +1 -0
- package/dist/extensions/dev.d.ts.map +1 -1
- package/dist/extensions/dev.js +5 -1
- package/dist/extensions/dev.js.map +1 -1
- package/dist/globals.d.ts +1 -0
- package/dist/globals.d.ts.map +1 -1
- package/dist/globals.js +2 -0
- package/dist/globals.js.map +1 -1
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/date-picker-widget.d.ts.map +1 -1
- package/dist/internal/date-picker-widget.js +4 -0
- package/dist/internal/date-picker-widget.js.map +1 -1
- package/dist/internal/providers.d.ts.map +1 -1
- package/dist/internal/providers.js +1 -3
- package/dist/internal/providers.js.map +1 -1
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +2 -1
- package/dist/logger.js.map +1 -1
- package/dist/markdown-utils.d.ts +22 -1
- package/dist/markdown-utils.d.ts.map +1 -1
- package/dist/markdown-utils.js +66 -1
- package/dist/markdown-utils.js.map +1 -1
- package/dist/opentui.d.ts +4 -0
- package/dist/opentui.d.ts.map +1 -0
- package/dist/opentui.js +3 -0
- package/dist/opentui.js.map +1 -0
- package/dist/release.d.ts +2 -1
- package/dist/release.d.ts.map +1 -1
- package/dist/release.js +2 -1
- package/dist/release.js.map +1 -1
- package/dist/state.d.ts +1 -0
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +1 -1
- package/dist/state.js.map +1 -1
- package/dist/swift-runtime.d.ts.map +1 -1
- package/dist/swift-runtime.js +20 -5
- package/dist/swift-runtime.js.map +1 -1
- package/dist/theme.d.ts +1 -0
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js +13 -0
- package/dist/theme.js.map +1 -1
- package/dist/themes/nerv.json +227 -0
- package/dist/themes/termcast.json +72 -71
- package/dist/themes.d.ts +2 -1
- package/dist/themes.d.ts.map +1 -1
- package/dist/themes.js +7 -5
- package/dist/themes.js.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +4 -1
- package/dist/utils.js.map +1 -1
- package/package.json +12 -4
- package/src/apis/cache.test.ts +1 -1
- package/src/apis/cache.tsx +1 -2
- package/src/apis/localstorage.tsx +1 -2
- package/src/apis/sqlite.ts +14 -0
- package/src/build.tsx +15 -5
- package/src/cli.tsx +5 -49
- package/src/colors.tsx +7 -7
- package/src/compile.tsx +53 -30
- package/src/components/actions.tsx +1 -1
- package/src/components/bar-chart.tsx +271 -0
- package/src/components/bar-graph.tsx +214 -0
- package/src/components/detail.tsx +7 -8
- package/src/components/footer.tsx +14 -15
- package/src/components/form/date-picker.tsx +9 -0
- package/src/components/form/dropdown.tsx +13 -3
- package/src/components/form/index.tsx +4 -6
- package/src/components/form/use-form-navigation.tsx +6 -0
- package/src/components/graph.tsx +506 -0
- package/src/components/icon.tsx +5 -5
- package/src/components/list.tsx +210 -102
- package/src/components/loading-bar.tsx +3 -3
- package/src/components/loading-text.tsx +4 -2
- package/src/components/metadata.tsx +2 -2
- package/src/components/row.tsx +31 -0
- package/src/components/table.tsx +511 -0
- package/src/descendants.tsx +13 -13
- package/src/examples/action-shortcut.vitest.tsx +1 -1
- package/src/examples/actions-context.vitest.tsx +1 -1
- package/src/examples/bar-graph-weekly.tsx +264 -0
- package/src/examples/bar-graph-weekly.vitest.tsx +275 -0
- package/src/examples/detail-metadata-showcase.vitest.tsx +22 -22
- package/src/examples/form-basic.vitest.tsx +239 -0
- package/src/examples/form-dropdown.vitest.tsx +29 -29
- package/src/examples/form-tagpicker.vitest.tsx +27 -27
- package/src/examples/github.vitest.tsx +4 -4
- package/src/examples/graph-bar-chart.tsx +408 -0
- package/src/examples/graph-bar-chart.vitest.tsx +283 -0
- package/src/examples/graph-multi-series.tsx +36 -0
- package/src/examples/graph-multi-series.vitest.tsx +89 -0
- package/src/examples/graph-polymarket.tsx +182 -0
- package/src/examples/graph-polymarket.vitest.tsx +130 -0
- package/src/examples/graph-row.tsx +347 -0
- package/src/examples/graph-row.vitest.tsx +295 -0
- package/src/examples/graph-styles.tsx +457 -0
- package/src/examples/graph-styles.vitest.tsx +322 -0
- package/src/examples/list-accessory-table.tsx +77 -0
- package/src/examples/list-detail-metadata.vitest.tsx +21 -21
- package/src/examples/list-dropdown-default.vitest.tsx +12 -12
- package/src/examples/list-item-accessories.tsx +106 -0
- package/src/examples/list-item-accessories.vitest.tsx +115 -0
- package/src/examples/list-no-actions.tsx +18 -0
- package/src/examples/list-no-actions.vitest.tsx +97 -0
- package/src/examples/list-spacing-mode.vitest.tsx +6 -6
- package/src/examples/list-with-detail.vitest.tsx +73 -73
- package/src/examples/list-with-dropdown.vitest.tsx +49 -6
- package/src/examples/list-with-sections.vitest.tsx +61 -56
- package/src/examples/simple-detail-markdown.vitest.tsx +21 -18
- package/src/examples/simple-detail-table.tsx +65 -0
- package/src/examples/simple-detail-table.vitest.tsx +200 -0
- package/src/examples/simple-graph.tsx +51 -0
- package/src/examples/simple-graph.vitest.tsx +124 -0
- package/src/examples/simple-grid.vitest.tsx +3 -3
- package/src/examples/simple-list-search.vitest.tsx +65 -0
- package/src/examples/simple-navigation.vitest.tsx +3 -3
- package/src/examples/simple-table-wrap.tsx +55 -0
- package/src/examples/simple-table-wrap.vitest.tsx +91 -0
- package/src/examples/store.vitest.tsx +1 -1
- package/src/examples/table-edge-cases.tsx +72 -0
- package/src/examples/table-edge-cases.vitest.tsx +307 -0
- package/src/examples/table-flex-grow.tsx +53 -0
- package/src/examples/table-flex-grow.vitest.tsx +124 -0
- package/src/extensions/dev.tsx +7 -1
- package/src/globals.ts +3 -0
- package/src/index.tsx +31 -0
- package/src/internal/date-picker-widget.tsx +4 -0
- package/src/internal/providers.tsx +1 -4
- package/src/logger.tsx +2 -1
- package/src/markdown-utils.tsx +82 -1
- package/src/opentui.tsx +5 -0
- package/src/release.tsx +3 -0
- package/src/state.tsx +2 -1
- package/src/swift-runtime.tsx +19 -5
- package/src/theme.tsx +14 -0
- package/src/themes/nerv.json +231 -0
- package/src/themes/termcast.json +75 -71
- package/src/themes.ts +8 -5
- package/src/utils.test.tsx +1 -1
- 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
|
|
20
|
+
return util.inspect(msg, { depth: 3 })
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
export const logger = {
|
package/src/markdown-utils.tsx
CHANGED
|
@@ -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
|
-
|
|
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
|
+
}
|
package/src/opentui.tsx
ADDED
|
@@ -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: '
|
|
113
|
+
currentThemeName: 'nerv',
|
|
113
114
|
// Active search input ref
|
|
114
115
|
activeSearchInputRef: null,
|
|
115
116
|
// Registered action shortcuts
|
package/src/swift-runtime.tsx
CHANGED
|
@@ -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 =
|
|
13
|
-
|
|
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
|
|
19
|
-
|
|
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
|
+
}
|