@opencode/ui 0.0.0-beta-19507 → 0.0.0-dev-19274

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.
@@ -4,7 +4,7 @@ import { type IconProps } from "@opencode/ui/icon";
4
4
  import "./button.css";
5
5
  export interface ButtonProps extends ComponentProps<typeof Root>, Pick<ComponentProps<"button">, "class" | "classList" | "children"> {
6
6
  size?: "small" | "normal" | "large";
7
- variant?: "neutral" | "danger" | "warning" | "outline" | "contrast" | "submit" | "ghost" | "ghost-muted" | "ghost-faint" | "loading";
7
+ variant?: "neutral" | "danger" | "warning" | "outline" | "contrast" | "ghost" | "ghost-muted" | "ghost-faint" | "loading";
8
8
  icon?: IconProps["name"];
9
9
  }
10
10
  export declare function Button(props: ButtonProps): import("solid-js").JSX.Element;
@@ -5,7 +5,7 @@ import "./icon-button.css";
5
5
  export interface IconButtonProps extends ComponentProps<typeof Root>, Pick<ComponentProps<"button">, "class" | "classList"> {
6
6
  icon?: JSX.Element;
7
7
  size?: "small" | "normal" | "large";
8
- variant?: "neutral" | "contrast" | "submit" | "ghost" | "ghost-muted";
8
+ variant?: "neutral" | "contrast" | "ghost" | "ghost-muted";
9
9
  state?: "rest" | "hover" | "pressed";
10
10
  }
11
11
  export declare function IconButton(props: ComponentProps<"button"> & IconButtonProps): JSX.Element;
