@tldraw/commenting 5.7.0-canary.ea40e3961399 → 5.7.0-canary.ed10ee6bcceb

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 (102) hide show
  1. package/commenting.css +277 -275
  2. package/dist-cjs/canvas/canvas-events.js +25 -1
  3. package/dist-cjs/canvas/canvas-events.js.map +2 -2
  4. package/dist-cjs/canvas/comment-tool.js +29 -28
  5. package/dist-cjs/canvas/comment-tool.js.map +2 -2
  6. package/dist-cjs/canvas/comments-filter-menu.js +55 -38
  7. package/dist-cjs/canvas/comments-filter-menu.js.map +2 -2
  8. package/dist-cjs/canvas/comments-overflow-menu.js +6 -24
  9. package/dist-cjs/canvas/comments-overflow-menu.js.map +2 -2
  10. package/dist-cjs/canvas/comments-overlay.js +1 -0
  11. package/dist-cjs/canvas/comments-overlay.js.map +2 -2
  12. package/dist-cjs/canvas/comments-sidebar.js +15 -3
  13. package/dist-cjs/canvas/comments-sidebar.js.map +2 -2
  14. package/dist-cjs/canvas/comments-visibility-toggle.js +1 -1
  15. package/dist-cjs/canvas/comments-visibility-toggle.js.map +1 -1
  16. package/dist-cjs/canvas/options.js.map +2 -2
  17. package/dist-cjs/canvas/pending-composer.js +133 -8
  18. package/dist-cjs/canvas/pending-composer.js.map +2 -2
  19. package/dist-cjs/canvas/region-box.js +150 -35
  20. package/dist-cjs/canvas/region-box.js.map +3 -3
  21. package/dist-cjs/canvas/thread-pin.js +20 -4
  22. package/dist-cjs/canvas/thread-pin.js.map +2 -2
  23. package/dist-cjs/canvas/thread-view.js +130 -57
  24. package/dist-cjs/canvas/thread-view.js.map +2 -2
  25. package/dist-cjs/index.d.ts +39 -11
  26. package/dist-cjs/index.js +1 -1
  27. package/dist-cjs/ui/byline.js +2 -2
  28. package/dist-cjs/ui/byline.js.map +2 -2
  29. package/dist-cjs/ui/comment-card.js +3 -1
  30. package/dist-cjs/ui/comment-card.js.map +2 -2
  31. package/dist-cjs/ui/comment-extensions.js +4 -1
  32. package/dist-cjs/ui/comment-extensions.js.map +2 -2
  33. package/dist-cjs/ui/comments-list.js +6 -7
  34. package/dist-cjs/ui/comments-list.js.map +2 -2
  35. package/dist-cjs/ui/icons.js +4 -4
  36. package/dist-cjs/ui/icons.js.map +2 -2
  37. package/dist-cjs/ui/reaction-picker.js +2 -2
  38. package/dist-cjs/ui/reaction-picker.js.map +1 -1
  39. package/dist-cjs/ui/send-button.js.map +1 -1
  40. package/dist-esm/canvas/canvas-events.mjs +25 -1
  41. package/dist-esm/canvas/canvas-events.mjs.map +2 -2
  42. package/dist-esm/canvas/comment-tool.mjs +30 -29
  43. package/dist-esm/canvas/comment-tool.mjs.map +2 -2
  44. package/dist-esm/canvas/comments-filter-menu.mjs +57 -39
  45. package/dist-esm/canvas/comments-filter-menu.mjs.map +2 -2
  46. package/dist-esm/canvas/comments-overflow-menu.mjs +8 -24
  47. package/dist-esm/canvas/comments-overflow-menu.mjs.map +2 -2
  48. package/dist-esm/canvas/comments-overlay.mjs +1 -0
  49. package/dist-esm/canvas/comments-overlay.mjs.map +2 -2
  50. package/dist-esm/canvas/comments-sidebar.mjs +16 -4
  51. package/dist-esm/canvas/comments-sidebar.mjs.map +2 -2
  52. package/dist-esm/canvas/comments-visibility-toggle.mjs +1 -1
  53. package/dist-esm/canvas/comments-visibility-toggle.mjs.map +1 -1
  54. package/dist-esm/canvas/options.mjs.map +2 -2
  55. package/dist-esm/canvas/pending-composer.mjs +143 -9
  56. package/dist-esm/canvas/pending-composer.mjs.map +2 -2
  57. package/dist-esm/canvas/region-box.mjs +161 -38
  58. package/dist-esm/canvas/region-box.mjs.map +3 -3
  59. package/dist-esm/canvas/thread-pin.mjs +22 -6
  60. package/dist-esm/canvas/thread-pin.mjs.map +2 -2
  61. package/dist-esm/canvas/thread-view.mjs +140 -58
  62. package/dist-esm/canvas/thread-view.mjs.map +2 -2
  63. package/dist-esm/index.d.mts +39 -11
  64. package/dist-esm/index.mjs +1 -1
  65. package/dist-esm/ui/byline.mjs +2 -2
  66. package/dist-esm/ui/byline.mjs.map +2 -2
  67. package/dist-esm/ui/comment-card.mjs +3 -1
  68. package/dist-esm/ui/comment-card.mjs.map +2 -2
  69. package/dist-esm/ui/comment-extensions.mjs +11 -2
  70. package/dist-esm/ui/comment-extensions.mjs.map +2 -2
  71. package/dist-esm/ui/comments-list.mjs +6 -7
  72. package/dist-esm/ui/comments-list.mjs.map +2 -2
  73. package/dist-esm/ui/icons.mjs +4 -4
  74. package/dist-esm/ui/icons.mjs.map +2 -2
  75. package/dist-esm/ui/reaction-picker.mjs +2 -2
  76. package/dist-esm/ui/reaction-picker.mjs.map +1 -1
  77. package/dist-esm/ui/send-button.mjs.map +1 -1
  78. package/package.json +5 -5
  79. package/src/canvas/canvas-events.ts +39 -2
  80. package/src/canvas/canvas.css +73 -38
  81. package/src/canvas/comment-render.test.ts +8 -1
  82. package/src/canvas/comment-tool.test.ts +34 -44
  83. package/src/canvas/comment-tool.tsx +51 -55
  84. package/src/canvas/comments-filter-menu.tsx +19 -6
  85. package/src/canvas/comments-overflow-menu.tsx +12 -18
  86. package/src/canvas/comments-overlay.tsx +5 -2
  87. package/src/canvas/comments-sidebar.tsx +20 -5
  88. package/src/canvas/comments-visibility-toggle.tsx +1 -1
  89. package/src/canvas/options.ts +21 -2
  90. package/src/canvas/pending-composer.tsx +182 -17
  91. package/src/canvas/region-box.tsx +192 -42
  92. package/src/canvas/thread-pin.tsx +28 -6
  93. package/src/canvas/thread-view.test.ts +39 -0
  94. package/src/canvas/thread-view.tsx +185 -70
  95. package/src/ui/byline.tsx +5 -2
  96. package/src/ui/comment-card.tsx +7 -1
  97. package/src/ui/comment-extensions.ts +18 -5
  98. package/src/ui/comments-list.tsx +23 -17
  99. package/src/ui/comments.css +175 -201
  100. package/src/ui/icons.tsx +5 -5
  101. package/src/ui/reaction-picker.tsx +2 -2
  102. package/src/ui/send-button.tsx +2 -2
