visual-regression-ci 0.0.0-stage → 0.9.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 (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +953 -2
  3. package/package.json +76 -4
  4. package/src/ci/actionReport.js +340 -0
  5. package/src/ci/prComment.js +420 -0
  6. package/src/cli/capture.js +243 -0
  7. package/src/cli/compare.js +190 -0
  8. package/src/cli/config.js +287 -0
  9. package/src/cli/database.js +69 -0
  10. package/src/cli/display.js +119 -0
  11. package/src/cli/errors.js +17 -0
  12. package/src/cli/index.js +577 -0
  13. package/src/cli/installBrowsers.js +59 -0
  14. package/src/cli/invocation.js +66 -0
  15. package/src/cli/jsonTarget.js +100 -0
  16. package/src/cli/logger.js +15 -0
  17. package/src/cli/manifest.js +139 -0
  18. package/src/cli/naming.js +60 -0
  19. package/src/cli/reporter.js +172 -0
  20. package/src/cli/result.js +225 -0
  21. package/src/cli/serve.js +64 -0
  22. package/src/server/app.js +135 -0
  23. package/src/server/db.js +691 -0
  24. package/src/server/importRuns.js +837 -0
  25. package/src/server/paths.js +107 -0
  26. package/src/server/public/css/styles.css +2362 -0
  27. package/src/server/public/js/common.js +32 -0
  28. package/src/server/public/js/dashboard.js +140 -0
  29. package/src/server/public/js/import-upload.js +169 -0
  30. package/src/server/public/js/review-actions.js +379 -0
  31. package/src/server/public/js/shortcuts.js +242 -0
  32. package/src/server/public/js/slider.js +104 -0
  33. package/src/server/public/js/tabs.js +85 -0
  34. package/src/server/public/js/theme.js +83 -0
  35. package/src/server/routes/api.js +141 -0
  36. package/src/server/routes/views.js +68 -0
  37. package/src/server/security.js +79 -0
  38. package/src/server/uploadImport.js +227 -0
  39. package/src/server/urls.js +31 -0
  40. package/src/server/viewModels.js +366 -0
  41. package/src/server/views/history.ejs +111 -0
  42. package/src/server/views/index.ejs +283 -0
  43. package/src/server/views/layout.ejs +11 -0
  44. package/src/server/views/partials/footer.ejs +11 -0
  45. package/src/server/views/partials/header.ejs +93 -0
  46. package/src/server/views/run-detail.ejs +295 -0
  47. package/src/shared/packageSpec.js +49 -0
  48. package/src/shared/text.js +59 -0
@@ -0,0 +1,111 @@
1
+ <%#
2
+ History of one route at one viewport across runs (newest first).
3
+ Model: see historyModel() in viewModels.js. Every local URL goes through url().
4
+ -%>
5
+ <%- include('partials/header', { navLink: 'back', crumbs: [{ label: 'Dashboard', href: '/' }, { label: 'History' }, { label: `${route} @ ${viewport}`, mono: true }] }) %>
6
+
7
+ <main class="container" id="main" tabindex="-1">
8
+ <div class="detail-header-card">
9
+ <div class="detail-title-row">
10
+ <div class="history-title">
11
+ <h1 class="detail-run-id">History</h1>
12
+ <span class="route-pill"><%= route %></span>
13
+ <span class="viewport-badge"><%= viewport %></span>
14
+ </div>
15
+ <% if (baselineUrl) { %>
16
+ <a href="<%= url(baselineUrl) %>" class="btn-inspect">View current baseline</a>
17
+ <% } %>
18
+ </div>
19
+ <div class="detail-meta-row">
20
+ <span><%= entries.length %> run(s)<%= truncated ? ` (latest ${limit} shown)` : '' %>, newest first</span>
21
+ <% if (routes.length > 1) { %>
22
+ <span>• Includes routes <%= routes.join(', ') %> (same baseline file)</span>
23
+ <% } %>
24
+ <% if (!baselineUrl) { %>
25
+ <span>• No shared baseline exists for this route and viewport</span>
26
+ <% } %>
27
+ </div>
28
+ </div>
29
+
30
+ <section class="history-chart-card" aria-labelledby="history-chart-heading">
31
+ <div class="history-chart-head">
32
+ <h2 id="history-chart-heading" class="history-chart-title">Mismatch over time <span class="history-chart-sub">(oldest → newest)</span></h2>
33
+ <% if (sparkline.points.length) { %>
34
+ <dl class="history-chart-stats">
35
+ <div><dt>Min</dt><dd><%= sparkline.min.toFixed(2) %>%</dd></div>
36
+ <div><dt>Max</dt><dd><%= sparkline.max.toFixed(2) %>%</dd></div>
37
+ <div><dt>Latest</dt><dd><%= sparkline.latest.toFixed(2) %>%</dd></div>
38
+ </dl>
39
+ <% } %>
40
+ </div>
41
+ <svg class="history-sparkline" viewBox="0 0 <%= sparkline.width %> <%= sparkline.height %>" role="img" aria-label="<%= sparkline.label %>" focusable="false">
42
+ <line class="history-sparkline-axis" x1="0" y1="<%= sparkline.height - 8 %>" x2="<%= sparkline.width %>" y2="<%= sparkline.height - 8 %>"></line>
43
+ <% sparkline.changes.forEach((c) => { %>
44
+ <line class="history-sparkline-change" x1="<%= c.x %>" y1="0" x2="<%= c.x %>" y2="<%= sparkline.height %>"><title><%= c.label %> (<%= c.runId %>)</title></line>
45
+ <% }) %>
46
+ <% if (sparkline.points.length > 1) { %>
47
+ <path class="history-sparkline-line" d="<%= sparkline.path %>"></path>
48
+ <% } %>
49
+ <% sparkline.points.forEach((p, i) => { %>
50
+ <circle class="history-sparkline-dot<%= i === sparkline.points.length - 1 ? ' is-latest' : '' %>" cx="<%= p.x %>" cy="<%= p.y %>" r="<%= i === sparkline.points.length - 1 ? 4 : 2.5 %>"></circle>
51
+ <% }) %>
52
+ </svg>
53
+ <% if (sparkline.changes.length) { %>
54
+ <p class="history-chart-legend"><span class="history-legend-swatch" aria-hidden="true"></span> Dashed lines mark runs compared against a different baseline than the run before.</p>
55
+ <% } %>
56
+ </section>
57
+
58
+ <div class="table-card">
59
+ <div class="table-responsive">
60
+ <table class="history-table">
61
+ <thead>
62
+ <tr>
63
+ <th scope="col">Run</th>
64
+ <th scope="col">Git</th>
65
+ <th scope="col">Status</th>
66
+ <th scope="col">Mismatch</th>
67
+ <th scope="col">Screenshot</th>
68
+ </tr>
69
+ </thead>
70
+ <tbody>
71
+ <% entries.forEach((e) => { %>
72
+ <tr<%- e.baselineChanged ? ' class="history-row-baseline-changed"' : '' %>>
73
+ <td class="history-run-cell">
74
+ <a href="<%= url(e.runUrl) %>" class="run-id-link"><%= e.run_id %></a>
75
+ <div class="timestamp-text history-time">
76
+ <% if (e.createdAtIso) { %><time datetime="<%= e.createdAtIso %>"><%= e.created_at %> UTC</time><% } else { %><%= e.created_at || 'Unknown time' %> UTC<% } %>
77
+ </div>
78
+ <% if (e.baselineChanged) { %>
79
+ <span class="history-baseline-marker" title="This run was compared against a different baseline than the run before it">
80
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" aria-hidden="true"><polyline points="23 4 23 10 17 10"></polyline><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"></path></svg>
81
+ <span><%= e.baselineChangeLabel %></span>
82
+ </span>
83
+ <% } %>
84
+ </td>
85
+ <td data-label="Git">
86
+ <div class="git-context">
87
+ <% if (e.branch) { %><span class="git-badge git-badge-text" title="<%= e.branch %>"><%= e.branch %></span><% } %>
88
+ <% if (e.commit_hash) { %><span class="git-badge git-commit">#<%= e.commit_hash %></span><% } %>
89
+ <% if (!e.branch && !e.commit_hash) { %><span class="timestamp-text">—</span><% } %>
90
+ </div>
91
+ </td>
92
+ <td data-label="Status"><span class="status-pill <%= e.statusPill.cls %>"><%= e.statusPill.label %></span></td>
93
+ <td class="history-mismatch" data-label="Mismatch"><%= e.mismatch.toFixed(2) %>%</td>
94
+ <td class="history-thumb-cell">
95
+ <% if (e.currentUrl) { %>
96
+ <a href="<%= url(e.runUrl) %>" class="history-thumb-link">
97
+ <img class="history-thumb" src="<%= url(e.currentUrl) %>" loading="lazy" alt="Screenshot of <%= e.route %> at <%= viewport %> in run <%= e.run_id %>">
98
+ </a>
99
+ <% } else { %>
100
+ <span class="timestamp-text">Not in storage</span>
101
+ <% } %>
102
+ </td>
103
+ </tr>
104
+ <% }) %>
105
+ </tbody>
106
+ </table>
107
+ </div>
108
+ </div>
109
+ </main>
110
+
111
+ <%- include('partials/footer') %>
@@ -0,0 +1,283 @@
1
+ <%- include('partials/header', { crumbs: [{ label: 'Dashboard' }] }) %>
2
+ <!-- Main Content Area -->
3
+ <main class="container" id="main" tabindex="-1">
4
+ <!-- Page Heading -->
5
+ <div class="page-heading">
6
+ <div class="page-heading-left">
7
+ <div class="heading-icon-container">
8
+ <svg aria-hidden="true" width="26" height="26" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
9
+ <rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
10
+ <circle cx="8.5" cy="8.5" r="1.5"></circle>
11
+ <polyline points="21 15 16 10 5 21"></polyline>
12
+ </svg>
13
+ </div>
14
+ <div class="heading-text-group">
15
+ <h1 class="page-title">Visual Regression Test Runs</h1>
16
+ <p class="page-subtitle">Track, inspect, and approve screenshot regressions across viewports.</p>
17
+ </div>
18
+ </div>
19
+
20
+ <div class="page-heading-actions">
21
+ <% if (mode !== 'static') { %>
22
+ <%# Import a CI artifact (import-upload.js); not in the read-only static build. -%>
23
+ <div class="import-control" data-max-upload-bytes="<%= locals.maxUploadBytes || '' %>" data-cli-command="<%= locals.cliCommand || 'visual-ci' %>">
24
+ <button type="button" class="btn-import" id="import-run-btn" aria-describedby="import-hint">
25
+ <svg aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
26
+ <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
27
+ <polyline points="17 8 12 3 7 8"></polyline>
28
+ <line x1="12" y1="3" x2="12" y2="15"></line>
29
+ </svg>
30
+ <span class="import-label">Import CI run</span>
31
+ </button>
32
+ <p class="import-hint" id="import-hint">The <code>visual-regression-diffs</code> .zip from a failed CI run, or drop it on this page</p>
33
+ <input type="file" id="import-file" accept=".zip,application/zip,application/x-zip-compressed" hidden>
34
+ </div>
35
+ <% } %>
36
+ <div class="action-pill">
37
+ <span class="action-pill-dot"></span>
38
+ <span>Engine Active</span>
39
+ <span style="color: var(--border-color);">|</span>
40
+ <span style="font-family: var(--font-mono); font-size: 13px; color: var(--bright-cyan); font-weight: 600;"><%= runs.length %> Test Runs</span>
41
+ </div>
42
+ </div>
43
+ </div>
44
+
45
+ <% if (mode !== 'static') { %>
46
+ <div class="import-feedback">
47
+ <%# Progress and results of an import; errors go to the alert region. -%>
48
+ <div class="import-status" role="status" data-import-status></div>
49
+ <div class="action-error" role="alert" data-import-error></div>
50
+ </div>
51
+ <div class="drop-overlay" data-drop-overlay hidden>
52
+ <div class="drop-overlay-inner">Drop the artifact .zip to import it</div>
53
+ </div>
54
+ <% } %>
55
+
56
+ <!-- Exactly 3 Statistics Cards (KPIs) -->
57
+ <section class="kpi-grid" aria-label="Run statistics">
58
+ <!-- Card 1: Total Runs -->
59
+ <div class="kpi-card kpi-card-blue">
60
+ <div class="kpi-icon-circle">
61
+ <svg aria-hidden="true" width="26" height="26" viewBox="0 0 24 24" fill="currentColor">
62
+ <polygon points="6 4 20 12 6 20 6 4"></polygon>
63
+ </svg>
64
+ </div>
65
+ <div class="kpi-content">
66
+ <span class="kpi-label">Total Runs</span>
67
+ <div class="kpi-value"><%= stats.total %></div>
68
+ </div>
69
+ <svg aria-hidden="true" class="kpi-curve" viewBox="0 0 180 90" fill="none" xmlns="http://www.w3.org/2000/svg">
70
+ <path d="M0 75 C 50 48, 100 88, 180 25" stroke="currentColor" stroke-opacity="0.28" stroke-width="2.5" stroke-linecap="round"/>
71
+ <path d="M25 90 C 70 62, 120 95, 180 48" stroke="currentColor" stroke-opacity="0.14" stroke-width="1.5" stroke-linecap="round"/>
72
+ </svg>
73
+ </div>
74
+
75
+ <!-- Card 2: Passed / Approved -->
76
+ <div class="kpi-card kpi-card-green">
77
+ <div class="kpi-icon-circle">
78
+ <svg aria-hidden="true" width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
79
+ <path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path>
80
+ <polyline points="22 4 12 14.01 9 11.01"></polyline>
81
+ </svg>
82
+ </div>
83
+ <div class="kpi-content">
84
+ <span class="kpi-label">Passed / Approved</span>
85
+ <div class="kpi-value kpi-value-green"><%= stats.passedOrApproved %></div>
86
+ </div>
87
+ <svg aria-hidden="true" class="kpi-curve" viewBox="0 0 180 90" fill="none" xmlns="http://www.w3.org/2000/svg">
88
+ <path d="M0 75 C 50 48, 100 88, 180 25" stroke="currentColor" stroke-opacity="0.28" stroke-width="2.5" stroke-linecap="round"/>
89
+ <path d="M25 90 C 70 62, 120 95, 180 48" stroke="currentColor" stroke-opacity="0.14" stroke-width="1.5" stroke-linecap="round"/>
90
+ </svg>
91
+ </div>
92
+
93
+ <!-- Card 3: Visual Regressions -->
94
+ <div class="kpi-card kpi-card-red">
95
+ <div class="kpi-icon-circle">
96
+ <svg aria-hidden="true" width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
97
+ <path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"></path>
98
+ <line x1="12" y1="9" x2="12" y2="13"></line>
99
+ <line x1="12" y1="17" x2="12.01" y2="17"></line>
100
+ </svg>
101
+ </div>
102
+ <div class="kpi-content">
103
+ <span class="kpi-label">Visual Regressions</span>
104
+ <div class="kpi-value kpi-value-red"><%= stats.failed %></div>
105
+ </div>
106
+ <svg aria-hidden="true" class="kpi-curve" viewBox="0 0 180 90" fill="none" xmlns="http://www.w3.org/2000/svg">
107
+ <path d="M0 75 C 50 48, 100 88, 180 25" stroke="currentColor" stroke-opacity="0.28" stroke-width="2.5" stroke-linecap="round"/>
108
+ <path d="M25 90 C 70 62, 120 95, 180 48" stroke="currentColor" stroke-opacity="0.14" stroke-width="1.5" stroke-linecap="round"/>
109
+ </svg>
110
+ </div>
111
+ </section>
112
+
113
+ <!-- Table Toolbar: Filtering Tabs + Quick Search -->
114
+ <div class="table-toolbar">
115
+ <%# Toggle buttons (aria-pressed), not tabs: they filter one table rather than switch panels. -%>
116
+ <div class="filter-tabs" role="group" aria-label="Filter runs by status">
117
+ <button type="button" class="filter-tab active" data-filter="all" aria-pressed="true">All Runs (<%= stats.total %>)</button>
118
+ <button type="button" class="filter-tab" data-filter="passed" aria-pressed="false">Passed (<%= stats.passed %>)</button>
119
+ <button type="button" class="filter-tab" data-filter="approved" aria-pressed="false">Approved (<%= stats.approved %>)</button>
120
+ <button type="button" class="filter-tab" data-filter="failed" aria-pressed="false">Regressions (<%= stats.failed %>)</button>
121
+ </div>
122
+
123
+ <div class="search-input-wrapper">
124
+ <label for="dashboard-search" class="visually-hidden">Filter runs by ID, branch or commit</label>
125
+ <svg aria-hidden="true" class="search-input-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
126
+ <circle cx="11" cy="11" r="8"></circle>
127
+ <line x1="21" y1="21" x2="16.65" y2="16.65"></line>
128
+ </svg>
129
+ <input type="text" id="dashboard-search" class="search-input" placeholder="Filter by ID, branch, commit...">
130
+ </div>
131
+ </div>
132
+
133
+ <!-- Test Runs Table Card -->
134
+ <div class="table-card">
135
+ <div class="table-responsive">
136
+ <table id="test-runs-table">
137
+ <thead>
138
+ <tr>
139
+ <th scope="col" style="width: 130px;">Status</th>
140
+ <th scope="col" style="width: 240px;">Run ID</th>
141
+ <th scope="col" style="width: 240px;">Git Context</th>
142
+ <th scope="col" style="width: 200px;">Snapshots</th>
143
+ <th scope="col" style="width: 180px;">Created (UTC)</th>
144
+ <th scope="col" style="width: 100px; text-align: right;">Actions</th>
145
+ </tr>
146
+ </thead>
147
+ <tbody>
148
+ <% if (runs.length === 0) { %>
149
+ <tr>
150
+ <td colspan="6">
151
+ <div class="empty-state">
152
+ <svg aria-hidden="true" class="empty-state-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
153
+ <rect x="2" y="3" width="20" height="14" rx="2" ry="2"></rect>
154
+ <line x1="8" y1="21" x2="16" y2="21"></line>
155
+ <line x1="12" y1="17" x2="12" y2="21"></line>
156
+ </svg>
157
+ <div class="empty-state-title">No test runs recorded yet</div>
158
+ <div class="empty-state-desc">
159
+ Execute <code><%= locals.cliCommand || 'visual-ci' %> test</code> in your project terminal to perform multi-viewport captures and compare against baselines.
160
+ </div>
161
+ </div>
162
+ </td>
163
+ </tr>
164
+ <% } else { %>
165
+ <% runs.forEach(run => { %>
166
+ <tr data-run-id="<%= run.id %>" data-status="<%= run.status %>" data-branch="<%= run.branch || '' %>" data-commit="<%= run.commit_hash || '' %>">
167
+ <!-- 1. Status Pill -->
168
+ <td data-label="Status">
169
+ <% if (run.status === 'PASSED') { %>
170
+ <span class="status-pill status-pill-passed">
171
+ <svg aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
172
+ <polyline points="20 6 9 17 4 12"></polyline>
173
+ </svg>
174
+ <span>PASSED</span>
175
+ </span>
176
+ <% } else if (run.status === 'APPROVED') { %>
177
+ <span class="status-pill status-pill-approved">
178
+ <svg aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
179
+ <path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path>
180
+ <polyline points="22 4 12 14.01 9 11.01"></polyline>
181
+ </svg>
182
+ <span>APPROVED</span>
183
+ </span>
184
+ <% } else if (run.status === 'FAILED') { %>
185
+ <span class="status-pill status-pill-failed">
186
+ <svg aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
187
+ <line x1="18" y1="6" x2="6" y2="18"></line>
188
+ <line x1="6" y1="6" x2="18" y2="18"></line>
189
+ </svg>
190
+ <span>FAILED</span>
191
+ </span>
192
+ <% } else if (run.status === 'REJECTED') { %>
193
+ <span class="status-pill status-pill-rejected">
194
+ <svg aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
195
+ <circle cx="12" cy="12" r="10"></circle>
196
+ <line x1="4.93" y1="4.93" x2="19.07" y2="19.07"></line>
197
+ </svg>
198
+ <span>REJECTED</span>
199
+ </span>
200
+ <% } else { %>
201
+ <span class="status-pill status-pill-new"><%= run.status %></span>
202
+ <% } %>
203
+ </td>
204
+
205
+ <!-- 2. Run ID -->
206
+ <td data-label="Run ID">
207
+ <a href="<%= url(`/runs/${encodeURIComponent(run.id)}`) %>" class="run-id-link"><%= run.id %></a>
208
+ <% if (run.imported_at) { %>
209
+ <span class="imported-badge" title="Imported <%= run.imported_at %> UTC">Imported</span>
210
+ <% } %>
211
+ </td>
212
+
213
+ <!-- 3. Git Context -->
214
+ <td data-label="Git">
215
+ <div class="git-context">
216
+ <% if (run.branch) { %>
217
+ <span class="git-badge">
218
+ <svg aria-hidden="true" class="git-icon" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
219
+ <line x1="6" y1="3" x2="6" y2="15"></line>
220
+ <circle cx="18" cy="6" r="3"></circle>
221
+ <circle cx="6" cy="18" r="3"></circle>
222
+ <path d="M18 9a9 9 0 0 1-9 9"></path>
223
+ </svg>
224
+ <span title="<%= run.branch %>"><%= run.branch %></span>
225
+ </span>
226
+ <% } %>
227
+ <% if (run.commit_hash) { %>
228
+ <span class="git-badge git-commit">#<%= run.commit_hash %></span>
229
+ <% } %>
230
+ <% if (!run.branch && !run.commit_hash) { %>
231
+ <span style="color: var(--text-muted); font-size: 13px; font-family: var(--font-mono);">local</span>
232
+ <% } %>
233
+ </div>
234
+ </td>
235
+
236
+ <!-- 4. Snapshots: total, then each non-zero status count -->
237
+ <td data-label="Snapshots">
238
+ <div class="snapshots-summary">
239
+ <span class="snapshots-count"><%= run.total_snapshots || 0 %> snapshot<%= run.total_snapshots === 1 ? '' : 's' %></span>
240
+ <% if (run.snapshotCounts.length) { %>
241
+ <span class="snapshots-sub">
242
+ <% run.snapshotCounts.forEach((part) => { %>
243
+ <span class="<%= part.cls %>">• <%= part.count %> <%= part.label %></span>
244
+ <% }) %>
245
+ </span>
246
+ <% } %>
247
+ </div>
248
+ </td>
249
+
250
+ <!-- 5. Created Date/Time (stored as UTC) -->
251
+ <td data-label="Created">
252
+ <span class="timestamp-text"><% if (run.createdAtIso) { %><time datetime="<%= run.createdAtIso %>"><%= run.created_at %> UTC</time><% } else { %><%= run.created_at %> UTC<% } %></span>
253
+ </td>
254
+
255
+ <!-- 6. Actions -->
256
+ <td class="run-actions-cell" style="text-align: right;">
257
+ <a href="<%= url(`/runs/${encodeURIComponent(run.id)}`) %>" class="btn-inspect">
258
+ <span>Inspect<span class="visually-hidden"> run <%= run.id %></span></span>
259
+ <svg aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
260
+ <polyline points="9 18 15 12 9 6"></polyline>
261
+ </svg>
262
+ </a>
263
+ </td>
264
+ </tr>
265
+ <% }) %>
266
+ <% } %>
267
+ </tbody>
268
+ </table>
269
+ </div>
270
+
271
+ <!-- Pagination Footer -->
272
+ <div class="pagination-bar">
273
+ <span id="showing-range" aria-live="polite">Showing <%= Math.min(runs.length, 10) %> of <%= runs.length %> runs</span>
274
+ <div class="pagination-controls">
275
+ <button type="button" id="prev-page-btn" class="pagination-btn" disabled><span aria-hidden="true">←</span> Previous</button>
276
+ <span id="pagination-info" style="font-size: 12px; color: var(--text-muted); padding: 0 4px;">Page 1 of <%= Math.max(1, Math.ceil(runs.length / 10)) %></span>
277
+ <button type="button" id="next-page-btn" class="pagination-btn" <%= runs.length <= 10 ? 'disabled' : '' %>>Next <span aria-hidden="true">→</span></button>
278
+ </div>
279
+ </div>
280
+ </div>
281
+ </main>
282
+
283
+ <%- include('partials/footer', { scripts: mode === 'static' ? ['/js/dashboard.js'] : ['/js/dashboard.js', '/js/import-upload.js'] }) %>
@@ -0,0 +1,11 @@
1
+ <%# Error page. Params: title, heading, message (both escaped here). -%>
2
+ <%- include('partials/header', { navLink: 'back', crumbs: [{ label: 'Dashboard', href: '/' }, { label: locals.title || 'Error' }] }) %>
3
+
4
+ <main class="container" id="main" tabindex="-1">
5
+ <div class="error-container">
6
+ <h1><%= locals.heading || 'Something went wrong' %></h1>
7
+ <p><%= locals.message || '' %></p>
8
+ </div>
9
+ </main>
10
+
11
+ <%- include('partials/footer') %>
@@ -0,0 +1,11 @@
1
+ <%#
2
+ Shared page end. Params: scripts (array of local paths such as '/js/dashboard.js'),
3
+ loaded as ES modules through url() so they work under a sub-path.
4
+ /js/theme.js (light/dark toggle) is loaded on every page.
5
+ -%>
6
+ <div id="live-region" class="visually-hidden" role="status" aria-live="polite"></div>
7
+ <% ['/js/theme.js', ...(locals.scripts || [])].forEach((src) => { -%>
8
+ <script type="module" src="<%= url(src) %>"></script>
9
+ <% }) -%>
10
+ </body>
11
+ </html>
@@ -0,0 +1,93 @@
1
+ <%#
2
+ Shared page head + navbar.
3
+ Params: title, crumbs (array of { label, href?, mono? }; the last one is the current page),
4
+ navLink ('back' for "Back to Runs", otherwise "Documentation"),
5
+ repoUrl (optional; static demo banner links to it).
6
+ All local URLs go through url() so pages work under a sub-path.
7
+ mode === 'static' (the GitHub Pages build) adds a banner explaining that approvals are simulated.
8
+ -%>
9
+ <% const pageCrumbs = locals.crumbs || []; -%>
10
+ <!DOCTYPE html>
11
+ <html lang="en" data-base="<%= base %>" data-mode="<%= mode %>">
12
+ <head>
13
+ <meta charset="UTF-8">
14
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
15
+ <title><%= locals.title || 'Visual Regression Tool' %></title>
16
+ <%# Theme: runs before the stylesheet so the first paint already has the right colours.
17
+ Stored choice ('vrt-theme' in localStorage) wins, otherwise the system preference.
18
+ No JS = no data-theme = the dark default. public/js/theme.js does the rest. -%>
19
+ <script>(function () { var t; try { t = localStorage.getItem('vrt-theme'); } catch (e) {} if (t !== 'light' && t !== 'dark') { t = window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark'; } document.documentElement.setAttribute('data-theme', t); })();</script>
20
+ <link rel="stylesheet" href="<%= url('/css/styles.css') %>">
21
+ </head>
22
+ <body>
23
+ <a class="skip-link" href="#main">Skip to main content</a>
24
+ <!-- Header: Compact top navbar with breadcrumbs -->
25
+ <header class="navbar">
26
+ <div class="navbar-inner">
27
+ <div class="navbar-left">
28
+ <a href="<%= url('/') %>" class="navbar-brand">
29
+ <div class="navbar-brand-icon">
30
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
31
+ <rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
32
+ <circle cx="8.5" cy="8.5" r="1.5"></circle>
33
+ <polyline points="21 15 16 10 5 21"></polyline>
34
+ </svg>
35
+ </div>
36
+ <span>Visual CI</span>
37
+ </a>
38
+ <% pageCrumbs.forEach((crumb, i) => { const middle = i < pageCrumbs.length - 1 ? ' crumb-middle' : ''; -%>
39
+ <span class="breadcrumb-separator<%= middle %>">/</span>
40
+ <% if (crumb.href) { -%>
41
+ <a href="<%= url(crumb.href) %>" class="navbar-link<%= middle %>" style="padding: 0; font-size: 14px;"><%= crumb.label %></a>
42
+ <% } else if (crumb.mono) { -%>
43
+ <span class="breadcrumb-current<%= middle %>" style="font-family: var(--font-mono); font-size: 13px;"><%= crumb.label %></span>
44
+ <% } else { -%>
45
+ <span class="breadcrumb-current<%= middle %>"><%= crumb.label %></span>
46
+ <% } -%>
47
+ <% }) -%>
48
+ </div>
49
+
50
+ <div class="navbar-right">
51
+ <%# Two-state toggle: aria-pressed="true" = dark theme on (synced by theme.js; hidden without JS). -%>
52
+ <button type="button" class="theme-toggle" data-theme-toggle aria-pressed="true" title="Toggle dark theme">
53
+ <svg class="theme-icon theme-icon-moon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
54
+ <path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path>
55
+ </svg>
56
+ <svg class="theme-icon theme-icon-sun" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
57
+ <circle cx="12" cy="12" r="4"></circle>
58
+ <path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"></path>
59
+ </svg>
60
+ <span class="visually-hidden">Dark theme</span>
61
+ </button>
62
+ <% if (locals.navLink === 'back') { -%>
63
+ <a href="<%= url('/') %>" class="navbar-link">
64
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
65
+ <polyline points="15 18 9 12 15 6"></polyline>
66
+ </svg>
67
+ <span class="navbar-link-text">Back to Runs</span>
68
+ </a>
69
+ <% } else { -%>
70
+ <a href="<%= url('/') %>" class="navbar-link">
71
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
72
+ <path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"></path>
73
+ <path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"></path>
74
+ </svg>
75
+ <span class="navbar-link-text">Documentation</span>
76
+ </a>
77
+ <% } -%>
78
+ </div>
79
+ </div>
80
+ </header>
81
+ <% if (mode === 'static') { -%>
82
+ <div class="demo-banner" role="note" aria-label="About this demo">
83
+ <div class="demo-banner-inner">
84
+ <span class="demo-banner-tag">Demo</span>
85
+ <p class="demo-banner-text">
86
+ Live demo with sample data: approvals are simulated and reset when you reload. Run it locally to review your own app.
87
+ <%_ if (locals.repoUrl) { _%>
88
+ <a href="<%= repoUrl %>" class="demo-banner-link">Get it on GitHub</a>
89
+ <%_ } _%>
90
+ </p>
91
+ </div>
92
+ </div>
93
+ <% } -%>