diff --git a/.gitignore b/.gitignore index be9c312a..61f24bc4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .zig-cache zig-out -.zx \ No newline at end of file +.zx +tmp \ No newline at end of file diff --git a/build.zig.zon b/build.zig.zon index 579cf0cf..d06c1dc9 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -1,6 +1,6 @@ .{ .name = .zx, - .version = "0.0.1-dev.23", + .version = "0.0.1-dev.24", .fingerprint = 0xcad77a8d2a3389f2, .minimum_zig_version = "0.15.2", .dependencies = .{ diff --git a/site/assets/doc.css b/site/assets/doc.css index 9bc2574d..fbde3aaa 100644 --- a/site/assets/doc.css +++ b/site/assets/doc.css @@ -65,6 +65,26 @@ body { border-bottom: 2px solid var(--border-color); } +.nav-header-top { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 0.25rem; +} + +.source-code-link { + font-size: 0.875rem; + color: var(--link-color); + text-decoration: none; + font-weight: 500; + transition: color 0.2s; +} + +.source-code-link:hover { + color: #0052a3; + text-decoration: underline; +} + .nav-header h1 { font-size: 2rem; font-weight: 700; @@ -84,6 +104,59 @@ body { .nav-menu li { border-bottom: 1px solid var(--border-color); + position: relative; +} + +.nav-item-with-submenu { + position: relative; +} + +.nav-parent { + display: flex; + justify-content: space-between; + align-items: center; +} + +.submenu-arrow { + font-size: 0.7em; + transition: transform 0.2s; + margin-left: auto; +} + +.nav-item-with-submenu:hover .submenu-arrow, +.nav-item-with-submenu:focus-within .submenu-arrow { + transform: rotate(180deg); +} + +.nav-submenu { + list-style: none; + padding: 0; + max-height: 0; + overflow: hidden; + transition: max-height 0.3s ease-out; + background: rgba(0, 0, 0, 0.02); +} + +.nav-item-with-submenu:hover .nav-submenu, +.nav-item-with-submenu:focus-within .nav-submenu { + max-height: 200px; + transition: max-height 0.3s ease-in; +} + +.nav-submenu li { + border-bottom: none; + border-top: 1px solid rgba(0, 0, 0, 0.05); +} + +.nav-submenu a { + padding-left: 3rem; + font-size: 0.9em; + color: #666; +} + +.nav-submenu a:hover { + background: rgba(0, 102, 204, 0.05); + border-left-color: var(--link-color); } .nav-menu a { @@ -100,6 +173,7 @@ body { border-left-color: var(--link-color); } + /* Main Content */ .content { margin-left: var(--sidebar-width); @@ -115,14 +189,22 @@ body { scroll-margin-top: 2rem; } -.section h2 { - font-size: 2rem; - font-weight: 700; +.section-header { + display: flex; + justify-content: space-between; + align-items: center; margin-bottom: 1.5rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--border-color); } +.section h2 { + font-size: 2rem; + font-weight: 700; + margin: 0; + flex: 1; +} + .section h3 { font-size: 1.5rem; font-weight: 600; @@ -141,6 +223,44 @@ body { margin-bottom: 1rem; } +/* Source Code Badge */ +.source-code-badge { + display: inline-block; + margin-left: 1rem; +} + +.source-code-badge-link { + display: inline-flex; + align-items: center; + gap: 0.5rem; + padding: 0.5rem 1rem; + background: #f6f8fa; + border: 1px solid var(--border-color); + border-radius: 6px; + color: var(--text-color); + text-decoration: none; + font-size: 0.875rem; + font-weight: 500; + transition: all 0.2s ease; +} + +.source-code-badge-link:hover { + background: #eaeef2; + border-color: #d0d7de; + color: var(--link-color); + text-decoration: none; +} + +.source-code-badge-link svg { + flex-shrink: 0; + width: 16px; + height: 16px; +} + +.source-code-badge-link span { + white-space: nowrap; +} + .section ul { margin-left: 2rem; margin-bottom: 1rem; @@ -790,6 +910,16 @@ code[class*="language-"] { font-size: 0.85em; } + .section-header { + flex-direction: column; + align-items: flex-start; + gap: 1rem; + } + + .source-code-badge { + margin-left: 0; + } + .section h2 { font-size: 1.5rem; } @@ -867,6 +997,16 @@ code[class*="language-"] { font-size: 0.8em; } + .section-header { + flex-direction: column; + align-items: flex-start; + gap: 1rem; + } + + .source-code-badge { + margin-left: 0; + } + .section h2 { font-size: 1.5rem; } diff --git a/site/build.zig.zon b/site/build.zig.zon index 837a297d..7dbe0040 100644 --- a/site/build.zig.zon +++ b/site/build.zig.zon @@ -10,7 +10,7 @@ }, .zx = .{ .url = "../", - .hash = "zx-0.0.1-dev.13-8okzKgkxAgD4YtDI6QCVIt-Rn9t8-SVR3w9xvA2dYoOk", + .hash = "zx-0.0.1-dev.23-8okzKlZXAgCczvT0Fb0y5HglAXl7PjbTf7KalHyuMuVb", }, }, .paths = .{ diff --git a/site/pages/doc/page.zx b/site/pages/doc/page.zx index 0bfed75e..94395c1e 100644 --- a/site/pages/doc/page.zx +++ b/site/pages/doc/page.zx @@ -1,5 +1,4 @@ pub fn Page(allocator: zx.Allocator) zx.Component { - // If example var aw_if: std.io.Writer.Allocating = .init(allocator); const zx_example_if = @embedFile("../../../pages/doc/example/if.zx"); @@ -52,6 +51,10 @@ pub fn Page(allocator: zx.Allocator) zx.Component { const txt_expr = "{expression}"; const fmt_expr = "{[expression:format]}"; + var aw_icon_svg_base64: std.io.Writer.Allocating = .init(allocator); + std.base64.standard.Encoder.encodeWriter(&aw_icon_svg_base64.writer, @embedFile("../../public/zx-icon.svg")) catch unreachable; + const icon_href = std.fmt.allocPrint(allocator, "data:image/svg+xml;base64,{s}", .{aw_icon_svg_base64.written()}) catch unreachable; + return (
@@ -60,6 +63,7 @@ pub fn Page(allocator: zx.Allocator) zx.Component {