@@ -1,5 +1,3 @@
1
- /* Real comment UI components. Co-located so styles travel to any view (studio,
2
- canvas), and themed via tldraw's --tl-color tokens so they follow light/dark. */
3
1
  .tlui-cmt-card {
4
2
  position: relative;
5
3
  display: flex;
@@ -18,7 +16,6 @@
18
16
  padding-left: calc(28px + 6px);
19
17
  }
20
18
 
21
- /* hover-revealed controls (edit, react…) stacked at the card's top-right */
22
19
  .tlui-cmt-card__actions {
23
20
  position: absolute;
24
21
  top: 6px;
@@ -28,12 +25,22 @@
28
25
  opacity: 0;
29
26
  }
30
27
  .tlui-cmt-card:hover .tlui-cmt-card__actions,
31
- .tlui-cmt-card:focus-within .tlui-cmt-card__actions,
32
- /* an open menu is portaled out of the card, so neither :hover nor :focus-within survives moving
33
- the pointer into it — keep the controls up while their menu is open */
28
+ /* Keyboard focus, not any focus: closing an edit hands focus back to the card's ⋯ button, and that
29
+ alone mustn't leave the controls up for a pointer that has moved away. */
30
+ .tlui-cmt-card:has(:focus-visible) .tlui-cmt-card__actions,
31
+ /* an open menu is portaled out of the card, so neither :hover nor focus survives moving the
32
+ pointer into it — keep the controls up while their menu is open */
34
33
  .tlui-cmt-card__actions:has([data-state='open']) {
35
34
  opacity: 1;
36
35
  }
36
+ /* The editor only rings a focused button once Tab or an arrow key has turned its focus ring on, but
37
+ leaving an edit with Escape or Enter hands keyboard focus to the card's ⋯ button without either,
38
+ which would leave the keyboard user nothing showing where focus went. Same ring as the editor's. */
39
+ .tlui-cmt-card__actions .tlui-button:focus-visible {
40
+ border-radius: 10px;
41
+ outline: 2px solid var(--tl-color-focus);
42
+ outline-offset: -5px;
43
+ }
37
44
 
38
45
  .tlui-cmt-body {
39
46
  flex: 1;
@@ -44,12 +51,13 @@
44
51
  display: flex;
45
52
  align-items: center;
46
53
  gap: 6px;
54
+ margin-bottom: -4px;
47
55
  }
48
56
 
49
57
  .tlui-cmt-author {
50
58
  font-weight: 500;
51
59
  font-size: 12px;
52
- color: var(--tl-color-text-1);
60
+ color: var(--tl-color-text);
53
61
  /* a long name ellipsizes rather than pushing the time out or running under the actions */
54
62
  min-width: 0;
55
63
  overflow: hidden;
@@ -64,8 +72,6 @@
64
72
  white-space: nowrap;
65
73
  }
66
74
 
67
- /* In the hover preview a long comment truncates with an ellipsis rather than growing the card —
68
- ~7 lines (≈120px at this line height). Preview only. */
69
75
  .tlui-cmt-canvas-preview--thread .tlui-cmt-text {
70
76
  display: -webkit-box;
71
77
  -webkit-box-orient: vertical;
@@ -92,13 +98,53 @@
92
98
  -webkit-user-select: text;
93
99
  user-select: text;
94
100
  }
