aboutsummaryrefslogtreecommitdiff
path: root/src/z/App/root.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/z/App/root.zig')
-rw-r--r--src/z/App/root.zig22
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(),