Commit 238ea85b7e

Rocknest <35231115+Rocknest@users.noreply.github.com>
2019-10-10 23:39:08
Fix dark mode
Additionally introduces css variables
1 parent a34b697
Changed files (1)
lib
std
special
lib/std/special/docs/index.html
@@ -5,490 +5,443 @@
     <title>Documentation - Zig</title>
     <link rel="icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAgklEQVR4AWMYWuD7EllJIM4G4g4g5oIJ/odhOJ8wToOxSTXgNxDHoeiBMfA4+wGShjyYOCkG/IGqWQziEzYAoUAeiF9D5U+DxEg14DRU7jWIT5IBIOdCxf+A+CQZAAoopEB7QJwBCBwHiip8UYmRdrAlDpIMgApwQZNnNii5Dq0MBgCxxycBnwEd+wAAAABJRU5ErkJggg==">
     <style type="text/css">
-      .old body {
-        font-family: system-ui, -apple-system, Roboto, "Segoe UI", sans-serif;
-        max-width: 60em;
+      :root {
+        font-size: 1em;
+        --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
+        --mono: "Source Code Pro", monospace;
+        --tx-color: #141414;
+        --bg-color: #ffffff;
+        --link-color: #2A6286;
+        --sidebar-sh-color: rgba(0, 0, 0, 0.09);
+        --search-bg-color: #f3f3f3;
+        --search-bg-color-focus: #ffffff;
+        --search-sh-color: rgba(0, 0, 0, 0.18);
+        --help-sh-color: rgba(0, 0, 0, 0.75);
+      }
+
+      a {
+        text-decoration: none;
       }
-      .old .hidden {
+      
+      a:hover {
+        text-decoration: underline;
+      }
+      
+      .hidden {
         display: none;
       }
-      .old a {
-        color: #2A6286;
+
+      /* layout */
+      .canvas {
+        width: 100vw;
+        height: 100vh;
+        overflow: hidden;
+        margin: 0;
+        padding: 0;
+        font-family: var(--ui);
+        color: var(--tx-color);
+        background-color: var(--bg-color);
       }
-      .old pre{
-        font-family:"Source Code Pro",monospace;
-        font-size:1em;
-        background-color:#F5F5F5;
-        padding:1em;
-        overflow-x: auto;
+
+      .flex-main {
+        display: flex;
+        width: 100%;
+        height: 100%;
+        justify-content: center;
+        
+        z-index: 100;
       }
-      .old code {
-        font-family:"Source Code Pro",monospace;
-        font-size:1em;
+
+      .flex-filler {
+        flex-grow: 1;
+        flex-shrink: 1;
       }
-      .old nav {
-        width: 10em;
-        position: fixed;
-        left: 0;
-        top: 0;
-        height: 100vh;
+
+      .flex-left {
+        width: 12rem;
+        max-width: 15vw;
+        min-width: 9.5rem;
         overflow: auto;
+        overflow-wrap: break-word;
+        flex-shrink: 0;
+        flex-grow: 0;
+        
+        z-index: 300;
       }
-      .old nav h2 {
-        font-size: 1.2em;
-        text-decoration: underline;
-        margin: 0;
-        padding: 0.5em 0;
-        text-align: center;
+
+      .flex-right {
+        display: flex;
+        overflow: auto;
+        flex-grow: 1;
+        flex-shrink: 1;
+        
+        z-index: 200;
+      }
+
+      .flex-right > .wrap {
+        width: 60rem;
+        max-width: 85vw;
+        flex-shrink: 1;
+      }
+      
+      .help-modal {
+        z-index: 400;
+      }
+      
+      /* sidebar */
+      .sidebar {
+        font-size: 1rem;
+        background-color: var(--bg-color);
+        box-shadow: 0 0 1rem var(--sidebar-sh-color);
+      }
+      
+      .sidebar .logo {
+        padding: 0.35rem 0.35rem;
       }
-      .old nav p {
+      
+      .sidebar .logo > img {
+        width: 100%;
+      }
+      
+      .sidebar h2 {
+        margin: 0.5rem;
+        padding: 0;
+        font-size: 1.2rem;
+      }
+      
+      .sidebar h2 > span {
+        border-bottom: 0.125rem dotted var(--tx-color);
+      }
+      
+      .sidebar .packages {
+        list-style-type: none;
         margin: 0;
         padding: 0;
-        text-align: center;
+        background-color: #f1f1f1;
       }
-      .old section {
-        margin-left: 10em;
+      
+      .sidebar .packages > li > a {
+        display: block;
+        padding: 0.5rem 1rem;
+        color: var(--tx-color);
+        text-decoration: none;
       }
-      .old section h1 {
+      
+      .sidebar .packages > li > a:hover {
+        color: #fff;
+        background-color: #555;
+      }
+      
+      .sidebar .packages > li > a.active {
+        color: #000;
+        background-color: #FFBB4D;
+      }
+      
+      .sidebar p.str {
+        margin: 0.5rem;
+        font-family: var(--mono);
+      }
+
+      /* docs section */
+      .docs {
+        padding: 0.7rem 0.7rem 2.4rem 1.4rem;
+        font-size: 1rem;
+        background-color: var(--bg-color);
+        overflow-wrap: break-word;
+      }
+
+      .docs .search {
+        width: 100%;
+        padding: 0.5rem;
+        font-size: 1rem;
+        font-family: var(--ui);
+        color: var(--tx-color);
+        background-color: var(--search-bg-color);
+        border-top: 0;
+        border-left: 0;
+        border-right: 0;
+        border-bottom-width: 0.125rem;
+        border-bottom-style: solid;
+        border-bottom-color: var(--tx-color);
+        outline: none;
+        transition: border-bottom-color 0.35s, background 0.35s, box-shadow 0.35s;
+      }
+      
+      .docs .search:focus {
+        background-color: var(--search-bg-color-focus);
+        border-bottom-color: #ffbb4d;
+        box-shadow: 0 0.3em 1em 0.125em var(--search-sh-color);
+      }
+      
+      .docs .search::placeholder {
+        font-size: 1rem;
+        font-family: var(--ui);
+        color: var(--tx-color);
+        opacity: 0.5;
+      }
+      
+      .docs a {
+        color: var(--link-color);
+      }
+      
+      .docs pre {
+        font-family: var(--mono);
+        font-size:1em;
+        background-color:#F5F5F5;
+        padding:1em;
+        overflow-x: auto;
+      }
+      
+      .docs code {
+        font-family: var(--mono);
+        font-size:1em;
+      }
+      
+      .docs h1 {
         border-bottom: 1px dashed;
       }
-      .old section h2 {
+      
+      .docs  h2 {
         font-size: 1.3em;
         margin: 0.5em 0;
         padding: 0;
         border-bottom: 1px solid;
       }
-      .old #listNav {
+      #listNav {
         list-style-type: none;
         margin: 0.5em 0 0 0;
         padding: 0;
         overflow: hidden;
         background-color: #f1f1f1;
       }
-      .old #listNav li {
+      #listNav li {
         float:left;
       }
-      .old #listNav li a {
+      #listNav li a {
         display: block;
         color: #000;
         text-align: center;
         padding: .5em .8em;
         text-decoration: none;
       }
-      .old #listNav li a:hover {
+      #listNav li a:hover {
         background-color: #555;
         color: #fff;
       }
-      .old #listNav li a.active {
+      #listNav li a.active {
         background-color: #FFBB4D;
         color: #000;
       }
 
-      .old #listPkgs {
-        list-style-type: none;
-        margin: 0;
-        padding: 0;
-        background-color: #f1f1f1;
-      }
-      .old #listPkgs li a {
-        display: block;
-        color: #000;
-        padding: 0.5em 1em;
-        text-decoration: none;
-      }
-      .old #listPkgs li a:hover {
-        background-color: #555;
-        color: #fff;
-      }
-      .old #listPkgs li a.active {
-        background-color: #FFBB4D;
-        color: #000;
-      }
-      .old #logo {
-        width: 8em;
-        padding: 0.5em 1em;
+      #listSearchResults li.selected {
+        background-color: #93e196;
       }
 
-      .old #search {
-        width: 100%;
+      #tableFnErrors dt {
+        font-weight: bold;
       }
 