101
+ /* In an opened thread the byline, the resolved banner and a host's own `CommentBody` (which may not
102
+ use .tlui-cmt-text) are selectable too, so a quote can be copied with its author and time. Rows
103
+ in the list stay unselectable: they're click targets, and a drag there would select instead. */
104
+ .tlui-cmt-thread :is(.tlui-cmt-author, .tlui-cmt-time, .tlui-cmt-body, .tlui-cmt-thread__resolved),
105
+ .tlui-cmt-thread
106
+ :is(.tlui-cmt-author, .tlui-cmt-time, .tlui-cmt-body, .tlui-cmt-thread__resolved)
107
+ * {
108
+ -webkit-user-select: text;
109
+ user-select: text;
110
+ }
111
+ /* …but not the controls inside them (reaction pills, See more), whose labels aren't content. */
112
+ .tlui-cmt-thread .tlui-cmt-body :is(button, button *) {
113
+ -webkit-user-select: none;
114
+ user-select: none;
115
+ }
116
+
117
+ /* A long comment in the thread view, clamped to 10 lines until expanded. A line clamp, not a max
118
+ height, so it always ends on a whole line: paragraph gaps would leave a height cut mid-line. */
119
+ .tlui-cmt-collapsible--collapsed {
120
+ display: -webkit-box;
121
+ -webkit-box-orient: vertical;
122
+ -webkit-line-clamp: 10;
123
+ line-clamp: 10;
124
+ overflow: hidden;
125
+ }
126
+ /* Styled as the byline's time ("now"), so it reads as metadata rather than a button. */
127
+ .tlui-cmt-see-more {
128
+ display: block;
129
+ /* The clamped body's own bottom margin is clipped with its overflow. */
130
+ margin: 4px 0 6px;
131
+ padding: 0;
132
+ border: none;
133
+ background: none;
134
+ font: inherit;
135
+ font-size: 12px;
136
+ font-weight: normal;
137
+ color: var(--tl-color-text-3);
138
+ cursor: pointer;
139
+ }
140
+ .tlui-cmt-see-more:hover {
141
+ color: var(--tl-color-text-1);
142
+ }
95
143
 
96
144
  .tlui-cmt-edited {
97
145
  font-style: italic;
98
146
  }
99
147
 
100
- /* rendered rich text inside a comment body — bare tags emitted by the comment renderer
101
- (paragraphs, lists, code, highlight, links), matching the limited comment extension set. */
102
148
  .tlui-cmt-text p {
103
149
  margin: 0;
104
150
  }
@@ -138,9 +184,7 @@
138
184
 
139
185
  /* Avatar and mention styles live in @tldraw/mentions and are imported by commenting.css. */
140
186
 
141
- /* composer — an avatar beside a rounded-rect field holding the rich-text input and the send button.
142
- Formatting is applied via markdown and keyboard shortcuts (no toolbar). The avatar aligns to the
143
- top so it stays put as the field grows to multiple lines. */
187
+ /* The avatar aligns to the top so it stays put as the field grows to multiple lines. */
144
188
  .tlui-cmt-composer {
145
189
  display: flex;
146
190
  align-items: flex-start;
@@ -172,7 +216,6 @@
172
216
  the full width and the send button drops to its own row, right-aligned. */
173
217
  .tlui-cmt-composer__field--expanded {
174
218
  flex-wrap: wrap;
175
- /* No vertical gap between the input and the send-button row it wraps onto. */
176
219
  row-gap: 0;
177
220
  }
178
221
  .tlui-cmt-composer__field--expanded .tlui-cmt-composer__input-wrap {
@@ -185,7 +228,6 @@
185
228
  margin-left: auto;
186
229
  }
187
230
 
188
- /* the editable area, with the placeholder overlaid while it's empty */
189
231
  .tlui-cmt-composer__input-wrap {
190
232
  position: relative;
191
233
  flex: 1;
@@ -255,8 +297,6 @@
255
297
  }
256
298
  }
257
299
 
258
- /* A bare up-arrow icon button (matching the placement composer): no fill by default, a grey square
259
- on hover, grey while there's nothing to send and dark once there is. */
260
300
  .tlui-cmt-send {
261
301
  flex-shrink: 0;
262
302
  display: inline-flex;
@@ -298,8 +338,9 @@
298
338
  }
299
339
 
300
340
  /* The shared marker treatment. To the pointer a comment pin and a count badge are the same
301
- object — a token sitting on the canvas — so they rest and lift identically; everything shared
302
- lives here so the two can't drift apart. */
341
+ object — a token sitting on the canvas — so their resting and hover shadows live here, where the
342
+ two can't drift apart. Each opts out of the hover scale below; a canvas pin gets it back from
343
+ canvas.css, keyed off its hit layer. */
303
344
  .tlui-cmt-marker {
304
345
  box-shadow: var(--tlui-cmt-marker-shadow);
305
346
  cursor: pointer;
@@ -312,52 +353,45 @@
312
353
  transform: scale(var(--tlui-cmt-marker-hover-scale));
313
354
  }
314
355
 
315
- /* The hover shadow is for closed markers only — an open one keeps its selection ring, which this
316
- box-shadow would otherwise override (the hover selector outranks the --open rule). */
317
356
  .tlui-cmt-marker:not(.tlui-cmt-marker--open):hover {
318
357
  box-shadow: var(--tlui-cmt-marker-shadow-hover);
319
358
  }
320
359
 
321
- /* Count badges don't react to hover — no scale, no shadow lift. Only pins do. */
322
360
  .tlui-cmt-count-badge:hover {
323
361
  transform: none;
324
- box-shadow: var(--tlui-cmt-marker-shadow);
362
+ box-shadow: var(--tlui-cmt-marker-shadow-hover);
325
363
  }
326
364
 
327
- /* Pins don't scale on hover — only the shadow lifts. */
365
+ /* A pin's own :hover doesn't scale it; on the canvas, canvas.css scales it from the hit layer. */
328
366
  .tlui-cmt-pin:hover {
329
367
  transform: none;
330
368
  }
331
369
 
332
- /* open: the thread (or a stack's list) is showing — the active marker just keeps its lift shadow,
333
- no selection ring. */
334
370
  .tlui-cmt-marker--open {
335
- box-shadow: var(--tlui-cmt-marker-shadow);
371
+ box-shadow: var(--tlui-cmt-marker-shadow-hover);
336
372
  }
337
373
 
