atagen

matrix-rust-sdk

public
Star0
Watch0
ssh://brewery@pls.lobotomise.me:33/atagen/matrix-rust-sdk.git
xtask/src/log/timer.template.htmlHtml261 lines6.4 KB
1
<!doctype html>
2
<html lang="en">
3
<head>
4
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
5
  <meta http-equiv="content-security-policy" content="default-src 'self'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data:">
6
  <meta name="viewport" content="width=device-width, minimum-scale=1">
7
8
  <style>
9
  /* Reset */
10
11
  *, *::before, *::after {
12
    box-sizing: border-box;
13
  }
14
15
  * { margin: 0 }
16
17
  :root {
18
    color-scheme: dark;
19
20
    --space-very-small: .25rem;
21
    --space-small: .5rem;
22
    --space: 1rem;
23
    --space-large: 2rem;
24
    --space-very-large: 4rem;
25
26
    --border-radius: 3px;
27
28
    --color-accent: oklch(59.1% .236 10.25);
29
    --color-text: oklch(.84 0 0);
30
    --color-canvas: oklch(0.258 0.007 285.867);
31
    --color-canvas-lighter: oklch(0.303 0.007 285.966);
32
    --color-canvas-lighter-2: oklch(0.343 0.009 285.935);
33
    --color-canvas-lighter-3: oklch(0.6 0 0);
34
35
    --color-white: oklch(1 0 0);
36
    --color-red: oklch(.503 .172 25);
37
    --color-orange: oklch(.793 .171 70.67);
38
    --color-blue: oklch(0.579 0.191 252.0);
39
    --color-green: oklch(0.571 0.181 145.0);
40
    --color-black: oklch(0 0 0);
41
  }
42
43
  .content-grid {
44
    --padding-inline: 1rem;
45
    --content-max-width: 70ch;
46
    --breakout-max-width: 85ch;
47
48
    --breakout-size: calc((var(--breakout-max-width) - var(--content-max-width)) / 2);
49
50
    display: grid;
51
    grid-template-columns:
52
      [full-width-start]
53
        minmax(var(--padding-inline), 1fr)
54
        [breakout-start]
55
          minmax(0, var(--breakout-size))
56
          [content-start]
57
            min(
58
              100% - (var(--padding-inline) * 2),
59
              var(--content-max-width)
60
            )
61
          [content-end]
62
          minmax(0, var(--breakout-size))
63
        [breakout-end]
64
        minmax(var(--padding-inline), 1fr)
65
      [full-width-end];
66
67
    > * {
68
      grid-column: content;
69
    }
70
71
    > .breakout {
72
      grid-column: breakout;
73
    }
74
75
    > .full-width {
76
      grid-column: full-width;
77
    }
78
  }
79
80
  html {
81
    scroll-padding-top: var(--space-very-large);
82
  }
83
84
  body {
85
    font-size: .95rem;
86
    /* Thanks modernfontstacks.com */
87
    font-family: Inter, Roboto, 'Helvetica Neue', 'Arial Nova', 'Nimbus Sans', Arial, sans-serif;
88
    font-weight: normal;
89
    font-variant-numeric: proportional-nums slashed-zero;
90
    color: var(--color-text);
91
    background: var(--color-canvas);
92
    scroll-behaviour: smooth;
93
  }
94
95
  header {
96
    text-align: center;
97
    text-wrap: balanced;
98
    margin-block: var(--space) var(--space-large);
99
  }
100
101
  details > summary {
102
    cursor: pointer;
103
  }
104
105
  main > form {
106
    --_block-space: var(--space);
107
    padding: var(--_block-space) var(--space-large);
108
    border-radius: var(--border-radius);
109
    background: var(--color-canvas-lighter);
110
111
    details[open]::details-content {
112
      margin-block-start: var(--_block-space);
113
    }
114
    
115
    fieldset {
116
      width: fit-content;
117
      display: grid;
118
      padding-inline: var(--space-large);
119
      border-color: var(--color-canvas-lighter-3);
120
      border-style: solid;
121
      border-radius: var(--border-radius);
122
      
123
      label input {
124
        margin-inline-end: var(--space-small);
125
      }
126
    }
127
  }
