@lukstei/util-review-ui 0.0.0-stage → 0.2.2-rc.5.11

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.
@@ -0,0 +1,599 @@
1
+ .root {
2
+ container: git-diff / size;
3
+ display: flex;
4
+ flex-direction: column;
5
+ height: 100%;
6
+ min-height: 0;
7
+ min-width: 0;
8
+ color: var(--dsw-alias-label-primary);
9
+ font-family: var(--dsw-font-family);
10
+ font-size: var(--dsh-content-font-size-secondary);
11
+ line-height: 1.5;
12
+ }
13
+ .header {
14
+ box-sizing: border-box;
15
+ display: flex;
16
+ flex: none;
17
+ align-items: center;
18
+ gap: 6px;
19
+ min-width: 0;
20
+ min-height: 35px;
21
+ height: 35px;
22
+ padding: 0 10px;
23
+ background: var(--dsw-alias-bg-module-platform);
24
+ border-bottom: 0.5px solid var(--dsw-alias-border-l2);
25
+ }
26
+ .repositoryName {
27
+ display: block;
28
+ flex: 1;
29
+ min-width: 0;
30
+ overflow: hidden;
31
+ text-overflow: ellipsis;
32
+ white-space: nowrap;
33
+ font-size: 13px;
34
+ font-weight: 500;
35
+ color: var(--dsw-alias-label-secondary);
36
+ }
37
+ .scopePicker {
38
+ display: block;
39
+ flex: 0 1 auto;
40
+ min-width: 0;
41
+ max-width: 240px;
42
+ }
43
+ .scopeSelector {
44
+ margin-inline-start: auto;
45
+ }
46
+ .baselinePicker {
47
+ max-width: 120px;
48
+ min-width: 0;
49
+ height: 26px;
50
+ border-radius: var(--dsw-radius-sm);
51
+ color: inherit;
52
+ font: inherit;
53
+ font-size: 13px;
54
+ line-height: 26px;
55
+ }
56
+ .body {
57
+ display: flex;
58
+ flex-direction: column;
59
+ flex: 1;
60
+ min-height: 0;
61
+ min-width: 0;
62
+ gap: 8px;
63
+ overflow: hidden;
64
+ }
65
+ .body > p {
66
+ padding: 12px;
67
+ }
68
+ .note,
69
+ .baseline {
70
+ color: var(--dsw-alias-label-secondary);
71
+ margin: 0;
72
+ font: inherit;
73
+ }
74
+ .error {
75
+ color: var(--dsw-alias-state-error-primary);
76
+ margin: 0;
77
+ overflow-wrap: anywhere;
78
+ }
79
+ .branchButton {
80
+ width: auto;
81
+ max-width: 100%;
82
+ min-width: 0;
83
+ height: 26px;
84
+ justify-content: flex-start;
85
+ padding-inline: 6px;
86
+ border-radius: var(--dsw-radius-sm);
87
+ font-size: 13px;
88
+ }
89
+ .truncate,
90
+ .filename {
91
+ min-width: 0;
92
+ overflow: hidden;
93
+ text-overflow: ellipsis;
94
+ white-space: nowrap;
95
+ }
96
+ .filename {
97
+ flex: 0 1 auto;
98
+ line-height: 20px;
99
+ }
100
+ .baseline {
101
+ font-size: 13px;
102
+ height: 26px;
103
+ line-height: 26px;
104
+ display: inline-flex;
105
+ align-items: center;
106
+ flex: none;
107
+ max-width: 45%;
108
+ min-width: 0;
109
+ overflow: hidden;
110
+ text-overflow: ellipsis;
111
+ white-space: nowrap;
112
+ }
113
+ .commitLabel {
114
+ display: flex;
115
+ flex-direction: column;
116
+ min-width: 0;
117
+ }
118
+ .branchMenuLabel {
119
+ display: flex;
120
+ flex: 1;
121
+ align-items: center;
122
+ justify-content: space-between;
123
+ gap: 20px;
124
+ min-width: 0;
125
+ }
126
+ .branchMenuLabel time {
127
+ flex: none;
128
+ white-space: nowrap;
129
+ }
130
+ .fileTreeScroll {
131
+ flex: 1;
132
+ min-height: 0;
133
+ min-width: 0;
134
+ overflow: auto;
135
+ overscroll-behavior: contain;
136
+ }
137
+ .directory {
138
+ padding: 5px 12px;
139
+ overflow: hidden;
140
+ text-overflow: ellipsis;
141
+ white-space: nowrap;
142
+ color: var(--dsw-alias-label-tertiary);
143
+ cursor: pointer;
144
+ }
145
+ .fileTree {
146
+ list-style: none;
147
+ margin: 0;
148
+ padding: 0;
149
+ }
150
+ .row {
151
+ flex: 1;
152
+ min-width: 0;
153
+ height: auto;
154
+ min-height: 34px;
155
+ padding: 4px 8px;
156
+ justify-content: flex-start;
157
+ align-items: center;
158
+ text-align: left;
159
+ gap: 8px;
160
+ border-radius: 0;
161
+ }
162
+ .row time {
163
+ flex: none;
164
+ white-space: nowrap;
165
+ line-height: 20px;
166
+ }
167
+ .fileToolbar .row:hover:not(:disabled),
168
+ .fileToolbar .row:active:not(:disabled) {
169
+ background: transparent;
170
+ }
171
+ .disclosureOpen,
172
+ .disclosureClosed {
173
+ width: 14px;
174
+ height: 14px;
175
+ flex: none;
176
+ align-self: center;
177
+ transform-origin: center;
178
+ }
179
+ .disclosureClosed {
180
+ transform: rotate(-90deg);
181
+ }
182
+ .fileEntry {
183
+ border-bottom: 0.5px solid var(--dsw-alias-border-l1);
184
+ }
185
+ .fileBody {
186
+ min-width: 0;
187
+ }
188
+ .fileBody > p {
189
+ padding: 8px 12px;
190
+ }
191
+ .status {
192
+ display: inline-flex;
193
+ align-items: center;
194
+ flex: none;
195
+ width: 1em;
196
+ color: var(--dsw-alias-label-tertiary);
197
+ font-size: 0.9em;
198
+ line-height: 20px;
199
+ }
200
+ .lineCounts {
201
+ display: flex;
202
+ flex: none;
203
+ align-items: center;
204
+ gap: 6px;
205
+ font-size: 0.9em;
206
+ line-height: 20px;
207
+ font-variant-numeric: tabular-nums;
208
+ white-space: nowrap;
209
+ }
210
+ .added {
211
+ color: var(--dsw-alias-file-diff-added-marker);
212
+ }
213
+ .visuallyHidden {
214
+ position: absolute;
215
+ width: 1px;
216
+ height: 1px;
217
+ padding: 0;
218
+ border: 0;
219
+ overflow: hidden;
220
+ clip-path: inset(50%);
221
+ white-space: nowrap;
222
+ }
223
+ .deleted {
224
+ color: var(--dsw-alias-file-diff-deleted-marker);
225
+ }
226
+ .diffContent {
227
+ display: block;
228
+ min-width: 0;
229
+ --diffs-font-family: var(--dsh-font-family-code, monospace);
230
+ --diffs-font-size: var(--dsh-code-font-size, 12px);
231
+ }
232
+
233
+ .icon {
234
+ width: 16px;
235
+ height: 16px;
236
+ flex: none;
237
+ }
238
+ .fileToolbar {
239
+ box-sizing: border-box;
240
+ display: flex;
241
+ align-items: center;
242
+ justify-content: space-between;
243
+ gap: 8px;
244
+ min-height: 36px;
245
+ margin: 0;
246
+ padding: 0 6px 0 0;
247
+ flex: none;
248
+ background: transparent;
249
+ transition: background var(--ds-transition-duration-fast, 0.1s)
250
+ var(--ds-ease-in-out, ease);
251
+ }
252
+ .fileToolbar:hover {
253
+ background: var(--dsw-alias-interactive-bg-hover);
254
+ }
255
+ .fileToolbar .fileAction {
256
+ width: 28px;
257
+ min-width: 28px;
258
+ padding: 0;
259
+ color: var(--dsw-alias-label-secondary);
260
+ }
261
+ .fileAction[aria-pressed="true"] {
262
+ color: var(--dsw-alias-label-primary);
263
+ }
264
+ .fileAction .icon {
265
+ width: 14px;
266
+ height: 14px;
267
+ }
268
+ .reviewDock {
269
+ display: flex;
270
+ flex-direction: column;
271
+ flex: none;
272
+ min-height: 0;
273
+ }
274
+ .reviewBar {
275
+ box-sizing: border-box;
276
+ display: flex;
277
+ flex: none;
278
+ align-items: center;
279
+ justify-content: space-between;
280
+ gap: 8px;
281
+ min-height: 40px;
282
+ height: 40px;
283
+ padding: 4px 10px;
284
+ background: var(--dsw-alias-bg-base);
285
+ border-top: 0.5px solid var(--dsw-alias-border-l3);
286
+ }
287
+ .reviewDrawer {
288
+ box-sizing: border-box;
289
+ max-height: min(280px, 35cqh);
290
+ overflow: auto;
291
+ overscroll-behavior: contain;
292
+ padding: 4px 8px;
293
+ border-top: 0.5px solid var(--dsw-alias-border-l3);
294
+ }
295
+ .reviewRow {
296
+ flex: 1;
297
+ width: 100%;
298
+ min-width: 0;
299
+ height: auto;
300
+ justify-content: flex-start;
301
+ text-align: left;
302
+ }
303
+ .reviewPreview {
304
+ display: flex;
305
+ flex-direction: column;
306
+ min-width: 0;
307
+ padding-block: 4px;
308
+ }
309
+ .reviewItem {
310
+ display: flex;
311
+ align-items: center;
312
+ gap: 4px;
313
+ }
314
+ .chevronOpen {
315
+ width: 16px;
316
+ height: 16px;
317
+ transform: rotate(180deg);
318
+ }
319
+
320
+ .comment {
321
+ box-sizing: border-box;
322
+ margin: 8px 12px;
323
+ padding: 8px 12px;
324
+ color: var(--dsw-alias-label-primary);
325
+ background: var(--dsw-alias-markdown-code-block);
326
+ border: 0.5px solid var(--dsw-alias-border-l3);
327
+ border-radius: var(--dsw-radius-lg);
328
+ font: var(--dsh-content-font-size-secondary) / 1.5 var(--dsw-font-family);
329
+ max-width: 860px;
330
+ }
331
+ .commentHeader {
332
+ display: flex;
333
+ align-items: center;
334
+ justify-content: space-between;
335
+ gap: 8px;
336
+ }
337
+ .commentActions {
338
+ display: flex;
339
+ align-items: center;
340
+ gap: 4px;
341
+ }
342
+ .commentText {
343
+ width: 100%;
344
+ height: auto;
345
+ text-align: left;
346
+ justify-content: flex-start;
347
+ white-space: pre-wrap;
348
+ overflow-wrap: anywhere;
349
+ }
350
+
351
+ .comment textarea {
352
+ box-sizing: border-box;
353
+ display: block;
354
+ width: 100%;
355
+ resize: vertical;
356
+ margin: 4px 0;
357
+ padding: 6px;
358
+ color: inherit;
359
+ background: transparent;
360
+ border: 1px solid var(--dsw-alias-border-l3);
361
+ border-radius: 4px;
362
+ font: inherit;
363
+ }
364
+
365
+ @media (pointer: coarse) {
366
+ .fileToolbar {
367
+ padding-block: 0;
368
+ }
369
+ .row,
370
+ .directory {
371
+ min-height: 44px;
372
+ }
373
+ .directory {
374
+ box-sizing: border-box;
375
+ padding-block: 12px;
376
+ }
377
+ }
378
+ @container git-diff (max-width: 600px) {
379
+ .header > .baseline {
380
+ display: none;
381
+ }
382
+ }
383
+
384
+ @container git-diff (max-width: 600px) {
385
+ .scopePicker {
386
+ max-width: 180px;
387
+ }
388
+ }
389
+
390
+ .fileHeading {
391
+ font: var(--dsh-content-font-size-secondary) / 1.5 var(--dsw-font-family);
392
+ background: var(--dsw-alias-bg-module-platform);
393
+ }
394
+ .fileHeading[data-expanded="true"] {
395
+ border-bottom: 0.5px solid var(--dsw-alias-border-l2);
396
+ }
397
+
398
+ .reviewCardList {
399
+ --deliverable-fill: var(--dsw-static-neutral-50);
400
+ --deliverable-hover: var(--dsw-static-neutral-100);
401
+ display: flex;
402
+ flex-direction: column;
403
+ gap: 6px;
404
+ margin-block: 6px;
405
+ width: 100%;
406
+ }
407
+ :global(body[data-ds-dark-theme]) .reviewCardList {
408
+ --deliverable-fill: var(--dsw-static-neutral-850);
409
+ --deliverable-hover: var(--dsw-static-neutral-800);
410
+ }
411
+ .reviewCard {
412
+ position: relative;
413
+ box-sizing: border-box;
414
+ display: flex;
415
+ align-items: center;
416
+ gap: 10px;
417
+ min-width: 0;
418
+ width: 100%;
419
+ height: 60px;
420
+ padding: 8px 10px;
421
+ overflow: hidden;
422
+ border: 0.5px solid var(--dsw-alias-border-l1);
423
+ border-radius: var(--dsw-radius-lg);
424
+ background: var(--deliverable-fill, var(--dsw-static-neutral-50));
425
+ color: var(--dsw-alias-label-primary);
426
+ transition: background-color 120ms ease;
427
+ }
428
+ :global(body[data-ds-dark-theme]) .reviewCard {
429
+ background: var(--deliverable-fill, var(--dsw-static-neutral-850));
430
+ }
431
+ @media (hover: hover) {
432
+ .reviewCard:hover {
433
+ background: var(--deliverable-hover, var(--dsw-static-neutral-100));
434
+ }
435
+ :global(body[data-ds-dark-theme]) .reviewCard:hover {
436
+ background: var(--deliverable-hover, var(--dsw-static-neutral-800));
437
+ }
438
+ }
439
+ .reviewCard[data-clickable="true"] {
440
+ cursor: pointer;
441
+ }
442
+ .reviewCard:focus-visible {
443
+ outline: none;
444
+ box-shadow: inset 0 0 0 2px
445
+ var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));
446
+ }
447
+ .reviewIcon {
448
+ position: relative;
449
+ z-index: 2;
450
+ box-sizing: border-box;
451
+ flex: 0 0 auto;
452
+ display: grid;
453
+ place-items: center;
454
+ width: 40px;
455
+ height: 40px;
456
+ overflow: hidden;
457
+ pointer-events: none;
458
+ border: 0.5px solid var(--dsw-alias-border-l1);
459
+ border-radius: 10px;
460
+ background: color-mix(in srgb, var(--dsw-static-neutral-00) 50%, transparent);
461
+ color: var(--dsw-alias-link);
462
+ }
463
+ :global(body[data-ds-dark-theme]) .reviewIcon {
464
+ background: color-mix(in srgb, var(--dsw-static-neutral-00) 5%, transparent);
465
+ }
466
+ .reviewDetails {
467
+ position: relative;
468
+ z-index: 2;
469
+ display: flex;
470
+ flex: 1;
471
+ flex-direction: column;
472
+ justify-content: center;
473
+ gap: 2px;
474
+ min-width: 0;
475
+ }
476
+ .reviewTitle {
477
+ display: inline-flex;
478
+ align-items: center;
479
+ min-width: 0;
480
+ color: var(--dsw-alias-label-primary);
481
+ font-size: 13px;
482
+ font-weight: 500;
483
+ line-height: 20px;
484
+ }
485
+ .reviewBranchCopy {
486
+ display: inline-flex;
487
+ align-items: center;
488
+ gap: 6px;
489
+ min-width: 0;
490
+ max-width: 100%;
491
+ cursor: pointer;
492
+ border-radius: var(--dsw-radius-xs, 4px);
493
+ padding: 1px 4px;
494
+ margin-left: -4px;
495
+ transition: background-color 100ms ease;
496
+ user-select: text;
497
+ -webkit-user-select: text;
498
+ }
499
+ @media (hover: hover) {
500
+ .reviewBranchCopy:hover {
501
+ background: var(--dsw-alias-interactive-bg-hover);
502
+ }
503
+ }
504
+ .reviewBranchCopy:focus-visible {
505
+ outline: none;
506
+ box-shadow: 0 0 0 1.5px
507
+ var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));
508
+ }
509
+ .reviewBranchName {
510
+ overflow: hidden;
511
+ text-overflow: ellipsis;
512
+ white-space: nowrap;
513
+ user-select: text;
514
+ -webkit-user-select: text;
515
+ }
516
+ .reviewCopyIcon {
517
+ display: inline-flex;
518
+ flex: none;
519
+ align-items: center;
520
+ opacity: 0.6;
521
+ color: var(--dsw-alias-label-secondary);
522
+ transition:
523
+ opacity 100ms ease,
524
+ color 100ms ease;
525
+ }
526
+ .reviewBranchCopy:hover .reviewCopyIcon,
527
+ .reviewBranchCopy[data-copied="true"] .reviewCopyIcon {
528
+ opacity: 1;
529
+ color: var(--dsw-alias-link);
530
+ }
531
+ .reviewCopyFeedback {
532
+ flex: none;
533
+ font-size: 11px;
534
+ font-weight: 400;
535
+ line-height: 16px;
536
+ color: var(--dsw-alias-link);
537
+ }
538
+ .reviewDescription {
539
+ overflow: hidden;
540
+ text-overflow: ellipsis;
541
+ white-space: nowrap;
542
+ color: var(--dsw-alias-label-tertiary);
543
+ font-size: 10px;
544
+ font-weight: 400;
545
+ line-height: 16px;
546
+ }
547
+
548
+ .codeViewWrapper {
549
+ position: relative;
550
+ min-width: 0;
551
+ }
552
+
553
+ /* Optical alignment & tabular typography for diff line numbers */
554
+ .codeViewWrapper :global(.md-code-block[data-line-numbers]) {
555
+ margin: 0;
556
+ }
557
+ .codeViewWrapper
558
+ :global(.md-code-block[data-line-numbers])
559
+ :where(pre)
560
+ code
561
+ > :global(.line) {
562
+ padding-inline-start: calc(var(--dsl-code-block-line-number-width) + 20px);
563
+ }
564
+ .codeViewWrapper
565
+ :global(.md-code-block[data-line-numbers])
566
+ :where(pre)
567
+ code
568
+ > :global(.line)::before {
569
+ inset-inline-start: 8px;
570
+ width: var(--dsl-code-block-line-number-width);
571
+ font-family: var(--dsh-font-family-code, monospace);
572
+ font-variant-numeric: tabular-nums;
573
+ }
574
+ .floatingQuote {
575
+ position: absolute;
576
+ z-index: 25;
577
+ pointer-events: auto;
578
+ }
579
+ .floatingQuoteButton {
580
+ display: inline-flex;
581
+ align-items: center;
582
+ justify-content: center;
583
+ height: 24px;
584
+ padding: 0 10px;
585
+ font-size: 11px;
586
+ font-weight: 500;
587
+ font-family: var(--dsw-font-family);
588
+ color: #ffffff;
589
+ background: var(--dsw-alias-interactive-bg-primary, #3b82f6);
590
+ border: none;
591
+ border-radius: 12px;
592
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
593
+ cursor: pointer;
594
+ user-select: none;
595
+ white-space: nowrap;
596
+ }
597
+ .floatingQuoteButton:hover {
598
+ filter: brightness(1.1);
599
+ }
@@ -0,0 +1,112 @@
1
+ import {
2
+ IconBranchOutlineRegular,
3
+ IconCheckOutlineRegular,
4
+ IconCopyOutlineRegular,
5
+ useClipboardCopy,
6
+ } from "@deepseek-ai/dsh-client-ui-primitives";
7
+ import type { KeyboardEvent, MouseEvent, ReactNode } from "react";
8
+ import css, { cssText } from "./GitDiffPane.module.css";
9
+
10
+ /** One presented Git review: its branch, its commit line, and the open action. */
11
+ export interface ReviewCardProps {
12
+ /** Branch name. */
13
+ title: string;
14
+ /** Commit line, or the branch's commit range label. */
15
+ description: string;
16
+ onOpen?: () => void;
17
+ }
18
+
19
+ /**
20
+ * Render one review card in the transcript's turn tail.
21
+ * @param props - branch, commit line, and optional open action.
22
+ * @returns the card row.
23
+ */
24
+ export function ReviewCard({
25
+ title,
26
+ description,
27
+ onOpen,
28
+ }: ReviewCardProps): ReactNode {
29
+ const { copied, onCopy } = useClipboardCopy(title);
30
+
31
+ const handleCardClick = () => {
32
+ if (onOpen !== undefined) {
33
+ onOpen();
34
+ }
35
+ };
36
+
37
+ const handleCardKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {
38
+ if (onOpen !== undefined && (e.key === "Enter" || e.key === " ")) {
39
+ e.preventDefault();
40
+ onOpen();
41
+ }
42
+ };
43
+
44
+ const handleCopyClick = (e: MouseEvent) => {
45
+ e.stopPropagation();
46
+ const selection = window.getSelection()?.toString();
47
+ if (selection && selection.length > 0) {
48
+ return;
49
+ }
50
+ onCopy();
51
+ };
52
+
53
+ const handleCopyKeyDown = (e: KeyboardEvent) => {
54
+ if (e.key === "Enter" || e.key === " ") {
55
+ e.preventDefault();
56
+ e.stopPropagation();
57
+ onCopy();
58
+ }
59
+ };
60
+
61
+ return (
62
+ <div
63
+ className={css.reviewCard}
64
+ data-review-card
65
+ data-clickable={onOpen !== undefined ? "true" : undefined}
66
+ onClick={onOpen !== undefined ? handleCardClick : undefined}
67
+ onKeyDown={onOpen !== undefined ? handleCardKeyDown : undefined}
68
+ tabIndex={onOpen !== undefined ? 0 : undefined}
69
+ role={onOpen !== undefined ? "button" : undefined}
70
+ >
71
+ <style>{cssText}</style>
72
+ <span className={css.reviewIcon} aria-hidden>
73
+ <IconBranchOutlineRegular size={20} />
74
+ </span>
75
+ <div className={css.reviewDetails}>
76
+ <div className={css.reviewTitle}>
77
+ {/* biome-ignore lint/a11y/useSemanticElements: Clickable text preserves text selection of branch name */}
78
+ <span
79
+ className={css.reviewBranchCopy}
80
+ data-branch-copy
81
+ data-copied={copied ? "true" : undefined}
82
+ title={
83
+ copied
84
+ ? "Copied branch name"
85
+ : `Click to copy branch name: ${title}`
86
+ }
87
+ onClick={handleCopyClick}
88
+ onKeyDown={handleCopyKeyDown}
89
+ tabIndex={0}
90
+ role="button"
91
+ aria-label={
92
+ copied ? "Copied branch name" : `Copy branch name: ${title}`
93
+ }
94
+ >
95
+ <span className={css.reviewBranchName}>{title}</span>
96
+ <span className={css.reviewCopyIcon} aria-hidden>
97
+ {copied ? (
98
+ <IconCheckOutlineRegular size={13} />
99
+ ) : (
100
+ <IconCopyOutlineRegular size={13} />
101
+ )}
102
+ </span>
103
+ {copied && <span className={css.reviewCopyFeedback}>Copied!</span>}
104
+ </span>
105
+ </div>
106
+ <span className={css.reviewDescription} title={description}>
107
+ {description}
108
+ </span>
109
+ </div>
110
+ </div>
111
+ );
112
+ }
@@ -0,0 +1,5 @@
1
+ declare module "*.module.css" {
2
+ const classes: Record<string, string>;
3
+ export const cssText: string;
4
+ export default classes;
5
+ }