338
- /* pin — a canvas marker: a white teardrop holding the author's avatar circle, so a thread is
339
- identifiable at a glance. */
340
374
  .tlui-cmt-pin {
341
375
  --tlui-cmt-marker-size: var(--tlui-cmt-pin-size);
342
376
  width: var(--tlui-cmt-marker-size);
343
377
  height: var(--tlui-cmt-marker-size);
344
378
  border-radius: 50% 50% 50% 0;
345
379
  background: var(--tl-color-panel);
346
- color: #fff;
380
+ color: var(--tl-color-panel-contrast);
347
381
  display: flex;
348
382
  align-items: center;
349
383
  justify-content: center;
350
384
  font-size: 14px;
351
385
  font-weight: 600;
352
386
  }
353
- /* The pin holds the author's 22px avatar circle, centred in its 28px face. */
354
387
  .tlui-cmt-pin .tlui-cmt-avatar {
355
388
  width: 22px;
356
389
  height: 22px;
390
+ box-shadow: inset 0px 0px 0px 1px var(--tl-color-hint);
357
391
  }
358
392
 
359
- /* resolved: a solid, muted grey (the default --tl-color-muted-1 is 10% black, so it goes
360
- translucent over the canvas). Dark mode gets its own grey — the token's dark value is near-black. */
393
+ /* resolved: a solid, muted grey per theme. The muted tokens are translucent (10% black, or 10% white
394
+ in dark mode), so the canvas would show through a pin filled with one. */
361
395
  .tlui-cmt-pin--resolved {
362
396
  background: #dfe0e1;
363
397
  color: hsl(214, 8%, 42%);
@@ -367,7 +401,6 @@
367
401
  color: hsl(0, 0%, 72%);
368
402
  }
369
403
 
370
- /* count badge — the same marker as a pin. */
371
404
  .tlui-cmt-count-badge {
372
405
  width: var(--tlui-cmt-marker-size);
373
406
  height: var(--tlui-cmt-marker-size);
@@ -382,12 +415,13 @@
382
415
  user-select: none;
383
416
  }
384
417
 
385
- /* reactions */
386
418
  .tlui-cmt-reactions {
387
419
  display: flex;
388
420
  flex-wrap: wrap;
389
421
  gap: 4px;
390
- margin-top: 6px;
422
+ margin-top: 4px;
423
+ /* Pull the row left by the pill's inline padding so the first emoji lines up with the text above. */
424
+ margin-left: -6px;
391
425
  }
392
426
 
