DiffBlock.module.css 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* Geometry mirrors CodeBlock/TerminalBlock (12px radius, code-block surface +
  2. banner row, markdown code-block font) so a diff card reads as one family with
  3. a fenced block and a terminal card. The deliberate divergence, shared with
  4. TerminalBlock: the body keeps `white-space: pre` and scrolls horizontally,
  5. because folding a source line destroys the indentation a diff is read by. */
  6. .block {
  7. --dsl-diff-radius: 12px;
  8. --dsl-diff-line-height: 22px;
  9. position: relative;
  10. margin: 16px 0;
  11. color: var(--dsw-alias-label-primary);
  12. background: var(--dsw-alias-markdown-code-block);
  13. border-radius: var(--dsl-diff-radius);
  14. }
  15. /* The copy control floats in the top-right corner over the body, so the card
  16. has no empty banner row above its first diff line (the TUI diff card has no
  17. banner either — only the footer). The block is position: relative, so this
  18. anchors to the card. */
  19. .copyButton {
  20. position: absolute;
  21. top: 8px;
  22. right: 12px;
  23. z-index: 1;
  24. background-color: transparent;
  25. border: none;
  26. padding: 0;
  27. margin: 0;
  28. color: var(--dsw-alias-label-secondary);
  29. cursor: pointer;
  30. font: var(--dsw-font-xs-13);
  31. }
  32. .body {
  33. padding: 12px 14px;
  34. font: var(--dsw-font-markdown-code-block);
  35. overflow-x: auto;
  36. overflow-y: hidden;
  37. }
  38. /* No wrapping, no word-break: a diff is read by its indentation. */
  39. .line {
  40. min-height: var(--dsl-diff-line-height);
  41. white-space: pre;
  42. }
  43. /* A file header: the path in the primary tone, set apart by weight. The copy
  44. button floats over this first row's top-right corner, so reserve space at the
  45. line's end for it — a long path scrolls under the button otherwise, and the
  46. button's hit area would eat clicks on the path's tail. */
  47. .path {
  48. color: var(--dsw-alias-label-primary);
  49. font-weight: 600;
  50. padding-right: 56px;
  51. }
  52. /* A same-file second hunk's separator (a scattered edit), in the dim tone. */
  53. .gap {
  54. color: var(--dsw-alias-label-tertiary);
  55. }
  56. /* The diff's own meaning-carrying colors: removed on the error token, added on
  57. the success token. A `- `/`+ ` prefix is drawn here so a copied line and the
  58. shown line agree, and so the sign reads without relying on color alone. */
  59. .del::before {
  60. content: '- ';
  61. color: var(--dsw-alias-state-error-primary);
  62. }
  63. .del {
  64. color: var(--dsw-alias-state-error-primary);
  65. }
  66. .add::before {
  67. content: '+ ';
  68. color: var(--dsw-alias-state-success-primary);
  69. }
  70. .add {
  71. color: var(--dsw-alias-state-success-primary);
  72. }
  73. .expand {
  74. display: block;
  75. width: 100%;
  76. padding: 0;
  77. border: none;
  78. background-color: transparent;
  79. color: var(--dsw-alias-label-tertiary);
  80. cursor: pointer;
  81. font: inherit;
  82. text-align: left;
  83. }
  84. .expand:hover {
  85. color: var(--dsw-alias-label-secondary);
  86. }
  87. /* The change summary, dim under the body: `└ +A -R · N file(s)`, the same
  88. footer the TUI transcript's diff card draws. */
  89. .footer {
  90. padding: 0 14px 12px;
  91. font: var(--dsw-font-markdown-code-block);
  92. color: var(--dsw-alias-label-tertiary);
  93. }