╭ changed ───╮ │src/main.zig│ ╰────────────╯ ╭────────────────────────────────────────╮ │1 const std = @import("std"); │ │2 -const builtin = @import("builtin"); │ │2 const xit = @import("xit"); │ │3 const rp = xit.repo; │ │4 const cmd = @import("./command.zig");│ ╰────────────────────────────────────────╯ ╭ changed ────────╮ │src/main_wasm.zig│ ╰─────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────╮ │75 │ │76 const html = try web.generateHtml(allocator, root_ptr); │ │77 defer allocator.free(html); │ │78 - setHtml(html); │ │78 + _setHtml(html.ptr, @intCast(html.len)); │ │79 │ │80 // emit the overlay (form + inputs + button) on every tick so the wasm│ │81 // layout drives positions, not just the server's initial render. JS │ ╰──────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────╮ │85 // form submission. │ │86 const overlay = try web.generateOverlay(allocator, root_ptr, &session);│ │87 defer allocator.free(overlay); │ │88 - setOverlay(overlay); │ │88 + _setOverlay(overlay.ptr, @intCast(overlay.len)); │ │89 │ │90 const root_focus = root_ptr.getFocus(); │ │91 if (root_focus.grandchild_id) |gid| { │ ╰───────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────╮ │130 // follow a cross-page link │ │131 if (ui.crossPageLink(root_ptr.getFocus(), gid, session.data.current_page)) |route| {│ │132 const url = try route.urlAlloc(&page_arena); │ │133 - navigate(url); │ │133 + _navigate(url.ptr, @intCast(url.len)); │ │134 return; │ │135 } │ │136 } │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ │144 // follow a cross-page link │ │145 if (ui.crossPageLink(root_ptr.getFocus(), focus_id, session.data.current_page)) |route| {│ │146 const url = try route.urlAlloc(&page_arena); │ │147 - navigate(url); │ │147 + _navigate(url.ptr, @intCast(url.len)); │ │148 return; │ │149 } │ │150 root_ptr.getFocus().setFocus(focus_id); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────╮ │157 │ │158 fn consoleLog(arg: []const u8) void { │ │159 _consoleLog(arg.ptr, @intCast(arg.len)); │ │160 -} │ │161 - │ │162 -fn setHtml(arg: []const u8) void { │ │163 - _setHtml(arg.ptr, @intCast(arg.len)); │ │164 -} │ │165 - │ │166 -fn setOverlay(arg: []const u8) void { │ │167 - _setOverlay(arg.ptr, @intCast(arg.len)); │ │160 } │ │161 │ │170 -fn navigate(arg: []const u8) void { │ │171 - _navigate(arg.ptr, @intCast(arg.len)); │ │172 -} │ │173 - │ │162 extern fn _consoleLog(arg: [*]const u8, len: u32) void;│ │163 extern fn _setHtml(arg: [*]const u8, len: u32) void; │ │164 extern fn _setOverlay(arg: [*]const u8, len: u32) void;│ ╰────────────────────────────────────────────────────────────╯ ╭ changed ─╮ │src/ui.zig│ ╰──────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │217 pub fn slice(self: *const Array(max_len)) []const u8 { │ │218 return self.bytes[0..self.len]; │ │219 } │ │220 - }; │ │221 - } │ │222 - │ │223 - pub fn url(comptime self: RoutablePage) []const u8 { │ │224 - return switch (self) { │ │225 - .home_users => "/users", │ │226 - .home_repos => "/repos", │ │227 - .home_settings => "/settings", │ │228 - .home_auth => "/auth", │ │229 - .user_repos, .user_settings, .user_auth => @compileError("user routes are dynamic; use urlAlloc"), │ │230 - .repo_files, .repo_commits, .repo_refs, .repo_settings, .repo_auth => @compileError("repo routes are dynamic; use urlAlloc"),│ │220 }; │ │221 } │ │222 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │224 return switch (self) { │ │225 .home_users => |after| if (after == 0) @as([]const u8, "/users") else try std.fmt.allocPrint(arena.allocator(), "/users?after={d}", .{after}),│ │226 .home_repos => |after| if (after == 0) @as([]const u8, "/repos") else try std.fmt.allocPrint(arena.allocator(), "/repos?after={d}", .{after}),│ │227 + .home_settings => "/settings", │ │228 + .home_auth => "/auth", │ │229 .user_repos => |u| if (u.after == 0) │ │230 try std.fmt.allocPrint(arena.allocator(), user_segment ++ "{s}/repos", .{u.name.slice()}) │ │231 else │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │246 try std.fmt.allocPrint(arena.allocator(), repo_segment ++ "{s}/refs?kind={s}&after={d}", .{ r.name.slice(), @tagName(r.kind), r.after }),│ │247 .repo_settings => |name| try std.fmt.allocPrint(arena.allocator(), repo_segment ++ "{s}/settings", .{name.slice()}), │ │248 .repo_auth => |name| try std.fmt.allocPrint(arena.allocator(), repo_segment ++ "{s}/auth", .{name.slice()}), │ │258 - inline else => |_, tag| url(tag), │ │249 }; │ │250 } │ │251 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ───────╮ │src/ui/input.zig│ ╰────────────────╯ ╭─────────────────────────────────────────────────────────────╮ │61 } │ │62 return if (new_tab != current_tab) new_tab else null;│ │63 } │ │64 + │ ╰─────────────────────────────────────────────────────────────╯