rshow 0.0.0-stage → 0.0.2
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.
- package/LICENSE +21 -0
- package/README.md +50 -2
- package/dist/main.js +8500 -0
- package/package.json +48 -4
- package/skills/rshow/SKILL.md +144 -0
- package/skills/rshow/reference/cli.md +263 -0
- package/skills/rshow/reference/dashboard.md +122 -0
- package/skills/rshow/reference/mockups.md +113 -0
- package/skills/rshow/reference/page-contract.md +83 -0
- package/skills/rshow/reference/pages.md +174 -0
- package/skills/rshow/reference/poster.md +137 -0
- package/skills/rshow/reference/project-page.md +132 -0
- package/skills/rshow/reference/reports.md +158 -0
- package/skills/rshow/reference/sketch.md +78 -0
- package/skills/rshow/reference/terminal.md +148 -0
- package/skills/rshow/reference/themes.md +139 -0
- package/skills/rshow-implement/SKILL.md +112 -0
- package/skills/rshow-implement/reference/compare.md +156 -0
- package/skills/rshow-implement/reference/handoff.md +125 -0
- package/skills/rshow-implement/reference/map.md +151 -0
- package/skills/rshow-slides/SKILL.md +136 -0
- package/skills/rshow-slides/reference/layouts.md +251 -0
- package/themes/default/dashboard.css +521 -0
- package/themes/default/dashboard.js +1390 -0
- package/themes/default/deck.css +586 -0
- package/themes/default/deck.js +741 -0
- package/themes/default/example/capture.ans +1 -0
- package/themes/default/example/dashboard.html +106 -0
- package/themes/default/example/demo.cast +14 -0
- package/themes/default/example/drawing.excalidraw +377 -0
- package/themes/default/example/index.html +311 -0
- package/themes/default/example/mockup-desktop.html +331 -0
- package/themes/default/example/mockup-platforms.html +742 -0
- package/themes/default/example/mockup.html +416 -0
- package/themes/default/example/page.html +153 -0
- package/themes/default/example/poster-figure.svg +58 -0
- package/themes/default/example/poster.html +181 -0
- package/themes/default/example/project.html +229 -0
- package/themes/default/example/report.html +404 -0
- package/themes/default/example/results.csv +61 -0
- package/themes/default/example/sketch.html +178 -0
- package/themes/default/example/teaser.svg +66 -0
- package/themes/default/example/terminal.html +231 -0
- package/themes/default/example/tui.html +223 -0
- package/themes/default/fonts/IBMPlexMono-Regular-Latin1.woff2 +0 -0
- package/themes/default/fonts/IBMPlexSans-Light-Latin1.woff2 +0 -0
- package/themes/default/fonts/IBMPlexSans-Regular-Latin1.woff2 +0 -0
- package/themes/default/fonts/IBMPlexSans-SemiBold-Latin1.woff2 +0 -0
- package/themes/default/fonts/OFL.txt +93 -0
- package/themes/default/fonts.css +63 -0
- package/themes/default/index.html +573 -0
- package/themes/default/mockup.css +1078 -0
- package/themes/default/mockup.js +1433 -0
- package/themes/default/mode.js +242 -0
- package/themes/default/page.css +320 -0
- package/themes/default/poster.css +480 -0
- package/themes/default/poster.js +223 -0
- package/themes/default/project.css +482 -0
- package/themes/default/project.js +116 -0
- package/themes/default/report.css +776 -0
- package/themes/default/report.js +427 -0
- package/themes/default/sketch.css +166 -0
- package/themes/default/sketch.js +681 -0
- package/themes/default/skins/adwaita.css +669 -0
- package/themes/default/skins/custom.css +596 -0
- package/themes/default/skins/egui.css +639 -0
- package/themes/default/skins/fluent.css +1093 -0
- package/themes/default/skins/fluent.js +458 -0
- package/themes/default/skins/mac.css +647 -0
- package/themes/default/skins/material.css +692 -0
- package/themes/default/skins/sketch.css +436 -0
- package/themes/default/skins/sketch.js +494 -0
- package/themes/default/skins/wire.css +561 -0
- package/themes/default/terminal.css +292 -0
- package/themes/default/terminal.js +433 -0
- package/themes/default/theme.json +149 -0
- package/themes/default/tokens.css +255 -0
- package/themes/default/tui.css +703 -0
- package/themes/default/tui.js +472 -0
- package/worker/index.js +6918 -0
- package/worker/migrations/0001_init.sql +52 -0
- package/worker/migrations/0002_blobs.sql +5 -0
- package/worker/migrations/0003_projects.sql +31 -0
- package/worker/migrations/0004_page_data_blob.sql +19 -0
|
@@ -0,0 +1,482 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* rshow theme "default": project layout
|
|
3
|
+
*
|
|
4
|
+
* The landing page of a paper. Link order: fonts.css, tokens.css, project.css,
|
|
5
|
+
* then mode.js in <head> and project.js (defer).
|
|
6
|
+
*
|
|
7
|
+
* Markup: <div class="project"> with one <header class="project-head">, one
|
|
8
|
+
* <figure class="teaser wide">, one <main> and one <footer>. Every child of
|
|
9
|
+
* .project is one column of prose at --prose, which is about 72 characters at
|
|
10
|
+
* 18px, and a child marked .wide, such as the teaser, takes the wider --wide.
|
|
11
|
+
* Carbon's 16 column breakpoints set the padding: md at 672px, lg at 1056px.
|
|
12
|
+
*
|
|
13
|
+
* The teaser is an <img>, and the dark block inside teaser.svg resolves against
|
|
14
|
+
* this document's used color-scheme, which is why html takes color-scheme from
|
|
15
|
+
* the mode token: an explicit data-mode="dark" carries into the image too.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
:root {
|
|
19
|
+
/* A ch is the width of a zero, wider than an average letter, so 56ch of Plex
|
|
20
|
+
Sans at 18px is about 72 characters: the measure a reader can hold. */
|
|
21
|
+
--prose: 56ch;
|
|
22
|
+
--wide: 928px;
|
|
23
|
+
--tap: 44px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
*,
|
|
27
|
+
*::before,
|
|
28
|
+
*::after {
|
|
29
|
+
box-sizing: border-box;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
html {
|
|
33
|
+
color-scheme: var(--color-scheme);
|
|
34
|
+
-webkit-text-size-adjust: 100%;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
body {
|
|
38
|
+
margin: 0;
|
|
39
|
+
background: var(--bg);
|
|
40
|
+
color: var(--fg);
|
|
41
|
+
font-family: var(--font-sans);
|
|
42
|
+
font-size: var(--text-sm);
|
|
43
|
+
line-height: var(--lh-read);
|
|
44
|
+
-webkit-font-smoothing: antialiased;
|
|
45
|
+
text-rendering: optimizeLegibility;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
:focus-visible {
|
|
49
|
+
outline: 2px solid var(--accent);
|
|
50
|
+
outline-offset: 2px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* ---------------------------------------------------------------- layout -- */
|
|
54
|
+
|
|
55
|
+
.project {
|
|
56
|
+
display: grid;
|
|
57
|
+
grid-template-columns: minmax(0, 1fr);
|
|
58
|
+
justify-items: center;
|
|
59
|
+
max-width: 1584px;
|
|
60
|
+
margin: 0 auto;
|
|
61
|
+
padding: var(--space-10) var(--space-05) var(--space-12);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.project > * {
|
|
65
|
+
width: 100%;
|
|
66
|
+
max-width: var(--prose);
|
|
67
|
+
min-width: 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.project > .wide {
|
|
71
|
+
max-width: var(--wide);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@media (min-width: 672px) {
|
|
75
|
+
.project {
|
|
76
|
+
padding: var(--space-11) var(--space-07) var(--space-13);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@media (min-width: 1056px) {
|
|
81
|
+
.project {
|
|
82
|
+
padding-top: var(--space-12);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* ----------------------------------------------------------- title block -- */
|
|
87
|
+
|
|
88
|
+
.project-head {
|
|
89
|
+
margin: 0 0 var(--space-08);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.project h1 {
|
|
93
|
+
max-width: 100%;
|
|
94
|
+
margin: 0;
|
|
95
|
+
font-size: var(--text-2xl);
|
|
96
|
+
font-weight: 400;
|
|
97
|
+
line-height: 1.15;
|
|
98
|
+
letter-spacing: -0.01em;
|
|
99
|
+
text-wrap: balance;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.authors {
|
|
103
|
+
margin: var(--space-06) 0 0;
|
|
104
|
+
font-size: var(--text-sm);
|
|
105
|
+
line-height: 1.5;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.affiliations,
|
|
109
|
+
.marks,
|
|
110
|
+
.venue {
|
|
111
|
+
margin: var(--space-03) 0 0;
|
|
112
|
+
font-size: var(--text-xs);
|
|
113
|
+
line-height: 1.5;
|
|
114
|
+
color: var(--muted);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.marks {
|
|
118
|
+
margin-top: var(--space-02);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.venue {
|
|
122
|
+
margin-top: var(--space-05);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
sup {
|
|
126
|
+
font-size: 0.7em;
|
|
127
|
+
line-height: 0;
|
|
128
|
+
vertical-align: super;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/* ---------------------------------------------------------------- links --- */
|
|
132
|
+
|
|
133
|
+
/* A ghost button carries 16px of its own padding, so the row shifts left by
|
|
134
|
+
that much and the first label lines up with the title above it. */
|
|
135
|
+
.links {
|
|
136
|
+
display: flex;
|
|
137
|
+
flex-wrap: wrap;
|
|
138
|
+
align-items: center;
|
|
139
|
+
gap: var(--space-02) var(--space-03);
|
|
140
|
+
margin: var(--space-06) 0 0 calc(var(--space-05) * -1);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.btn {
|
|
144
|
+
display: inline-flex;
|
|
145
|
+
align-items: center;
|
|
146
|
+
gap: var(--space-03);
|
|
147
|
+
min-height: var(--tap);
|
|
148
|
+
padding: 0 var(--space-05);
|
|
149
|
+
border: 1px solid transparent;
|
|
150
|
+
border-radius: var(--radius);
|
|
151
|
+
background: transparent;
|
|
152
|
+
color: var(--accent);
|
|
153
|
+
font-family: inherit;
|
|
154
|
+
font-size: var(--text-xs);
|
|
155
|
+
line-height: 1;
|
|
156
|
+
letter-spacing: 0;
|
|
157
|
+
text-align: left;
|
|
158
|
+
text-decoration: none;
|
|
159
|
+
cursor: pointer;
|
|
160
|
+
-webkit-appearance: none;
|
|
161
|
+
appearance: none;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/* Carbon fills a tertiary button with blue on hover. Here the hover is the
|
|
165
|
+
layer colour, so the label keeps its 4.5:1 contrast in both modes. */
|
|
166
|
+
.btn:hover {
|
|
167
|
+
background: var(--layer-01);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.btn:focus-visible {
|
|
171
|
+
outline: 2px solid var(--accent);
|
|
172
|
+
outline-offset: -2px;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.btn--tertiary {
|
|
176
|
+
border-color: var(--accent);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.btn .icon {
|
|
180
|
+
flex: none;
|
|
181
|
+
width: 16px;
|
|
182
|
+
height: 16px;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/* ----------------------------------------------------------------- prose -- */
|
|
186
|
+
|
|
187
|
+
.project h2 {
|
|
188
|
+
margin: var(--space-10) 0 var(--space-04);
|
|
189
|
+
font-size: var(--text-lg);
|
|
190
|
+
font-weight: 600;
|
|
191
|
+
line-height: 1.25;
|
|
192
|
+
letter-spacing: 0;
|
|
193
|
+
text-wrap: balance;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
p {
|
|
197
|
+
margin: 0 0 var(--space-05);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
a {
|
|
201
|
+
color: var(--accent);
|
|
202
|
+
text-decoration: underline;
|
|
203
|
+
text-decoration-thickness: 1px;
|
|
204
|
+
text-underline-offset: 2px;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
strong {
|
|
208
|
+
font-weight: 600;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
ul,
|
|
212
|
+
ol {
|
|
213
|
+
margin: 0 0 var(--space-05);
|
|
214
|
+
padding-left: var(--space-06);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
li::marker {
|
|
218
|
+
color: var(--muted);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.tldr {
|
|
222
|
+
margin: var(--space-08) 0 var(--space-09);
|
|
223
|
+
font-size: var(--text-base);
|
|
224
|
+
line-height: 1.5;
|
|
225
|
+
text-wrap: pretty;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.abstract {
|
|
229
|
+
margin: 0 0 var(--space-09);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.abstract h2 {
|
|
233
|
+
margin-top: 0;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.abstract p {
|
|
237
|
+
font-size: var(--text-base);
|
|
238
|
+
line-height: 1.5;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/* -------------------------------------------------------------- figures --- */
|
|
242
|
+
|
|
243
|
+
figure {
|
|
244
|
+
margin: var(--space-07) 0 var(--space-08);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
figure img,
|
|
248
|
+
figure svg {
|
|
249
|
+
display: block;
|
|
250
|
+
max-width: 100%;
|
|
251
|
+
height: auto;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/* A diagram fills the figure it is in, so it sits on the same axis as the text
|
|
255
|
+
under it instead of hugging the left edge of a wider box. */
|
|
256
|
+
.teaser img {
|
|
257
|
+
width: 100%;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
figcaption {
|
|
261
|
+
margin-top: var(--space-04);
|
|
262
|
+
font-size: var(--text-2xs);
|
|
263
|
+
line-height: 1.5;
|
|
264
|
+
color: var(--muted);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.teaser figcaption {
|
|
268
|
+
max-width: 62ch;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/* ---------------------------------------------------------------- tables -- */
|
|
272
|
+
|
|
273
|
+
.table {
|
|
274
|
+
margin: 0 0 var(--space-08);
|
|
275
|
+
overflow-x: auto;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
table {
|
|
279
|
+
width: 100%;
|
|
280
|
+
border-collapse: collapse;
|
|
281
|
+
font-size: var(--text-xs);
|
|
282
|
+
line-height: 1.45;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
caption {
|
|
286
|
+
margin: 0 0 var(--space-03);
|
|
287
|
+
padding: 0;
|
|
288
|
+
text-align: left;
|
|
289
|
+
font-size: var(--text-2xs);
|
|
290
|
+
color: var(--muted);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
th,
|
|
294
|
+
td {
|
|
295
|
+
padding: var(--space-03) var(--space-05) var(--space-03) 0;
|
|
296
|
+
text-align: left;
|
|
297
|
+
vertical-align: baseline;
|
|
298
|
+
border-bottom: 1px solid var(--border-subtle);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
thead th {
|
|
302
|
+
font-size: var(--text-2xs);
|
|
303
|
+
font-weight: 600;
|
|
304
|
+
color: var(--muted);
|
|
305
|
+
border-bottom: 1px solid var(--border-strong);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
tbody tr:last-child th,
|
|
309
|
+
tbody tr:last-child td {
|
|
310
|
+
border-bottom: 0;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.num-cell {
|
|
314
|
+
text-align: right;
|
|
315
|
+
padding-right: 0;
|
|
316
|
+
font-variant-numeric: tabular-nums;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/* ---------------------------------------------------------------- bibtex -- */
|
|
320
|
+
|
|
321
|
+
/* The entry wraps rather than scrolling, so a phone reader sees all of it. The
|
|
322
|
+
copy button hands over the text as written, newlines and all. */
|
|
323
|
+
pre {
|
|
324
|
+
margin: 0;
|
|
325
|
+
padding: var(--space-05);
|
|
326
|
+
overflow-x: auto;
|
|
327
|
+
background: var(--layer-01);
|
|
328
|
+
border-radius: var(--radius);
|
|
329
|
+
font-family: var(--font-mono);
|
|
330
|
+
font-size: var(--text-2xs);
|
|
331
|
+
line-height: var(--lh-code);
|
|
332
|
+
white-space: pre-wrap;
|
|
333
|
+
overflow-wrap: break-word;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
code,
|
|
337
|
+
kbd,
|
|
338
|
+
samp {
|
|
339
|
+
font-family: var(--font-mono);
|
|
340
|
+
font-size: 0.94em;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
pre code {
|
|
344
|
+
padding: 0;
|
|
345
|
+
background: none;
|
|
346
|
+
font-size: inherit;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.copy-row {
|
|
350
|
+
display: flex;
|
|
351
|
+
flex-wrap: wrap;
|
|
352
|
+
align-items: center;
|
|
353
|
+
gap: var(--space-03) var(--space-04);
|
|
354
|
+
margin: var(--space-04) 0 0 calc(var(--space-05) * -1);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/* The live region stays rendered and empty, because a region hidden with
|
|
358
|
+
display: none is dropped from the accessibility tree and is never read. */
|
|
359
|
+
.copy-status {
|
|
360
|
+
margin: 0;
|
|
361
|
+
font-size: var(--text-2xs);
|
|
362
|
+
line-height: 1.5;
|
|
363
|
+
color: var(--muted);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/* ---------------------------------------------------------------- footer -- */
|
|
367
|
+
|
|
368
|
+
.project-foot {
|
|
369
|
+
margin-top: var(--space-11);
|
|
370
|
+
padding-top: var(--space-05);
|
|
371
|
+
border-top: 1px solid var(--border-subtle);
|
|
372
|
+
font-size: var(--text-2xs);
|
|
373
|
+
line-height: 1.6;
|
|
374
|
+
color: var(--muted);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.project-foot p {
|
|
378
|
+
margin: 0 0 var(--space-03);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
.project-foot .ack {
|
|
382
|
+
font-size: var(--text-xs);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/* --------------------------------------------------------- narrow screens -- */
|
|
386
|
+
|
|
387
|
+
@media (max-width: 671px) {
|
|
388
|
+
.project {
|
|
389
|
+
padding: var(--space-07) var(--space-05) var(--space-11);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.project h1 {
|
|
393
|
+
font-size: var(--text-xl);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.project h2 {
|
|
397
|
+
font-size: var(--text-md);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
.tldr {
|
|
401
|
+
font-size: var(--text-sm);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.abstract p {
|
|
405
|
+
font-size: var(--text-sm);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/* A wide diagram or chart scrolls instead of shrinking to unreadable type. */
|
|
409
|
+
.teaser,
|
|
410
|
+
figure {
|
|
411
|
+
overflow-x: auto;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.teaser img {
|
|
415
|
+
min-width: 560px;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
figure svg {
|
|
419
|
+
min-width: 560px;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.teaser figcaption,
|
|
423
|
+
figcaption {
|
|
424
|
+
min-width: 0;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
@media (prefers-reduced-motion: reduce) {
|
|
429
|
+
* {
|
|
430
|
+
animation-duration: 0.01ms !important;
|
|
431
|
+
transition-duration: 0.01ms !important;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/* ----------------------------------------------------------------- print -- */
|
|
436
|
+
|
|
437
|
+
@media print {
|
|
438
|
+
.project {
|
|
439
|
+
display: block;
|
|
440
|
+
max-width: none;
|
|
441
|
+
padding: 0;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
.project > * {
|
|
445
|
+
max-width: none;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
figure,
|
|
449
|
+
.table {
|
|
450
|
+
break-inside: avoid;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
.teaser img,
|
|
454
|
+
figure svg {
|
|
455
|
+
min-width: 0;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
.btn {
|
|
459
|
+
min-height: 0;
|
|
460
|
+
padding: 0;
|
|
461
|
+
border-color: transparent;
|
|
462
|
+
color: #000;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/* The copy button has nothing to do on paper, and a URL a reader cannot
|
|
466
|
+
click is printed in full. */
|
|
467
|
+
.copy-row {
|
|
468
|
+
display: none;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
a {
|
|
472
|
+
color: #000;
|
|
473
|
+
text-decoration: none;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
a[href^="http"]::after {
|
|
477
|
+
content: " (" attr(href) ")";
|
|
478
|
+
font-size: 9pt;
|
|
479
|
+
color: #525252;
|
|
480
|
+
overflow-wrap: anywhere;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* rshow theme "default": project runtime. Zero dependencies.
|
|
3
|
+
*
|
|
4
|
+
* Markup: a <button type="button" class="btn" data-rshow-copy="<id>"> inside a
|
|
5
|
+
* .copy-row, with a <span class="btn-label"> for its word and a sibling
|
|
6
|
+
* <p class="copy-status" role="status" aria-live="polite"></p> for the
|
|
7
|
+
* announcement. The entry itself is ordinary text in the page, so with
|
|
8
|
+
* JavaScript off a reader can still select and copy it by hand.
|
|
9
|
+
*/
|
|
10
|
+
(function () {
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
var RESET_AFTER = 2500;
|
|
14
|
+
var HELP = 'The entry is selected: press Command and C, or Control and C, to copy it.';
|
|
15
|
+
|
|
16
|
+
function word(button) {
|
|
17
|
+
return button.querySelector('.btn-label');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function status(button) {
|
|
21
|
+
return button.parentNode ? button.parentNode.querySelector('.copy-status') : null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function settle(button, message, label) {
|
|
25
|
+
var name = word(button);
|
|
26
|
+
var live = status(button);
|
|
27
|
+
if (name) {
|
|
28
|
+
name.textContent = label;
|
|
29
|
+
}
|
|
30
|
+
if (live) {
|
|
31
|
+
live.textContent = message;
|
|
32
|
+
}
|
|
33
|
+
if (button.rshowReset) {
|
|
34
|
+
window.clearTimeout(button.rshowReset);
|
|
35
|
+
}
|
|
36
|
+
button.rshowReset = window.setTimeout(function () {
|
|
37
|
+
var back = word(button);
|
|
38
|
+
var cleared = status(button);
|
|
39
|
+
if (back) {
|
|
40
|
+
back.textContent = 'Copy';
|
|
41
|
+
}
|
|
42
|
+
if (cleared) {
|
|
43
|
+
cleared.textContent = '';
|
|
44
|
+
}
|
|
45
|
+
button.rshowReset = null;
|
|
46
|
+
}, RESET_AFTER);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function select(element) {
|
|
50
|
+
var selection = window.getSelection ? window.getSelection() : null;
|
|
51
|
+
if (!selection) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
var range = document.createRange();
|
|
55
|
+
range.selectNodeContents(element);
|
|
56
|
+
selection.removeAllRanges();
|
|
57
|
+
selection.addRange(range);
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// The clipboard API needs a secure context and a granted permission, so a page
|
|
62
|
+
// opened from disk or a refused prompt falls back to selecting the text and
|
|
63
|
+
// copying that selection with the older command.
|
|
64
|
+
function bySelection(element) {
|
|
65
|
+
if (!select(element)) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
return document.execCommand('copy') === true;
|
|
70
|
+
} catch (err) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function report(button, ok) {
|
|
76
|
+
if (ok) {
|
|
77
|
+
settle(button, 'Copied', 'Copied');
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
settle(button, HELP, 'Copy');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function run(button) {
|
|
84
|
+
var id = button.getAttribute('data-rshow-copy');
|
|
85
|
+
var element = id ? document.getElementById(id) : null;
|
|
86
|
+
if (!element) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
var clipboard = window.navigator.clipboard;
|
|
90
|
+
if (clipboard && clipboard.writeText) {
|
|
91
|
+
clipboard.writeText(element.textContent || '').then(function () {
|
|
92
|
+
report(button, true);
|
|
93
|
+
}, function () {
|
|
94
|
+
report(button, bySelection(element));
|
|
95
|
+
});
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
report(button, bySelection(element));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function start() {
|
|
102
|
+
var buttons = document.querySelectorAll('[data-rshow-copy]');
|
|
103
|
+
var i;
|
|
104
|
+
for (i = 0; i < buttons.length; i += 1) {
|
|
105
|
+
buttons[i].addEventListener('click', function () {
|
|
106
|
+
run(this);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (document.readyState === 'loading') {
|
|
112
|
+
document.addEventListener('DOMContentLoaded', start);
|
|
113
|
+
} else {
|
|
114
|
+
start();
|
|
115
|
+
}
|
|
116
|
+
}());
|