~bigbes/sr-ht-compare

ref: f18653603d66734b583b52d2fe0da7c59a7b1f32 sr-ht-compare/scss/main.scss -rw-r--r-- 4.9 KiB
f1865360 — bigbes ci: the family's build pipeline, and PKGVER by export 9 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
// compare.sr.ht stylesheet.
//
// Mirrors the SourceHut service pattern (see paste.sr.ht/scss/main.scss): pull
// in the shared `base` partial (Bootstrap 4 + the SourceHut chrome: contrast,
// variables, nav, events, highlight, dark) and then add only the styles unique
// to the compare/diff views.
//
// Build (dev): dart-sass with the core.sr.ht scss dir + a Bootstrap 4 scss dir
// on the load path; production uses `sassc -I /usr/share/sourcehut/scss`.

@import "base";

// Let the @pierre/trees sidebar (which styles itself with the CSS `light-dark()`
// function) and any other scheme-aware widget follow prefers-color-scheme.
:root {
  color-scheme: light dark;
}

// ---- Truncation / info banner --------------------------------------------

.compare-truncated {
  @extend .alert;
  background: lighten($warning, 30);
  border: 1px solid $warning;
  color: $gray-900;
  margin-bottom: 1rem;

  @media (prefers-color-scheme: dark) {
    background: darken($warning, 35);
    border-color: darken($warning, 20);
    color: $gray-100;
  }
}

// ---- Two-column app shell: tree sidebar + fluid diff column ---------------

#compare-app {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;

  @include media-breakpoint-down(sm) {
    flex-direction: column;
    gap: 0.5rem;
  }
}

#tree-root {
  flex: 0 0 220px;
  width: 220px;
  max-width: 220px;
  position: sticky;
  top: 0.5rem;
  max-height: calc(100vh - 1rem);
  overflow: auto;

  @include media-breakpoint-down(sm) {
    position: static;
    flex-basis: auto;
    width: 100%;
    max-width: 100%;
    max-height: 16rem;
  }
}

#diff-root {
  flex: 1 1 auto;
  // Allow the flex child to shrink so wide code can scroll instead of
  // forcing horizontal overflow on the whole page.
  min-width: 0;

  // Drop the @pierre/diffs vertical code padding (the "gap-block", default
  // 8px) that otherwise shows as a grey band above the first line and below
  // the last. Inherited into the DIFFS-CONTAINER shadow DOM. The inline gap
  // (horizontal code padding) is left on its 8px default.
  --diffs-gap-block: 0;

  // Each code row scrolls horizontally on its own (overflow-x: scroll) and
  // reserves a classic scrollbar track sized to --diffs-scrollbar-gutter
  // (measured per platform). On systems with non-overlay scrollbars that track
  // reads as a grey strip under any row with a long line. Force the gutter to
  // 0 for overlay-style behaviour: long lines stay scrollable by trackpad /
  // wheel, just without an always-reserved track.
  --diffs-scrollbar-gutter-override: 0;
}

// ---- Layout toggle -------------------------------------------------------

.diff-layout-toggle {
  display: inline-flex;
  gap: 0.25rem;
  margin-bottom: 0.5rem;

  button {
    @extend .btn;
    @extend .btn-default;

    &.active {
      background: darken($primary, 10);
      border-color: darken($primary, 40);
      color: $white;
    }
  }
}

// ---- Per-file diff sections ----------------------------------------------

.diff-file {
  border: 1px solid $gray-400;
  // Tight vertical rhythm between file blocks: enough to read the border as a
  // separator, not so much that consecutive files drift apart. The @pierre diff
  // body sits flush under our header, so this margin is the only inter-file gap.
  margin-bottom: 0.5rem;
  // The shared `base` partial sets `section { padding-bottom: .5rem }`; this
  // element is a <section>, so cancel it  otherwise it shows as a grey band
  // below the last diff line, inside the file border.
  padding-bottom: 0;
  overflow: hidden;

  @media (prefers-color-scheme: dark) {
    border-color: $gray-700;
  }
}

.diff-file-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.25rem 0.75rem;
  background: $gray-200;
  border-bottom: 1px solid $gray-400;
  font-family: $font_family_monospace;
  font-size: 0.9rem;

  @media (prefers-color-scheme: dark) {
    background: lighten($gray-900, 5);
    border-bottom-color: $gray-700;
  }
}

.diff-file-path {
  overflow-wrap: anywhere;
  font-weight: bold;
}

.diff-file-arrow {
  color: $gray-600;
}

.diff-file-oldpath {
  color: $gray-600;
  text-decoration: line-through;
}

.diff-file-stats {
  display: inline-flex;
  gap: 0.5rem;
  white-space: nowrap;
  flex: 0 0 auto;
}

.diff-file-add {
  color: darken($success, 10);
  @media (prefers-color-scheme: dark) {
    color: lighten($success, 10);
  }
}

.diff-file-del {
  color: darken($danger, 5);
  @media (prefers-color-scheme: dark) {
    color: lighten($danger, 5);
  }
}

.diff-file-badge {
  padding: 0 0.25rem;
  border: 1px solid $gray-500;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: $gray-700;

  @media (prefers-color-scheme: dark) {
    color: $gray-300;
    border-color: $gray-600;
  }
}

.diff-file-body {
  overflow-x: auto;
}

.diff-file-note,
.diff-empty {
  padding: 0.5rem 0.75rem;
  color: $gray-600;
  font-style: italic;
}