path_coverage 0.2.0 → 0.3.0

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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +112 -113
  3. data/lib/path_coverage/calls.rb +4 -11
  4. data/lib/path_coverage/card.rb +14 -0
  5. data/lib/path_coverage/condition.rb +8 -1
  6. data/lib/path_coverage/configuration.rb +1 -17
  7. data/lib/path_coverage/configuration_paths.rb +4 -2
  8. data/lib/path_coverage/console_summary.rb +15 -17
  9. data/lib/path_coverage/gaps.rb +12 -9
  10. data/lib/path_coverage/html/file.html +5 -5
  11. data/lib/path_coverage/html/index.html +3 -1
  12. data/lib/path_coverage/html/settings.js +50 -0
  13. data/lib/path_coverage/html/side.js +341 -432
  14. data/lib/path_coverage/html/style.css +330 -225
  15. data/lib/path_coverage/html/theme.js +27 -0
  16. data/lib/path_coverage/html_branch.rb +30 -0
  17. data/lib/path_coverage/html_cards.rb +111 -0
  18. data/lib/path_coverage/html_cells.rb +66 -0
  19. data/lib/path_coverage/html_file.rb +82 -68
  20. data/lib/path_coverage/html_index.rb +28 -29
  21. data/lib/path_coverage/html_index_head.rb +10 -30
  22. data/lib/path_coverage/html_labels.rb +23 -0
  23. data/lib/path_coverage/html_methods.rb +66 -0
  24. data/lib/path_coverage/html_nav.rb +50 -50
  25. data/lib/path_coverage/html_report.rb +45 -49
  26. data/lib/path_coverage/html_statements.rb +166 -0
  27. data/lib/path_coverage/html_syntax.rb +156 -0
  28. data/lib/path_coverage/html_template.rb +6 -0
  29. data/lib/path_coverage/html_tree.rb +36 -72
  30. data/lib/path_coverage/json_reader.rb +21 -14
  31. data/lib/path_coverage/json_writer.rb +26 -13
  32. data/lib/path_coverage/kernel.rb +29 -49
  33. data/lib/path_coverage/kinds/block.rb +2 -1
  34. data/lib/path_coverage/kinds/case.rb +7 -4
  35. data/lib/path_coverage/kinds/contains.rb +6 -4
  36. data/lib/path_coverage/kinds/safe.rb +5 -3
  37. data/lib/path_coverage/manifest.rb +2 -1
  38. data/lib/path_coverage/manifest_blocks.rb +3 -4
  39. data/lib/path_coverage/manifest_case.rb +2 -3
  40. data/lib/path_coverage/manifest_choices.rb +4 -3
  41. data/lib/path_coverage/manifest_folding.rb +1 -1
  42. data/lib/path_coverage/merge.rb +3 -3
  43. data/lib/path_coverage/method_statements.rb +300 -0
  44. data/lib/path_coverage/recorder.rb +12 -31
  45. data/lib/path_coverage/render.rb +19 -22
  46. data/lib/path_coverage/rewriter.rb +36 -55
  47. data/lib/path_coverage/site_tree.rb +9 -0
  48. data/lib/path_coverage/statement_arms.rb +161 -0
  49. data/lib/path_coverage/summary.rb +11 -15
  50. data/lib/path_coverage/totals.rb +6 -12
  51. data/lib/path_coverage/version.rb +1 -1
  52. data/lib/path_coverage/within_methods.rb +92 -0
  53. metadata +16 -11
  54. data/lib/path_coverage/html/toggle.js +0 -12
  55. data/lib/path_coverage/html_paths.rb +0 -138
  56. data/lib/path_coverage/path_gaps.rb +0 -41
  57. data/lib/path_coverage/path_manifest.rb +0 -110
@@ -9,37 +9,68 @@
9
9
  --rule: #D5DAE2;
10
10
  --ok: #1F5FBF;
11
11
  --ok-tint: #E6EEFA;
12
- --warn: #A35200;
13
12
  --bad: #B54708;
14
13
  --on-status: #FFFFFF;
15
14
  --link: #1F5FBF;
16
- /* The tree is inverted from the page, so it never reads as
17
- more source lines. */
18
- --tree-bg: #1E2638;
19
- --tree-fg: #E8ECF4;
20
- --tree-muted: #A3AEC2;
21
- --tree-rule: #3A4560;
22
- --tree-gap: #F5A25D;
23
15
  --font-body: "Helvetica Neue", Arial, sans-serif;
24
16
  --font-code: Menlo, Consolas, "DejaVu Sans Mono", monospace;
25
17
  }