package/dist/i18n/en.d.ts CHANGED
@@ -94,13 +94,7 @@ declare const source: {
94
94
  "ui.messagePart.review.title": string;
95
95
  "ui.messagePart.questions.dismissed": string;
96
96
  "ui.messagePart.compaction": string;
97
- "ui.messagePart.compaction.started": string;
98
- "ui.messagePart.compaction.running": string;
99
- "ui.messagePart.compaction.failed": string;
100
- "ui.messagePart.compaction.cancelled": string;
101
- "ui.messagePart.compaction.interrupted": string;
102
97
  "ui.messagePart.providerCompaction": string;
103
- "ui.messagePart.compaction.usage": string;
104
98
  "ui.messagePart.context.details": string;
105
99
  "ui.messagePart.context.read.one": string;
106
100
  "ui.messagePart.context.read.other": string;
@@ -114,8 +108,7 @@ declare const source: {
114
108
  "ui.messagePart.context.thought.other": string;
115
109
  "ui.messagePart.context.match.one": string;
116
110
  "ui.messagePart.context.match.other": string;
117
- "ui.messagePart.tools.used.one": string;
118
- "ui.messagePart.tools.used.other": string;
111
+ "ui.messagePart.tools.used": string;
119
112
  "ui.list.loading": string;
120
113
  "ui.list.empty": string;
121
114
  "ui.list.clearFilter": string;
@@ -2,14 +2,6 @@ import { type ComponentProps } from "solid-js";
2
2
  import { additionalIcons } from "./additional-icons";
3
3
  import "./icon.css";
4
4
  declare const icons: {
5
- lock: {
6
- viewBox: string;
7
- body: string;
8
- };
9
- globe: {
10
- viewBox: string;
11
- body: string;
12
- };
13
5
  flask: {
14
6
  viewBox: string;
15
7
  body: string;
@@ -198,10 +190,6 @@ declare const icons: {
198
190
  viewBox: string;
199
191
  body: string;
200
192
  };
201
- refresh: {
202
- viewBox: string;
203
- body: string;
204
- };
205
193
  reset: {
206
194
  viewBox: string;
207
195
  body: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencode/ui",
3
- "version": "0.0.0-beta-19507",
3
+ "version": "0.0.0-dev-19274",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,5 +1,3 @@
1
- @import "../submit.css";
2
-
3
1
  * {
4
2
  -webkit-font-smoothing: antialiased;
5
3
  -moz-osx-font-smoothing: grayscale;
@@ -13,7 +13,6 @@ export interface ButtonProps
13
13
  | "warning"
14
14
  | "outline"
15
15
  | "contrast"
16
- | "submit"
17
16
  | "ghost"
18
17
  | "ghost-muted"
19
18
  | "ghost-faint"
@@ -1,5 +1,3 @@
1
- @import "../submit.css";
2
-
3
1
  * {
4
2
  -webkit-font-smoothing: antialiased;
5
3
  -moz-osx-font-smoothing: grayscale;
@@ -71,6 +69,61 @@
71
69
  cursor: not-allowed;
72
70
  }
73
71
 
72
+ /* Contrast */
73
+ [data-component="icon-button-v2"][data-variant="contrast"] {
74
+ --icon-button-contrast-highlight: var(--v2-alpha-light-20);
75
+ --icon-button-contrast-hover: var(--v2-overlay-simple-overlay-contrast-hover);
76
+
77
+ background-image:
78
+ linear-gradient(180deg, var(--icon-button-contrast-highlight) 0%, var(--v2-alpha-light-0) 100%),
79
+ linear-gradient(
80
+ 90deg,
81
+ var(--v2-background-bg-icon-button-contrast) 0%,
82
+ var(--v2-background-bg-icon-button-contrast) 100%
83
+ );
84
+ color: var(--v2-text-text-contrast);
85
+ text-shadow: 0 0.5px 0.5px rgba(0, 0, 0, 0.3);
86
+ box-shadow: var(--v2-elevation-button-contrast);
87
+ }
88
+
89
+ [data-color-scheme="dark"] [data-component="icon-button-v2"][data-variant="contrast"] {
90
+ --icon-button-contrast-highlight: var(--v2-alpha-light-60);
91
+ --icon-button-contrast-hover: var(--v2-alpha-dark-8);
92
+
93
+ color: var(--v2-icon-icon-inverse);
94
+ }
95
+
96
+ [data-component="icon-button-v2"][data-variant="contrast"]:is(:hover, [data-state="hover"]):not(:disabled) {
97
+ background-image:
98
+ linear-gradient(90deg, var(--icon-button-contrast-hover) 0%, var(--icon-button-contrast-hover) 100%),
99
+ linear-gradient(180deg, var(--icon-button-contrast-highlight) 0%, var(--v2-alpha-light-0) 100%),
100
+ linear-gradient(
101
+ 90deg,
102
+ var(--v2-background-bg-icon-button-contrast) 0%,
103
+ var(--v2-background-bg-icon-button-contrast) 100%
104
+ );
105
+ }
106
+
107
+ [data-component="icon-button-v2"][data-variant="contrast"]:is(:active, [data-state="pressed"]):not(:disabled) {
108
+ background-image:
109
+ linear-gradient(
110
+ 90deg,
111
+ var(--v2-overlay-simple-overlay-contrast-pressed) 0%,
112
+ var(--v2-overlay-simple-overlay-contrast-pressed) 100%
113
+ ),
114
+ linear-gradient(180deg, var(--icon-button-contrast-highlight) 0%, var(--v2-alpha-light-0) 100%),
115
+ linear-gradient(
116
+ 90deg,
117
+ var(--v2-background-bg-icon-button-contrast) 0%,
118
+ var(--v2-background-bg-icon-button-contrast) 100%
119
+ );
120
+ }
121
+
122
+ [data-component="icon-button-v2"][data-variant="contrast"]:is(:disabled, [data-state="disabled"]) {
123
+ opacity: 0.4;
124
+ cursor: not-allowed;
125
+ }
126
+
74
127
  /* Ghost */
75
128
  [data-component="icon-button-v2"][data-variant="ghost"] {
76
129
  background-color: transparent;
@@ -8,7 +8,7 @@ export interface IconButtonProps
8
8
  Pick<ComponentProps<"button">, "class" | "classList"> {
9
9
  icon?: JSX.Element
10
10
  size?: "small" | "normal" | "large"
11
- variant?: "neutral" | "contrast" | "submit" | "ghost" | "ghost-muted"
11
+ variant?: "neutral" | "contrast" | "ghost" | "ghost-muted"
12
12
  state?: "rest" | "hover" | "pressed"
13
13
  }
14
14
 
@@ -16,35 +16,7 @@ let smallParser: Marked | undefined
16
16
  export function parseSmallMarkdown(text: string) {
17
17
  // Any possible KaTeX delimiter stays on the worker, including escaped ones.
18
18
  if (text.length > 1024 || text.includes("\\(") || text.includes("$$")) return
19
- // Ordinary prose does not need the block/inline lexer's cold regular expressions.
20
- // Keep every possible Markdown construct, autolink, and hard break on that lexer.
21
- if (
22
- /^[\p{L}\p{N} \t\r\n,.;:!?'"’“”()\-–—…$%]+$/u.test(text) &&
23
- !/(?:^|[\r\n])(?:[ \t]|\d|[-])| {2}(?:\r\n?|\n)|www\./.test(text)
24
- ) {
25
- return text
26
- .replace(/\r\n?/g, "\n")
27
- .replace(/^\n+|\n+$/g, "")
28
- .split(/\n{2,}/)
29
- .filter(Boolean)
30
- .map((paragraph) => `<p>${paragraph.replace(/["']/g, (value) => (value === '"' ? "&quot;" : "&#39;"))}</p>\n`)
31
- .join("")
32
- }
33
19
  const parser = (smallParser ??= createMarkdownBase())
34
- const paragraphs = text.replace(/\r\n?/g, "\n")
35
- // Inline formatting in ordinary paragraphs does not need the block lexer.
36
- // Any possible block opener, HTML, table, or reference definition stays on it.
37
- if (
38
- !/[<|]/.test(paragraphs) &&
39
- !/^(?:[ \t>\d\[\-=]|#{1,6}(?:[ \t]|$)|[`~]{3}|[+*](?:[ \t]|$)|(?:[*_][ \t]*){3,}$)/m.test(paragraphs)
40
- ) {
41
- return paragraphs
42
- .replace(/^\n+|\n+$/g, "")
43
- .split(/\n{2,}/)
44
- .filter(Boolean)
45
- .map((paragraph) => `<p>${parser.parseInline(paragraph, { async: false })}</p>\n`)
46
- .join("")
47
- }
48
20
  const tokens = parser.lexer(text)
49
21
  let code = false
50
22
  parser.walkTokens(tokens, (token) => {
@@ -260,19 +260,20 @@
260
260
  --menu-v2-fg-muted: var(--v2-text-text-faint);
261
261
  --menu-v2-fg-subtle: var(--v2-text-text-muted);
262
262
  --menu-v2-icon: var(--v2-icon-icon-base);
263
+ --menu-v2-accent: var(--v2-text-text-accent);
263
264
  --menu-v2-badge-bg: var(--v2-background-bg-layer-02);
264
265
  --menu-v2-badge-border: var(--v2-border-border-base);
265
266
  --menu-v2-hover: var(--v2-overlay-simple-overlay-hover);
266
267
  }
267
268
 
268
- /* Listbox uses data-selected; menu item CSS uses data-checked — mirror selection styling */
269
+ /* Listbox uses data-selected; menu item CSS uses data-checked — mirror accent */
269
270
  [data-slot="select-v2-listbox"] [data-component="menu-v2-item"][data-selected] [data-slot="menu-v2-item-content"] {
270
- font-weight: 440;
271
- color: var(--menu-v2-fg);
271
+ font-weight: 530;
272
+ color: var(--menu-v2-accent);
272
273
  }
273
274
 
274
275
  [data-slot="select-v2-listbox"] [data-component="menu-v2-item"][data-selected] [data-slot="menu-v2-item-indicator"] {
275
- color: var(--menu-v2-icon);
276
+ color: var(--menu-v2-accent);
276
277
  }
277
278
 
278
279
  [data-slot="select-v2-listbox"]
package/src/i18n/en.ts CHANGED
@@ -104,13 +104,7 @@ const source = {
104
104
  "ui.messagePart.review.title": "Review your answers",
105
105
  "ui.messagePart.questions.dismissed": "Questions dismissed",
106
106
  "ui.messagePart.compaction": "Session compacted",
107
- "ui.messagePart.compaction.started": "Session compaction started",
108
- "ui.messagePart.compaction.running": "Compacting",
109
- "ui.messagePart.compaction.failed": "Session compaction failed",
110
- "ui.messagePart.compaction.cancelled": "Session compaction cancelled",
111
- "ui.messagePart.compaction.interrupted": "Session compaction interrupted",
112
107
  "ui.messagePart.providerCompaction": "Session compacted by provider",
113
- "ui.messagePart.compaction.usage": "{{input}} in · {{output}} out",
114
108
  "ui.messagePart.context.details": "Details",
115
109
  "ui.messagePart.context.read.one": "{{count}} read",
116
110
  "ui.messagePart.context.read.other": "{{count}} reads",
@@ -120,12 +114,11 @@ const source = {
120
114
  "ui.messagePart.context.list.other": "{{count}} lists",
121
115
  "ui.messagePart.context.notice.one": "{{count}} Notice",
122
116
  "ui.messagePart.context.notice.other": "{{count}} Notices",
123
- "ui.messagePart.context.thought.one": "Thought",
124
- "ui.messagePart.context.thought.other": "Thoughts",
117
+ "ui.messagePart.context.thought.one": "{{count}} Thought",
118
+ "ui.messagePart.context.thought.other": "{{count}} Thoughts",
125
119
  "ui.messagePart.context.match.one": "({{count}} match)",
126
120
  "ui.messagePart.context.match.other": "({{count}} matches)",
127
- "ui.messagePart.tools.used.one": "Used {{count}} {{tools}}",
128
- "ui.messagePart.tools.used.other": "Used {{count}} {{tools}}",
121
+ "ui.messagePart.tools.used": "Used {{tools}}",
129
122
 
130
123
  "ui.list.loading": "Loading",
131
124
  "ui.list.empty": "No results",
@@ -4,14 +4,6 @@ import "./icon.css"
4
4
 
5
5
  // Consumers center the SVG viewport, so each icon must center its artwork within its viewBox.
6
6
  const icons = {
7
- lock: {
8
- viewBox: "0 0 16 16",
9
- body: `<rect x="3.5" y="7" width="9" height="7" rx="1" stroke="currentColor"/><path d="M5 7V5a3 3 0 0 1 6 0v2M8 10v1" stroke="currentColor" stroke-linecap="round"/>`,
10
- },
11
- globe: {
12
- viewBox: "0 0 16 16",
13
- body: `<circle cx="8" cy="8" r="6" stroke="currentColor"/><ellipse cx="8" cy="8" rx="2.5" ry="6" stroke="currentColor"/><path d="M2 8h12" stroke="currentColor"/>`,
14
- },
15
7
  flask: {
16
8
  viewBox: "0 0 16 16",
17
9
  body: `<path d="M5.5 2H10.5M6 2V6L2.5 12C2 13 2.5 14 3.5 14H12.5C13.5 14 14 13 13.5 12L10 6V2M4.25 9H11.75" stroke="currentColor" stroke-linecap="square" stroke-linejoin="round"/>`,
@@ -200,10 +192,6 @@ const icons = {
200
192
  viewBox: "0 0 20 20",
201
193
  body: `<path d="M2.5 10s3.33-5.42 7.5-5.42S17.5 10 17.5 10s-3.33 5.42-7.5 5.42S2.5 10 2.5 10Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/><circle cx="10" cy="10" r="2.5" stroke="currentColor"/><path d="M3 3 17 17" stroke="currentColor" stroke-linecap="round"/>`,
202
194
  },
203
- refresh: {
204
- viewBox: "0 0 20 20",
205
- body: `<path d="M16.25 7.5A6.5 6.5 0 1 0 16.5 11M16.25 3.5v4h-4" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>`,
206
- },
207
195
  reset: {
208
196
  viewBox: "0 0 20 20",
209
197
  body: `<path d="M5.83333 4.16406L2.5 7.4974L5.83333 10.8307M3.33333 7.4974H17.9167V15.4141H10" stroke="currentColor" stroke-linecap="square"/>`,
@@ -40,6 +40,7 @@
40
40
  --menu-v2-fg-muted: var(--v2-text-text-faint);
41
41
  --menu-v2-fg-subtle: var(--v2-text-text-muted);
42
42
  --menu-v2-icon: var(--v2-icon-icon-base);
43
+ --menu-v2-accent: var(--v2-text-text-accent);
43
44
  --menu-v2-badge-bg: var(--v2-background-bg-layer-02);
44
45
  --menu-v2-badge-border: var(--v2-border-border-base);
45
46
  --menu-v2-hover: var(--v2-overlay-simple-overlay-hover);
@@ -145,12 +146,12 @@
145
146
  }
146
147
 
147
148
  &[data-checked] [data-slot="menu-v2-item-content"] {
148
- font-weight: 440;
149
- color: var(--menu-v2-fg);
149
+ font-weight: 530;
150
+ color: var(--menu-v2-accent);
150
151
  }
151
152
 
152
153
  &[data-checked] [data-slot="menu-v2-item-indicator"] {
153
- color: var(--menu-v2-icon);
154
+ color: var(--menu-v2-accent);
154
155
  }
155
156
 
156
157
  &[data-disabled] {
@@ -1,74 +0,0 @@
1
- /* Shared by Composer submit actions and contrast icon buttons. */
2
- :is(
3
- [data-component="button-v2"][data-variant="submit"],
4
- [data-component="icon-button-v2"]:is([data-variant="submit"], [data-variant="contrast"])
5
- ) {
6
- --submit-highlight: var(--v2-alpha-light-20);
7
- --submit-hover: var(--v2-overlay-simple-overlay-contrast-hover);
8
-
9
- background-image:
10
- linear-gradient(180deg, var(--submit-highlight) 0%, var(--v2-alpha-light-0) 100%),
11
- linear-gradient(
12
- 90deg,
13
- var(--v2-background-bg-icon-button-contrast) 0%,
14
- var(--v2-background-bg-icon-button-contrast) 100%
15
- );
16
- color: var(--v2-text-text-contrast);
17
- text-shadow: 0 0.5px 0.5px rgba(0, 0, 0, 0.3);
18
- box-shadow: var(--v2-elevation-button-contrast);
19
- }
20
-
21
- [data-color-scheme="dark"]
22
- :is(
23
- [data-component="button-v2"][data-variant="submit"],
24
- [data-component="icon-button-v2"]:is([data-variant="submit"], [data-variant="contrast"])
25
- ) {
26
- --submit-highlight: var(--v2-alpha-light-60);
27
- --submit-hover: var(--v2-alpha-dark-8);
28
-
29
- color: var(--v2-text-text-inverse);
30
- }
31
-
32
- [data-color-scheme="dark"] [data-component="icon-button-v2"]:is([data-variant="submit"], [data-variant="contrast"]) {
33
- color: var(--v2-icon-icon-inverse);
34
- }
35
-
36
- :is(
37
- [data-component="button-v2"][data-variant="submit"],
38
- [data-component="icon-button-v2"]:is([data-variant="submit"], [data-variant="contrast"])
39
- ):is(:hover, [data-state="hover"]):not(:disabled) {
40
- background-image:
41
- linear-gradient(90deg, var(--submit-hover) 0%, var(--submit-hover) 100%),
42
- linear-gradient(180deg, var(--submit-highlight) 0%, var(--v2-alpha-light-0) 100%),
43
- linear-gradient(
44
- 90deg,
45
- var(--v2-background-bg-icon-button-contrast) 0%,
46
- var(--v2-background-bg-icon-button-contrast) 100%
47
- );
48
- }
49
-
50
- :is(
51
- [data-component="button-v2"][data-variant="submit"],
52
- [data-component="icon-button-v2"]:is([data-variant="submit"], [data-variant="contrast"])
53
- ):is(:active, [data-state="pressed"]):not(:disabled) {
54
- background-image:
55
- linear-gradient(
56
- 90deg,
57
- var(--v2-overlay-simple-overlay-contrast-pressed) 0%,
58
- var(--v2-overlay-simple-overlay-contrast-pressed) 100%
59
- ),
60
- linear-gradient(180deg, var(--submit-highlight) 0%, var(--v2-alpha-light-0) 100%),
61
- linear-gradient(
62
- 90deg,
63
- var(--v2-background-bg-icon-button-contrast) 0%,
64
- var(--v2-background-bg-icon-button-contrast) 100%
65
- );
66
- }
67
-
68
- :is(
69
- [data-component="button-v2"][data-variant="submit"],
70
- [data-component="icon-button-v2"]:is([data-variant="submit"], [data-variant="contrast"])
71
- ):is(:disabled, [data-state="disabled"]) {
72
- opacity: 0.4;
73
- cursor: not-allowed;
74
- }