393
427
  .tlui-cmt-reaction {
@@ -397,7 +431,7 @@
397
431
  padding: 2px 6px;
398
432
  border: none;
399
433
  border-radius: var(--tl-radius-1);
400
- background: var(--tl-color-muted-2);
434
+ background: none;
401
435
  font: inherit;
402
436
  font-size: 10px;
403
437
  font-weight: 400;
@@ -410,20 +444,8 @@ button.tlui-cmt-reaction {
410
444
  cursor: pointer;
411
445
  }
412
446
 
413
- /* Hover deepens the grey — no border to tint now. Mixing toward the text colour is theme-aware:
414
- it darkens the fill in light mode and lightens it in dark, tracking the pill's own contrast. */
415
447
  button.tlui-cmt-reaction:hover {
416
- background: var(--tl-color-muted-1);
417
- }
418
-
419
- /* a reaction you're part of fills with the selection colour, so "I reacted with this" stands out
420
- from the grey pills of reactions you haven't joined. */
421
- .tlui-cmt-reaction--active {
422
- background: color-mix(in srgb, var(--tl-color-selected) 28%, var(--tl-color-panel));
423
- }
424
-
425
- button.tlui-cmt-reaction--active:hover {
426
- background: color-mix(in srgb, var(--tl-color-selected) 38%, var(--tl-color-panel));
448
+ background: var(--tl-color-muted-2);
427
449
  }
428
450
 
429
451
  /* The emoji renders larger than the 10px count, but its pinned line-height keeps the pill the
@@ -440,14 +462,16 @@ button.tlui-cmt-reaction--active:hover {
440
462
 
441
463
  .tlui-cmt-reaction--active .tlui-cmt-reaction__count {
442
464
  color: var(--tl-color-text-1);
465
+ font-weight: 700;
443
466
  }
444
467
 
445
- /* emoji picker */
468
+ /* Laid out like tldraw's .tlui-grid (the actions menu): 40px hit areas overlapping 2px on every
469
+ side, so the 32px hover squares sit 4px apart and 4px in from the panel edge. */
446
470
  .tlui-cmt-emoji-picker {
447
471
  display: grid;
448
- grid-template-columns: repeat(5, 40px);
472
+ grid-template-columns: repeat(5, 36px);
449
473
  gap: 0;
450
- padding: 4px;
474
+ padding: 2px;
451
475
  }
452
476
 
453
477
  .tlui-cmt-emoji-picker__item {
@@ -457,6 +481,7 @@ button.tlui-cmt-reaction--active:hover {
457
481
  justify-content: center;
458
482
  width: 40px;
459
483
  height: 40px;
484
+ margin: -2px;
460
485
  padding: 0;
461
486
  border: none;
462
487
  background: none;
@@ -466,12 +491,11 @@ button.tlui-cmt-reaction--active:hover {
466
491
  cursor: pointer;
467
492
  }
468
493
 
469
- /* Inset wash behind the glyph — the 40px hit cells tile edge-to-edge, the squares sit 4px apart,
470
- like the thread action buttons. Sits under the emoji so an opaque selected fill can't hide it. */
494
+ /* Sits under the emoji so an opaque selected fill can't hide it. */
471
495
  .tlui-cmt-emoji-picker__item::after {
472
496
  content: '';
473
497
  position: absolute;
474
- inset: 2px;
498
+ inset: 4px;
475
499
  z-index: -1;
476
500
  border-radius: var(--tl-radius-2);
477
501
  }
@@ -486,7 +510,6 @@ button.tlui-cmt-reaction--active:hover {
486
510
  background: color-mix(in srgb, var(--tl-color-selected) 28%, var(--tl-color-panel));
487
511
  }
488
512
 
489
- /* empty state */
490
513
  .tlui-cmt-empty {
491
514
  display: flex;
492
515
  flex-direction: column;
@@ -508,8 +531,6 @@ button.tlui-cmt-reaction--active:hover {
508
531
  line-height: 1.4;
509
532
  }
510
533
 
511
- /* a comment thread: an elevated panel holding a header, an optional resolved banner, the
512
- comments, and a reply composer */
513
534
  /* The thread panel's layout metrics live on the container because two separate portals need them:
514
535
  the panel itself, and the canvas hover preview, which has to land its first comment on exactly
515
536
  the pixel the panel would. Deriving the preview's offset from these means the two can't drift —
@@ -524,16 +545,20 @@ button.tlui-cmt-reaction--active:hover {
524
545
  stops at the marker's edge instead of covering it. Mirrored by `MARKER_SIZE` in
525
546
  thread-view.tsx. */
526
547
  --tlui-cmt-marker-size: var(--tlui-cmt-pin-size);
527
- /* How a marker sits, lifts, and rings. Shared so a pin and a badge respond identically.
528
- shadow-3's depth without its `inset 1px panel-contrast` edge — that inset reads as a white
529
- border on a coloured pin (it's invisible on the panel-white menus shadow-3 is meant for). */
530
- --tlui-cmt-marker-shadow: 0px 1px 2px hsl(0, 0%, 0%, 28%), 0px 2px 6px hsl(0, 0%, 0%, 14%);
531
- --tlui-cmt-marker-shadow-hover: var(--tlui-cmt-marker-shadow);
548
+ /* How a marker rests and lifts. Shared so a pin and a badge respond identically. shadow-3's
549
+ depth without its `inset 1px panel-contrast` edge, which would ring the text-coloured count
550
+ badge in the panel's contrast colour. */
551
+ --tlui-cmt-marker-shadow:
552
+ 0px 1px 2px hsl(0, 0%, 0%, 28%), 0px 2px 6px hsl(0, 0%, 0%, 14%),
553
+ inset 0px 0px 0px 1px var(--tl-color-panel-contrast);
554
+ --tlui-cmt-marker-shadow-hover:
555
+ 0px 1px 2px hsl(0, 0%, 0%, 32%), 0px 2px 6px hsl(0, 0%, 0%, 14%),
556
+ inset 0px 0px 0px 1px var(--tl-color-panel-contrast);
532
557
  --tlui-cmt-marker-hover-scale: 1.08;
533
558
  --tlui-cmt-marker-transition: 0.08s ease;
534
559
  --tlui-cmt-thread-padding: 12px;
535
560
  --tlui-cmt-thread-gap: 0px;
536
- /* Hit-area width of one .tlui-cmt-thread__action button (drawn as a 32px square inset 4px). */
561
+ /* Hit-area width of one .tlui-cmt-icon-btn button (drawn as a 32px square inset 4px). */
537
562
  --tlui-cmt-thread-action-size: 40px;
538
563
  /* A floating pill's edge — its hairline ring is the only thing separating it from the panel it
539
564
  overlaps, so the ring is a theme token rather than a literal black: a near-black hairline
@@ -551,7 +576,6 @@ button.tlui-cmt-reaction--active:hover {
551
576
  border-radius: var(--tl-radius-4);
552
577
  box-shadow: var(--tl-shadow-3);
553
578
  }
554
- /* A pill of its own, floating above the panel's top-right corner and overlapping its top edge. */
555
579
  .tlui-cmt-thread__header {
556
580
  position: absolute;
557
581
  right: 10px;
@@ -564,17 +588,17 @@ button.tlui-cmt-reaction--active:hover {
564
588
  box-shadow: var(--tlui-cmt-pill-shadow);
565
589
  transition: opacity 0.1s ease;
566
590
  }
567
- /* The first comment's hover actions surface right where the header pill sits, so hide the pill
568
- while that comment is hovered — one pill in the corner, never two stacked. */
591
+ /* The first comment's hover actions surface right under the header pill, so hide the pill while
592
+ that comment is hovered — one set of actions in the corner, never two stacked. */
569
593
  .tlui-cmt-thread:has(.tlui-cmt-thread__list > :first-child:hover)
570
594
  .tlui-cmt-thread__header:not(:has(.tlui-cmt-thread__title)) {
571
595
  opacity: 0;
572
596
  pointer-events: none;
573
597
  }
574
- /* A title puts the header back in the panel, in flow. The pill above is tuned for the actions-only
575
- case tldraw itself uses: right-anchored and only as wide as its buttons, so a title inside it
576
- would grow leftwards off the panel's edge and float over whatever sits above. `header` is public
577
- API (see `CommentThreadProps`), so it has to keep laying out sensibly for anyone passing one. */
598
+ /* A title puts the header back in the panel, in flow — the case tldraw's own thread view uses
599
+ ("Comment"). The pill above suits an actions-only header: right-anchored and only as wide as its
600
+ buttons, so a title inside it would grow leftwards off the panel's edge. `header` is public API
601
+ (see `CommentThreadProps`), so both layouts have to hold up. */
578
602
  .tlui-cmt-thread__header:has(.tlui-cmt-thread__title) {
579
603
  position: static;
580
604
  align-items: center;
@@ -585,24 +609,22 @@ button.tlui-cmt-reaction--active:hover {
585
609
  }
586
610
  .tlui-cmt-thread__title {
587
611
  padding: 10px 12px;
588
- font-size: 12px;
589
- line-height: 20px;
590
- font-weight: 500;
591
- color: var(--tl-color-text-1);
612
+ color: var(--tl-color-text);
592
613
  }
593
614
  .tlui-cmt-thread__actions {
594
615
  display: flex;
595
616
  gap: 0;
596
- /* Right-align the actions whether or not the header has a title (it currently has none, so
597
- space-between alone would leave them at the left). */
617
+ /* Right-align the actions whether or not the header has a title (with none, space-between alone
618
+ would leave them at the left). */
598
619
  margin-left: auto;
599
620
  }
600
- /* These are TldrawUiButtons (type="icon"), so the 40px box, the 32px ::after square carrying the
601
- hover wash, and the hover z-index flip all come from .tlui-button — the hit area (not the
602
- ::after) is what's clickable, and it never reaches past its row. Only the bits that differ from
603
- a toolbar button are set here, at .tlui-button's specificity + 1 so stylesheet order can't
604
- decide the winner. */
605
- .tlui-button.tlui-cmt-thread__action {
621
+ /* Every icon button in the comment UI: thread and sidebar headers, and a comment's own actions.
622
+ These are TldrawUiButtons (type="icon"), so the 40px box, the 32px ::after square carrying the
623
+ hover wash, and the hover z-index flip all come from .tlui-button. Only the bits that differ
624
+ from a toolbar button are set here, at .tlui-button's specificity + 1 so stylesheet order can't
625
+ decide the winner. `.tlui-cmt-thread__action` and `.tlui-cmt-header-btn` are the class's former
626
+ names, kept so a host's own buttons still pick the styles up. */
627
+ .tlui-button:is(.tlui-cmt-icon-btn, .tlui-cmt-thread__action, .tlui-cmt-header-btn) {
606
628
  width: 40px;
607
629
  padding: 0;
608
630
  border-radius: 6px;
@@ -611,13 +633,31 @@ button.tlui-cmt-reaction--active:hover {
611
633
  line-height: 1;
612
634
  }
613
635
  /* Overlap each button 4px into the previous so the 32px visual squares sit 4px apart, not 8px.
614
- Left-only, so the last button's hit area still stops at its row's right edge. */
615
- .tlui-cmt-thread__action + .tlui-cmt-thread__action {
616
- margin-left: -4px;
636
+ On the leading side only, so the last button's hit area still stops at its row's edge. */
637
+ :is(.tlui-cmt-icon-btn, .tlui-cmt-thread__action, .tlui-cmt-header-btn)
638
+ + :is(.tlui-cmt-icon-btn, .tlui-cmt-thread__action, .tlui-cmt-header-btn) {
639
+ margin-inline-start: -4px;
640
+ }
641
+ @media (hover: hover) {
642
+ .tlui-button:is(.tlui-cmt-icon-btn, .tlui-cmt-thread__action, .tlui-cmt-header-btn):hover {
643
+ color: var(--tl-color-text-1);
644
+ }
617
645
  }
618
- .tlui-button.tlui-cmt-thread__action:hover {
646
+ .tlui-button:is(
647
+ .tlui-cmt-icon-btn,
648
+ .tlui-cmt-thread__action,
649
+ .tlui-cmt-header-btn
650
+ )[data-state='open'] {
619
651
  color: var(--tl-color-text-1);
620
652
  }
653
+ .tlui-button:is(
654
+ .tlui-cmt-icon-btn,
655
+ .tlui-cmt-thread__action,
656
+ .tlui-cmt-header-btn
657
+ )[data-state='open']::after {
658
+ background: var(--tl-muted-gradient-to-bottom);
659
+ opacity: 1;
660
+ }
621
661
  .tlui-cmt-thread__resolved {
622
662
  margin: 4px 12px;
623
663
  padding: 6px 10px;
@@ -648,48 +688,31 @@ button.tlui-cmt-reaction--active:hover {
648
688
  .tlui-cmt-thread .tlui-cmt-avatar,
649
689
  .tlui-cmt-canvas-preview--thread .tlui-cmt-avatar,
650
690
  .tlui-cmt-canvas-preview--list .tlui-cmt-avatar,
651
- .tlui-cmt-stack-list .tlui-cmt-avatar {
691
+ .tlui-cmt-stack-list .tlui-cmt-avatar,
692
+ .tlui-cmt-list .tlui-cmt-avatar {
652
693
  width: 12px;
653
694
  height: 12px;
654
695
  font-size: 0;
655
696
  }
656
697
 
657
698
  .tlui-cmt-thread .tlui-cmt-composer {
658
- padding: 12px;
699
+ padding: 4px;
659
700
  }
660
701
  .tlui-cmt-thread .tlui-cmt-composer .tlui-cmt-avatar {
661
702
  display: none;
662
703
  }
663
704
 
664
- /* The sidebar's rows use the same small colour dot as the thread view. */
665
- .tlui-cmt-list .tlui-cmt-avatar {
666
- width: 14px;
667
- height: 14px;
668
- font-size: 0;
669
- margin-top: 2px;
670
- }
671
- /* The sidebar row already leads with its own avatar (the flex row's first column); the byline's
672
- avatar — added for the canvas thread views — would double it, so hide the byline's inside a row. */
673
- .tlui-cmt-list .tlui-cmt-head .tlui-cmt-avatar {
674
- display: none;
675
- }
676
-
677
- /* The dot treatment is for colour-only identity — an image avatar stays full size. */
678
705
  .tlui-cmt-thread .tlui-cmt-avatar--image,
679
706
  .tlui-cmt-canvas-preview--thread .tlui-cmt-avatar--image,
680
707
  .tlui-cmt-canvas-preview--list .tlui-cmt-avatar--image,
681
- .tlui-cmt-stack-list .tlui-cmt-avatar--image {
708
+ .tlui-cmt-stack-list .tlui-cmt-avatar--image,
709
+ .tlui-cmt-list .tlui-cmt-avatar--image {
682
710
  /* Match the 12px colour dot's width so the body's calc(12px + 6px) indent still lines up under
683
711
  the byline name when the author has an image rather than a dot. */
684
712
  width: 12px;
685
713
  height: 12px;
686
714
  margin-top: 0;
687
715
  }
688
- .tlui-cmt-list .tlui-cmt-avatar--image {
689
- width: 24px;
690
- height: 24px;
691
- margin-top: 0;
692
- }
693
716
 
694
717
  /* inside the panel, comments are plain content — no surrounding box; the composer's field carries
695
718
  its own surface. The hover preview is the same panel without a header, so its comment is laid
@@ -706,31 +729,30 @@ button.tlui-cmt-reaction--active:hover {
706
729
  .tlui-cmt-thread .tlui-cmt-body,
707
730
  .tlui-cmt-canvas-preview--thread .tlui-cmt-body,
708
731
  .tlui-cmt-canvas-preview--list .tlui-cmt-body,
709
- .tlui-cmt-stack-list .tlui-cmt-body {
732
+ .tlui-cmt-stack-list .tlui-cmt-body,
733
+ .tlui-cmt-list .tlui-cmt-body {
710
734
  padding-left: calc(12px + 6px);
711
735
  }
712
- /* Inside a panel the actions float as their own pill — the same pill the thread header is, in the
713
- same corner (which is why the header hides while the first comment is hovered). It sits just
714
- above the card's top edge rather than on the byline. */
715
736
  /* Line the card actions up with the header actions: flush to the full-width card's right edge (the
716
- panel edge, matching the header ✕) and flush on the 40px byline row, so the 40px buttons fill it. */
737
+ panel edge, under the header's ⋯) and flush on the 40px byline row, so the 40px buttons fill it. */
717
738
  .tlui-cmt-thread .tlui-cmt-card .tlui-cmt-card__actions {
718
739
  top: 0;
719
740
  right: 0;
720
741
  }
721
- /* The byline row is 40px: on the opened thread it fits the action pills (react/edit/delete) that
722
- float in its corner without the text running underneath; previews and collapsed cards carry the
723
- same height so every comment row reads identically, solo or in a stack. */
742
+ /* The byline row is 40px: on the opened thread it fits the action buttons (⋯ menu, react) in its
743
+ corner without the text running underneath; previews and stack lists carry the same height so
744
+ every comment row reads identically, solo or in a stack. */
724
745
  .tlui-cmt-thread .tlui-cmt-card .tlui-cmt-head,
725
746
  .tlui-cmt-canvas-preview--thread .tlui-cmt-card .tlui-cmt-head,
726
747
  .tlui-cmt-canvas-preview--list .tlui-cmt-card .tlui-cmt-head,
727
- .tlui-cmt-stack-list .tlui-cmt-card .tlui-cmt-head {
748
+ .tlui-cmt-stack-list .tlui-cmt-card .tlui-cmt-head,
749
+ .tlui-cmt-list__item .tlui-cmt-head {
728
750
  min-height: 40px;
729
751
  }
730
- /* Reserve head room only for pills that actually rendered (one child / two children) — pill count
731
- is a permissions question (canModifyComment), not ownership, and empty slots (read-only viewers)
732
- keep the full row. Sized from the 40px hit areas (4px overlap), minus the card padding the
733
- right:0 pills sit over; text stops 4px shy of the visible square. */
752
+ /* Reserve head room only for buttons that actually rendered (one child / two children) — the count
753
+ is a permissions question (see canModifyComment), not ownership, and empty slots (read-only
754
+ viewers) keep the full row. Sized from the 40px hit areas (4px overlap), minus the card padding
755
+ the right:0 buttons sit over; text stops 4px shy of the visible square. */
734
756
  .tlui-cmt-thread .tlui-cmt-card:has(.tlui-cmt-card__actions > *) .tlui-cmt-head {
735
757
  padding-right: calc(var(--tlui-cmt-thread-action-size) - var(--tlui-cmt-thread-padding));
736
758
  }
@@ -740,7 +762,6 @@ button.tlui-cmt-reaction--active:hover {
740
762
  );
741
763
  }
742
764
 
743
- /* comments list — thread summaries, one per row (used by the canvas sidebar) */
744
765
  .tlui-cmt-list {
745
766
  display: flex;
746
767
  flex-direction: column;
@@ -753,99 +774,45 @@ button.tlui-cmt-reaction--active:hover {
753
774
  align-items: center;
754
775
  justify-content: space-between;
755
776
  gap: 8px;
756
- padding: 2px 2px 2px 14px;
777
+ /* Flush top and right, like the thread popover's header: the 40px buttons' 32px hover squares
778
+ then sit 4px in from the panel edge, and the title shares the popover's 12px inset. */
779
+ height: 40px;
780
+ padding: 0 0 0 12px;
757
781
  border-bottom: 1px solid var(--tl-color-divider);
758
782
  }
759
783
  .tlui-cmt-list__header-title {
760
784
  font-size: 12px;
761
- font-weight: 500;
762
- color: var(--tl-color-text-1);
785
+ color: var(--tl-color-text);
763
786
  }
764
787
 
765
- /* An icon button in the sidebar header (filter funnel, overflow …). Sized like the thread actions:
766
- a TldrawUiButton (type="icon") left at its native 40px box, with .tlui-button's 32px ::after
767
- square carrying the hover wash. Only the bits that differ are set here, at .tlui-button's
768
- specificity + 1 so stylesheet order can't decide the winner. */
769
- .tlui-button.tlui-cmt-header-btn {
770
- width: 40px;
771
- padding: 0;
772
- border-radius: 6px;
773
- color: var(--tl-color-text-2);
774
- }
775
- /* Overlap each button 4px into the previous so the 32px visual squares sit 4px apart, not 8px —
776
- the same tiling the thread actions use. */
777
- .tlui-cmt-header-btn + .tlui-cmt-header-btn {
778
- margin-left: -4px;
779
- }
780
- .tlui-button.tlui-cmt-header-btn:hover,
781
- .tlui-button.tlui-cmt-header-btn[data-state='open'] {
782
- color: var(--tl-color-text-1);
783
- }
784
788
  .tlui-cmt-list__header-actions {
785
789
  display: flex;
786
790
  align-items: center;
787
791
  }
788
792
 
789
- /* The commenting dropdowns' surface — a little air between the items and the menu edge. */
790
- .tlui-cmt-menu {
791
- min-width: 100px;
792
- padding: 4px;
793
- }
794
-
795
- /* a menu row with a label and a right-aligned shortcut hint (overflow menu) */
796
- .tlui-cmt-menu-item {
797
- position: relative;
798
- display: flex;
799
- align-items: center;
800
- justify-content: space-between;
801
- gap: 24px;
802
- width: 100%;
803
- min-height: 40px;
804
- padding: 0 10px;
805
- border: none;
806
- background: transparent;
807
- font: inherit;
808
- font-size: 12px;
809
- color: var(--tl-color-text-1);
810
- cursor: pointer;
811
- }
812
- /* 36px visual inset within the 40px row — the hover wash the action and emoji buttons use. */
813
- .tlui-cmt-menu-item::after {
814
- content: '';
815
- position: absolute;
816
- inset: 2px;
817
- border-radius: var(--tl-radius-2);
818
- }
819
- .tlui-cmt-menu-item:hover::after {
820
- background: var(--tl-color-muted-2);
821
- }
822
- /* Destructive menu entries (delete) — the same danger colour as tldraw's danger buttons. */
823
- .tlui-cmt-menu-item--danger {
824
- color: var(--tl-color-danger);
825
- }
826
-
827
- .tlui-cmt-menu-item__shortcut {
828
- color: var(--tl-color-text-3);
829
- font-size: 12px;
830
- }
831
793
  .tlui-cmt-list__items {
832
794
  flex: 1;
833
795
  min-height: 0;
834
796
  overflow-y: auto;
797
+ /* A row's hover wash has no bottom inset, so rows tile; this is the last row's 4px. */
798
+ padding-bottom: 4px;
835
799
  }
836
800
  .tlui-cmt-list__empty {
837
- padding: 20px 14px;
838
- color: var(--tl-color-text-3);
801
+ /* extra 2px at the bottom of the list */
802
+ padding: 12px 12px 14px 12px;
803
+ font-weight: 400;
839
804
  font-size: 12px;
805
+ min-height: 40px;
840
806
  }
841
807
  .tlui-cmt-list__item {
842
808
  position: relative;
843
809
  display: flex;
844
810
  gap: 10px;
845
811
  width: 100%;
846
- padding: 12px 14px;
812
+ /* No top padding: the 40px byline row supplies the space above the name, as on a thread card.
813
+ The 6px bottom matches the thread card text's trailing margin, so a row is as tall as a card. */
814
+ padding: 0 12px 6px;
847
815
  border: none;
848
- border-bottom: 1px solid var(--tl-color-divider);
849
816
  background: transparent;
850
817
  font: inherit;
851
818
  text-align: left;
@@ -859,7 +826,7 @@ button.tlui-cmt-reaction--active:hover {
859
826
  .tlui-cmt-list__item::after {
860
827
  content: '';
861
828
  position: absolute;
862
- inset: 4px;
829
+ inset: 4px 4px 0px 4px;
863
830
  border-radius: var(--tl-radius-2);
864
831
  pointer-events: none;
865
832
  }
@@ -887,8 +854,8 @@ button.tlui-cmt-reaction--active:hover {
887
854
  min-width: 0;
888
855
  }
889
856
  .tlui-cmt-list__item-preview {
890
- margin-top: 2px;
891
857
  font-size: 12px;
858
+ line-height: 1.4;
892
859
  color: var(--tl-color-text-1);
893
860
  overflow: hidden;
894
861
  text-overflow: ellipsis;
@@ -899,7 +866,6 @@ button.tlui-cmt-reaction--active:hover {
899
866
  mid-string — same treatment as the card body. */
900
867
  overflow-wrap: anywhere;
901
868
  }
902
- /* meta line under the preview: page label and/or a resolved marker */
903
869
  .tlui-cmt-list__item-meta {
904
870
  display: flex;
905
871
  align-items: center;
@@ -910,22 +876,30 @@ button.tlui-cmt-reaction--active:hover {
910
876
  }
911
877
  .tlui-cmt-list__item-resolved {
912
878
  display: inline-flex;
879
+ flex-shrink: 0;
913
880
  align-items: center;
914
881
  gap: 3px;
915
- font-weight: 600;
916
882
  }
883
+ /* Block, not flex: an ellipsis only applies to text in a block container, not to a flex item's
884
+ anonymous text. */
917
885
  .tlui-cmt-list__item-page {
918
- display: inline-flex;
919
- align-items: center;
886
+ display: block;
887
+ min-width: 0;
888
+ overflow: hidden;
889
+ text-overflow: ellipsis;
890
+ white-space: nowrap;
920
891
  padding: 1px 6px;
921
892
  border-radius: 4px;
922
- background: var(--tl-color-muted-2);
893
+ }
894
+ /* Same alignment as the reactions row; only when it leads, since "Resolved" has no padding. */
895
+ .tlui-cmt-list__item-page:first-child {
896
+ margin-left: -6px;
923
897
  }
924
898
  .tlui-cmt-list__item-replies {
925
899
  display: inline-flex;
900
+ flex-shrink: 0;
926
901
  align-items: center;
927
902
  }
928
- /* reply count under a preview card's opening comment — the thread continues past what's shown */
929
903
  .tlui-cmt-card__replies {
930
904
  display: block;
931
905
  margin-top: 6px;