@opencode/ui 0.0.0-dev-228 → 0.0.0-dev-233
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/data-display/keybind/keybind.d.ts +1 -1
- package/dist/data-display/line-comment/line-comment.d.ts +4 -2
- package/dist/i18n/en.d.ts +2 -0
- package/package.json +3 -2
- package/src/data-display/keybind/keybind.css +11 -3
- package/src/data-display/keybind/keybind.tsx +1 -1
- package/src/data-display/line-comment/line-comment.css +91 -0
- package/src/data-display/line-comment/line-comment.tsx +199 -95
- package/src/data-display/line-comment/quote-check.svg +3 -0
- package/src/i18n/en.ts +2 -0
|
@@ -2,6 +2,6 @@ import { type ComponentProps } from "solid-js";
|
|
|
2
2
|
import "./keybind.css";
|
|
3
3
|
export interface KeybindProps extends ComponentProps<"div"> {
|
|
4
4
|
keys: string[];
|
|
5
|
-
variant?: "neutral" | "ghost";
|
|
5
|
+
variant?: "neutral" | "ghost" | "outline";
|
|
6
6
|
}
|
|
7
7
|
export declare function Keybind(props: KeybindProps): import("solid-js").JSX.Element;
|
|
@@ -23,14 +23,16 @@ export interface LineCommentEditorProps extends Omit<ComponentProps<"div">, "chi
|
|
|
23
23
|
onInput: (value: string) => void;
|
|
24
24
|
onCancel: () => void;
|
|
25
25
|
onSubmit: (value: string) => void;
|
|
26
|
-
/** Optional context in the footer,
|
|
26
|
+
/** Optional context in the footer, or above the input in the compact variant. */
|
|
27
27
|
selection?: JSX.Element;
|
|
28
|
+
/** Compact layout with a growing input and inline action. */
|
|
29
|
+
variant?: "default" | "compact";
|
|
28
30
|
placeholder?: string;
|
|
29
31
|
rows?: number;
|
|
30
32
|
cancelLabel?: string;
|
|
31
33
|
submitLabel?: string;
|
|
32
34
|
autofocus?: boolean;
|
|
33
|
-
/** Submit an empty value too, such as to clear a comment that exists (default: false). */
|
|
35
|
+
/** Submit an empty value too, such as to clear a comment that exists (default: false). Compact empty actions otherwise cancel. */
|
|
34
36
|
allowEmpty?: boolean;
|
|
35
37
|
mention?: LineCommentEditorMention;
|
|
36
38
|
}
|
package/dist/i18n/en.d.ts
CHANGED
|
@@ -306,6 +306,8 @@ declare const source: {
|
|
|
306
306
|
"ui.question.answer.none": string;
|
|
307
307
|
"ui.question.review.notAnswered": string;
|
|
308
308
|
"ui.question.multiHint": string;
|
|
309
|
+
"ui.question.singleHint": string;
|
|
310
|
+
"ui.question.classic.multiHint": string;
|
|
309
311
|
"ui.question.custom.placeholder": string;
|
|
310
312
|
"ui.question.custom.answerPlaceholder": string;
|
|
311
313
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opencode/ui",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-233",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"!src/**/*.stories.ts",
|
|
24
24
|
"!src/**/*.stories.tsx",
|
|
25
25
|
"src/**/*.css",
|
|
26
|
+
"src/data-display/line-comment/*.svg",
|
|
26
27
|
"src/theme/themes/*.json",
|
|
27
28
|
"src/components/app-icons/sprite.svg",
|
|
28
29
|
"src/components/provider-icons/sprite.svg",
|
|
@@ -287,7 +288,7 @@
|
|
|
287
288
|
"dependencies": {
|
|
288
289
|
"@kitlangton/solid-motion": "0.2.2",
|
|
289
290
|
"@kobalte/core": "0.13.13",
|
|
290
|
-
"@opencode/util": "0.0.0-dev-
|
|
291
|
+
"@opencode/util": "0.0.0-dev-233",
|
|
291
292
|
"@pierre/diffs": "1.6.1",
|
|
292
293
|
"@pierre/highlights": "0.2.0",
|
|
293
294
|
"@solid-primitives/event-listener": "2.4.6",
|
|
@@ -34,6 +34,9 @@
|
|
|
34
34
|
border-radius: 2px;
|
|
35
35
|
flex: none;
|
|
36
36
|
flex-grow: 0;
|
|
37
|
+
transition:
|
|
38
|
+
background-color var(--keybind-transition-duration, 0s) ease,
|
|
39
|
+
box-shadow var(--keybind-transition-duration, 0s) ease;
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
[data-component="keybind-v2"][data-variant="neutral"] [data-slot="keybind-v2-key"] {
|
|
@@ -44,6 +47,11 @@
|
|
|
44
47
|
background: transparent;
|
|
45
48
|
}
|
|
46
49
|
|
|
50
|
+
[data-component="keybind-v2"][data-variant="outline"] [data-slot="keybind-v2-key"] {
|
|
51
|
+
background: transparent;
|
|
52
|
+
box-shadow: inset 0 0 0 1px var(--v2-border-border-strong);
|
|
53
|
+
}
|
|
54
|
+
|
|
47
55
|
[data-component="keybind-v2"] [data-slot="keybind-v2-label"] {
|
|
48
56
|
display: flex;
|
|
49
57
|
flex-direction: row;
|
|
@@ -53,8 +61,8 @@
|
|
|
53
61
|
padding: 0;
|
|
54
62
|
flex: none;
|
|
55
63
|
font-style: normal;
|
|
56
|
-
font-weight: 530;
|
|
57
|
-
font-size: 11px;
|
|
64
|
+
font-weight: var(--keybind-font-weight, 530);
|
|
65
|
+
font-size: var(--keybind-font-size, 11px);
|
|
58
66
|
line-height: 1;
|
|
59
67
|
text-align: center;
|
|
60
68
|
letter-spacing: 0.05px;
|
|
@@ -67,7 +75,7 @@
|
|
|
67
75
|
user-select: none;
|
|
68
76
|
}
|
|
69
77
|
|
|
70
|
-
[data-component="keybind-v2"][data-variant="neutral"] [data-slot="keybind-v2-label"] {
|
|
78
|
+
[data-component="keybind-v2"]:is([data-variant="neutral"], [data-variant="outline"]) [data-slot="keybind-v2-label"] {
|
|
71
79
|
color: var(--v2-text-text-muted);
|
|
72
80
|
}
|
|
73
81
|
|
|
@@ -125,6 +125,10 @@
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
/* --- Editor --- */
|
|
128
|
+
[data-component="line-comment-v2"] [data-slot="line-comment-v2-input"] {
|
|
129
|
+
display: contents;
|
|
130
|
+
}
|
|
131
|
+
|
|
128
132
|
[data-component="line-comment-v2"][data-variant="editor"] [data-slot="line-comment-v2-shell"] {
|
|
129
133
|
display: flex;
|
|
130
134
|
flex-direction: column;
|
|
@@ -196,6 +200,93 @@
|
|
|
196
200
|
margin-inline-start: auto;
|
|
197
201
|
}
|
|
198
202
|
|
|
203
|
+
[data-component="line-comment-v2"][data-layout="compact"] {
|
|
204
|
+
display: flex;
|
|
205
|
+
max-height: var(--line-comment-max-height, none);
|
|
206
|
+
|
|
207
|
+
[data-slot="line-comment-v2-shell"] {
|
|
208
|
+
flex: 1 1 auto;
|
|
209
|
+
min-width: 0;
|
|
210
|
+
max-height: inherit;
|
|
211
|
+
padding: 12px;
|
|
212
|
+
gap: 10px;
|
|
213
|
+
border-radius: 8px;
|
|
214
|
+
box-shadow: none;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
[data-slot="line-comment-v2-preview"] {
|
|
218
|
+
width: 100%;
|
|
219
|
+
min-width: 0;
|
|
220
|
+
flex-shrink: 0;
|
|
221
|
+
border-inline-start: 2px solid var(--v2-background-bg-layer-03);
|
|
222
|
+
padding-inline-start: 12px;
|
|
223
|
+
color: var(--v2-text-text-muted);
|
|
224
|
+
font-size: 13px;
|
|
225
|
+
font-weight: 440;
|
|
226
|
+
line-height: var(--line-height-base);
|
|
227
|
+
letter-spacing: -0.04px;
|
|
228
|
+
|
|
229
|
+
> span {
|
|
230
|
+
display: -webkit-box;
|
|
231
|
+
overflow: hidden;
|
|
232
|
+
-webkit-box-orient: vertical;
|
|
233
|
+
-webkit-line-clamp: var(--line-comment-preview-lines, 2);
|
|
234
|
+
overflow-wrap: anywhere;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
[data-slot="line-comment-v2-input"] {
|
|
239
|
+
display: flex;
|
|
240
|
+
align-items: flex-end;
|
|
241
|
+
gap: 12px;
|
|
242
|
+
width: 100%;
|
|
243
|
+
min-width: 0;
|
|
244
|
+
min-height: var(--line-height-base);
|
|
245
|
+
flex: 1 1 auto;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
[data-slot="line-comment-v2-field"] {
|
|
249
|
+
flex: 1 1 auto;
|
|
250
|
+
width: auto;
|
|
251
|
+
min-height: 0;
|
|
252
|
+
align-self: stretch;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
[data-slot="line-comment-v2-textarea"] {
|
|
256
|
+
field-sizing: content;
|
|
257
|
+
height: auto;
|
|
258
|
+
flex: 1 1 auto;
|
|
259
|
+
min-height: var(--line-height-base);
|
|
260
|
+
max-height: 160px;
|
|
261
|
+
overflow-y: auto;
|
|
262
|
+
scrollbar-gutter: stable;
|
|
263
|
+
line-height: var(--line-height-base);
|
|
264
|
+
|
|
265
|
+
&::placeholder {
|
|
266
|
+
color: var(--v2-text-text-faint);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
[data-slot="line-comment-v2-submit"] {
|
|
271
|
+
position: relative;
|
|
272
|
+
flex-shrink: 0;
|
|
273
|
+
|
|
274
|
+
@media (hover: none) {
|
|
275
|
+
&::after {
|
|
276
|
+
content: "";
|
|
277
|
+
position: absolute;
|
|
278
|
+
inset: -12px;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
[data-slot="line-comment-v2-submit-icon"] {
|
|
284
|
+
width: 16px;
|
|
285
|
+
height: 16px;
|
|
286
|
+
background: currentColor;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
199
290
|
[data-component="line-comment-v2"][data-variant="editor"] [data-slot="line-comment-v2-mention-list"] {
|
|
200
291
|
display: flex;
|
|
201
292
|
flex-direction: column;
|
|
@@ -1,8 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
For,
|
|
3
|
+
Show,
|
|
4
|
+
createEffect,
|
|
5
|
+
createSignal,
|
|
6
|
+
on,
|
|
7
|
+
onCleanup,
|
|
8
|
+
onMount,
|
|
9
|
+
splitProps,
|
|
10
|
+
type ComponentProps,
|
|
11
|
+
type JSX,
|
|
12
|
+
} from "solid-js"
|
|
2
13
|
import { FileIcon } from "@opencode/ui/file-icon"
|
|
3
14
|
import { useI18n } from "../../context/i18n"
|
|
4
15
|
import { useFilteredList } from "../../hooks"
|
|
5
16
|
import { Button } from "@opencode/ui/button"
|
|
17
|
+
import { Icon } from "@opencode/ui/icon"
|
|
18
|
+
import { IconButton } from "@opencode/ui/icon-button"
|
|
19
|
+
import { Keybind } from "@opencode/ui/keybind"
|
|
20
|
+
import { Tooltip } from "@opencode/ui/tooltip"
|
|
21
|
+
import check from "./quote-check.svg"
|
|
6
22
|
import "./line-comment.css"
|
|
7
23
|
|
|
8
24
|
/** Horizontal “more” glyph for the display-card overflow control (Figma outline-dots). */
|
|
@@ -72,14 +88,16 @@ export interface LineCommentEditorProps extends Omit<ComponentProps<"div">, "chi
|
|
|
72
88
|
onInput: (value: string) => void
|
|
73
89
|
onCancel: () => void
|
|
74
90
|
onSubmit: (value: string) => void
|
|
75
|
-
/** Optional context in the footer,
|
|
91
|
+
/** Optional context in the footer, or above the input in the compact variant. */
|
|
76
92
|
selection?: JSX.Element
|
|
93
|
+
/** Compact layout with a growing input and inline action. */
|
|
94
|
+
variant?: "default" | "compact"
|
|
77
95
|
placeholder?: string
|
|
78
96
|
rows?: number
|
|
79
97
|
cancelLabel?: string
|
|
80
98
|
submitLabel?: string
|
|
81
99
|
autofocus?: boolean
|
|
82
|
-
/** Submit an empty value too, such as to clear a comment that exists (default: false). */
|
|
100
|
+
/** Submit an empty value too, such as to clear a comment that exists (default: false). Compact empty actions otherwise cancel. */
|
|
83
101
|
allowEmpty?: boolean
|
|
84
102
|
mention?: LineCommentEditorMention
|
|
85
103
|
}
|
|
@@ -108,6 +126,7 @@ export function LineCommentEditor(props: LineCommentEditorProps) {
|
|
|
108
126
|
"onCancel",
|
|
109
127
|
"onSubmit",
|
|
110
128
|
"selection",
|
|
129
|
+
"variant",
|
|
111
130
|
"placeholder",
|
|
112
131
|
"rows",
|
|
113
132
|
"cancelLabel",
|
|
@@ -120,6 +139,12 @@ export function LineCommentEditor(props: LineCommentEditorProps) {
|
|
|
120
139
|
])
|
|
121
140
|
|
|
122
141
|
const canSubmit = () => !!local.allowEmpty || local.value.trim().length > 0
|
|
142
|
+
const compactCancel = () => !canSubmit()
|
|
143
|
+
|
|
144
|
+
const compactLabel = () =>
|
|
145
|
+
compactCancel()
|
|
146
|
+
? (local.cancelLabel ?? i18n.t("ui.lineComment.cancel"))
|
|
147
|
+
: (local.submitLabel ?? i18n.t("ui.lineComment.submit"))
|
|
123
148
|
|
|
124
149
|
const closeMention = () => {
|
|
125
150
|
setMentionOpen(false)
|
|
@@ -215,124 +240,203 @@ export function LineCommentEditor(props: LineCommentEditorProps) {
|
|
|
215
240
|
requestAnimationFrame(() => textareaRef?.focus())
|
|
216
241
|
})
|
|
217
242
|
|
|
243
|
+
onMount(() => {
|
|
244
|
+
if (CSS.supports("field-sizing", "content")) return
|
|
245
|
+
|
|
246
|
+
createEffect(() => {
|
|
247
|
+
const textarea = textareaRef
|
|
248
|
+
|
|
249
|
+
if (local.variant !== "compact" || !textarea) return
|
|
250
|
+
|
|
251
|
+
const resize = () => {
|
|
252
|
+
// Reset before measuring so the field can shrink as well as grow.
|
|
253
|
+
textarea.style.height = "0px"
|
|
254
|
+
textarea.style.height = `${textarea.scrollHeight}px`
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
createEffect(on(() => local.value, resize))
|
|
258
|
+
|
|
259
|
+
let width = 0
|
|
260
|
+
|
|
261
|
+
const observer = new ResizeObserver(([entry]) => {
|
|
262
|
+
if (!entry || entry.contentRect.width === width) return
|
|
263
|
+
width = entry.contentRect.width
|
|
264
|
+
resize()
|
|
265
|
+
})
|
|
266
|
+
|
|
267
|
+
observer.observe(textarea)
|
|
268
|
+
onCleanup(() => {
|
|
269
|
+
observer.disconnect()
|
|
270
|
+
textarea.style.removeProperty("height")
|
|
271
|
+
})
|
|
272
|
+
})
|
|
273
|
+
})
|
|
274
|
+
|
|
218
275
|
return (
|
|
219
276
|
<div
|
|
220
277
|
{...rest}
|
|
221
278
|
data-component="line-comment-v2"
|
|
222
279
|
data-variant="editor"
|
|
280
|
+
data-layout={local.variant ?? "default"}
|
|
223
281
|
classList={{
|
|
224
282
|
...local.classList,
|
|
225
283
|
[local.class ?? ""]: !!local.class,
|
|
226
284
|
}}
|
|
227
285
|
>
|
|
228
286
|
<div data-slot="line-comment-v2-shell">
|
|
229
|
-
<
|
|
230
|
-
<
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
local.
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
287
|
+
<Show when={local.variant === "compact" && local.selection}>
|
|
288
|
+
{(selection) => <div data-slot="line-comment-v2-preview">{selection()}</div>}
|
|
289
|
+
</Show>
|
|
290
|
+
<div data-slot="line-comment-v2-input">
|
|
291
|
+
<div data-slot="line-comment-v2-field">
|
|
292
|
+
<textarea
|
|
293
|
+
ref={(el) => {
|
|
294
|
+
textareaRef = el
|
|
295
|
+
}}
|
|
296
|
+
data-slot="line-comment-v2-textarea"
|
|
297
|
+
data-scrollable
|
|
298
|
+
aria-label={local.label ?? i18n.t("ui.lineComment.submit")}
|
|
299
|
+
dir="auto"
|
|
300
|
+
rows={local.rows ?? (local.variant === "compact" ? 1 : 4)}
|
|
301
|
+
placeholder={local.placeholder ?? i18n.t("ui.lineComment.contextPlaceholder")}
|
|
302
|
+
value={local.value}
|
|
303
|
+
style={{ "unicode-bidi": "plaintext", "text-align": "start" }}
|
|
304
|
+
onInput={(e) => {
|
|
305
|
+
local.onInput(e.currentTarget.value)
|
|
306
|
+
syncMention()
|
|
307
|
+
}}
|
|
308
|
+
onClick={() => syncMention()}
|
|
309
|
+
onSelect={() => syncMention()}
|
|
310
|
+
onKeyDown={(e) => {
|
|
311
|
+
e.stopPropagation()
|
|
312
|
+
|
|
313
|
+
if (e.isComposing || e.keyCode === 229) return
|
|
314
|
+
|
|
315
|
+
if (mentionOpen()) {
|
|
316
|
+
if (e.key === "Escape") {
|
|
317
|
+
e.preventDefault()
|
|
318
|
+
closeMention()
|
|
319
|
+
|
|
320
|
+
return
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
if (e.key === "Tab") {
|
|
324
|
+
if (mention.flat().length === 0) return
|
|
325
|
+
e.preventDefault()
|
|
326
|
+
selectActiveMention()
|
|
327
|
+
|
|
328
|
+
return
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
const nav = e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "Enter"
|
|
332
|
+
|
|
333
|
+
const ctrlNav =
|
|
334
|
+
e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey && (e.key === "n" || e.key === "p")
|
|
335
|
+
|
|
336
|
+
if ((nav || ctrlNav) && mention.flat().length > 0) {
|
|
337
|
+
mention.onKeyDown(e)
|
|
338
|
+
e.preventDefault()
|
|
339
|
+
|
|
340
|
+
return
|
|
341
|
+
}
|
|
258
342
|
}
|
|
259
343
|
|
|
260
|
-
if (e.key === "
|
|
261
|
-
if (mention.flat().length === 0) return
|
|
344
|
+
if (e.key === "Escape") {
|
|
262
345
|
e.preventDefault()
|
|
263
|
-
|
|
346
|
+
e.currentTarget.blur()
|
|
347
|
+
local.onCancel()
|
|
264
348
|
|
|
265
349
|
return
|
|
266
350
|
}
|
|
267
351
|
|
|
268
|
-
|
|
269
|
-
const ctrlNav = e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey && (e.key === "n" || e.key === "p")
|
|
270
|
-
|
|
271
|
-
if ((nav || ctrlNav) && mention.flat().length > 0) {
|
|
272
|
-
mention.onKeyDown(e)
|
|
352
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
273
353
|
e.preventDefault()
|
|
274
|
-
|
|
275
|
-
return
|
|
354
|
+
submit()
|
|
276
355
|
}
|
|
356
|
+
}}
|
|
357
|
+
/>
|
|
358
|
+
<Show when={mentionOpen() && mention.flat().length > 0}>
|
|
359
|
+
<div data-slot="line-comment-v2-mention-list">
|
|
360
|
+
<For each={mention.flat().slice(0, 10)}>
|
|
361
|
+
{(item) => {
|
|
362
|
+
const directory = item.path.endsWith("/") ? item.path : pathDirectory(item.path)
|
|
363
|
+
const name = item.path.endsWith("/") ? "" : pathFilename(item.path)
|
|
364
|
+
|
|
365
|
+
return (
|
|
366
|
+
<button
|
|
367
|
+
type="button"
|
|
368
|
+
data-slot="line-comment-v2-mention-item"
|
|
369
|
+
data-active={mention.active() === item.path ? "" : undefined}
|
|
370
|
+
onMouseDown={(event) => event.preventDefault()}
|
|
371
|
+
onMouseEnter={() => mention.setActive(item.path)}
|
|
372
|
+
onClick={() => selectMention(item)}
|
|
373
|
+
>
|
|
374
|
+
<FileIcon node={{ path: item.path, type: "file" }} class="shrink-0 size-4" />
|
|
375
|
+
<div data-slot="line-comment-v2-mention-path">
|
|
376
|
+
<span data-slot="line-comment-v2-mention-dir">{directory}</span>
|
|
377
|
+
<Show when={name}>
|
|
378
|
+
<span data-slot="line-comment-v2-mention-file">{name}</span>
|
|
379
|
+
</Show>
|
|
380
|
+
</div>
|
|
381
|
+
</button>
|
|
382
|
+
)
|
|
383
|
+
}}
|
|
384
|
+
</For>
|
|
385
|
+
</div>
|
|
386
|
+
</Show>
|
|
387
|
+
</div>
|
|
388
|
+
<Show when={local.variant === "compact"}>
|
|
389
|
+
<Tooltip
|
|
390
|
+
value={
|
|
391
|
+
<>
|
|
392
|
+
{compactLabel()} <Keybind keys={[compactCancel() ? "Esc" : "⏎"]} variant="neutral" />
|
|
393
|
+
</>
|
|
277
394
|
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
<div data-slot="line-comment-v2-mention-list">
|
|
295
|
-
<For each={mention.flat().slice(0, 10)}>
|
|
296
|
-
{(item) => {
|
|
297
|
-
const directory = item.path.endsWith("/") ? item.path : pathDirectory(item.path)
|
|
298
|
-
const name = item.path.endsWith("/") ? "" : pathFilename(item.path)
|
|
299
|
-
|
|
300
|
-
return (
|
|
301
|
-
<button
|
|
302
|
-
type="button"
|
|
303
|
-
data-slot="line-comment-v2-mention-item"
|
|
304
|
-
data-active={mention.active() === item.path ? "" : undefined}
|
|
305
|
-
onMouseDown={(event) => event.preventDefault()}
|
|
306
|
-
onMouseEnter={() => mention.setActive(item.path)}
|
|
307
|
-
onClick={() => selectMention(item)}
|
|
308
|
-
>
|
|
309
|
-
<FileIcon node={{ path: item.path, type: "file" }} class="shrink-0 size-4" />
|
|
310
|
-
<div data-slot="line-comment-v2-mention-path">
|
|
311
|
-
<span data-slot="line-comment-v2-mention-dir">{directory}</span>
|
|
312
|
-
<Show when={name}>
|
|
313
|
-
<span data-slot="line-comment-v2-mention-file">{name}</span>
|
|
314
|
-
</Show>
|
|
315
|
-
</div>
|
|
316
|
-
</button>
|
|
395
|
+
placement="top"
|
|
396
|
+
>
|
|
397
|
+
<IconButton
|
|
398
|
+
data-slot="line-comment-v2-submit"
|
|
399
|
+
type="button"
|
|
400
|
+
size="small"
|
|
401
|
+
variant={local.value.trim() ? "neutral" : "ghost-muted"}
|
|
402
|
+
icon={
|
|
403
|
+
compactCancel() ? (
|
|
404
|
+
<Icon name="close" />
|
|
405
|
+
) : (
|
|
406
|
+
<span
|
|
407
|
+
aria-hidden="true"
|
|
408
|
+
data-slot="line-comment-v2-submit-icon"
|
|
409
|
+
style={{ mask: `url("${check}") center / contain no-repeat` }}
|
|
410
|
+
/>
|
|
317
411
|
)
|
|
412
|
+
}
|
|
413
|
+
aria-label={compactLabel()}
|
|
414
|
+
onClick={() => (compactCancel() ? local.onCancel() : submit())}
|
|
415
|
+
onKeyDown={(event) => {
|
|
416
|
+
if (event.key !== "Escape" || event.isComposing) return
|
|
417
|
+
event.preventDefault()
|
|
418
|
+
event.stopPropagation()
|
|
419
|
+
local.onCancel()
|
|
318
420
|
}}
|
|
319
|
-
|
|
320
|
-
</
|
|
421
|
+
/>
|
|
422
|
+
</Tooltip>
|
|
321
423
|
</Show>
|
|
322
424
|
</div>
|
|
323
|
-
<
|
|
324
|
-
<
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
<
|
|
329
|
-
{
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
425
|
+
<Show when={local.variant !== "compact"}>
|
|
426
|
+
<div data-slot="line-comment-v2-footer">
|
|
427
|
+
<Show when={local.selection}>
|
|
428
|
+
{(selection) => <div data-slot="line-comment-v2-footer-meta">{selection()}</div>}
|
|
429
|
+
</Show>
|
|
430
|
+
<div data-slot="line-comment-v2-footer-actions">
|
|
431
|
+
<Button type="button" size="small" variant="ghost" onClick={() => local.onCancel()}>
|
|
432
|
+
{local.cancelLabel ?? i18n.t("ui.lineComment.cancel")}
|
|
433
|
+
</Button>
|
|
434
|
+
<Button type="button" size="small" variant="contrast" disabled={!canSubmit()} onClick={submit}>
|
|
435
|
+
{local.submitLabel ?? i18n.t("ui.lineComment.submit")}
|
|
436
|
+
</Button>
|
|
437
|
+
</div>
|
|
334
438
|
</div>
|
|
335
|
-
</
|
|
439
|
+
</Show>
|
|
336
440
|
</div>
|
|
337
441
|
</div>
|
|
338
442
|
)
|
package/src/i18n/en.ts
CHANGED
|
@@ -334,6 +334,8 @@ const source = {
|
|
|
334
334
|
"ui.question.answer.none": "(no answer)",
|
|
335
335
|
"ui.question.review.notAnswered": "(not answered)",
|
|
336
336
|
"ui.question.multiHint": "Pick any",
|
|
337
|
+
"ui.question.singleHint": "Select one answer",
|
|
338
|
+
"ui.question.classic.multiHint": "Select all answers that apply",
|
|
337
339
|
"ui.question.custom.placeholder": "Type your answer…",
|
|
338
340
|
"ui.question.custom.answerPlaceholder": "Type your own answer…",
|
|
339
341
|
} satisfies Record<string, string>
|