diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2026-10-07 00:09:34 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2026-10-07 00:09:34 +0200 |
| commit | 4e86e3e18e9b43e442a35361ac82b30dd6c0103a (patch) | |
| tree | c37d84000608386147b910dd41df5743e947fd93 /src/z/App/root.zig | |
| parent | 12a02f161504b49a54243bed996df6b44e25b7b4 (diff) | |
wasm implement components
Diffstat (limited to 'src/z/App/root.zig')
| -rw-r--r-- | src/z/App/root.zig | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/z/App/root.zig b/src/z/App/root.zig index 326f3c0..a3d0916 100644 --- a/src/z/App/root.zig +++ b/src/z/App/root.zig @@ -1,10 +1,13 @@ const builtin = @import("builtin"); const std = @import("std"); -const h = @import("html"); +const h = @import("../html.zig"); +const Component = @import("../root.zig").Component; pub const Options = struct { name: []const u8, globals: []const Global, + components: []const Component, + body: h.Element, pub const Global = struct { name: []const u8, @@ -37,6 +40,12 @@ pub fn App(comptime options: Options) type { }, pub const init: @This() = .{}; + + comptime { + for (options.components) |component| { + component.exportLinks(); + } + } }; } else { return struct { @@ -63,6 +72,17 @@ pub fn App(comptime options: Options) type { break :reg register_code; })), .native(.script, .{}, .content(@embedFile("main.js"))), + .transparent(.children(comp: { + var cs: []const h.Element = &.{}; + + for (options.components) |component| { + const c: []const h.Element = &.{component.toElement()}; + cs = cs ++ c; + } + + break :comp cs; + })), + options.body, })), })).toDocument(), |