report-studio 0.0.1 → 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 (68) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +363 -4
  3. package/dist/designer-qy59eEux.js +3416 -0
  4. package/dist/designer.js +2 -0
  5. package/dist/index.js +2 -4
  6. package/dist/react-designer.js +41 -0
  7. package/dist/react.js +58 -2
  8. package/dist/viewer-xa17tyMJ.js +1721 -0
  9. package/package.json +65 -18
  10. package/src/asset/images/icon.png +0 -0
  11. package/src/asset/images/logo.png +0 -0
  12. package/src/cli/index.js +282 -0
  13. package/src/cli/serve.js +135 -0
  14. package/src/designer/blank.js +53 -0
  15. package/src/designer/canvas.js +518 -0
  16. package/src/designer/designer.js +2054 -0
  17. package/src/designer/dialog.js +708 -0
  18. package/src/designer/fields.js +633 -0
  19. package/src/designer/geometry.js +154 -0
  20. package/src/designer/guides.js +370 -0
  21. package/src/designer/history.js +113 -0
  22. package/src/designer/icons.js +123 -0
  23. package/src/designer/index.html +28 -0
  24. package/src/designer/main.js +39 -0
  25. package/src/designer/menu.js +126 -0
  26. package/src/designer/panel.js +498 -0
  27. package/src/designer/preview.js +95 -0
  28. package/src/designer/rulers.js +231 -0
  29. package/src/designer/sample-data.js +411 -0
  30. package/src/designer/select.js +699 -0
  31. package/src/designer/structure.js +685 -0
  32. package/src/designer/styles.css +1654 -0
  33. package/src/designer/toast.js +62 -0
  34. package/src/designer/tokens.js +293 -0
  35. package/src/engine/csv.js +350 -0
  36. package/src/engine/group.js +367 -0
  37. package/src/engine/index.js +35 -0
  38. package/src/engine/measure.js +391 -0
  39. package/src/engine/paginate.js +865 -0
  40. package/src/engine/regions.js +175 -0
  41. package/src/engine/resolve.js +208 -0
  42. package/src/engine/search.js +129 -0
  43. package/src/engine/tables.js +87 -0
  44. package/src/engine/text-metrics.js +206 -0
  45. package/src/engine/validate.js +403 -0
  46. package/src/index.html +79 -0
  47. package/src/index.js +51 -0
  48. package/src/preview/chrome.css +505 -0
  49. package/src/preview/chrome.js +147 -0
  50. package/src/preview/index.html +28 -0
  51. package/src/preview/main.js +66 -0
  52. package/src/preview/styles.css +16 -0
  53. package/src/preview/viewer.js +763 -0
  54. package/src/react/designer.js +87 -0
  55. package/src/react/index.js +117 -0
  56. package/src/render/items.js +518 -0
  57. package/src/render/render.js +98 -0
  58. package/src/render/report.css +232 -0
  59. package/src/server/routes.js +331 -0
  60. package/src/shared/brand.css +29 -0
  61. package/src/shared/dropdown.css +136 -0
  62. package/src/shared/dropdown.js +166 -0
  63. package/src/shared/modal.css +125 -0
  64. package/src/shared/prefix.js +13 -0
  65. package/src/shared/store.js +145 -0
  66. package/src/shared/theme.css +72 -0
  67. package/src/shared/window.js +138 -0
  68. package/src/vite/index.js +53 -0
