report-studio 1.0.0 → 1.1.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 (47) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +129 -4
  3. package/dist/designer-qy59eEux.js +3416 -0
  4. package/dist/designer.js +2 -3209
  5. package/dist/index.js +2 -2
  6. package/dist/react-designer.js +41 -0
  7. package/dist/react.js +60 -0
  8. package/dist/{viewer-D-c0lKzQ.js → viewer-xa17tyMJ.js} +682 -537
  9. package/package.json +80 -66
  10. package/src/cli/serve.js +135 -135
  11. package/src/designer/designer.js +2054 -1900
  12. package/src/designer/dialog.js +708 -708
  13. package/src/designer/fields.js +51 -2
  14. package/src/designer/icons.js +5 -0
  15. package/src/designer/index.html +28 -28
  16. package/src/designer/main.js +39 -39
  17. package/src/designer/menu.js +2 -2
  18. package/src/designer/panel.js +21 -1
  19. package/src/designer/sample-data.js +180 -9
  20. package/src/designer/structure.js +87 -6
  21. package/src/designer/styles.css +1654 -1616
  22. package/src/designer/tokens.js +9 -0
  23. package/src/engine/csv.js +350 -315
  24. package/src/engine/group.js +128 -65
  25. package/src/engine/index.js +35 -34
  26. package/src/engine/measure.js +13 -12
  27. package/src/engine/paginate.js +8 -4
  28. package/src/engine/resolve.js +37 -0
  29. package/src/engine/tables.js +87 -0
  30. package/src/engine/validate.js +97 -22
  31. package/src/index.html +79 -79
  32. package/src/index.js +51 -50
  33. package/src/preview/chrome.css +505 -505
  34. package/src/preview/chrome.js +147 -147
  35. package/src/preview/index.html +28 -28
  36. package/src/preview/viewer.js +763 -745
  37. package/src/react/designer.js +87 -0
  38. package/src/react/index.js +117 -0
  39. package/src/render/items.js +94 -1
  40. package/src/render/report.css +30 -0
  41. package/src/server/routes.js +331 -331
  42. package/src/shared/brand.css +29 -29
  43. package/src/shared/dropdown.css +136 -136
  44. package/src/shared/modal.css +125 -125
  45. package/src/shared/store.js +145 -145
  46. package/src/shared/theme.css +72 -72
  47. package/src/shared/window.js +138 -138
