@opencode-ai/ui 0.0.0-dev-202608040319 → 0.0.0-dev-202608040416

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 (48) hide show
  1. package/dist/context/marked-parser.d.ts +2 -0
  2. package/dist/context/marked-theme-register.d.ts +1 -0
  3. package/dist/context/marked-theme.d.ts +2 -0
  4. package/dist/context/marked.d.ts +2 -9
  5. package/dist/i18n/az.d.ts +1 -0
  6. package/dist/i18n/fi.d.ts +1 -0
  7. package/dist/i18n/hi.d.ts +1 -0
  8. package/dist/i18n/id.d.ts +1 -0
  9. package/dist/i18n/it.d.ts +1 -0
  10. package/dist/i18n/nl.d.ts +1 -0
  11. package/dist/i18n/pa.d.ts +1 -0
  12. package/dist/i18n/sv.d.ts +1 -0
  13. package/dist/i18n/ur.d.ts +1 -0
  14. package/dist/i18n/vi.d.ts +1 -0
  15. package/package.json +2 -3
  16. package/src/context/marked-parser.tsx +68 -0
  17. package/src/context/marked-theme-register.tsx +10 -0
  18. package/src/context/marked-theme.tsx +372 -0
  19. package/src/context/marked.tsx +20 -562
  20. package/src/i18n/ar.ts +22 -22
  21. package/src/i18n/az.ts +175 -0
  22. package/src/i18n/br.ts +6 -6
  23. package/src/i18n/bs.ts +23 -23
  24. package/src/i18n/da.ts +12 -12
  25. package/src/i18n/de.ts +36 -36
  26. package/src/i18n/es.ts +17 -17
  27. package/src/i18n/fi.ts +175 -0
  28. package/src/i18n/fr.ts +22 -21
  29. package/src/i18n/hi.ts +176 -0
  30. package/src/i18n/id.ts +195 -0
  31. package/src/i18n/it.ts +176 -0
  32. package/src/i18n/ja.ts +5 -5
  33. package/src/i18n/ko.ts +12 -12
  34. package/src/i18n/nl.ts +175 -0
  35. package/src/i18n/no.ts +23 -23
  36. package/src/i18n/pa.ts +176 -0
  37. package/src/i18n/pl.ts +24 -24
  38. package/src/i18n/ru.ts +23 -23
  39. package/src/i18n/sv.ts +175 -0
  40. package/src/i18n/th.ts +20 -21
  41. package/src/i18n/tr.ts +25 -25
  42. package/src/i18n/uk.ts +15 -15
  43. package/src/i18n/ur.ts +176 -0
  44. package/src/i18n/vi.ts +175 -0
  45. package/src/i18n/zh.ts +28 -29
  46. package/src/i18n/zht.ts +21 -22
  47. package/dist/context/marked-code-span.d.ts +0 -10
  48. package/src/context/marked-code-span.ts +0 -17
@@ -0,0 +1,2 @@
1
+ import { Marked } from "marked";
2
+ export declare function createMarkdownParser(highlight: (code: string, language: string) => string | Promise<string>): Marked<string, string>;
@@ -0,0 +1 @@
1
+ export declare function registerOpenCodeTheme(): void;
@@ -0,0 +1,2 @@
1
+ import type { ThemeRegistrationResolved } from "@pierre/diffs";
2
+ export declare const OpenCodeTheme: ThemeRegistrationResolved;
@@ -1,9 +1,2 @@
1
- import { marked } from "marked";
2
- import { ThemeRegistrationResolved } from "@pierre/diffs";
3
- export declare const OpenCodeTheme: ThemeRegistrationResolved;
4
- export type NativeMarkdownParser = (markdown: string) => Promise<string>;
5
- export declare const useMarked: () => NonNullable<typeof marked | {
6
- parse(markdown: string): Promise<string>;
7
- }>, MarkedProvider: (props: import("solid-js").ParentProps<{
8
- nativeParser?: NativeMarkdownParser;
9
- }>) => import("solid-js").JSX.Element;
1
+ export { OpenCodeTheme } from "./marked-theme";
2
+ export declare const useMarked: () => import("marked").Marked<string, string>, MarkedProvider: (props: import("solid-js").ParentProps<Record<string, any>>) => import("solid-js").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const dict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const dict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const dict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const dict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const dict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const dict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const dict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const dict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const dict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const dict: Record<string, string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencode-ai/ui",
3
- "version": "0.0.0-dev-202608040319",
3
+ "version": "0.0.0-dev-202608040416",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -135,8 +135,7 @@
135
135
  "fuzzysort": "3.1.0",