package/src/index.js ADDED
@@ -0,0 +1,51 @@
1
+ /**
2
+ * report-studio - the package's main entry point.
3
+ *
4
+ * The engine and the viewer, and nothing that touches the document on import -
5
+ * so an application that only builds pages, or only renders them on a server,
6
+ * pays for nothing it does not use.
7
+ *
8
+ * The designer is a separate entry (`report-studio/designer`) because it is the
9
+ * larger half and most applications ship the reports rather than the tool that
10
+ * drew them. Each screen has a stylesheet of its own to link beside it:
11
+ * `report-studio/viewer.css` and `report-studio/designer.css`, or
12
+ * `report-studio/report.css` alone to draw a report with no chrome at all.
13
+ */
14
+
15
+ export {
16
+ buildPages,
17
+ resolve,
18
+ group,
19
+ measure,
20
+ paginate,
21
+ validateLayout,
22
+ ReportError,
23
+ search,
24
+ searchPages,
25
+ toCSV,
26
+ toReportCSV,
27
+ reportFilename,
28
+ reportTables,
29
+ measureText,
30
+ wrapLines,
31
+ textHeight,
32
+ LINE_HEIGHT_RATIO
33
+ } from './engine/index.js';
34
+
35
+ export { render } from './render/render.js';
36
+
37
+ /**
38
+ * The viewer: paging, zoom, search, print and CSV over a page list.
39
+ *
40
+ * It takes one empty element and builds the rest, the same way createDesigner
41
+ * does. Link `report-studio/viewer.css` beside it - the report's own stylesheet
42
+ * is included there, so that one file is enough.
43
+ */
44
+ export { createViewer, openViewerWindow } from './preview/viewer.js';
45
+
46
+ /**
47
+ * Opens a blank window with the host's stylesheets in it, ready to be mounted
48
+ * into - for a host that wants a screen of its own without using one of the
49
+ * two helpers above.
50
+ */
51
+ export { openWindow } from './shared/window.js';
@@ -0,0 +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
+ }
@@ -0,0 +1,147 @@
1
+ /**
2
+ * chrome.js is the viewer's own markup: the toolbar, the floating pager and the
3
+ * export dialog.
4
+ *
5
+ * It lives here rather than in a page because the viewer is something an
6
+ * application mounts, and an API whose first instruction is "copy these 144
7
+ * lines of HTML into your app" is not an API. createDesigner has always taken
8
+ * one empty element and built what it needs inside it; this is the viewer
9
+ * catching up.
10
+ *
11
+ * Ids became data-roles on the way: an id may appear once in a document, and
12
+ * nothing should stop a page showing two reports side by side.
13
+ */
14
+
15
+
16
+ /**
17
+ * @param {object} [options]
18
+ * @param {string} [options.title] what the brand corner reads
19
+ * @returns {string} the whole of the viewer's chrome
20
+ */
21
+ export function chrome({ title = 'Report Studio' } = {}) {
22
+ return `
23
+ <!--
24
+ A header, not role="toolbar": that role promises arrow-key roving focus
25
+ between the controls, and here the arrow keys page the report instead.
26
+ -->
27
+ <header class="toolbar" data-role="bar" aria-label="Report tools">
28
+ <div class="toolbar-brand">${title}</div>
29
+
30
+ <div class="toolbar-centre">
31
+ <div class="toolbar-group toolbar-search">
32
+ <!--
33
+ Buttons cannot live inside an <input>, so the wrapper draws
34
+ the field and the input inside it draws no chrome of its own.
35
+ -->
36
+ <div class="search-field">
37
+ <input type="search" data-role="query" placeholder="Search the report (ctrl+K)"
38
+ title="Search the report (ctrl+K)"
39
+ aria-label="Search the report" spellcheck="false">
40
+ <span class="hits" data-role="hits" data-state="idle" aria-live="polite"></span>
41
+ <button type="button" data-role="hit-prev" title="Previous match (shift+enter)"
42
+ aria-label="Previous match">&#8593;</button>
43
+ <button type="button" data-role="hit-next" title="Next match (enter)"
44
+ aria-label="Next match">&#8595;</button>
45
+ </div>
46
+ </div>
47
+
48
+ <div class="toolbar-group toolbar-zoom">
49
+ <button type="button" data-role="zoom-out" title="Zoom out (ctrl+-)"
50
+ aria-label="Zoom out">&#8722;</button>
51
+
52
+ <!--
53
+ A listbox rather than a <select>: option items are drawn by
54
+ the operating system, so they cannot take the palette.
55
+ -->
56
+ <div class="dropdown" data-role="zoom-dropdown">
57
+ <button type="button" class="dropdown-trigger" data-role="zoom"
58
+ aria-haspopup="listbox" aria-expanded="false" aria-label="Zoom level">
59
+ <span class="dropdown-value">100%</span>
60
+ <span class="dropdown-caret" aria-hidden="true"></span>
61
+ </button>
62
+
63
+ <ul class="dropdown-menu" data-role="zoom-menu" role="listbox"
64
+ aria-label="Zoom level" hidden>
65
+ <li class="dropdown-item" role="option" tabindex="-1" data-value="fit">Fit width</li>
66
+ <li class="dropdown-item" role="option" tabindex="-1" data-value="0.5">50%</li>
67
+ <li class="dropdown-item" role="option" tabindex="-1" data-value="0.75">75%</li>
68
+ <li class="dropdown-item" role="option" tabindex="-1" data-value="1"
69
+ data-selected="true">100%</li>
70
+ <li class="dropdown-item" role="option" tabindex="-1" data-value="1.25">125%</li>
71
+ <li class="dropdown-item" role="option" tabindex="-1" data-value="1.5">150%</li>
72
+ <li class="dropdown-item" role="option" tabindex="-1" data-value="2">200%</li>
73
+ <li class="dropdown-item" role="option" tabindex="-1" data-value="3">300%</li>
74
+ </ul>
75
+ </div>
76
+
77
+ <button type="button" data-role="zoom-in" title="Zoom in (ctrl++)"
78
+ aria-label="Zoom in">&#43;</button>
79
+ </div>
80
+ </div>
81
+
82
+ <div class="toolbar-group toolbar-save">
83
+ <button type="button" data-role="print" title="Print or save as PDF (ctrl+P)">
84
+ Print</button>
85
+ <button type="button" data-role="export" title="Export the report (ctrl+X)">
86
+ Export&#8230;</button>
87
+ </div>
88
+ </header>
89
+
90
+ <div class="viewport" data-role="viewport"></div>
91
+
92
+ <!-- paging floats over the report rather than taking a strip of it -->
93
+ <div class="pager" data-role="pager" role="toolbar" aria-label="Page navigation">
94
+ <button type="button" data-role="prev" title="Previous page (left arrow)"
95
+ aria-label="Previous page">&#8249;</button>
96
+
97
+ <label class="page-of">
98
+ <input type="number" data-role="current" min="1" value="1" aria-label="Current page">
99
+ <span>of</span>
100
+ <span data-role="total">1</span>
101
+ </label>
102
+
103
+ <button type="button" data-role="next" title="Next page (right arrow)"
104
+ aria-label="Next page">&#8250;</button>
105
+ </div>
106
+
107
+
108
+
109
+ <!--
110
+ Hand-written rather than a <dialog>: the element is still unimplemented
111
+ in the environment the specs run in, and a stubbed showModal would test
112
+ the stub instead of the behaviour.
113
+ -->
114
+ <div class="modal" data-role="export-modal" hidden>
115
+ <div class="modal-backdrop" data-role="export-backdrop"></div>
116
+
117
+ <div class="modal-card" role="dialog" aria-modal="true" aria-labelledby="export-title">
118
+ <h2 id="export-title">Export report</h2>
119
+
120
+ <div class="modal-formats" role="radiogroup" aria-labelledby="export-title">
121
+ <label class="format">
122
+ <input type="radio" name="export-format" value="pdf" checked>
123
+ <span class="format-body">
124
+ <span class="format-name">PDF</span>
125
+ <span class="format-note">Opens the print dialog - choose "Save as PDF"</span>
126
+ </span>
127
+ </label>
128
+
129
+ <label class="format">
130
+ <input type="radio" name="export-format" value="csv">
131
+ <span class="format-body">
132
+ <span class="format-name">CSV</span>
133
+ <span class="format-note">Every text line and table row, in report order</span>
134
+ </span>
135
+ </label>
136
+ </div>
137
+
138
+ <p class="modal-summary" data-role="export-summary" aria-live="polite"></p>
139
+
140
+ <div class="modal-actions">
141
+ <button type="button" data-role="export-cancel">Cancel</button>
142
+ <button type="button" class="is-primary" data-role="export-confirm">Export</button>
143
+ </div>
144
+ </div>
145
+ </div>
146
+ `;
147
+ }