@@ -1,505 +1,505 @@
1
- /**
2
- * The viewer's chrome: toolbar, pager, search field, export dialog, and how a
3
- * page is presented on screen.
4
- *
5
- * Split out of styles.css because the viewer is opened from two places. The
6
- * preview screen links styles.css, which is this plus the shared layers; the
7
- * designer imports this file alone, because it already has those layers - and
8
- * it needs these rules, since "open the report in its own tab" mounts a viewer
9
- * into a window built from the designer's own stylesheets. Without them the
10
- * report opened in that window arrives unstyled.
11
- *
12
- * Every rule is scoped to .report-viewer, the class createViewer puts on its
13
- * mount, and that is not tidiness - it is what makes the file safe to import.
14
- * An unscoped `.page { display: none }` here is the viewer paging its report;
15
- * on the designer's canvas, which draws `class="page dz-page"`, it is the whole
16
- * design sheet gone. The same goes for any host that links viewer.css beside
17
- * its own stylesheet: what the viewer draws, the viewer styles, and nothing
18
- * outside its mount is touched.
19
- *
20
- * The three exceptions are the mount itself and the two classes a page puts
21
- * around it - .graph-paper on the body, .report-fills-window on the mount - and
22
- * the print rule that stops the page background printing over the report.
23
- *
24
- * How a report *looks* is not here - it is in render/report.css, shared with the
25
- * designer canvas so the two cannot drift. The palette is in shared/theme.css
26
- * for the same reason.
27
- */
28
-
29
- .graph-paper {
30
- min-height: 100vh;
31
- background-color: var(--backdrop);
32
- }
33
-
34
- /**
35
- * The viewer fills whatever it is given.
36
- *
37
- * The bar and the pager used to be `position: fixed`, which pinned them to the
38
- * window - fine for a page that is nothing but a report, and impossible for an
39
- * application embedding one in a panel beside its own chrome. They are laid out
40
- * inside the mount now, so the viewer is a component rather than a screen.
41
- */
42
- .report-viewer {
43
- position: relative;
44
- display: flex;
45
- flex-direction: column;
46
- height: 100%;
47
- min-height: 0;
48
- background: var(--backdrop);
49
- }
50
-
51
- /* the standalone page gives it the window; an application gives it a panel */
52
- .report-fills-window {
53
- height: 100vh;
54
- }
55
-
56
- /**
57
- * The viewport is the scroll container, sized to leave the fixed bar alone.
58
- * It scrolls only when a page is taller than the window - the report itself is
59
- * paged, not scrolled.
60
- */
61
- /**
62
- * The pager floats over this rather than taking a strip of it, so the bottom
63
- * padding is what lets the end of a page scroll clear of the pill.
64
- */
65
- .report-viewer .viewport {
66
- flex: 1;
67
- min-height: 0;
68
- overflow: auto;
69
- padding: 24px 24px calc(var(--pager-height) + var(--pager-offset) + 24px);
70
- }
71
-
72
- /**
73
- * The stack is the page's scaled footprint. A CSS transform does not affect
74
- * layout, so without an explicit size here there would be nothing to scroll at
75
- * 200% - viewer.js sets width/height from the layout's page size times zoom.
76
- * margin:auto centres it while it is narrower than the viewport.
77
- */
78
- .report-viewer #main-page {
79
- margin: 0 auto;
80
- }
81
-
82
- /**
83
- * One page on screen at a time. The others stay in the DOM so that paging is
84
- * instant and the browser's own find still reaches them if someone wants it.
85
- * The page's own appearance comes from report.css; these are the two things
86
- * only the preview does with it.
87
- */
88
- .report-viewer .page {
89
- display: none;
90
-
91
- /**
92
- * Scale the drawn page rather than its font sizes: re-computing type would
93
- * re-wrap the text and stop matching what the engine paginated.
94
- */
95
- transform: scale(var(--zoom, 1));
96
- transform-origin: top left;
97
- }
98
-
99
- .report-viewer .page.is-current {
100
- display: block;
101
- }
102
-
103
-
104
- /* ---------------- the floating pager ---------------- */
105
-
106
- .report-viewer .pager {
107
- position: absolute;
108
- left: 50%;
109
- bottom: var(--pager-offset);
110
- transform: translateX(-50%);
111
- z-index: 10;
112
-
113
- display: flex;
114
- align-items: center;
115
- gap: 8px;
116
- height: var(--pager-height);
117
- padding: 0 8px;
118
-
119
- background: var(--surface);
120
- border: 1px solid var(--border);
121
- /* a pill, to read as floating rather than as a docked strip */
122
- border-radius: 999px;
123
- box-shadow: 0 4px 16px rgba(34, 39, 44, .12);
124
-
125
- font-family: "Instrument Sans", system-ui, sans-serif;
126
- font-size: 13px;
127
- color: var(--ink);
128
- }
129
-
130
- .report-viewer .pager button {
131
- min-width: 30px;
132
- height: 30px;
133
- padding: 0 8px;
134
- border: 1px solid transparent;
135
- border-radius: 999px;
136
- background: none;
137
- color: var(--ink);
138
- font: inherit;
139
- font-size: 15px;
140
- line-height: 1;
141
- cursor: pointer;
142
- }
143
-
144
- .report-viewer .pager button:hover:not(:disabled) {
145
- background: var(--accent-soft);
146
- border-color: var(--accent);
147
- }
148
-
149
- .report-viewer .pager button:disabled {
150
- opacity: .38;
151
- cursor: default;
152
- }
153
-
154
- .report-viewer .pager input {
155
- height: 28px;
156
- padding: 0 6px;
157
- border: 1px solid var(--border);
158
- border-radius: 6px;
159
- background: var(--surface);
160
- color: var(--ink);
161
- font: inherit;
162
- }
163
-
164
- .report-viewer .pager input:focus-visible,
165
- .report-viewer .pager button:focus-visible {
166
- outline: 2px solid var(--accent-strong);
167
- outline-offset: 1px;
168
- }
169
-
170
-
171
- /* ---------------- viewer chrome ---------------- */
172
-
173
- .report-viewer .toolbar {
174
- flex: none;
175
- height: var(--bar-height);
176
-
177
- /**
178
- * Three columns, not a flex row: the outer two share the slack equally, so
179
- * the search sits on the centre of the window rather than on the centre of
180
- * whatever the zoom and export controls left over.
181
- */
182
- display: grid;
183
- grid-template-columns: 1fr auto 1fr;
184
- align-items: center;
185
- gap: 16px;
186
- padding: 0 16px;
187
- background: var(--surface);
188
- border-bottom: 1px solid var(--border);
189
- font-family: "Instrument Sans", system-ui, sans-serif;
190
- font-size: 13px;
191
- color: var(--ink);
192
- z-index: 10;
193
- }
194
-
195
- .report-viewer .toolbar-group {
196
- display: flex;
197
- align-items: center;
198
- gap: 8px;
199
- }
200
-
201
- /* the wordmark holds the left column, so the centre column stays centred */
202
- .report-viewer .toolbar-brand {
203
- justify-self: start;
204
- display: flex;
205
- align-items: center;
206
- gap: 8px;
207
- font-size: 14px;
208
- font-weight: 600;
209
- letter-spacing: -0.01em;
210
- color: var(--ink);
211
- white-space: nowrap;
212
- }
213
-
214
- /*
215
- * The monogram, not the wordmark: the text beside it is the report's name
216
- * rather than the product's, so the mark is the only thing saying whose viewer
217
- * this is and it has to sit in a square beside a line of type.
218
- */
219
- .report-viewer .toolbar-brand::before {
220
- content: "";
221
- flex: none;
222
- width: 26px;
223
- height: 26px;
224
-
225
- background-image: var(--brand-icon);
226
- background-repeat: no-repeat;
227
- background-position: center;
228
- background-size: contain;
229
- }
230
-
231
- /* search, then zoom to its right - one cluster on the centre of the window */
232
- .report-viewer .toolbar-centre {
233
- justify-self: center;
234
- display: flex;
235
- align-items: center;
236
- gap: 12px;
237
- }
238
-
239
- .report-viewer .toolbar-save {
240
- justify-self: end;
241
- }
242
-
243
- .report-viewer .toolbar button {
244
- min-width: 32px;
245
- height: 32px;
246
- padding: 0 8px;
247
- border: 1px solid var(--border);
248
- border-radius: 6px;
249
- background: var(--surface);
250
- color: var(--ink);
251
- font: inherit;
252
- font-size: 15px;
253
- line-height: 1;
254
- cursor: pointer;
255
- }
256
-
257
- .report-viewer .toolbar button:hover:not(:disabled) {
258
- background: var(--accent-soft);
259
- border-color: var(--accent);
260
- }
261
-
262
- .report-viewer .toolbar button:disabled {
263
- opacity: .38;
264
- cursor: default;
265
- }
266
-
267
- .report-viewer .toolbar-save button {
268
- min-width: 0;
269
- padding: 0 14px;
270
- font-size: 12px;
271
- white-space: nowrap;
272
- }
273
-
274
- /**
275
- * Export is the primary action and carries the accent; Print sits beside it as
276
- * an ordinary button. Two accent fills next to each other would leave neither
277
- * looking primary.
278
- */
279
- .report-viewer .toolbar-save [data-role="export"] {
280
- font-weight: 600;
281
- background: var(--accent);
282
- border-color: var(--accent);
283
- color: var(--ink);
284
- }
285
-
286
- /* accent-strong is only 3.5:1, too thin to put surface-coloured text on */
287
- .report-viewer .toolbar-save [data-role="export"]:hover:not(:disabled) {
288
- background: var(--accent-ink);
289
- border-color: var(--accent-ink);
290
- color: var(--surface);
291
- }
292
-
293
- /* the accent alone is 2:1 on this surface - the ring uses the darker mix */
294
- .report-viewer .toolbar button:focus-visible {
295
- outline: 2px solid var(--accent-strong);
296
- outline-offset: 1px;
297
- }
298
-
299
- .report-viewer .page-of {
300
- display: flex;
301
- align-items: center;
302
- gap: 6px;
303
- color: var(--ink-soft);
304
- }
305
-
306
- .report-viewer .page-of input {
307
- width: 56px;
308
- text-align: center;
309
- color: var(--ink);
310
- }
311
-
312
- /* the spinners fight the fixed width and add nothing here */
313
- .report-viewer .page-of input::-webkit-outer-spin-button,
314
- .report-viewer .page-of input::-webkit-inner-spin-button {
315
- -webkit-appearance: none;
316
- margin: 0;
317
- }
318
-
319
- .report-viewer .page-of input {
320
- -moz-appearance: textfield;
321
- appearance: textfield;
322
- }
323
-
324
- /**
325
- * The field is the control: it carries the border, the background and the focus
326
- * ring, so the count and the match arrows sit inside the box with the text.
327
- */
328
- .report-viewer .search-field {
329
- display: flex;
330
- align-items: center;
331
- gap: 2px;
332
- width: min(380px, 44vw);
333
- height: 32px;
334
- padding: 0 4px 0 10px;
335
- border: 1px solid var(--border);
336
- border-radius: 6px;
337
- background: var(--surface);
338
- }
339
-
340
- .report-viewer .search-field:focus-within {
341
- outline: 2px solid var(--accent-strong);
342
- outline-offset: 1px;
343
- }
344
-
345
- .report-viewer .search-field input[type="search"] {
346
- flex: 1;
347
- min-width: 0;
348
- height: 100%;
349
- padding: 0;
350
- border: none;
351
- background: none;
352
- color: var(--ink);
353
- font: inherit;
354
- }
355
-
356
- /* the wrapper shows the ring, so the input must not draw a second one */
357
- .report-viewer .search-field input[type="search"]:focus,
358
- .report-viewer .search-field input[type="search"]:focus-visible {
359
- outline: none;
360
- }
361
-
362
- .report-viewer .search-field button {
363
- flex: none;
364
- min-width: 0;
365
- width: 24px;
366
- height: 24px;
367
- padding: 0;
368
- border: none;
369
- border-radius: 4px;
370
- background: none;
371
- font-size: 12px;
372
- }
373
-
374
- .report-viewer .search-field button:hover:not(:disabled) {
375
- background: var(--accent-soft);
376
- }
377
-
378
- .report-viewer .hits {
379
- flex: none;
380
- min-width: 62px;
381
- padding-right: 2px;
382
- text-align: right;
383
- font-size: 11px;
384
- color: var(--ink-soft);
385
- font-variant-numeric: tabular-nums;
386
- }
387
-
388
- /**
389
- * "no matches" is information, not an error, so it stays in the palette rather
390
- * than reaching for a red the rest of the page never uses.
391
- */
392
- .report-viewer .hits[data-state="empty"] {
393
- color: var(--accent-ink);
394
- }
395
-
396
- /**
397
- * Two levels: every hit on the page is tinted, the one you are standing on
398
- * takes the accent outright. accent-soft is too close to the paper to see.
399
- */
400
- .report-viewer mark.hit {
401
- background: var(--accent-tint);
402
- color: inherit;
403
- padding: 5px;
404
- }
405
-
406
- .report-viewer mark.hit.is-focused {
407
- background: var(--accent);
408
- outline: 1px solid var(--accent-ink);
409
- }
410
-
411
- @media print {
412
- .report-viewer .toolbar,
413
- .report-viewer .pager { display: none; }
414
- /* margin-top holds a gap for the bar, which is not printed */
415
- .report-viewer .viewport { margin-top: 0; height: auto; overflow: visible; padding: 0; }
416
- /* print at true size - zoom is a screen convenience, not a layout change */
417
- .report-viewer #main-page { width: auto !important; height: auto !important; margin: 0; }
418
-
419
- /* the sheet's own background must not print over the report */
420
- body,
421
- .graph-paper { background: none; }
422
-
423
- .report-viewer .page {
424
- display: block;
425
- border: none;
426
- transform: none;
427
-
428
- /**
429
- * Table header fills and group bands are how a report is read. Browsers
430
- * strip backgrounds when printing unless told not to.
431
- */
432
- -webkit-print-color-adjust: exact;
433
- print-color-adjust: exact;
434
- }
435
-
436
- /**
437
- * Only *between* pages. break-after on the last one asks the printer for a
438
- * sheet after the final page, which is where the trailing blank comes from.
439
- */
440
- .report-viewer .page:not(:last-child) {
441
- break-after: page;
442
- page-break-after: always;
443
- }
444
- }
445
-
446
- /* ---------------- export dialog ---------------- */
447
-
448
- /* the dialog shell is shared/modal.css; these are the export format cards */
449
- .report-viewer .modal-formats {
450
- display: flex;
451
- flex-direction: column;
452
- gap: 8px;
453
- }
454
-
455
- .report-viewer .format {
456
- display: flex;
457
- align-items: flex-start;
458
- gap: 10px;
459
- padding: 10px 12px;
460
- border: 1px solid var(--border);
461
- border-radius: 8px;
462
- cursor: pointer;
463
- }
464
-
465
- .report-viewer .format:hover {
466
- border-color: var(--accent);
467
- background: var(--accent-soft);
468
- }
469
-
470
- /* the selected card uses the darker mix on its border so the state is legible */
471
- .report-viewer .format:has(input:checked) {
472
- border-color: var(--accent-strong);
473
- background: var(--accent-soft);
474
- }
475
-
476
- .report-viewer .format:has(input:focus-visible) {
477
- outline: 2px solid var(--accent-strong);
478
- outline-offset: 1px;
479
- }
480
-
481
- .report-viewer .format.is-unavailable {
482
- opacity: .5;
483
- cursor: not-allowed;
484
- }
485
-
486
- .report-viewer .format input {
487
- margin-top: 2px;
488
- accent-color: var(--accent-strong);
489
- }
490
-
491
- .report-viewer .format-body {
492
- display: flex;
493
- flex-direction: column;
494
- gap: 2px;
495
- }
496
-
497
- .report-viewer .format-name {
498
- font-size: 13px;
499
- font-weight: 600;
500
- }
501
-
502
- .report-viewer .format-note {
503
- font-size: 12px;
504
- color: var(--ink-soft);
505
- }
1
+ /**
2
+ * The viewer's chrome: toolbar, pager, search field, export dialog, and how a
3
+ * page is presented on screen.
4
+ *
5
+ * Split out of styles.css because the viewer is opened from two places. The
6
+ * preview screen links styles.css, which is this plus the shared layers; the
7
+ * designer imports this file alone, because it already has those layers - and
8
+ * it needs these rules, since "open the report in its own tab" mounts a viewer
9
+ * into a window built from the designer's own stylesheets. Without them the
10
+ * report opened in that window arrives unstyled.
11
+ *
12
+ * Every rule is scoped to .report-viewer, the class createViewer puts on its
13
+ * mount, and that is not tidiness - it is what makes the file safe to import.
14
+ * An unscoped `.page { display: none }` here is the viewer paging its report;
15
+ * on the designer's canvas, which draws `class="page dz-page"`, it is the whole
16
+ * design sheet gone. The same goes for any host that links viewer.css beside
17
+ * its own stylesheet: what the viewer draws, the viewer styles, and nothing
18
+ * outside its mount is touched.
19
+ *
20
+ * The three exceptions are the mount itself and the two classes a page puts
21
+ * around it - .graph-paper on the body, .report-fills-window on the mount - and
22
+ * the print rule that stops the page background printing over the report.
23
+ *
24
+ * How a report *looks* is not here - it is in render/report.css, shared with the
25
+ * designer canvas so the two cannot drift. The palette is in shared/theme.css
26
+ * for the same reason.
27
+ */
28
+
29
+ .graph-paper {
30
+ min-height: 100vh;
31
+ background-color: var(--backdrop);
32
+ }
33
+
34
+ /**
35
+ * The viewer fills whatever it is given.
36
+ *
37
+ * The bar and the pager used to be `position: fixed`, which pinned them to the
38
+ * window - fine for a page that is nothing but a report, and impossible for an
39
+ * application embedding one in a panel beside its own chrome. They are laid out
40
+ * inside the mount now, so the viewer is a component rather than a screen.
41
+ */
42
+ .report-viewer {
43
+ position: relative;
44
+ display: flex;
45
+ flex-direction: column;
46
+ height: 100%;
47
+ min-height: 0;
48
+ background: var(--backdrop);
49
+ }
50
+
51
+ /* the standalone page gives it the window; an application gives it a panel */
52
+ .report-fills-window {
53
+ height: 100vh;
54
+ }
55
+
56
+ /**
57
+ * The viewport is the scroll container, sized to leave the fixed bar alone.
58
+ * It scrolls only when a page is taller than the window - the report itself is
59
+ * paged, not scrolled.
60
+ */
61
+ /**
62
+ * The pager floats over this rather than taking a strip of it, so the bottom
63
+ * padding is what lets the end of a page scroll clear of the pill.
64
+ */
65
+ .report-viewer .viewport {
66
+ flex: 1;
67
+ min-height: 0;
68
+ overflow: auto;
69
+ padding: 24px 24px calc(var(--pager-height) + var(--pager-offset) + 24px);
70
+ }
71
+
72
+ /**
73
+ * The stack is the page's scaled footprint. A CSS transform does not affect
74
+ * layout, so without an explicit size here there would be nothing to scroll at
75
+ * 200% - viewer.js sets width/height from the layout's page size times zoom.
76
+ * margin:auto centres it while it is narrower than the viewport.
77
+ */
78
+ .report-viewer #main-page {
79
+ margin: 0 auto;
80
+ }
81
+
82
+ /**
83
+ * One page on screen at a time. The others stay in the DOM so that paging is
84
+ * instant and the browser's own find still reaches them if someone wants it.
85
+ * The page's own appearance comes from report.css; these are the two things
86
+ * only the preview does with it.
87
+ */
88
+ .report-viewer .page {
89
+ display: none;
90
+
91
+ /**
92
+ * Scale the drawn page rather than its font sizes: re-computing type would
93
+ * re-wrap the text and stop matching what the engine paginated.
94
+ */
95
+ transform: scale(var(--zoom, 1));
96
+ transform-origin: top left;
97
+ }
98
+
99
+ .report-viewer .page.is-current {
100
+ display: block;
101
+ }
102
+
103
+
104
+ /* ---------------- the floating pager ---------------- */
105
+
106
+ .report-viewer .pager {
107
+ position: absolute;
108
+ left: 50%;
109
+ bottom: var(--pager-offset);
110
+ transform: translateX(-50%);
111
+ z-index: 10;
112
+
113
+ display: flex;
114
+ align-items: center;
115
+ gap: 8px;
116
+ height: var(--pager-height);
117
+ padding: 0 8px;
118
+
119
+ background: var(--surface);
120
+ border: 1px solid var(--border);
121
+ /* a pill, to read as floating rather than as a docked strip */
122
+ border-radius: 999px;
123
+ box-shadow: 0 4px 16px rgba(34, 39, 44, .12);
124
+
125
+ font-family: "Instrument Sans", system-ui, sans-serif;
126
+ font-size: 13px;
127
+ color: var(--ink);
128
+ }
129
+
130
+ .report-viewer .pager button {
131
+ min-width: 30px;
132
+ height: 30px;
133
+ padding: 0 8px;
134
+ border: 1px solid transparent;
135
+ border-radius: 999px;
136
+ background: none;
137
+ color: var(--ink);
138
+ font: inherit;
139
+ font-size: 15px;
140
+ line-height: 1;
141
+ cursor: pointer;
142
+ }
143
+
144
+ .report-viewer .pager button:hover:not(:disabled) {
145
+ background: var(--accent-soft);
146
+ border-color: var(--accent);
147
+ }
148
+
149
+ .report-viewer .pager button:disabled {
150
+ opacity: .38;
151
+ cursor: default;
152
+ }
153
+
154
+ .report-viewer .pager input {
155
+ height: 28px;
156
+ padding: 0 6px;
157
+ border: 1px solid var(--border);
158
+ border-radius: 6px;
159
+ background: var(--surface);
160
+ color: var(--ink);
161
+ font: inherit;
162
+ }
163
+
164
+ .report-viewer .pager input:focus-visible,
165
+ .report-viewer .pager button:focus-visible {
166
+ outline: 2px solid var(--accent-strong);
167
+ outline-offset: 1px;
168
+ }
169
+
170
+
171
+ /* ---------------- viewer chrome ---------------- */
172
+
173
+ .report-viewer .toolbar {
174
+ flex: none;
175
+ height: var(--bar-height);
176
+
177
+ /**
178
+ * Three columns, not a flex row: the outer two share the slack equally, so
179
+ * the search sits on the centre of the window rather than on the centre of
180
+ * whatever the zoom and export controls left over.
181
+ */
182
+ display: grid;
183
+ grid-template-columns: 1fr auto 1fr;
184
+ align-items: center;
185
+ gap: 16px;
186
+ padding: 0 16px;
187
+ background: var(--surface);
188
+ border-bottom: 1px solid var(--border);
189
+ font-family: "Instrument Sans", system-ui, sans-serif;
190
+ font-size: 13px;
191
+ color: var(--ink);
192
+ z-index: 10;
193
+ }
194
+
195
+ .report-viewer .toolbar-group {
196
+ display: flex;
197
+ align-items: center;
198
+ gap: 8px;
199
+ }
200
+
201
+ /* the wordmark holds the left column, so the centre column stays centred */
202
+ .report-viewer .toolbar-brand {
203
+ justify-self: start;
204
+ display: flex;
205
+ align-items: center;
206
+ gap: 8px;
207
+ font-size: 14px;
208
+ font-weight: 600;
209
+ letter-spacing: -0.01em;
210
+ color: var(--ink);
211
+ white-space: nowrap;
212
+ }
213
+
214
+ /*
215
+ * The monogram, not the wordmark: the text beside it is the report's name
216
+ * rather than the product's, so the mark is the only thing saying whose viewer
217
+ * this is and it has to sit in a square beside a line of type.
218
+ */
219
+ .report-viewer .toolbar-brand::before {
220
+ content: "";
221
+ flex: none;
222
+ width: 26px;
223
+ height: 26px;
224
+
225
+ background-image: var(--brand-icon);
226
+ background-repeat: no-repeat;
227
+ background-position: center;
228
+ background-size: contain;
229
+ }
230
+
231
+ /* search, then zoom to its right - one cluster on the centre of the window */
232
+ .report-viewer .toolbar-centre {
233
+ justify-self: center;
234
+ display: flex;
235
+ align-items: center;
236
+ gap: 12px;
237
+ }
238
+
239
+ .report-viewer .toolbar-save {
240
+ justify-self: end;
241
+ }
242
+
243
+ .report-viewer .toolbar button {
244
+ min-width: 32px;
245
+ height: 32px;
246
+ padding: 0 8px;
247
+ border: 1px solid var(--border);
248
+ border-radius: 6px;
249
+ background: var(--surface);
250
+ color: var(--ink);
251
+ font: inherit;
252
+ font-size: 15px;
253
+ line-height: 1;
254
+ cursor: pointer;
255
+ }
256
+
257
+ .report-viewer .toolbar button:hover:not(:disabled) {
258
+ background: var(--accent-soft);
259
+ border-color: var(--accent);
260
+ }
261
+
262
+ .report-viewer .toolbar button:disabled {
263
+ opacity: .38;
264
+ cursor: default;
265
+ }
266
+
267
+ .report-viewer .toolbar-save button {
268
+ min-width: 0;
269
+ padding: 0 14px;
270
+ font-size: 12px;
271
+ white-space: nowrap;
272
+ }
273
+
274
+ /**
275
+ * Export is the primary action and carries the accent; Print sits beside it as
276
+ * an ordinary button. Two accent fills next to each other would leave neither
277
+ * looking primary.
278
+ */
279
+ .report-viewer .toolbar-save [data-role="export"] {
280
+ font-weight: 600;
281
+ background: var(--accent);
282
+ border-color: var(--accent);
283
+ color: var(--ink);
284
+ }
285
+
286
+ /* accent-strong is only 3.5:1, too thin to put surface-coloured text on */
287
+ .report-viewer .toolbar-save [data-role="export"]:hover:not(:disabled) {
288
+ background: var(--accent-ink);
289
+ border-color: var(--accent-ink);
290
+ color: var(--surface);
291
+ }
292
+
293
+ /* the accent alone is 2:1 on this surface - the ring uses the darker mix */
294
+ .report-viewer .toolbar button:focus-visible {
295
+ outline: 2px solid var(--accent-strong);
296
+ outline-offset: 1px;
297
+ }
298
+
299
+ .report-viewer .page-of {
300
+ display: flex;
301
+ align-items: center;
302
+ gap: 6px;
303
+ color: var(--ink-soft);
304
+ }
305
+
306
+ .report-viewer .page-of input {
307
+ width: 56px;
308
+ text-align: center;
309
+ color: var(--ink);
310
+ }
311
+
312
+ /* the spinners fight the fixed width and add nothing here */
313
+ .report-viewer .page-of input::-webkit-outer-spin-button,
314
+ .report-viewer .page-of input::-webkit-inner-spin-button {
315
+ -webkit-appearance: none;
316
+ margin: 0;
317
+ }
318
+
319
+ .report-viewer .page-of input {
320
+ -moz-appearance: textfield;
321
+ appearance: textfield;
322
+ }
323
+
324
+ /**
325
+ * The field is the control: it carries the border, the background and the focus
326
+ * ring, so the count and the match arrows sit inside the box with the text.
327
+ */
328
+ .report-viewer .search-field {
329
+ display: flex;
330
+ align-items: center;
331
+ gap: 2px;
332
+ width: min(380px, 44vw);
333
+ height: 32px;
334
+ padding: 0 4px 0 10px;
335
+ border: 1px solid var(--border);
336
+ border-radius: 6px;
337
+ background: var(--surface);
338
+ }
339
+
340
+ .report-viewer .search-field:focus-within {
341
+ outline: 2px solid var(--accent-strong);
342
+ outline-offset: 1px;
343
+ }
344
+
345
+ .report-viewer .search-field input[type="search"] {
346
+ flex: 1;
347
+ min-width: 0;
348
+ height: 100%;
349
+ padding: 0;
350
+ border: none;
351
+ background: none;
352
+ color: var(--ink);
353
+ font: inherit;
354
+ }
355
+
356
+ /* the wrapper shows the ring, so the input must not draw a second one */
357
+ .report-viewer .search-field input[type="search"]:focus,
358
+ .report-viewer .search-field input[type="search"]:focus-visible {
359
+ outline: none;
360
+ }
361
+
362
+ .report-viewer .search-field button {
363
+ flex: none;
364
+ min-width: 0;
365
+ width: 24px;
366
+ height: 24px;
367
+ padding: 0;
368
+ border: none;
369
+ border-radius: 4px;
370
+ background: none;
371
+ font-size: 12px;
372
+ }
373
+
374
+ .report-viewer .search-field button:hover:not(:disabled) {
375
+ background: var(--accent-soft);
376
+ }
377
+
378
+ .report-viewer .hits {
379
+ flex: none;
380
+ min-width: 62px;
381
+ padding-right: 2px;
382
+ text-align: right;
383
+ font-size: 11px;
384
+ color: var(--ink-soft);
385
+ font-variant-numeric: tabular-nums;
386
+ }
387
+
388
+ /**
389
+ * "no matches" is information, not an error, so it stays in the palette rather
390
+ * than reaching for a red the rest of the page never uses.
391
+ */
392
+ .report-viewer .hits[data-state="empty"] {
393
+ color: var(--accent-ink);
394
+ }
395
+
396
+ /**
397
+ * Two levels: every hit on the page is tinted, the one you are standing on
398
+ * takes the accent outright. accent-soft is too close to the paper to see.
399
+ */
400
+ .report-viewer mark.hit {
401
+ background: var(--accent-tint);
402
+ color: inherit;
403
+ padding: 5px;
404
+ }
405
+
406
+ .report-viewer mark.hit.is-focused {
407
+ background: var(--accent);
408
+ outline: 1px solid var(--accent-ink);
409
+ }
410
+
411
+ @media print {
412
+ .report-viewer .toolbar,
413
+ .report-viewer .pager { display: none; }
414
+ /* margin-top holds a gap for the bar, which is not printed */
415
+ .report-viewer .viewport { margin-top: 0; height: auto; overflow: visible; padding: 0; }
416
+ /* print at true size - zoom is a screen convenience, not a layout change */
417
+ .report-viewer #main-page { width: auto !important; height: auto !important; margin: 0; }
418
+
419
+ /* the sheet's own background must not print over the report */
420
+ body,
421
+ .graph-paper { background: none; }
422
+
423
+ .report-viewer .page {
424
+ display: block;
425
+ border: none;
426
+ transform: none;
427
+
428
+ /**
429
+ * Table header fills and group bands are how a report is read. Browsers
430
+ * strip backgrounds when printing unless told not to.
431
+ */
432
+ -webkit-print-color-adjust: exact;
433
+ print-color-adjust: exact;
434
+ }
435
+
436
+ /**
437
+ * Only *between* pages. break-after on the last one asks the printer for a
438
+ * sheet after the final page, which is where the trailing blank comes from.
439
+ */
440
+ .report-viewer .page:not(:last-child) {
441
+ break-after: page;
442
+ page-break-after: always;
443
+ }
444
+ }
445
+
446
+ /* ---------------- export dialog ---------------- */
447
+
448
+ /* the dialog shell is shared/modal.css; these are the export format cards */
449
+ .report-viewer .modal-formats {
450
+ display: flex;
451
+ flex-direction: column;
452
+ gap: 8px;
453
+ }
454
+
455
+ .report-viewer .format {
456
+ display: flex;
457
+ align-items: flex-start;
458
+ gap: 10px;
459
+ padding: 10px 12px;
460
+ border: 1px solid var(--border);
461
+ border-radius: 8px;
462
+ cursor: pointer;
463
+ }
464
+
465
+ .report-viewer .format:hover {
466
+ border-color: var(--accent);
467
+ background: var(--accent-soft);
468
+ }
469
+
470
+ /* the selected card uses the darker mix on its border so the state is legible */
471
+ .report-viewer .format:has(input:checked) {
472
+ border-color: var(--accent-strong);
473
+ background: var(--accent-soft);
474
+ }
475
+
476
+ .report-viewer .format:has(input:focus-visible) {
477
+ outline: 2px solid var(--accent-strong);
478
+ outline-offset: 1px;
479
+ }
480
+
481
+ .report-viewer .format.is-unavailable {
482
+ opacity: .5;
483
+ cursor: not-allowed;
484
+ }
485
+
486
+ .report-viewer .format input {
487
+ margin-top: 2px;
488
+ accent-color: var(--accent-strong);
489
+ }
490
+
491
+ .report-viewer .format-body {
492
+ display: flex;
493
+ flex-direction: column;
494
+ gap: 2px;
495
+ }
496
+
497
+ .report-viewer .format-name {
498
+ font-size: 13px;
499
+ font-weight: 600;
500
+ }
501
+
502
+ .report-viewer .format-note {
503
+ font-size: 12px;
504
+ color: var(--ink-soft);
505
+ }