128
129
  main > table {
130
    width: 100%;
131
    border-spacing: 0;
132
    margin-inline: var(--space);
133
134
    th, td {
135
      white-space: nowrap;
136
      padding: .15rem var(--space);
137
    }
138
139
    thead {
140
      position: sticky;
141
      top: 0;
142
      z-index: 100;
143
      background: oklch(from var(--color-canvas) l c h / .8);
144
      backdrop-filter: blur(5px);
145
146
      tr {
147
        font-weight: bold;
148
        height: 3em;
149
      }
150
    }
151
152
    tbody {
153
      --_longest-duration: var(--longest-duration, 1000000);
154
155
      > tr {
156
        > :first-child {
157
          --_line-height: 1.4rem;
158
159
          min-width: 200px;
160
          position: relative;
161
162
          .span {
163
            --_duration: var(--duration, 1);
164
            --_width: 0;
165
166
            main:has(input[name="duration_scale"][value="normal"]:checked) & {
167
              --_width: calc((var(--_duration) * 100) / var(--_longest-duration));
168
            }
169
170
            main:has(input[name="duration_scale"][value="logarithmic"]:checked) & {
171
              --_width: calc((log(var(--_duration), 10) * 100) / log(var(--_longest-duration), 10));
172
            }
173
174
            position: absolute;
175
            top: 0;
176
            right: 0;
177
            display: inline-block;
178
            height: var(--_line-height);
179
            width: calc(var(--_width) * 1%);
180
            border-radius: var(--border-radius) 0 0 var(--border-radius);
181
            background: var(--color-accent);
182
            
183
            transition: 150ms width ease-in-out;
184
            
185
            span {
186
              position: absolute;
187
              right: var(--space-very-small);
188
              font-size: .9em;
189
              line-height: var(--_line-height);
190
            }
191
          }
192
        }
193
      }
194
    }
195
196
    time {
197
      font-variant-numeric: slashed-zero tabular-nums;
198
    }
199
  }
200
201
  code {
202
    /* Thanks modernfontstacks.com */
203
    font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
204
    font-weight: normal;
205
    font-size: .9em;
206
  }
207
208
  .error, .warn, .info, .debug, .trace {
209
    display: inline-block;
210
    font-size: .9em;
211
    vertical-align: center;
212
    line-height: 1.4em;
213
    padding-inline: var(--space-very-small);
214
    border-radius: var(--border-radius);
215
    color: var(--color-white);
216
  }
217
218
  .error { background: var(--color-red) }
219
  .warn { background: var(--color-orange) }
220
  .info { background: var(--color-blue) }
221
  .debug { background: var(--color-green) }
222
  .trace { background: var(--color-black) }
223
  </style>
224
225
  <title>Timer viewer</title>
226
</head>
227
228
<body class="content-grid">
229
230
<header>
231
  <h1>Analyse of <code>{log_file}</code></h1>
232
</header>
233
234
<main class="full-width content-grid">
235
236
<form class="breakout">
237
  <details>
238
    <summary>Options</summary>
239
240
    <fieldset>
241
      <legend>Duration scale</legend>
242
243
      <label><input type="radio" name="duration_scale" value="normal" checked>Normal</label>
244
      <label><input type="radio" name="duration_scale" value="logarithmic">Logarithmic</label>
245
    </fieldset>
246
  </details>
247
</form>
248
249
<table class="full-width">
250
  <thead>
251
    <tr>
252
      <th scope="col">Duration</th>
253
      <th scope="col">Message</th>
254
      <th scope="col">Level</th>
255
      <th scope="col">Target</th>
256
      <th scope="col">Location</th>
257
      <th scope="col">Time</th>
258
    </tr>
259
  </thead>
260
261
  <tbody style="--longest-duration: {longest-duration}">