26
- @media (prefers-color-scheme: dark) {
27
- :root {
28
- --bg: #12151C; --surface: #181C25; --panel: #212633; --fg: #E4E8EF;
29
- --muted: #9AA4B5; --rule: #323949; --ok: #7FB0FF; --ok-tint: #1A2740;
30
- --warn: #F0A35E; --bad: #F08A3C; --on-status: #12151C; --link: #7FB0FF;
31
- --tree-bg: #E6EAF2; --tree-fg: #1C2230; --tree-muted: #4E5869;
32
- --tree-rule: #BCC4D2; --tree-gap: #A8480A;
33
- color-scheme: dark;
34
- }
18
+ /* Dark, unless the page's html element names light, as the theme
19
+ button does when pressed; so a page draws dark before any script
20
+ runs. */
21
+ :root:not([data-theme="light"]) {
22
+ --bg: #12151C; --surface: #181C25; --panel: #212633; --fg: #E4E8EF;
23
+ --muted: #9AA4B5; --rule: #323949; --ok: #7FB0FF; --ok-tint: #1A2740;
24
+ --bad: #F08A3C; --on-status: #12151C; --link: #7FB0FF;
25
+ --syn-k: #C79BEA; --syn-s: #9CCB9E; --syn-c: #7F8A99;
26
+ --syn-n: #E9A3C9; --syn-t: #AEB5F5; --syn-v: #7FCFC4; --syn-o: #E6D27A;
27
+ color-scheme: dark;
35
28
  }
29
+ /* Code's syntax colours, each muted so the orange, blue and green
30
+ of coverage still stand out: keywords, strings, comments,
31
+ numbers, constants, instance variables, and, in bold gold, the
32
+ operators that decide a path, eg && and &. */
33
+ :root {
34
+ --syn-k: #7E3BA0; --syn-s: #3B7550; --syn-c: #77808F;
35
+ --syn-n: #9E4A78; --syn-t: #4B52A0; --syn-v: #2A7570; --syn-o: #7A6600;
36
+ }
37
+ /* The same colours in the code and in a site's tree, its fold, and
38
+ a card's rows, which quote the code. */
39
+ :is(.src, .fold, .statements .prow) .k { color: var(--syn-k); }
40
+ :is(.src, .fold, .statements .prow) .s { color: var(--syn-s); }
41
+ :is(.src, .fold, .statements .prow) .c { color: var(--syn-c); font-style: italic; }
42
+ :is(.src, .fold, .statements .prow) .n { color: var(--syn-n); }
43
+ :is(.src, .fold, .statements .prow) .t { color: var(--syn-t); }
44
+ :is(.src, .fold, .statements .prow) .v { color: var(--syn-v); }
45
+ :is(.src, .fold, .statements .prow) .o { color: var(--syn-o); font-weight: 700; }
46
+ /* Everything a site's tree or a method's grid draws has this one
47
+ tint, in either mode; status is only ever the orange or blue of
48
+ an edge. A lit line, on a path being shown, is yellow. */
49
+ :root { --cond-tint: #E2F2D3; --lit: #FFE98A; }
50
+ :root:not([data-theme="light"]) { --cond-tint: #26361A; --lit: #5A4A12; }
51
+ /* --rail is the width of the column of trees and grids left of the
52
+ code; dragging the divider changes it. */
53
+ body { --rail: 560px; }
36
54
  body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 14px; }
37
55
  a { color: var(--link); }
38
56
  .page {
39
- max-width: 1080px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px;
40
- padding: 40px max(16px, env(safe-area-inset-right, 0px)) 64px max(16px, env(safe-area-inset-left, 0px));
57
+ max-width: 1080px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px;
58
+ padding: 0 max(16px, env(safe-area-inset-right, 0px)) 64px max(16px, env(safe-area-inset-left, 0px));
41
59
  }
60
+ /* A file's page is wider, to hold its rail beside its code. */
61
+ .page:has(.code) { max-width: 1800px; }
42
62
  h1 { margin: 0; font-size: 24px; font-weight: 600; }
63
+ /* Every page's top line: the Path coverage title, a link back to
64
+ the index on a file's page, then, on a file's page, its path. */
65
+ .top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; }
66
+ .title { margin: 0; font-size: 24px; font-weight: 600; }
67
+ .title a { color: inherit; text-decoration: none; }
68
+ .title a:hover { text-decoration: underline; }
69
+ /* A file's path links back to its row on the index, which stops
70
+ clear of the index's sticky header. */
71
+ h1.path a { color: inherit; text-decoration: none; }
72
+ h1.path a:hover { text-decoration: underline; }
73
+ table.files tr[id] { scroll-margin-top: 72px; }
43
74
  .box { border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); overflow-x: auto; }
44
75
  table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
45
76
  th, td { padding: 10px 16px; text-align: left; }
@@ -58,14 +89,14 @@ tfoot td:first-child { font-family: inherit; }
58
89
  .tabs [role="tab"]:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
59
90
  .num, td:not(:first-child) { text-align: right; }
60
91
  /* A total's taken, / of and % sit close, so a row still reads
61
- 3 / 4 75%; its name heads all three. The File column takes
62
- the table's spare width, so it never spreads them apart. */
92
+ 3 / 4 75%. The File column takes the table's spare width, so
93
+ it never spreads them apart. These rules name the files table,
94
+ so a path grid's taken cells are never matched. */
63
95
  table.files tr > :first-child { width: 100%; }
64
96
  table.files th, table.files td:not(:first-child) { white-space: nowrap; }