136
136
  "katex": "0.16.27",
137
137
  "luxon": "3.6.1",
138
- "marked": "17.0.6",
139
- "marked-katex-extension": "5.1.6",
138
+ "marked": "18.0.7",
140
139
  "marked-shiki": "1.2.1",
141
140
  "morphdom": "2.7.8",
142
141
  "motion": "12.34.5",
@@ -0,0 +1,68 @@
1
+ import katex from "katex"
2
+ import { Marked, type MarkedExtension, type Tokens } from "marked"
3
+ import markedShiki from "marked-shiki"
4
+
5
+ export function createMarkdownParser(highlight: (code: string, language: string) => string | Promise<string>) {
6
+ return new Marked(
7
+ {
8
+ renderer: {
9
+ link({ href, title, text }) {
10
+ const titleAttr = title ? ` title="${title}"` : ""
11
+ return `<a href="${href}"${titleAttr} class="external-link" target="_blank" rel="noopener noreferrer">${text}</a>`
12
+ },
13
+ },
14
+ },
15
+ katexExtension,
16
+ markedShiki({ highlight }),
17
+ )
18
+ }
19
+
20
+ const inlineMathRegex = /^\\\(((?:\\.|[^\\\n])*?)\\\)/
21
+ const blockMathRegex = /^\$\$\n([\s\S]+?)\n\$\$(?:\n|$)/
22
+
23
+ const katexExtension: MarkedExtension = {
24
+ extensions: [
25
+ {
26
+ name: "inlineKatex",
27
+ level: "inline",
28
+ start(src) {
29
+ const index = src.indexOf("\\(")
30
+ if (index === -1) return
31
+ return index
32
+ },
33
+ tokenizer(src) {
34
+ const match = src.match(inlineMathRegex)
35
+ if (!match) return
36
+ return {
37
+ type: "inlineKatex",
38
+ raw: match[0],
39
+ text: match[1].trim(),
40
+ displayMode: false,
41
+ }
42
+ },
43
+ renderer: renderKatexToken,
44
+ },
45
+ {
46
+ name: "blockKatex",
47
+ level: "block",
48
+ tokenizer(src) {
49
+ const match = src.match(blockMathRegex)
50
+ if (!match) return
51
+ return {
52
+ type: "blockKatex",
53
+ raw: match[0],
54
+ text: match[1].trim(),
55
+ displayMode: true,
56
+ }
57
+ },
58
+ renderer: renderKatexToken,
59
+ },
60
+ ],
61
+ }
62
+
63
+ function renderKatexToken(token: Tokens.Generic) {
64
+ return katex.renderToString(typeof token.text === "string" ? token.text : "", {
65
+ displayMode: token.displayMode === true,
66
+ throwOnError: false,
67
+ })
68
+ }
@@ -0,0 +1,10 @@
1
+ import { registerCustomTheme } from "@pierre/diffs"
2
+ import { OpenCodeTheme } from "./marked-theme"
3
+
4
+ let registered = false
5
+
6
+ export function registerOpenCodeTheme() {
7
+ if (registered) return
8
+ registered = true
9
+ registerCustomTheme("OpenCode", () => Promise.resolve(OpenCodeTheme))
10
+ }
@@ -0,0 +1,372 @@
1
+ import type { ThemeRegistrationResolved } from "@pierre/diffs"
2
+
3
+ export const OpenCodeTheme = {
4
+ name: "OpenCode",
5
+ bg: "var(--color-background-stronger)",
6
+ fg: "var(--text-base)",
7
+ colors: {
8
+ "editor.background": "var(--color-background-stronger)",
9
+ "editor.foreground": "var(--text-base)",
10
+ "gitDecoration.addedResourceForeground": "var(--syntax-diff-add)",
11
+ "gitDecoration.deletedResourceForeground": "var(--syntax-diff-delete)",
12
+ "gitDecoration.modifiedResourceForeground": "var(--syntax-diff-unknown)",
13
+ // "gitDecoration.conflictingResourceForeground": "#ffca00",
14
+ // "gitDecoration.modifiedResourceForeground": "#1a76d4",
15
+ // "gitDecoration.untrackedResourceForeground": "#00cab1",
16
+ // "gitDecoration.ignoredResourceForeground": "#84848A",
17
+ // "terminal.titleForeground": "#adadb1",
18
+ // "terminal.titleInactiveForeground": "#84848A",
19
+ // "terminal.background": "#141415",
20
+ // "terminal.foreground": "#adadb1",
21
+ // "terminal.ansiBlack": "#141415",
22
+ // "terminal.ansiRed": "#ff2e3f",
23
+ // "terminal.ansiGreen": "#0dbe4e",
24
+ // "terminal.ansiYellow": "#ffca00",
25
+ // "terminal.ansiBlue": "#008cff",
26
+ // "terminal.ansiMagenta": "#c635e4",
27
+ // "terminal.ansiCyan": "#08c0ef",
28
+ // "terminal.ansiWhite": "#c6c6c8",
29
+ // "terminal.ansiBrightBlack": "#141415",
30
+ // "terminal.ansiBrightRed": "#ff2e3f",
31
+ // "terminal.ansiBrightGreen": "#0dbe4e",
32
+ // "terminal.ansiBrightYellow": "#ffca00",
33
+ // "terminal.ansiBrightBlue": "#008cff",
34
+ // "terminal.ansiBrightMagenta": "#c635e4",
35
+ // "terminal.ansiBrightCyan": "#08c0ef",
36
+ // "terminal.ansiBrightWhite": "#c6c6c8",
37
+ },
38
+ tokenColors: [
39
+ {
40
+ scope: ["comment", "punctuation.definition.comment", "string.comment"],
41
+ settings: {
42
+ foreground: "var(--syntax-comment)",
43
+ },
44
+ },
45
+ {
46
+ scope: ["entity.other.attribute-name"],
47
+ settings: {
48
+ foreground: "var(--syntax-property)", // maybe attribute
49
+ },
50
+ },
51
+ {
52
+ scope: ["constant", "entity.name.constant", "variable.other.constant", "variable.language", "entity"],
53
+ settings: {
54
+ foreground: "var(--syntax-constant)",
55
+ },
56
+ },
57
+ {
58
+ scope: ["entity.name", "meta.export.default", "meta.definition.variable"],
59
+ settings: {
60
+ foreground: "var(--syntax-type)",
61
+ },
62
+ },
63
+ {
64
+ scope: ["meta.object.member"],
65
+ settings: {
66
+ foreground: "var(--syntax-primitive)",
67
+ },
68
+ },
69
+ {
70
+ scope: [
71
+ "variable.parameter.function",
72
+ "meta.jsx.children",
73
+ "meta.block",
74
+ "meta.tag.attributes",
75
+ "entity.name.constant",
76
+ "meta.embedded.expression",
77
+ "meta.template.expression",
78
+ "string.other.begin.yaml",
79
+ "string.other.end.yaml",
80
+ ],
81
+ settings: {
82
+ foreground: "var(--syntax-punctuation)",
83
+ },
84
+ },
85
+ {
86
+ scope: ["entity.name.function", "support.type.primitive"],
87
+ settings: {
88
+ foreground: "var(--syntax-primitive)",
89
+ },
90
+ },
91
+ {
92
+ scope: ["support.class.component"],
93
+ settings: {
94
+ foreground: "var(--syntax-type)",
95
+ },
96
+ },
97
+ {
98
+ scope: "keyword",
99
+ settings: {
100
+ foreground: "var(--syntax-keyword)",
101
+ },
102
+ },
103
+ {
104
+ scope: [
105
+ "keyword.operator",
106
+ "storage.type.function.arrow",
107
+ "punctuation.separator.key-value.css",
108
+ "entity.name.tag.yaml",
109
+ "punctuation.separator.key-value.mapping.yaml",
110
+ ],
111
+ settings: {
112
+ foreground: "var(--syntax-operator)",
113
+ },
114
+ },
115
+ {
116
+ scope: ["storage", "storage.type"],
117
+ settings: {
118
+ foreground: "var(--syntax-keyword)",
119
+ },
120
+ },
121
+ {
122
+ scope: ["storage.modifier.package", "storage.modifier.import", "storage.type.java"],
123
+ settings: {
124
+ foreground: "var(--syntax-primitive)",
125
+ },
126
+ },
127
+ {
128
+ scope: [
129
+ "string",
130
+ "punctuation.definition.string",
131
+ "string punctuation.section.embedded source",
132
+ "entity.name.tag",
133
+ ],
134
+ settings: {
135
+ foreground: "var(--syntax-string)",
136
+ },
137
+ },
138
+ {
139
+ scope: "support",
140
+ settings: {
141
+ foreground: "var(--syntax-primitive)",
142
+ },
143
+ },
144
+ {
145
+ scope: ["support.type.object.module", "variable.other.object", "support.type.property-name.css"],
146
+ settings: {
147
+ foreground: "var(--syntax-object)",
148
+ },
149
+ },
150
+ {
151
+ scope: "meta.property-name",
152
+ settings: {
153
+ foreground: "var(--syntax-property)",
154
+ },
155
+ },
156
+ {
157
+ scope: "variable",
158
+ settings: {
159
+ foreground: "var(--syntax-variable)",
160
+ },
161
+ },
162
+ {
163
+ scope: "variable.other",
164
+ settings: {
165
+ foreground: "var(--syntax-variable)",
166
+ },
167
+ },
168
+ {
169
+ scope: [
170
+ "invalid.broken",
171
+ "invalid.illegal",
172
+ "invalid.unimplemented",
173
+ "invalid.deprecated",
174
+ "message.error",
175
+ "markup.deleted",
176
+ "meta.diff.header.from-file",
177
+ "punctuation.definition.deleted",
178
+ "brackethighlighter.unmatched",
179
+ "token.error-token",
180
+ ],
181
+ settings: {
182
+ foreground: "var(--syntax-critical)",
183
+ },
184
+ },
185
+ {
186
+ scope: "carriage-return",
187
+ settings: {
188
+ foreground: "var(--syntax-keyword)",
189
+ },
190
+ },
191
+ {
192
+ scope: "string source",
193
+ settings: {
194
+ foreground: "var(--syntax-variable)",
195
+ },
196
+ },
197
+ {
198
+ scope: "string variable",
199
+ settings: {
200
+ foreground: "var(--syntax-constant)",
201
+ },
202
+ },
203
+ {
204
+ scope: [
205
+ "source.regexp",
206
+ "string.regexp",
207
+ "string.regexp.character-class",
208
+ "string.regexp constant.character.escape",
209
+ "string.regexp source.ruby.embedded",
210
+ "string.regexp string.regexp.arbitrary-repitition",
211
+ "string.regexp constant.character.escape",
212
+ ],
213
+ settings: {
214
+ foreground: "var(--syntax-regexp)",
215
+ },
216
+ },
217
+ {
218
+ scope: "support.constant",
219
+ settings: {
220
+ foreground: "var(--syntax-primitive)",
221
+ },
222
+ },
223
+ {
224
+ scope: "support.variable",
225
+ settings: {
226
+ foreground: "var(--syntax-variable)",
227
+ },
228
+ },
229
+ {
230
+ scope: "meta.module-reference",
231
+ settings: {
232
+ foreground: "var(--syntax-info)",
233
+ },
234
+ },
235
+ {
236
+ scope: "punctuation.definition.list.begin.markdown",
237
+ settings: {
238
+ foreground: "var(--syntax-punctuation)",
239
+ },
240
+ },
241
+ {
242
+ scope: ["markup.heading", "markup.heading entity.name"],
243
+ settings: {
244
+ fontStyle: "bold",
245
+ foreground: "var(--syntax-info)",
246
+ },
247
+ },
248
+ {
249
+ scope: "markup.quote",
250
+ settings: {
251
+ foreground: "var(--syntax-info)",
252
+ },
253
+ },
254
+ {
255
+ scope: "markup.italic",
256
+ settings: {
257
+ fontStyle: "italic",
258
+ // foreground: "",
259
+ },
260
+ },
261
+ {
262
+ scope: "markup.bold",
263
+ settings: {
264
+ fontStyle: "bold",
265
+ foreground: "var(--text-strong)",
266
+ },
267
+ },
268
+ {
269
+ scope: [
270
+ "markup.raw",
271
+ "markup.inserted",
272
+ "meta.diff.header.to-file",
273
+ "punctuation.definition.inserted",
274
+ "markup.changed",
275
+ "punctuation.definition.changed",
276
+ "markup.ignored",
277
+ "markup.untracked",
278
+ ],
279
+ settings: {
280
+ foreground: "var(--text-base)",
281
+ },
282
+ },
283
+ {
284
+ scope: "meta.diff.range",
285
+ settings: {
286
+ fontStyle: "bold",
287
+ foreground: "var(--syntax-unknown)",
288
+ },
289
+ },
290
+ {
291
+ scope: "meta.diff.header",
292
+ settings: {
293
+ foreground: "var(--syntax-unknown)",
294
+ },
295
+ },
296
+ {
297
+ scope: "meta.separator",
298
+ settings: {
299
+ fontStyle: "bold",
300
+ foreground: "var(--syntax-unknown)",
301
+ },
302
+ },
303
+ {
304
+ scope: "meta.output",
305
+ settings: {
306
+ foreground: "var(--syntax-unknown)",
307
+ },
308
+ },
309
+ {
310
+ scope: "meta.export.default",
311
+ settings: {
312
+ foreground: "var(--syntax-unknown)",
313
+ },
314
+ },
315
+ {
316
+ scope: [
317
+ "brackethighlighter.tag",
318
+ "brackethighlighter.curly",
319
+ "brackethighlighter.round",
320
+ "brackethighlighter.square",
321
+ "brackethighlighter.angle",
322
+ "brackethighlighter.quote",
323
+ ],
324
+ settings: {
325
+ foreground: "var(--syntax-unknown)",
326
+ },
327
+ },
328
+ {
329
+ scope: ["constant.other.reference.link", "string.other.link"],
330
+ settings: {
331
+ fontStyle: "underline",
332
+ foreground: "var(--syntax-unknown)",
333
+ },
334
+ },
335
+ {
336
+ scope: "token.info-token",
337
+ settings: {
338
+ foreground: "var(--syntax-info)",
339
+ },
340
+ },
341
+ {
342
+ scope: "token.warn-token",
343
+ settings: {
344
+ foreground: "var(--syntax-warning)",
345
+ },
346
+ },
347
+ {
348
+ scope: "token.debug-token",
349
+ settings: {
350
+ foreground: "var(--syntax-info)",
351
+ },
352
+ },
353
+ ],
354
+ semanticTokenColors: {
355
+ comment: "var(--syntax-comment)",
356
+ string: "var(--syntax-string)",
357
+ number: "var(--syntax-constant)",
358
+ regexp: "var(--syntax-regexp)",
359
+ keyword: "var(--syntax-keyword)",
360
+ variable: "var(--syntax-variable)",
361
+ parameter: "var(--syntax-variable)",
362
+ property: "var(--syntax-property)",
363
+ function: "var(--syntax-primitive)",
364
+ method: "var(--syntax-primitive)",
365
+ type: "var(--syntax-type)",
366
+ class: "var(--syntax-type)",
367
+ namespace: "var(--syntax-type)",
368
+ enumMember: "var(--syntax-primitive)",
369
+ "variable.constant": "var(--syntax-constant)",
370
+ "variable.defaultLibrary": "var(--syntax-unknown)",
371
+ },
372
+ } as unknown as ThemeRegistrationResolved