-      .old #helpDialog {
-        width: 21em;
-        height: 19em;
+      .docs td {
+        vertical-align: top;
+        margin: 0;
+        padding: 0.5em;
+        max-width: 20em;
+        text-overflow: ellipsis;
+        overflow-x: hidden;
+      }
+      
+      /* help dialog */
+      .help-modal {
+        display: flex;
+        width: 100%;
+        height: 100%;
         position: fixed;
         top: 0;
         left: 0;
-        background-color: #333;
+        justify-content: center;
+        align-items: center;
+        background-color: rgba(0, 0, 0, 0.15);
+        backdrop-filter: blur(0.3em);
+      }
+
+      .help-modal > .dialog {
+        max-width: 97vw;
+        max-height: 97vh;
+        overflow: auto;
+        font-size: 1rem;
         color: #fff;
-        border: 1px solid #fff;
+        background-color: #333;
+        border: 0.125rem solid #000;
+        box-shadow: 0 0.5rem 2.5rem 0.3rem var(--help-sh-color);
       }
-      .old #helpDialog h1 {
-        text-align: center;
+      
+      .help-modal h1 {
+        margin: 0.75em 2.5em 1em 2.5em;
         font-size: 1.5em;
+        text-align: center;
       }
-      .old #helpDialog dt, #helpDialog dd {
+      
+      .help-modal dt, .help-modal dd {
         display: inline;
         margin: 0 0.2em;
       }
