authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-10-19 16:43:39-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2019-10-19 16:43:39-04:00
log6948d7fce7d39b97d34689d2ba297132255e3f54
tree39e29ab0416cdba1f83bb16f0c18e94503b94f16
parentdbb1eaefb50572d3c11129925f3e0fdedf758723
parent40d53a7bc5ef18607266790e99fa693ba4344645
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #3429 from Rocknest/docs-local

Design suggestion for generated docs

1 files changed, 394 insertions(+), 216 deletions(-)

lib/std/special/docs/index.html+394-216
......@@ -5,62 +5,228 @@
55 <title>Documentation - Zig</title>
66 <link rel="icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAgklEQVR4AWMYWuD7EllJIM4G4g4g5oIJ/odhOJ8wToOxSTXgNxDHoeiBMfA4+wGShjyYOCkG/IGqWQziEzYAoUAeiF9D5U+DxEg14DRU7jWIT5IBIOdCxf+A+CQZAAoopEB7QJwBCBwHiip8UYmRdrAlDpIMgApwQZNnNii5Dq0MBgCxxycBnwEd+wAAAABJRU5ErkJggg==">
77 <style type="text/css">
8 body {
9 font-family: system-ui, -apple-system, Roboto, "Segoe UI", sans-serif;
10 max-width: 60em;
8 :root {
9 font-size: 1em;
10 --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
11 --mono: "Source Code Pro", monospace;
12 --tx-color: #141414;
13 --bg-color: #ffffff;
14 --link-color: #2A6286;
15 --sidebar-sh-color: rgba(0, 0, 0, 0.09);
16 --sidebar-pkg-bg-color: #f1f1f1;
17 --sidebar-pkglnk-tx-color: #141414;
18 --sidebar-pkglnk-tx-color-hover: #fff;
19 --sidebar-pkglnk-tx-color-active: #000;
20 --sidebar-pkglnk-bg-color: transparent;
21 --sidebar-pkglnk-bg-color-hover: #555;
22 --sidebar-pkglnk-bg-color-active: #FFBB4D;
23 --search-bg-color: #f3f3f3;
24 --search-bg-color-focus: #ffffff;
25 --search-sh-color: rgba(0, 0, 0, 0.18);
26 --help-sh-color: rgba(0, 0, 0, 0.75);
1127 }
28
29 a {
30 text-decoration: none;
31 }
32
33 a:hover {
34 text-decoration: underline;
35 }
36
1237 .hidden {
1338 display: none;
1439 }
15 a {
16 color: #2A6286;
40
41 /* layout */
42 .canvas {
43 width: 100vw;
44 height: 100vh;
45 overflow: hidden;
46 margin: 0;
47 padding: 0;
48 font-family: var(--ui);
49 color: var(--tx-color);
50 background-color: var(--bg-color);
1751 }
18 pre{
19 font-family:"Source Code Pro",monospace;
20 font-size:1em;
21 background-color:#F5F5F5;
22 padding:1em;
23 overflow-x: auto;
52
53 .flex-main {
54 display: flex;
55 width: 100%;
56 height: 100%;
57 justify-content: center;
58
59 z-index: 100;
2460 }
25 code {
26 font-family:"Source Code Pro",monospace;
27 font-size:1em;
61
62 .flex-filler {
63 flex-grow: 1;
64 flex-shrink: 1;
2865 }
29 nav {
30 width: 10em;
31 position: fixed;
32 left: 0;
33 top: 0;
34 height: 100vh;
66
67 .flex-left {
68 width: 12rem;
69 max-width: 15vw;
70 min-width: 9.5rem;
3571 overflow: auto;
72 overflow-wrap: break-word;
73 flex-shrink: 0;
74 flex-grow: 0;
75
76 z-index: 300;
3677 }
37 nav h2 {
38 font-size: 1.2em;
39 text-decoration: underline;
40 margin: 0;
41 padding: 0.5em 0;
42 text-align: center;
78
79 .flex-right {
80 display: flex;
81 overflow: auto;
82 flex-grow: 1;
83 flex-shrink: 1;
84
85 z-index: 200;
86 }
87
88 .flex-right > .wrap {
89 width: 60rem;
90 max-width: 85vw;
91 flex-shrink: 1;
92 }
93
94 .help-modal {
95 z-index: 400;
96 }
97
98 /* sidebar */
99 .sidebar {
100 font-size: 1rem;
101 background-color: var(--bg-color);
102 box-shadow: 0 0 1rem var(--sidebar-sh-color);
103 }
104
105 .sidebar .logo {
106 padding: 1rem 0.35rem 0.35rem 0.35rem;
107 }
108
109 .sidebar .logo > svg {
110 display: block;
111 overflow: visible;
112 }
113
114 .sidebar h2 {
115 margin: 0.5rem;
116 padding: 0;
117 font-size: 1.2rem;
43118 }
44 nav p {
119
120 .sidebar h2 > span {
121 border-bottom: 0.125rem dotted var(--tx-color);
122 }
123
124 .sidebar .packages {
125 list-style-type: none;
45126 margin: 0;
46127 padding: 0;
47 text-align: center;
128 background-color: var(--sidebar-pkg-bg-color);
129 }
130
131 .sidebar .packages > li > a {
132 display: block;
133 padding: 0.5rem 1rem;
134 color: var(--sidebar-pkglnk-tx-color);
135 background-color: var(--sidebar-pkglnk-bg-color);
136 text-decoration: none;
137 }
138
139 .sidebar .packages > li > a:hover {
140 color: var(--sidebar-pkglnk-tx-color-hover);
141 background-color: var(--sidebar-pkglnk-bg-color-hover);
142 }
143
144 .sidebar .packages > li > a.active {
145 color: var(--sidebar-pkglnk-tx-color-active);
146 background-color: var(--sidebar-pkglnk-bg-color-active);
147 }
148
149 .sidebar p.str {
150 margin: 0.5rem;
151 font-family: var(--mono);
152 }
153
154 /* docs section */
155 .docs {
156 padding: 1rem 0.7rem 2.4rem 1.4rem;
157 font-size: 1rem;
158 background-color: var(--bg-color);
159 overflow-wrap: break-word;
160 }
161
162 .docs .search {
163 width: 100%;
164 margin-bottom: 0.8rem;
165 padding: 0.5rem;
166 font-size: 1rem;
167 font-family: var(--ui);
168 color: var(--tx-color);
169 background-color: var(--search-bg-color);
170 border-top: 0;
171 border-left: 0;
172 border-right: 0;
173 border-bottom-width: 0.125rem;
174 border-bottom-style: solid;
175 border-bottom-color: var(--tx-color);
176 outline: none;
177 transition: border-bottom-color 0.35s, background 0.35s, box-shadow 0.35s;
178 }
179
180 .docs .search:focus {
181 background-color: var(--search-bg-color-focus);
182 border-bottom-color: #ffbb4d;
183 box-shadow: 0 0.3em 1em 0.125em var(--search-sh-color);
184 }
185
186 .docs .search::placeholder {
187 font-size: 1rem;
188 font-family: var(--ui);
189 color: var(--tx-color);
190 opacity: 0.5;
191 }
192
193 .docs a {
194 color: var(--link-color);
195 }
196
197 .docs p {
198 margin: 0.8rem 0;
199 }
200
201 .docs pre {
202 font-family: var(--mono);
203 font-size:1em;
204 background-color:#F5F5F5;
205 padding:1em;
206 overflow-x: auto;
48207 }
49 section {
50 margin-left: 10em;
208
209 .docs code {
210 font-family: var(--mono);
211 font-size: 1em;
51212 }
52 section h1 {
53 border-bottom: 1px dashed;
213
214 .docs h1 {
215 font-size: 1.4em;
216 margin: 0.8em 0;
217 padding: 0;
218 border-bottom: 0.0625rem dashed;
54219 }
55 section h2 {
220
221 .docs h2 {
56222 font-size: 1.3em;
57223 margin: 0.5em 0;
58224 padding: 0;
59 border-bottom: 1px solid;
225 border-bottom: 0.0625rem solid;
60226 }
61227 #listNav {
62228 list-style-type: none;
63 margin: 0.5em 0 0 0;
229 margin: 0;
64230 padding: 0;
65231 overflow: hidden;
66232 background-color: #f1f1f1;
......@@ -84,26 +250,14 @@
84250 color: #000;
85251 }
86252
87 #listPkgs {
88 list-style-type: none;
89 margin: 0;
90 padding: 0;
91 background-color: #f1f1f1;
92 }
93 #listPkgs li a {
94 display: block;
95 color: #000;
96 padding: 0.5em 1em;
97 text-decoration: none;
98 }
99 #listPkgs li a:hover {
100 background-color: #555;
101 color: #fff;
253 #listSearchResults li.selected {
254 background-color: #93e196;
102255 }
103 #listPkgs li a.active {
104 background-color: #FFBB4D;
105 color: #000;
256
257 #tableFnErrors dt {
258 font-weight: bold;
106259 }
260
107261 #listFnExamples {
108262 list-style-type: none;
109263 margin: 0;
......@@ -114,67 +268,76 @@
114268 white-space: nowrap;
115269 overflow-x: auto;
116270 }
117 #logo {
118 width: 8em;
119 padding: 0.5em 1em;
271
272 .docs td {
273 vertical-align: top;
274 margin: 0;
275 padding: 0.5em;
276 max-width: 27em;
277 text-overflow: ellipsis;
278 overflow-x: hidden;
120279 }
121
122 #search {
280
281 /* help dialog */
282 .help-modal {
283 display: flex;
123284 width: 100%;
124 }
125
126 #helpDialog {
127 width: 21em;
128 height: 19em;
285 height: 100%;
129286 position: fixed;
130287 top: 0;
131288 left: 0;
132 background-color: #333;
289 justify-content: center;
290 align-items: center;
291 background-color: rgba(0, 0, 0, 0.15);
292 backdrop-filter: blur(0.3em);
293 }
294
295 .help-modal > .dialog {
296 max-width: 97vw;
297 max-height: 97vh;
298 overflow: auto;
299 font-size: 1rem;
133300 color: #fff;
134 border: 1px solid #fff;
301 background-color: #333;
302 border: 0.125rem solid #000;
303 box-shadow: 0 0.5rem 2.5rem 0.3rem var(--help-sh-color);
135304 }
136 #helpDialog h1 {
137 text-align: center;
305
306 .help-modal h1 {
307 margin: 0.75em 2.5em 1em 2.5em;
138308 font-size: 1.5em;
309 text-align: center;
139310 }
140 #helpDialog dt, #helpDialog dd {
311
312 .help-modal dt, .help-modal dd {
141313 display: inline;
142314 margin: 0 0.2em;
143315 }
144 kbd {
316
317 .help-modal dl {
318 margin-left: 0.5em;
319 margin-right: 0.5em;
320 }
321
322 .help-modal kbd {
323 display: inline-block;
324 padding: 0.3em 0.2em;
325 font-size: 1.2em;
326 font-size: var(--mono);
327 line-height: 0.8em;
328 vertical-align: middle;
145329 color: #000;
146330 background-color: #fafbfc;
147331 border-color: #d1d5da;
148332 border-bottom-color: #c6cbd1;
333 border: solid 0.0625em;
334 border-radius: 0.1875em;
149335 box-shadow-color: #c6cbd1;
150 display: inline-block;
151 padding: 0.3em 0.2em;
152 font: 1.2em monospace;
153 line-height: 0.8em;
154 vertical-align: middle;
155 border: solid 1px;
156 border-radius: 3px;
157 box-shadow: inset 0 -1px 0;
336 box-shadow: inset 0 -0.0625em 0;
158337 cursor: default;
159338 }
160
161 #listSearchResults li.selected {
162 background-color: #93e196;
163 }
164
165 #tableFnErrors dt {
166 font-weight: bold;
167 }
168
169 td {
170 vertical-align: top;
171 margin: 0;
172 padding: 0.5em;
173 max-width: 27em;
174 text-overflow: ellipsis;
175 overflow-x: hidden;
176 }
177
339
340 /* tokens */
178341 .tok-kw {
179342 color: #333;
180343 font-weight: bold;
......@@ -203,16 +366,29 @@
203366 color: #458;
204367 font-weight: bold;
205368 }
206
369
370 /* dark mode */
207371 @media (prefers-color-scheme: dark) {
208 body{
209 background-color: #111;
210 color: #bbb;
372
373 :root {
374 --tx-color: #bbb;
375 --bg-color: #111;
376 --link-color: #88f;
377 --sidebar-sh-color: rgba(128, 128, 128, 0.09);
378 --sidebar-pkg-bg-color: #333;
379 --sidebar-pkglnk-tx-color: #fff;
380 --sidebar-pkglnk-tx-color-hover: #fff;
381 --sidebar-pkglnk-tx-color-active: #000;
382 --sidebar-pkglnk-bg-color: transparent;
383 --sidebar-pkglnk-bg-color-hover: #555;
384 --sidebar-pkglnk-bg-color-active: #FFBB4D;
385 --search-bg-color: #3c3c3c;
386 --search-bg-color-focus: #000;
387 --search-sh-color: rgba(255, 255, 255, 0.28);
388 --help-sh-color: rgba(142, 142, 142, 0.5);
211389 }
212 a {
213 color: #88f;
214 }
215 pre{
390
391 .docs pre {
216392 background-color:#2A2A2A;
217393 }
218394 #listNav {
......@@ -229,20 +405,6 @@
229405 background-color: #FFBB4D;
230406 color: #000;
231407 }
232 #listPkgs {
233 background-color: #333;
234 }
235 #listPkgs li a {
236 color: #fff;
237 }
238 #listPkgs li a:hover {
239 background-color: #555;
240 color: #fff;
241 }
242 #listPkgs li a.active {
243 background-color: #FFBB4D;
244 color: #000;
245 }
246408 #listSearchResults li.selected {
247409 background-color: #000;
248410 }
......@@ -273,112 +435,128 @@
273435 .tok-type {
274436 color: #68f;
275437 }
438
276439 }
277440 </style>
278441 </head>
279 <body>
280 <nav>
281 <img alt="ZIG" id="logo" src="data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAxNTAgMTAwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxnIGZpbGw9IiNmN2E0MWQiPjxwYXRoIGQ9Im0wIDEwdjgwaDE5bDYtMTAgMTItMTBoLTE3di00MGgxNXYtMjB6bTQwIDB2MjBoNjJ2LTIwem05MSAwLTYgMTAtMTIgMTBoMTd2NDBoLTE1djIwaDM1di04MHptLTgzIDYwdjIwaDYydi0yMHoiIHNoYXBlLXJlbmRlcmluZz0iY3Jpc3BFZGdlcyIvPjxwYXRoIGQ9Im0zNyA3MC0xOCAyMHYtMTV6Ii8+PHBhdGggZD0ibTExMyAzMCAxOC0yMHYxNXoiLz48cGF0aCBkPSJtOTYuOTggMTAuNjMgMzYuMjgtMTAuNC04MC4yOSA4OS4xNy0zNi4yOCAxMC40eiIvPjwvZz48L3N2Zz4K"></img>
282 <div id="sectPkgs" class="hidden">
283 <h2>Packages</h2>
284 <ul id="listPkgs">
285 </ul>
286 </div>
287 <div id="sectInfo" class="hidden">
288 <h2>Zig Version</h2>
289 <p id="tdZigVer"></p>
290 <h2>Target</h2>
291 <p id="tdTarget"></p>
442 <body class="canvas">
443 <div class="flex-main">
444 <div class="flex-filler"></div>
445 <div class="flex-left sidebar">
446 <nav>
447 <div class="logo">
448 <svg version="1.1" viewBox="0 0 150 80" xmlns="http://www.w3.org/2000/svg">
449 <g fill="#f7a41d">
450 <path d="m0,-0.08899l0,80l19,0l6,-10l12,-10l-17,0l0,-40l15,0l0,-20l-35,0zm40,0l0,20l62,0l0,-20l-62,0zm91,0l-6,10l-12,10l17,0l0,40l-15,0l0,20l35,0l0,-80l-19,0zm-83,60l0,20l62,0l0,-20l-62,0z" shape-rendering="crispEdges"></path>
451 <path d="m37,59.91101l-18,20l0,-15l18,-5z"></path>
452 <path d="m113,19.91101l18,-20l0,15l-18,5z"></path>
453 <path d="m96.98,0.54101l36.28,-10.4l-80.29,89.17l-36.28,10.4l80.29,-89.17z"></path>
454 </g>
455 </svg>
456 </div>
457 <div id="sectPkgs" class="hidden">
458 <h2><span>Packages</span></h2>
459 <ul id="listPkgs" class="packages"></ul>
460 </div>
461 <div id="sectInfo" class="hidden">
462 <h2><span>Zig Version</span></h2>
463 <p class="str" id="tdZigVer"></p>
464 <h2><span>Target</span></h2>
465 <p class="str" id="tdTarget"></p>
466 </div>
467 </nav>
292468 </div>
293 </nav>
294 <section>
295 <input type="search" id="search" autocomplete="off" spellcheck="false" placeholder="`s` to search, `?` to see more options">
296 <p id="status">Loading...</p>
297 <div id="sectNav" class="hidden"><ul id="listNav"></ul></div>
298 <div id="fnProto" class="hidden">
299 <pre id="fnProtoCode"></pre>
300 </div>
301 <h1 id="hdrName" class="hidden"></h1>
302 <div id="fnNoExamples" class="hidden">
303 <p>This function is not tested or referenced.</p>
304 </div>
305 <div id="declNoRef" class="hidden">
306 <p>
307 This declaration is not tested or referenced, and it has therefore not been included in
308 semantic analysis, which means the only documentation available is whatever is in the
309 doc comments.
310 </p>
311 </div>
312 <div id="fnDocs" class="hidden"></div>
313 <div id="sectFnErrors" class="hidden">
314 <h2>Errors</h2>
315 <div id="fnErrorsAnyError">
316 <p><span class="tok-type">anyerror</span> means the error set is known only at runtime.</p>
317 </div>
318 <div id="tableFnErrors"><dl id="listFnErrors"></dl></div>
319 </div>
320 <div id="sectSearchResults" class="hidden">
321 <h2>Search Results</h2>
322 <ul id="listSearchResults"></ul>
323 </div>
324 <div id="sectSearchNoResults" class="hidden">
325 <h2>No Results Found</h2>
326 <p>Press escape to exit search and then '?' to see more options.</p>
327 </div>
328 <div id="sectFields" class="hidden">
329 <h2>Fields</h2>
330 <div id="listFields">
469 <div class="flex-right">
470 <div class="wrap">
471 <section class="docs">
472 <input type="search" class="search" id="search" autocomplete="off" spellcheck="false" placeholder="`s` to search, `?` to see more options">
473 <p id="status">Loading...</p>
474 <div id="sectNav" class="hidden"><ul id="listNav"></ul></div>
475 <div id="fnProto" class="hidden">
476 <pre id="fnProtoCode"></pre>
477 </div>
478 <h1 id="hdrName" class="hidden"></h1>
479 <div id="fnNoExamples" class="hidden">
480 <p>This function is not tested or referenced.</p>
481 </div>
482 <div id="declNoRef" class="hidden">
483 <p>
484 This declaration is not tested or referenced, and it has therefore not been included in
485 semantic analysis, which means the only documentation available is whatever is in the
486 doc comments.
487 </p>
488 </div>
489 <div id="fnDocs" class="hidden"></div>
490 <div id="sectFnErrors" class="hidden">
491 <h2>Errors</h2>
492 <div id="fnErrorsAnyError">
493 <p><span class="tok-type">anyerror</span> means the error set is known only at runtime.</p>
494 </div>
495 <div id="tableFnErrors"><dl id="listFnErrors"></dl></div>
496 </div>
497 <div id="sectSearchResults" class="hidden">
498 <h2>Search Results</h2>
499 <ul id="listSearchResults"></ul>
500 </div>
501 <div id="sectSearchNoResults" class="hidden">
502 <h2>No Results Found</h2>
503 <p>Press escape to exit search and then '?' to see more options.</p>
504 </div>
505 <div id="sectFields" class="hidden">
506 <h2>Fields</h2>
507 <div id="listFields"></div>
508 </div>
509 <div id="sectTypes" class="hidden">
510 <h2>Types</h2>
511 <ul id="listTypes"></ul>
512 </div>
513 <div id="sectNamespaces" class="hidden">
514 <h2>Namespaces</h2>
515 <ul id="listNamespaces"></ul>
516 </div>
517 <div id="sectGlobalVars" class="hidden">
518 <h2>Global Variables</h2>
519 <table>
520 <tbody id="listGlobalVars"></tbody>
521 </table>
522 </div>
523 <div id="sectFns" class="hidden">
524 <h2>Functions</h2>
525 <table>
526 <tbody id="listFns"></tbody>
527 </table>
528 </div>
529 <div id="sectValues" class="hidden">
530 <h2>Values</h2>
531 <table>
532 <tbody id="listValues"></tbody>
533 </table>
534 </div>
535 <div id="sectErrSets" class="hidden">
536 <h2>Error Sets</h2>
537 <ul id="listErrSets"></ul>
538 </div>
539 <div id="fnExamples" class="hidden">
540 <h2>Examples</h2>
541 <ul id="listFnExamples"></ul>
542 </div>
543 </section>
544 </div>
545 <div class="flex-filler"></div>
331546 </div>
332547 </div>
333 <div id="sectTypes" class="hidden">
334 <h2>Types</h2>
335 <ul id="listTypes">
336 </ul>
337 </div>
338 <div id="sectNamespaces" class="hidden">
339 <h2>Namespaces</h2>
340 <ul id="listNamespaces">
341 </ul>
342 </div>
343 <div id="sectGlobalVars" class="hidden">
344 <h2>Global Variables</h2>
345 <table>
346 <tbody id="listGlobalVars">
347 </tbody>
348 </table>
349 </div>
350 <div id="sectFns" class="hidden">
351 <h2>Functions</h2>
352 <table>
353 <tbody id="listFns">
354 </tbody>
355 </table>
356 </div>
357 <div id="sectValues" class="hidden">
358 <h2>Values</h2>
359 <table>
360 <tbody id="listValues">
361 </tbody>
362 </table>
363 </div>
364 <div id="sectErrSets" class="hidden">
365 <h2>Error Sets</h2>
366 <ul id="listErrSets">
367 </ul>
368 </div>
369 <div id="fnExamples" class="hidden">
370 <h2>Examples</h2>
371 <ul id="listFnExamples"></ul>
372 </div>
373 </section>
374548 <div id="helpDialog" class="hidden">
375 <h1>Keyboard Shortcuts</h1>
376 <dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd></dl>
377 <dl><dt><kbd>Esc</kbd></dt><dd>Clear focus; close this dialog</dd></dl>
378 <dl><dt><kbd>s</kbd></dt><dd>Focus the search field</dd></dl>
379 <dl><dt><kbd>↑</kbd></dt><dd>Move up in search results</dd></dl>
380 <dl><dt><kbd>↓</kbd></dt><dd>Move down in search results</dd></dl>
381 <dl><dt><kbd>⏎</kbd></dt><dd>Go to active search result</dd></dl>
549 <div class="help-modal">
550 <div class="dialog">
551 <h1>Keyboard Shortcuts</h1>
552 <dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd></dl>
553 <dl><dt><kbd>Esc</kbd></dt><dd>Clear focus; close this dialog</dd></dl>
554 <dl><dt><kbd>s</kbd></dt><dd>Focus the search field</dd></dl>
555 <dl><dt><kbd>↑</kbd></dt><dd>Move up in search results</dd></dl>
556 <dl><dt><kbd>↓</kbd></dt><dd>Move down in search results</dd></dl>
557 <dl><dt><kbd>⏎</kbd></dt><dd>Go to active search result</dd></dl>
558 </div>
559 </div>
382560 </div>
383561 <script src="data.js"></script>
384562 <script src="main.js"></script>