authorgravatar for omegariisthebest@gmail.compfg <omegariisthebest@gmail.com> 2020-01-19 11:39:45-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-03-04 10:47:21-05:00
loge3b37fc9c158ea256b6f914692863b5aad88c7dd
treebed562ddc0bc4ee4196f9777f2e0b7ef069a248b
parente095475d922672c7c502c81477bfdcb973e30352

Generated documentation mobile support


2 files changed, 98 insertions(+), 15 deletions(-)

lib/std/special/docs/index.html+96-13
...@@ -2,6 +2,7 @@...@@ -2,6 +2,7 @@
2<html lang="en">2<html lang="en">
3 <head>3 <head>
4 <meta charset="utf-8">4 <meta charset="utf-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1">
5 <title>Documentation - Zig</title>6 <title>Documentation - Zig</title>
6 <link rel="icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAgklEQVR4AWMYWuD7EllJIM4G4g4g5oIJ/odhOJ8wToOxSTXgNxDHoeiBMfA4+wGShjyYOCkG/IGqWQziEzYAoUAeiF9D5U+DxEg14DRU7jWIT5IBIOdCxf+A+CQZAAoopEB7QJwBCBwHiip8UYmRdrAlDpIMgApwQZNnNii5Dq0MBgCxxycBnwEd+wAAAABJRU5ErkJggg==">7 <link rel="icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAgklEQVR4AWMYWuD7EllJIM4G4g4g5oIJ/odhOJ8wToOxSTXgNxDHoeiBMfA4+wGShjyYOCkG/IGqWQziEzYAoUAeiF9D5U+DxEg14DRU7jWIT5IBIOdCxf+A+CQZAAoopEB7QJwBCBwHiip8UYmRdrAlDpIMgApwQZNnNii5Dq0MBgCxxycBnwEd+wAAAABJRU5ErkJggg==">
7 <style>8 <style>
...@@ -25,6 +26,8 @@...@@ -25,6 +26,8 @@
25 --search-sh-color: rgba(0, 0, 0, 0.18);26 --search-sh-color: rgba(0, 0, 0, 0.18);
26 --help-sh-color: rgba(0, 0, 0, 0.75);27 --help-sh-color: rgba(0, 0, 0, 0.75);
27 }28 }
29
30 html, body { margin: 0; padding:0; height: 100%; }
2831
29 a {32 a {
30 text-decoration: none;33 text-decoration: none;
...@@ -69,6 +72,7 @@...@@ -69,6 +72,7 @@
69 max-width: 15vw;72 max-width: 15vw;
70 min-width: 9.5rem;73 min-width: 9.5rem;
71 overflow: auto;74 overflow: auto;
75 -webkit-overflow-scrolling: touch;
72 overflow-wrap: break-word;76 overflow-wrap: break-word;
73 flex-shrink: 0;77 flex-shrink: 0;
74 flex-grow: 0;78 flex-grow: 0;
...@@ -79,6 +83,7 @@...@@ -79,6 +83,7 @@
79 .flex-right {83 .flex-right {
80 display: flex;84 display: flex;
81 overflow: auto;85 overflow: auto;
86 -webkit-overflow-scrolling: touch;
82 flex-grow: 1;87 flex-grow: 1;
83 flex-shrink: 1;88 flex-shrink: 1;
84 89
...@@ -175,6 +180,8 @@...@@ -175,6 +180,8 @@
175 border-bottom-color: var(--tx-color);180 border-bottom-color: var(--tx-color);
176 outline: none;181 outline: none;
177 transition: border-bottom-color 0.35s, background 0.35s, box-shadow 0.35s;182 transition: border-bottom-color 0.35s, background 0.35s, box-shadow 0.35s;
183 border-radius: 0;
184 -webkit-appearance: none;
178 }185 }
179 186
180 .docs .search:focus {187 .docs .search:focus {
...@@ -258,12 +265,12 @@...@@ -258,12 +265,12 @@
258 font-weight: bold;265 font-weight: bold;
259 }266 }
260 267
261 #listFnExamples {268 .examples {
262 list-style-type: none;269 list-style-type: none;
263 margin: 0;270 margin: 0;
264 padding: 0;271 padding: 0;
265 }272 }
266 #listFnExamples li {273 .examples li {
267 padding: 0.5em 0;274 padding: 0.5em 0;
268 white-space: nowrap;275 white-space: nowrap;
269 overflow-x: auto;276 overflow-x: auto;
...@@ -435,6 +442,76 @@...@@ -435,6 +442,76 @@
435 }442 }
436 443
437 }444 }
445
446 @media only screen and (max-width: 750px) {
447 .canvas {
448 overflow: auto;
449 }
450 .flex-main {
451 flex-direction: column;
452 display: block;
453 }
454 .sidebar {
455 min-width: calc(100vw - 2.8rem);
456 padding-left: 1.4rem;
457 padding-right: 1.4rem;
458 }
459 .logo {
460 max-width: 6.5rem;
461 }
462 .flex-main > .flex-filler {
463 display: none;
464 }
465 .flex-main > .flex-right > .flex-filler {
466 display: none;
467 }
468 .flex-main > .flex-right > .wrap {
469 max-width: 100vw;
470 }
471 .flex-main > .flex-right > .wrap > .docs {
472 padding-right: 1.4rem;
473 background: transparent;
474 }
475 .packages {
476 display: flex;
477 flex-wrap: wrap;
478 }
479 .table-container table {
480 display: flex;
481 flex-direction: column;
482 }
483 .table-container tr {
484 display: flex;
485 flex-direction: column;
486 }
487 .examples {
488 overflow-x: scroll;
489 -webkit-overflow-scrolling: touch;
490 max-width: 100vw;
491 margin-left: -1.4rem;
492 margin-right: -1.4rem;
493 }
494 .examples li {
495 width: max-content;
496 padding-left: 1.4rem;
497 padding-right: 1.4rem;
498 }
499 .mobile-scroll-container {
500 overflow-x: scroll;
501 -webkit-overflow-scrolling: touch;
502 margin-left: -1.4rem;
503 margin-right: -1.4rem;
504 max-width: 100vw;
505 }
506 .mobile-scroll-container > .scroll-item {
507 margin-left: 1.4rem;
508 margin-right: 1.4rem;
509 box-sizing: border-box;
510 width: max-content;
511 display: inline-block;
512 min-width: calc(100% - 2.8rem);
513 }
514 }
438 </style>515 </style>
439 </head>516 </head>
440 <body class="canvas">517 <body class="canvas">
...@@ -471,7 +548,7 @@...@@ -471,7 +548,7 @@
471 <p id="status">Loading...</p>548 <p id="status">Loading...</p>
472 <div id="sectNav" class="hidden"><ul id="listNav"></ul></div>549 <div id="sectNav" class="hidden"><ul id="listNav"></ul></div>
473 <div id="fnProto" class="hidden">550 <div id="fnProto" class="hidden">
474 <pre id="fnProtoCode"></pre>551 <div class="mobile-scroll-container"><pre id="fnProtoCode" class="scroll-item"></pre></div>
475 </div>552 </div>
476 <h1 id="hdrName" class="hidden"></h1>553 <h1 id="hdrName" class="hidden"></h1>
477 <div id="fnNoExamples" class="hidden">554 <div id="fnNoExamples" class="hidden">
...@@ -518,21 +595,27 @@...@@ -518,21 +595,27 @@
518 </div>595 </div>
519 <div id="sectGlobalVars" class="hidden">596 <div id="sectGlobalVars" class="hidden">
520 <h2>Global Variables</h2>597 <h2>Global Variables</h2>
521 <table>598 <div class="table-container">
522 <tbody id="listGlobalVars"></tbody>599 <table>
523 </table>600 <tbody id="listGlobalVars"></tbody>
601 </table>
602 </div>
524 </div>603 </div>
525 <div id="sectFns" class="hidden">604 <div id="sectFns" class="hidden">
526 <h2>Functions</h2>605 <h2>Functions</h2>
527 <table>606 <div class="table-container">
528 <tbody id="listFns"></tbody>607 <table>
529 </table>608 <tbody id="listFns"></tbody>
609 </table>
610 </div>
530 </div>611 </div>
531 <div id="sectValues" class="hidden">612 <div id="sectValues" class="hidden">
532 <h2>Values</h2>613 <h2>Values</h2>
533 <table>614 <div class="table-container">
534 <tbody id="listValues"></tbody>615 <table>
535 </table>616 <tbody id="listValues"></tbody>
617 </table>
618 </div>
536 </div>619 </div>
537 <div id="sectErrSets" class="hidden">620 <div id="sectErrSets" class="hidden">
538 <h2>Error Sets</h2>621 <h2>Error Sets</h2>
...@@ -540,7 +623,7 @@...@@ -540,7 +623,7 @@
540 </div>623 </div>
541 <div id="fnExamples" class="hidden">624 <div id="fnExamples" class="hidden">
542 <h2>Examples</h2>625 <h2>Examples</h2>
543 <ul id="listFnExamples"></ul>626 <ul id="listFnExamples" class="examples"></ul>
544 </div>627 </div>
545 </section>628 </section>
546 </div>629 </div>
lib/std/special/docs/main.js+2-2
...@@ -1086,7 +1086,7 @@...@@ -1086,7 +1086,7 @@
1086 var fieldNode = zigAnalysis.astNodes[containerNode.fields[i]];1086 var fieldNode = zigAnalysis.astNodes[containerNode.fields[i]];
1087 var divDom = domListFields.children[i];1087 var divDom = domListFields.children[i];
10881088
1089 var html = '<pre>' + escapeHtml(fieldNode.name);1089 var html = '<div class="mobile-scroll-container"><pre class="scroll-item">' + escapeHtml(fieldNode.name);
10901090
1091 if (container.kind === typeKinds.Enum) {1091 if (container.kind === typeKinds.Enum) {
1092 html += ' = <span class="tok-number">' + field + '</span>';1092 html += ' = <span class="tok-number">' + field + '</span>';
...@@ -1099,7 +1099,7 @@...@@ -1099,7 +1099,7 @@
1099 }1099 }
1100 }1100 }
11011101
1102 html += ',</pre>';1102 html += ',</pre></div>';
11031103
1104 var docs = fieldNode.docs;1104 var docs = fieldNode.docs;
1105 if (docs != null) {1105 if (docs != null) {