-      .old kbd {
+      
+      .help-modal dl {
+        margin-left: 0.5em;
+        margin-right: 0.5em;
+      }
+      
+      .help-modal kbd {
+        display: inline-block;
+        padding: 0.3em 0.2em;
+        font-size: 1.2em;
+        font-size: var(--mono);
+        line-height: 0.8em;
+        vertical-align: middle;
         color: #000;
         background-color: #fafbfc;
         border-color: #d1d5da;
         border-bottom-color: #c6cbd1;
+        border: solid 0.0625em;
+        border-radius: 0.1875em;
         box-shadow-color: #c6cbd1;
-        display: inline-block;
-        padding: 0.3em 0.2em;
-        font: 1.2em monospace;
-        line-height: 0.8em;
-        vertical-align: middle;
-        border: solid 1px;
-        border-radius: 3px;
-        box-shadow: inset 0 -1px 0;
+        box-shadow: inset 0 -0.0625em 0;
         cursor: default;
       }
-
-      .old #listSearchResults li.selected {
-        background-color: #93e196;
-      }
-
-      .old #tableFnErrors dt {
-        font-weight: bold;
-      }
-
-      .old td {
-        vertical-align: top;
-        margin: 0;
-        padding: 0.5em;
-        max-width: 20em;
-        text-overflow: ellipsis;
-        overflow-x: hidden;
-      }
-
-      .old .tok-kw {
+      
+      /* tokens */
+      .tok-kw {
           color: #333;
           font-weight: bold;
       }
-      .old .tok-str {
+      .tok-str {
           color: #d14;
       }
-      .old .tok-builtin {
+      .tok-builtin {
           color: #0086b3;
       }
-      .old .tok-comment {
+      .tok-comment {
           color: #777;
           font-style: italic;
       }
-      .old .tok-fn {
+      .tok-fn {
           color: #900;
           font-weight: bold;
       }
-      .old .tok-null {
+      .tok-null {
           color: #008080;
       }
-      .old .tok-number {
+      .tok-number {
           color: #008080;
       }
-      .old .tok-type {
+      .tok-type {
           color: #458;
           font-weight: bold;
       }
-
+      
+      /* dark mode */
       @media (prefers-color-scheme: dark) {
-        .old body{
-          background-color: #111;
-          color: #bbb;
-        }
-        .old a {
-          color: #88f;
+      
+        :root {
+          --tx-color: #bbb;
+          --bg-color: #111;
+          --link-color: #88f;
+          --sidebar-sh-color: rgba(128, 128, 128, 0.09);
+          --search-bg-color: #3c3c3c;
+          --search-bg-color-focus: #000;
+          --search-sh-color: rgba(255, 255, 255, 0.28);
+          --help-sh-color: rgba(142, 142, 142, 0.5);
         }
-        .old pre{
+        
+        .docs pre {
           background-color:#2A2A2A;
         }
-        .old #listNav {
+        #listNav {
           background-color: #333;
         }
-        .old #listNav li a {
+        #listNav li a {
           color: #fff;
         }
-        .old #listNav li a:hover {
+        #listNav li a:hover {
           background-color: #555;
           color: #fff;
         }
-        .old #listNav li a.active {
+        #listNav li a.active {
           background-color: #FFBB4D;
           color: #000;
         }
-        .old #listPkgs {
+        #listPkgs {
           background-color: #333;
         }
-        .old #listPkgs li a {
+        #listPkgs li a {
           color: #fff;
         }
-        .old #listPkgs li a:hover {
+        #listPkgs li a:hover {
           background-color: #555;
           color: #fff;
         }
-        .old #listPkgs li a.active {
+        #listPkgs li a.active {
           background-color: #FFBB4D;
           color: #000;
         }
-        .old #listSearchResults li.selected {
+        #listSearchResults li.selected {
           background-color: #000;
         }
-        .old #listSearchResults li.selected a {
+        #listSearchResults li.selected a {
           color: #fff;
         }
-        .old .tok-kw {
+        .tok-kw {
             color: #eee;
         }
-        .old .tok-str {
+        .tok-str {
             color: #2e5;
         }
-        .old .tok-builtin {
+        .tok-builtin {
             color: #ff894c;
         }
-        .old .tok-comment {
+        .tok-comment {
             color: #aa7;
         }
-        .old .tok-fn {
+        .tok-fn {
             color: #e33;
         }
-        .old .tok-null {
+        .tok-null {
             color: #ff8080;
         }
-        .old .tok-number {
+        .tok-number {
             color: #ff8080;
         }
-        .old .tok-type {
+        .tok-type {
             color: #68f;
         }
-      }
-      
-      /* ------- */
-      .hidden {
-        display: none;
-      }
-      
-      .font-normal {
-        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
-      }
-      
-      .font-mono {
-        font-family: "Source Code Pro", monospace;
-      }
-
-      .canvas {
-        margin: 0;
-        padding: 0;
-        width: 100vw;
-        height: 100vh;
-        overflow: hidden;
-        /*background-color: #fff4ef;*/
-        /*background-color: #f7f7f7;*/
-      }
-
-      .help-flex {
-        position: fixed;
-        top: 0;
-        left: 0;
-        width: 100%;
-        height: 100%;
-        display: flex;
-        justify-content: center;
-        align-items: center;
-        background-color: rgba(0, 0, 0, 0.15);
-        
-        z-index: 400;
-      }
-
-      .help-modal {
-        max-width: 97vw;
-        max-height: 97vh;
-        background-color: #333;
-        color: #fff;
-        border: 0.125em solid #000;
-        box-shadow: 0 0.5em 2.5em 0.3em rgba(0, 0, 0, 0.75);
-        overflow: auto;
-      }
-      
-      .help-modal h1 {
-        text-align: center;
-        font-size: 1.5em;
-        margin: 0.75em 2.5em 1em 2.5em;
-      }
-      
-      dt, dd {
-        display: inline;
-        margin: 0 0.2em;
-      }
-      
-      dl {
-        margin-left: 0.5em;
-        margin-right: 0.5em;
-      }
-      
-      kbd {
-        color: #000;
-        background-color: #fafbfc;
-        border-color: #d1d5da;
-        border-bottom-color: #c6cbd1;
-        box-shadow-color: #c6cbd1;
-        display: inline-block;
-        padding: 0.3em 0.2em;
-        font: 1.2em monospace;
-        line-height: 0.8em;
-        vertical-align: middle;
-        border: solid 1px;
-        border-radius: 3px;
-        box-shadow: inset 0 -1px 0;
-        cursor: default;
-      }
-
-      .main-flex {
-        width: 100%;
-        height: 100%;
-        display: flex;
-        justify-content: center;
-        
-        z-index: 100;
-      }
-
-      .flex-filler {
-        flex-grow: 1;
-        flex-shrink: 1;
-      }
-
-      .nav {
-        width: 12em;
-        overflow: auto;
-        max-width: 15vw;
-        min-width: 9.5em;
-        flex-shrink: 0;
-        flex-grow: 0;
-        background: #fff;
-        box-shadow: 0 0 1em rgba(0, 0, 0, 0.09);
-        overflow-wrap: break-word;
         
-        z-index: 300;
-      }
-      
-      nav h2 {
-        font-size: 1.2em;
-        margin: 0.5em;
-        padding: 0;
-      }
-      
-      nav h2 > span {
-        border-bottom: 0.125em dotted #000;
-      }
-      
-      nav p {
-        margin: 0.5em;
       }
-      
-      .logo-wrap {
-        padding: 0.35em 0.35em;
-      }
-      
-      .logo {
-        width: 100%;
-      }
-
-      .right-flex {
-        display: flex;
-        overflow: auto;
-        flex-grow: 1;
-        flex-shrink: 1;
-        
-        z-index: 200;
-      }
-
-      .right-wrap {
-        width: 60em;
-        max-width: 85vw;
-        flex-shrink: 1;
-      }
-
-      .section-docs {
-        padding: 0.7em 0.7em 2.4em 1.4em;
-        background: #fff;
-        overflow-wrap: break-word;
-      }
-
-      .search {
-        width: 100%;
-        padding: 0.5em;
-        font-size: 1em;
-        background: #f3f3f3;
-        border-top: 0;
-        border-left: 0;
-        border-right: 0;
-        border-bottom-width: 0.125em;
-        border-bottom-style: solid;
-        border-bottom-color: #000;
-        outline: none;
-        transition: border-bottom-color 0.35s, background 0.35s, box-shadow 0.35s;
-      }
-      
-      .search:focus {
-        border-bottom-color: #ffbb4d;
-        background: white;
-        box-shadow: 0 0.3em 1em 0.125em rgba(0, 0, 0, 0.18);
-      }
-      
-      .search::placeholder {
-        color: #000;
-        opacity: 0.5;
-      }
-
-      /*section.section-docs h1 {
-        text-decoration: none;
-        border-bottom: 0.125em dashed #717171;
-        display: inline-block;
-        font-size: 1.35em;
-        max-width: 100%;
-        margin: 0.8em 0;
-      }
-      
-      section.section-docs h2 {
-        font-size: 1.2em;
-        margin: 0.5em 0;
-        padding: 0;
-        text-decoration: none;
-        border-bottom: 0.125em solid #717171;
-        display: inline-block;
-        max-width: 100%;
-      }
-      
-      table {
-        border: 1px solid red;
-      }*/
     </style>
   </head>
-  <body class="canvas font-normal">
-    <div class="main-flex">
+  <body class="canvas">
+    <div class="flex-main">
       <div class="flex-filler"></div>
-      <nav class="nav">
-        <div class="logo-wrap">
-          <img alt="ZIG" class="logo" id="logo" src="data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAxNTAgMTAwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxnIGZpbGw9IiNmN2E0MWQiPjxwYXRoIGQ9Im0wIDEwdjgwaDE5bDYtMTAgMTItMTBoLTE3di00MGgxNXYtMjB6bTQwIDB2MjBoNjJ2LTIwem05MSAwLTYgMTAtMTIgMTBoMTd2NDBoLTE1djIwaDM1di04MHptLTgzIDYwdjIwaDYydi0yMHoiIHNoYXBlLXJlbmRlcmluZz0iY3Jpc3BFZGdlcyIvPjxwYXRoIGQ9Im0zNyA3MC0xOCAyMHYtMTV6Ii8+PHBhdGggZD0ibTExMyAzMCAxOC0yMHYxNXoiLz48cGF0aCBkPSJtOTYuOTggMTAuNjMgMzYuMjgtMTAuNC04MC4yOSA4OS4xNy0zNi4yOCAxMC40eiIvPjwvZz48L3N2Zz4K"></img>
-        </div>
-        <div id="sectPkgs" class="old hidden">
-          <h2><span>Packages</span></h2>
-          <ul id="listPkgs">
-          </ul>
-        </div>
-        <div id="sectInfo" class="hidden">
-          <h2><span>Zig Version</span></h2>
-          <p class="font-mono" id="tdZigVer"></p>
-          <h2><span>Target</span></h2>
-          <p class="font-mono" id="tdTarget"></p>
-        </div>
-      </nav>
-      <div class="right-flex">
-        <div class="right-wrap">
-          <section class="old section-docs">
-            <input type="search" class="search font-normal" id="search" autocomplete="off" spellcheck="false" placeholder="`s` to search, `?` to see more options">
+      <div class="flex-left sidebar">
+        <nav>
+          <div class="logo">
+            <img alt="ZIG" id="logo" src="data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAxNTAgMTAwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxnIGZpbGw9IiNmN2E0MWQiPjxwYXRoIGQ9Im0wIDEwdjgwaDE5bDYtMTAgMTItMTBoLTE3di00MGgxNXYtMjB6bTQwIDB2MjBoNjJ2LTIwem05MSAwLTYgMTAtMTIgMTBoMTd2NDBoLTE1djIwaDM1di04MHptLTgzIDYwdjIwaDYydi0yMHoiIHNoYXBlLXJlbmRlcmluZz0iY3Jpc3BFZGdlcyIvPjxwYXRoIGQ9Im0zNyA3MC0xOCAyMHYtMTV6Ii8+PHBhdGggZD0ibTExMyAzMCAxOC0yMHYxNXoiLz48cGF0aCBkPSJtOTYuOTggMTAuNjMgMzYuMjgtMTAuNC04MC4yOSA4OS4xNy0zNi4yOCAxMC40eiIvPjwvZz48L3N2Zz4K"></img>
+          </div>
+          <div id="sectPkgs" class="hidden">
+            <h2><span>Packages</span></h2>
+            <ul id="listPkgs" class="packages"></ul>
+          </div>
+          <div id="sectInfo" class="hidden">
+            <h2><span>Zig Version</span></h2>
+            <p class="str" id="tdZigVer"></p>
+            <h2><span>Target</span></h2>
+            <p class="str" id="tdTarget"></p>
+          </div>
+        </nav>
+      </div>
+      <div class="flex-right">
+        <div class="wrap">
+          <section class="docs">
+            <input type="search" class="search" id="search" autocomplete="off" spellcheck="false" placeholder="`s` to search, `?` to see more options">
             <p id="status">Loading...</p>
             <div id="sectNav" class="hidden"><ul id="listNav"></ul></div>
             <div id="fnProto" class="hidden">
@@ -562,8 +515,8 @@
       </div>
     </div>
     <div id="helpDialog" class="hidden">
-      <div class="help-flex">
-        <div class="help-modal">
+      <div class="help-modal">
+        <div class="dialog">
           <h1>Keyboard Shortcuts</h1>
           <dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd></dl>
           <dl><dt><kbd>Esc</kbd></dt><dd>Clear focus; close this dialog</dd></dl>