65
- th.group { text-align: center; padding-bottom: 0; }
66
- .taken { text-align: right; padding-left: 32px; padding-right: 4px; }
67
- td.of, th.of { text-align: left; padding-left: 0; padding-right: 6px; }
68
- .percent { text-align: right; padding-left: 6px; }
97
+ table.files .taken { text-align: right; padding-left: 32px; padding-right: 4px; }
98
+ table.files .of { text-align: left; padding-left: 0; padding-right: 6px; }
99
+ table.files .percent { text-align: right; padding-left: 6px; }
69
100
  th button {
70
101
  font: 600 13px var(--font-body); color: var(--fg); background: none; border: 0;
71
102
  padding: 4px 0; cursor: pointer;
@@ -78,16 +109,24 @@ th button:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
78
109
  /* A file's page: plain source; on lines holding a condition the
79
110
  line numbers are one button. Every number has the same box, so
80
111
  digits stay aligned whether or not they are on a button. */
81
- .back { margin: 0; font-size: 13px; }
82
112
  h1.path { font-family: var(--font-code); font-size: 18px; }
83
- /* The back link, path and site lists stick together as one
84
- header. */
113
+ /* The top line, and on a file's page its path and site lists,
114
+ stick together as one header. */
85
115
  .head {
86
116
  position: sticky; top: 0; z-index: 5;
87
117
  display: flex; flex-direction: column; gap: 10px;
88
118
  margin: 0 -16px; padding: 12px 16px; background: var(--bg);
89
119
  border-bottom: 1px solid var(--rule);
90
120
  }
121
+ /* The theme button, small, at the title bar's right end, showing
122
+ the theme it switches to: a moon for dark, a sun for light. */
123
+ .theme {
124
+ margin-left: auto; width: 30px; height: 30px; padding: 0; font-size: 16px; line-height: 1;
125
+ border: 1px solid var(--rule); border-radius: 6px; background: var(--surface);
126
+ color: var(--fg); cursor: pointer;
127
+ }
128
+ .theme:hover { background: var(--panel); }
129
+ .theme:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
91
130
  .jumps { display: flex; flex-direction: column; gap: 8px; }
92
131
  .jump-list { display: flex; gap: 6px; align-items: center; overflow-x: auto; white-space: nowrap; min-width: 0; }
93
132
  .jump-label { width: 64px; flex-shrink: 0; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
@@ -101,12 +140,20 @@ a.jump[data-status] { background: var(--cond-tint); border-right-color: transpar
101
140
  a.jump[data-status="covered"] { color: var(--ok); border-top-color: var(--ok); border-left-color: var(--ok); }
102
141
  a.jump[data-status="gaps"] { color: var(--bad); border-top-color: var(--bad); border-left-color: var(--bad); }
103
142
  a.jump:focus-visible, .nav a:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
104
- /* The source pane's border and background start after the nav
105
- column, so the arrows sit outside the pane yet scroll with
106
- their line. */
107
- .box:has(> .code) { position: relative; isolation: isolate; border: 0; background: none; border-radius: 0; }
143
+ /* The code sits right of the rail of cards. The rail's column is
144
+ always there, --rail wide, and the divider in the gap after it
145
+ drags to change that. */
146
+ .box:has(> .code) {
147
+ position: relative; isolation: isolate; border: 0; background: none; border-radius: 0;
148
+ display: grid; column-gap: 12px; grid-template-columns: var(--rail) minmax(0, 1fr);
149
+ }
150
+ .box > .rail { grid-column: 1; grid-row: 1; }
151
+ .box > .code { grid-column: 2; grid-row: 1; }
152
+ /* The source pane's border and background start after the rail,
153
+ the gap and the nav column, so the arrows sit outside the pane
154
+ yet scroll with their line. */
108
155
  .box:has(> .code)::before {
109
- content: ""; position: absolute; inset: 0 0 0 26px; z-index: -1;
156
+ content: ""; position: absolute; inset: 0 0 0 calc(var(--rail) + 38px); z-index: -1;
110
157
  border: 1px solid var(--rule); border-radius: 8px;
111
158
  background: var(--surface); pointer-events: none;
112
159
  }
@@ -114,29 +161,62 @@ a.jump:focus-visible, .nav a:focus-visible { outline: 3px solid var(--link); out
114
161
  tall, keeping the gutter narrow. */
115
162
  .nav { display: flex; flex-direction: column; justify-content: center; width: 26px; flex-shrink: 0; }
116
163
  .nav a { width: 22px; text-align: center; line-height: 14px; font-size: 12px; color: var(--bad); text-decoration: none; }
164
+ /* A covered card's arrows, between the covered cards' lines, are
165
+ blue, as their numbers are. */
166
+ .nav a[data-status="covered"] { color: var(--ok); }
117
167
  .nav a:hover { color: var(--fg); }
118
- /* Clears the sticky header when a link jumps to a line. */
119
- .lineno { scroll-margin-top: 190px; }
120
- button.lnum:has(.lineno:target) { outline: 3px solid var(--link); outline-offset: 1px; }
121
- .code { font-family: var(--font-code); font-size: 13px; line-height: 32px; padding: 10px 0; min-width: 720px; }
168
+ .nav a[data-prev]::before { content: "\25B2"; }
169
+ .nav a[data-next]::before { content: "\25BC"; }
170
+ /* Every row is as wide as the longest line (or the pane, if
171
+ wider), so a method's band, and a lit line, reach past the code
172
+ when it scrolls sideways. */
173
+ .code {
174
+ font-family: var(--font-code); font-size: 13px; line-height: 32px; padding: 10px 0;
175
+ position: relative; isolation: isolate; min-width: 0; overflow-x: auto;
176
+ display: grid; grid-template-columns: minmax(max-content, 1fr); align-content: start;
177
+ }
122
178
  .line, .block { display: flex; align-items: flex-start; }
179
+ /* A loose site's whole block, its lines' code included, opens its
180
+ top card. */
181
+ .block { cursor: pointer; border-radius: 6px; }
182
+ .block:hover { filter: brightness(0.97); }
183
+ .line:has(.lineno) { cursor: default; }
123
184
  .srcs { display: flex; flex-direction: column; }
185
+ .block .srcs { flex: 1; }
124
186
  .src { white-space: pre; }
187
+ /* A lit line's background spans the code pane's full width. */
188
+ .line .src { flex: 1; }
189
+ /* Each line's code is as tall as its row, even an empty line's, so
190
+ a method's stripe runs unbroken from row to row. */
191
+ .line > .src, .block > .srcs { align-self: stretch; }
192
+ .srcs > .src:last-child { flex-grow: 1; }
193
+ /* scroll-margin-top clears the sticky header when a link jumps to
194
+ a line. */
125
195
  .lineno {
126
196
  display: block; width: 52px; padding-right: 20px; text-align: right;
127
197
  color: var(--muted); font-variant-numeric: tabular-nums; flex-shrink: 0;
198
+ scroll-margin-top: 190px;
128
199
  }
200
+ /* A loose site's button, its 9px right margin included, takes the
201
+ 72px a plain number takes, so its lines' code starts where every
202
+ other line's does. Its 63px includes its borders, so at any zoom,
203
+ where a border is rounded to whole screen pixels, its width
204
+ holds. */
129
205
  button.lnum {
130
- display: flex; flex-direction: column; flex-shrink: 0; margin: 4px 8px 4px 0; padding: 0;
206
+ position: relative; display: flex; flex-direction: column; flex-shrink: 0;
207
+ box-sizing: border-box; width: 63px;
208
+ margin: 4px 9px 4px 0; padding: 0;
131
209
  border: 1px solid transparent; border-radius: 6px; cursor: pointer;
132
210
  font: 600 13px/24px var(--font-code); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
133
211
  }
134
- button.lnum { position: relative; }
212
+ /* A loose site's top card opens in the left rail: a closed button
213
+ points left, where its card will open; an open one has no arrow,
214
+ as a click leaves it open. */
135
215
  button.lnum::before {
136
- content: "\25B8"; position: absolute; left: 7px; top: 4px;
137
- font-size: 11px; line-height: 24px; transition: transform 120ms;
216
+ content: "\25C2"; position: absolute; left: 7px; top: 4px;
217
+ font-size: 11px; line-height: 24px;
138
218
  }
139
- button.lnum[aria-expanded="true"]::before { transform: rotate(90deg); }
219
+ button.lnum[aria-expanded="true"]::before { content: none; }
140
220
  /* With a site count the count and the triangle share the
141
221
  button's height, one 11px line each. */
142
222
  button.lnum:has(.site-count)::before { top: 12px; line-height: 11px; }
@@ -147,219 +227,244 @@ button.lnum:has(.lineno + .lineno)::before { top: auto; bottom: 2px; line-height
147
227
  position: absolute; left: 7px; top: 1px;
148
228
  font-size: 9px; line-height: 11px; font-weight: 700;
149
229
  }
150
- /* The rule between sites spans the tree's full width, through
151
- its 16px side padding. */
152
- .site + .site {
153
- border-top: 1px solid var(--tree-rule); margin: 6px -16px 0; padding: 6px 16px 0;
154
- }
155
230
  button.lnum .lineno { width: 50px; padding-right: 11px; color: inherit; line-height: 32px; margin: -4px 0; }
156
231
  /* A site's button wears the condition tint, edged in its
157
- status colour on the top and left only, as a method's bar is. */
232
+ status colour on the top and left only. */
158
233
  button.lnum[data-status] { box-shadow: none; background: var(--cond-tint); border-right-color: transparent; border-bottom-color: transparent; }
159
234
  button.lnum[data-status="covered"] { color: var(--ok); border-top-color: var(--ok); border-left-color: var(--ok); }
160
235
  button.lnum[data-status="gaps"] { color: var(--bad); border-top-color: var(--bad); border-left-color: var(--bad); }
161
236
  button.lnum:hover { filter: brightness(1.1); }
162
237
  button.lnum:focus-visible { outline: 3px solid var(--link); outline-offset: 1px; }
163
- .tree {
164
- margin: 4px 20px 12px 120px; padding: 10px 16px; border: 1px solid var(--tree-rule);
165
- border-radius: 8px; background: var(--tree-bg); color: var(--tree-fg); line-height: 30px;
166
- box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
167
- }
168
- /* A row is its branch and label, then one fixed-width column per
169
- path: flowing by column, each cell after the label takes the
170
- next path's column, however many paths the site has. */
171
- .row {
172
- display: grid; grid-template-columns: auto minmax(200px, 1fr);
173
- grid-auto-flow: column; grid-auto-columns: 32px; column-gap: 16px;
238
+ /* An open loose site has its button's status edges, top and left,
239
+ doubled to 2px. A jump to it opens its card, so its button has
240
+ no outline of the jump to it. */
241
+ button.lnum[aria-expanded="true"][data-status="gaps"] { box-shadow: inset 1px 1px 0 var(--bad); }
242
+ button.lnum[aria-expanded="true"][data-status="covered"] { box-shadow: inset 1px 1px 0 var(--ok); }
243
+ button.lnum:has(.lineno:target) { outline: none; }
244
+ /* While a card is open, no button keeps a focus outline. */
245
+ body[data-open] button.lnum:focus-visible { outline: none; }
246
+ .rail { position: relative; min-width: 0; }
247
+ /* Each row lays its branch and label out at their own width, the
248
+ label pushing its cells to the row's right edge, so a site's
249
+ cells line up in columns however long or deep its labels. */
250
+ .row { display: flex; align-items: center; gap: 8px; }
251
+ .row > :is(.text, .arm, .operator) { margin-right: auto; padding-right: 8px; }
252
+ /* An explicit width, not just a flex basis, so a row's natural
253
+ width counts each cell as 26px, not as its one letter. */
254
+ .row > :is(.cell, .count) { flex: none; width: 26px; }
255
+ /* A thin rule under each site's counts row, across the tree's
256
+ full width through its 16px side padding. */
257
+ .site > .row:first-child {
258
+ border-bottom: 1px solid var(--rule); margin: 0 -16px 6px; padding: 0 16px 4px;
174
259
  }
175
- .operator { grid-column: span 2; font-weight: 600; }
176
- .row[data-subtree] .operator { grid-column: auto; }
260
+ .operator { font-weight: 600; }
177
261
  .row .arm { white-space: pre; font-weight: 600; }
178
- .branch { white-space: pre; color: var(--tree-muted); margin-right: -16px; }
262
+ /* An if's then names its arm, quoting no code, so is italic. */
263
+ .row .arm[data-named] { font-style: italic; }
264
+ .branch { white-space: pre; color: var(--muted); margin-right: -16px; }
179
265
  .row .text { white-space: pre; }
180
- /* A branch glyph drawn as a cell a whole row tall: v a vertical
181
- line, t a vertical with a stub right, l the top half of a
182
- vertical with a stub right, h a horizontal, s nothing. */
266
+ /* A branch's cell, of the kind its data-bx names, drawn a whole
267
+ row tall so branches join from row to row: v a vertical line,
268
+ t a vertical with a stub right, l the top half of a vertical
269
+ with a stub right, h a horizontal, s nothing. */
183
270
  .bx { display: inline-block; width: 1ch; height: 30px; vertical-align: top; --stroke: linear-gradient(currentColor, currentColor); }
184
271
  .bx[data-bx="v"] { background: var(--stroke) 50% 0 / 1px 100% no-repeat; }
185
272
  .bx[data-bx="t"] { background: var(--stroke) 50% 0 / 1px 100% no-repeat, var(--stroke) 100% 50% / 50% 1px no-repeat; }
186
273
  .bx[data-bx="l"] { background: var(--stroke) 50% 0 / 1px 50% no-repeat, var(--stroke) 100% 50% / 50% 1px no-repeat; }
187
274
  .bx[data-bx="h"] { background: var(--stroke) 0 50% / 100% 1px no-repeat; }
188
- /* Each path's count heads its column, orange for a path never
189
- taken; a leaf's T or F on that path sits in a chip, as in a
190
- path grid, and a blank means the path never reached it. */
275
+ /* Each path heads its column with a snake, a vertical ~ standing
276
+ for the path below it, then 0, orange, for a path never taken,
277
+ or *, blue, for one taken, its count on hover; a leaf's T or F
278
+ on that path sits in a chip, as in a path grid, and a blank
279
+ means the path never reached it. */
191
280
  .row .count { text-align: center; font-variant-numeric: tabular-nums; color: var(--ok); font-weight: 600; }
192
- .row .count.never { color: var(--tree-gap); }
281
+ .row .count::before { content: "\2240"; }
282
+ .row .count.never { color: var(--bad); }
193
283
  .row .cell { text-align: center; }
194
- .row .cell:not(:empty) {
284
+ .row .cell:is(:not(:empty), [data-mark]) {
195
285
  align-self: center; line-height: 22px; border-radius: 3px;
196
286
  background: var(--surface); color: var(--fg); font: 600 12px var(--font-code);
197
287
  }
198
-
199
- /* SPIKE: the code and a rail share the box; each tree sits in
200
- the rail, level with its site (its top set by side.js). */
201
- body[data-layout="beside"] .page { max-width: 1800px; }
202
- /* The code sits between two rails, condition trees on the left
203
- and path grids on the right, each as wide as --cc-rail or
204
- --pc-rail. Both are 0 until one opens; registered, so they
205
- animate, sliding the code and its frame aside together. */
206
- @property --cc-rail { syntax: "<length>"; inherits: true; initial-value: 0px; }
207
- @property --pc-rail { syntax: "<length>"; inherits: true; initial-value: 0px; }
208
- body[data-layout="beside"] { transition: --cc-rail 250ms ease, --pc-rail 250ms ease; }
209
- body[data-open="cc"] { --cc-rail: 560px; }
210
- body[data-open="pc"] { --pc-rail: 560px; }
211
- body[data-layout="beside"] .box:has(> .code) {
212
- display: grid; column-gap: 12px;
213
- grid-template-columns: var(--cc-rail) minmax(0, 1fr) var(--pc-rail);
288
+ /* A cell's mark, drawn in place of a letter: a tick for a path
289
+ that took an arm or called its operand, a disc for a &.
290
+ receiver not nil, an empty set for one nil. */
291
+ .row .cell[data-mark="taken"]::before { content: "\2713"; }
292
+ .row .cell[data-mark="present"]::before { content: "\25CF"; }
293
+ .row .cell[data-mark="absent"]::before { content: "\2205"; }
294
+ /* Hovering a cell with hover text, eg a path's count or a &.
295
+ receiver's mark, shows that text in a chip above it. */
296
+ .row [data-hover] { position: relative; cursor: default; }
297
+ .row [data-hover]:hover::after {
298
+ content: attr(data-hover); position: absolute; bottom: 100%; left: 50%;
299
+ transform: translateX(-50%); z-index: 4; padding: 0 7px; border-radius: 4px;
300
+ white-space: nowrap; font: 700 11px/20px var(--font-body); background: var(--fg); color: var(--bg);
214
301
  }
215
- /* Every row is as wide as the longest line (or the pane, if
216
- wider), so a site's band and outline, and a lit line, reach
217
- past the code when it scrolls sideways. */
218
- body[data-layout="beside"] .code {
219
- min-width: 0; overflow-x: auto;
220
- display: grid; grid-template-columns: minmax(max-content, 1fr);
221
- /* Lines keep their height when the box grows to hold a tree. */
222
- align-content: start;
223
- }
224
- body[data-layout="beside"] .box:has(> .code)::before {
225
- left: calc(var(--cc-rail) + 38px); right: calc(var(--pc-rail) + 12px);
226
- }
227
- .rail { position: relative; min-width: 0; }
228
- /* The rail's tree sits on the condition tint, in the page's own
229
- text colours, as a path grid sits on the path tint. */
230
- .rail .tree {
231
- --tree-bg: var(--cond-tint); --tree-fg: var(--fg); --tree-muted: var(--muted);
232
- --tree-rule: var(--rule); --tree-gap: var(--bad);
302
+
303
+ /* The divider: the gap between the rail and the code, a line down
304
+ its middle that darkens as it is hovered or dragged. */
305
+ .divider {
306
+ position: absolute; top: 0; bottom: 0; left: var(--rail); width: 12px;
307
+ cursor: col-resize; z-index: 4; touch-action: none;
233
308
  }
234
- /* The rail's tree has narrower columns, to fit its width; a
235
- thin rule under each site's counts row, across the tree's
236
- full width through its 16px side padding. */
237
- /* Each row lays its branch and label out at their own width, the
238
- label pushing its cells to the row's right edge, so a site's
239
- cells line up in columns however long or deep its labels. */
240
- .rail .row { display: flex; align-items: center; gap: 8px; }
241
- .rail .row > :is(.text, .arm, .operator) { margin-right: auto; padding-right: 8px; }
242
- /* An explicit width, not just a flex basis, so a row's natural
243
- width counts each cell as 26px, not as its one letter. */
244
- .rail .row > :is(.cell, .count) { flex: none; width: 26px; }
245
- /* The tree is as wide as its widest row, and at least the rail;
246
- side.js widens the rail to it. */
247
- .rail .tree { width: max-content; min-width: 100%; right: auto; }
248
- .rail .site > .row:first-child {
249
- border-bottom: 1px solid var(--tree-rule); margin: 0 -16px 6px; padding: 0 16px 4px;
309
+ .divider::after {
310
+ content: ""; position: absolute; top: 0; bottom: 0; left: 5px; width: 2px;
311
+ background: var(--rule);
250
312
  }
251
- .rail .tree { position: absolute; left: 0; right: 0; margin: 0; z-index: 2; font-family: var(--font-code); font-size: 13px; }
252
- /* Beside, a site's whole block, its lines' code included, is
253
- tinted by status and opens its tree, so each tree lines up
254
- with a band the eye can follow across. */
255
- :root { --bad-tint: #FBE6D6; }
256
- @media (prefers-color-scheme: dark) { :root { --bad-tint: #3A2416; } }
257
- /* Everything a site's grid draws has this tint, as everything
258
- a method's grid draws has --path-tint; status is only ever
259
- the orange or blue of an edge. */
260
- :root { --cond-tint: #E2F2D3; }
261
- @media (prefers-color-scheme: dark) { :root { --cond-tint: #26361A; } }
262
- body[data-layout="beside"] .block { cursor: pointer; border-radius: 6px; }
263
- /* A site's own characters are tinted, not its whole lines: the
264
- expression is what its grid is about. */
265
- /* The padding stretches the tint to the full 32px line, as tall
266
- as a method's band, without moving the text. */
267
- mark.site { color: inherit; border-radius: 3px; padding: 8px 0; }
268
- mark.site { background: var(--cond-tint); }
269
- mark.site[data-status="gaps"] { box-shadow: inset 0 -1px 0 var(--bad); }
270
- mark.site[data-status="covered"] { box-shadow: inset 0 -1px 0 var(--ok); }
271
- /* An open site, like an open method's bar, has its status edges
272
- doubled to 2px: its button's top and left, and its
273
- expressions' underlines. */
274
- body[data-layout="beside"] button.lnum[aria-expanded="true"][data-status="gaps"] { box-shadow: inset 1px 1px 0 var(--bad); }
275
- body[data-layout="beside"] button.lnum[aria-expanded="true"][data-status="covered"] { box-shadow: inset 1px 1px 0 var(--ok); }
276
- body[data-layout="beside"] .block:has(> button.lnum[aria-expanded="true"]) mark.site[data-status="gaps"] { box-shadow: inset 0 -2px 0 var(--bad); }
277
- body[data-layout="beside"] .block:has(> button.lnum[aria-expanded="true"]) mark.site[data-status="covered"] { box-shadow: inset 0 -2px 0 var(--ok); }
278
- /* Beside, a jump to a site opens its tree, whose doubled edges
279
- mark it, so its button has no outline of the jump to it; and
280
- while a method's paths are open, none keeps a focus outline. */
281
- body[data-layout="beside"] button.lnum:has(.lineno:target) { outline: none; }
282
- body[data-open="pc"] button.lnum:focus-visible { outline: none; }
283
- body[data-layout="beside"] .block .srcs { flex: 1; }
284
- body[data-layout="beside"] .block:hover { filter: brightness(0.97); }
285
- /* Beside, an open site's triangle points left, showing that a
286
- click closes its tree, rather than down. */
287
- /* A site's tree opens in the left rail: a closed button points
288
- left, where its tree will open, an open one right, the way it
289
- will close. */
290
- body[data-layout="beside"] button.lnum::before { content: "\25C2"; transform: none; }
291
- body[data-layout="beside"] button.lnum[aria-expanded="true"]::before { content: "\25B8"; transform: none; }
313
+ .divider:hover::after, .divider.dragging::after { background: var(--link); }
314
+ body.dragging { cursor: col-resize; user-select: none; }
292
315
 
293
- /* SPIKE: a path method's bar on the code pane's right edge,
294
- def to end, which opens its grid out into the rail: a column
295
- per path, never-taken first, each row level with its line. */
296
- .pathbar {
297
- position: absolute; width: 16px; padding: 0; z-index: 3;
298
- border: 0; border-radius: 4px; cursor: pointer;
299
- display: flex; align-items: center; justify-content: center;
300
- color: var(--on-status); font-size: 11px;
316
+ /* Within each method, each line of a method has a stripe in the
317
+ method's status colour, just left of its def's d, from its def
318
+ line to its last; its def line also has a band of the one tint,
319
+ from its def to the end of its text. Both are backgrounds of the
320
+ lines' code, placed in characters (side.js gives each line its
321
+ def's column), so the code's own layout keeps them aligned. Open,
322
+ a method's stripe thickens. */
323
+ /* Within each method, a method's body is folded under its def line
324
+ until its def's number opens it, so the page starts as a list of
325
+ def lines. */
326
+ .method-folded { display: none; }
327
+ /* The open method's def line, shifted down by side.js to stay just
328
+ below the sticky header, covers the body lines passing under it. */
329
+ .def-stuck {
330
+ position: relative; z-index: 3; background: var(--surface);
331
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
301
332
  }
302
- .pathbar::after { content: "\25B8"; }
303
- .pathbar[aria-expanded="true"]::after { content: "\25C2"; }
304
- /* A method's def line, lit from its def to its bar, under the
305
- code's text; the code is its own stacking context so the band
306
- can sit beneath its rows. */
307
- body[data-layout="beside"] .code { position: relative; isolation: isolate; }
308
- .methodband { position: absolute; z-index: -1; border-radius: 6px 0 0 6px; pointer-events: none; }
309
- /* A method's band is violet, whatever its status, so it never
310
- reads as a site's band; its status is its bar's colour and its
311
- bottom line's. */
312
- :root { --path-tint: #E9E0FB; }
313
- @media (prefers-color-scheme: dark) { :root { --path-tint: #33284F; } }
314
- .methodband { background: var(--path-tint); }
315
- .methodband[data-status="gaps"] { box-shadow: inset 0 1px 0 var(--bad); }
316
- .methodband[data-status="covered"] { box-shadow: inset 0 1px 0 var(--ok); }
317
- .line:has(.lineno) { cursor: default; }
318
- /* A bar is violet like its method's band, so violet always means
319
- paths; its status is a line down its right edge, as the band's
320
- is a line along its top. */
321
- .pathbar {
322
- background: var(--path-tint); color: var(--fg);
323
- border-radius: 0 0 4px 4px; align-items: flex-start; line-height: 32px;
333
+ .src.in-method {
334
+ --method-colour: var(--bad); --stripe: 2px;
335
+ --at: calc(var(--def-col) * 1ch - 4px);
336
+ background-image: linear-gradient(var(--method-colour), var(--method-colour));
337
+ background-size: var(--stripe) 100%;
338
+ background-position: var(--at) 0;
339
+ background-repeat: no-repeat;
340
+ }
341
+ .src.in-method[data-method-status="covered"] { --method-colour: var(--ok); }
342
+ .src.in-method.method-open { --stripe: 3px; }
343
+ /* A def line's band stops 1px short of its line's bottom, so the
344
+ bands of def lines one after another, eg one-line methods, stay
345
+ apart. Its stripe runs the full height, on into its body, but on
346
+ its method's last line, where it too stops 1px short, so the
347
+ stripes of methods one after another stay apart as well. */
348
+ .src.def-line {
349
+ --band: calc((var(--def-end) - var(--def-col)) * 1ch + 8px) calc(100% - 1px);
350
+ background-image:
351
+ linear-gradient(var(--method-colour), var(--method-colour)),
352
+ linear-gradient(var(--cond-tint), var(--cond-tint));
353
+ background-size: var(--stripe) 100%, var(--band);
354
+ background-position: var(--at) 0, var(--at) 0;
324
355
  }
325
- .pathbar[data-status="gaps"] { box-shadow: inset -1px 0 0 var(--bad), inset 0 1px 0 var(--bad); }
326
- .pathbar[data-status="covered"] { box-shadow: inset -1px 0 0 var(--ok), inset 0 1px 0 var(--ok); }
327
- /* Open, a method's status lines thicken, on its bar and band. */
328
- .pathbar[aria-expanded="true"][data-status="gaps"] { box-shadow: inset -2px 0 0 var(--bad), inset 0 2px 0 var(--bad); }
329
- .pathbar[aria-expanded="true"][data-status="covered"] { box-shadow: inset -2px 0 0 var(--ok), inset 0 2px 0 var(--ok); }
330
- .methodband.open[data-status="gaps"] { box-shadow: inset 0 2px 0 var(--bad); }
331
- .methodband.open[data-status="covered"] { box-shadow: inset 0 2px 0 var(--ok); }
332
- .pathbar:hover { filter: brightness(1.15); }
356
+ .src.in-method.method-end { background-size: var(--stripe) calc(100% - 1px); }
357
+ .src.def-line.method-end { background-size: var(--stripe) calc(100% - 1px), var(--band); }
358
+ /* A card floats in the rail, level with its first line (its top
359
+ set by side.js), framed by a border, rounded corners and a
360
+ shadow, its rows 16px in from its sides. */
333
361
  .rail .pathgrid {
334
362
  position: absolute; left: 0; right: 0; z-index: 2; overflow-x: auto; overflow-y: hidden;
335
- background: var(--path-tint); border-radius: 6px; font: 600 12px var(--font-code);
363
+ background: var(--cond-tint); font: 600 12px var(--font-code);
364
+ border: 1px solid var(--rule); border-radius: 8px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
365
+ }
366
+ .prow { position: absolute; left: 16px; display: flex; gap: 2px; white-space: nowrap; }
367
+ /* A statement card's rows flow down it, 10px above the first and
368
+ below the last, so a fold open under a row pushes the rows after
369
+ it down. */
370
+ .statements { padding: 10px 0; }
371
+ .statements .prow { position: static; padding: 0 16px; margin-bottom: 2px; }
372
+ /* A site's fold draws the site's tree in the code's font, its
373
+ rows as tall as the card's. Open, it takes its row's
374
+ place right of the row's arrow and line:col, 88px in (the card's
375
+ 16px padding, the arrow's 16px, the label's 52px and two 2px
376
+ gaps): its first row, the site's operator and its count on each
377
+ path, stands where the row's top and counts were, which hide,
378
+ and its other rows are indented as far, so they stay aligned
379
+ with the operator. The rows it reveals, below its first row
380
+ (24px and 2px padding), are tinted a shade off the card,
381
+ toward the text colour, so in either theme they stand out as
382
+ opened, with no rule needed above or below them. Lying over
383
+ its row, it takes no click itself, so one on the row's arrow
384
+ or line:col beneath reaches the row and folds it back; its
385
+ tree's rows take theirs. */
386
+ .fold {
387
+ position: relative; margin: -26px 0 6px; padding: 0 16px 4px 88px;
388
+ font: 400 13px var(--font-code); line-height: 24px; color: var(--fg);
389
+ pointer-events: none;
390
+ background: linear-gradient(transparent 26px,
391
+ color-mix(in srgb, var(--cond-tint), var(--fg) 6%) 26px);
392
+ }
393
+ .fold:last-child { margin-bottom: 0; }
394
+ .fold .site { pointer-events: auto; }
395
+ .fold .bx { height: 24px; }
396
+ .fold .site > .row:first-child {
397
+ border-bottom: 0; margin: 0 0 4px; padding: 0 0 2px; cursor: pointer;
398
+ }
399
+ .statements .prow.site:has(> .fold-arrow[aria-expanded="true"]) > .pcell { visibility: hidden; }
400
+ /* A site row's arrow, left of its line:col, points down while its
401
+ fold is shut and up while it is open; every other row's label
402
+ is indented by the arrow's width and the gap after it, so the
403
+ labels line up. */
404
+ .fold-arrow {
405
+ flex: none; width: 16px; padding: 0; border: none; background: none;
406
+ font: inherit; font-size: 10px; line-height: 24px; color: var(--muted); cursor: pointer;
336
407
  }
337
- .prow { position: absolute; left: 0; display: flex; gap: 2px; white-space: nowrap; }
338
- .plabel { width: 48px; flex-shrink: 0; text-align: right; padding-right: 8px; color: var(--muted); line-height: 24px; }
408
+ .fold-arrow::before { content: "\25BC"; }
409
+ .fold-arrow[aria-expanded="true"]::before { content: "\25B2"; }
410
+ .prow.site:hover .fold-arrow, .fold-arrow[aria-expanded="true"] { color: var(--link); }
411
+ .fold-arrow:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
412
+ .statements .prow > .plabel:first-child { margin-left: 18px; }
413
+ /* A grid's line labels sit at its left padding, as a tree's labels
414
+ do, their fixed width keeping the cells in columns. */
415
+ .plabel { width: 48px; flex-shrink: 0; text-align: left; padding-right: 8px; color: var(--muted); line-height: 24px; }
339
416
  .pcell { width: 24px; flex-shrink: 0; text-align: center; line-height: 24px; border-radius: 3px; }
340
- .pcell.ended { background: transparent; }
341
- .pcell.true, .pcell.false { background: var(--surface); color: var(--fg); }
342
- .prow.calls .pcell.taken { background: var(--ok-tint); color: var(--ok); }
343
- .prow.calls .pcell.never { background: var(--bad); color: var(--on-status); }
417
+ /* A statement card's cells hold words, eg return, not T or F. Its
418
+ line:col labels are narrow, so each row's top follows close
419
+ after, left aligned, its paths and taken at the card's right
420
+ edge; the title row's name is as wide as it needs. */
421
+ .statements .pcell { width: 72px; cursor: default; }
422
+ .statements .plabel { width: 44px; padding-right: 8px; overflow: visible; }
423
+ .statements .prow.calls .plabel { width: auto; }
424
+ .statements .plabel + .pcell { flex: 1; min-width: 56px; text-align: left; }
425
+ .statements .prow.site, .statements .prow.site .pcell { cursor: pointer; }
426
+ .statements .prow.site:hover .pcell, .statements .prow.site:hover .plabel { color: var(--link); }
427
+ .statements .prow.columns .plabel, .statements .prow.columns .pcell { color: var(--muted); }
428
+ /* A card's paths not taken are orange and those taken blue, as a
429
+ status always is; its column titles are too, as their key. None
430
+ not taken, 0, is no gap, so is blue. */
431
+ .statements .pcell.not-taken { color: var(--bad); }
432
+ .statements .pcell.was-taken,
433
+ .statements .pcell.not-taken.none { color: var(--ok); }
344
434
  .prow.calls .plabel { color: var(--fg); }
345
- /* SPIKE: hovering a path's column shows it in the code: the
346
- column outlined, skipped lines faded, each decision's line
347
- chipped with its outcome. */
348
- .pcell { cursor: default; }
349
- .pcell { cursor: pointer; }
350
- .pcell.hot { outline: 2px solid var(--fg); outline-offset: -1px; }
351
- .pcell.pinned { outline: 3px solid var(--link); outline-offset: -2px; }
352
- :root { --lit: #FFE98A; }
353
- @media (prefers-color-scheme: dark) { :root { --lit: #5A4A12; } }
354
- /* A lit line's background spans the code pane's full width. */
355
- .line .src { flex: 1; }
356
- .src.lit { background: var(--path-tint); }
435
+ /* Hovering a card's row lights its line in the code; hovering a
436
+ fold's row marks the characters of its operand. */
437
+ .src.lit { background: var(--cond-tint); }
357
438
  mark.chars { background: var(--lit); color: inherit; border-radius: 3px; box-shadow: 0 0 0 2px var(--lit); }
358
- .tree .row[data-at] { cursor: default; }
359
- .tree .row[data-at]:hover { background: rgba(255, 255, 255, 0.08); }
360
- .nav[data-chip] { flex-direction: row; align-items: center; justify-content: flex-end; padding-right: 2px; box-sizing: border-box; }
361
- .nav[data-chip] a { display: none; }
362
- .nav[data-chip]::after {
363
- content: attr(data-chip); padding: 0 7px; border-radius: 4px;
364
- font: 700 11px/20px var(--font-body); background: var(--fg); color: var(--bg);
439
+ .fold .row[data-at] { cursor: default; }
440
+ .fold .row[data-at]:hover { background: rgba(255, 255, 255, 0.08); }
441
+
442
+ /* A row of jumps with none keeps its height, though hidden, so the
443
+ sticky header, and the code below it, never move. */
444
+ .jump-list[data-empty] { visibility: hidden; }
445
+ /* The number of each method's def line wears a loose site's
446
+ button's look: the one tint, edged on the top and left in its
447
+ status colour, orange for gaps and blue for covered, with an
448
+ arrow pointing left while its card is closed, and none while it
449
+ is open. Its 63px and its 9px right margin take the 72px a plain
450
+ number takes, as a loose site's button does, so its line's code
451
+ starts where every other line's does and its digits end where
452
+ theirs do. */
453
+ .lineno.mdef {
454
+ position: relative; box-sizing: border-box; width: 63px; padding-right: 11px;
455
+ margin: 4px 9px 4px 0; line-height: 24px; cursor: pointer;
456
+ font: 600 13px/24px var(--font-code); border: 1px solid transparent;
457
+ border-radius: 6px; background: var(--cond-tint);
458
+ --mdef-status: var(--bad); color: var(--mdef-status);
459
+ border-top-color: var(--mdef-status); border-left-color: var(--mdef-status);
460
+ }
461
+ .lineno.mdef[data-status="covered"] { --mdef-status: var(--ok); }
462
+ .lineno.mdef::before {
463
+ content: "\25C2"; position: absolute; left: 7px; top: 0; font-size: 11px;
365
464
  }
465
+ .lineno.mdef[aria-expanded="true"]::before { content: none; }
466
+ .lineno.mdef[aria-expanded="true"] { box-shadow: inset 1px 1px 0 var(--mdef-status); }
467
+ .lineno.mdef:hover { filter: brightness(1.1); }
468
+ /* A line's gap arrows sit in the middle of its row, level with its
469
+ number, however tall its row is. */
470
+ .nav { align-self: stretch; }