blob: 3211335fa5455d0cd6586eb6dd76fad03f50ac72 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
const std = @import("std");
const html = @import("html");
const z = @import("root.zig");
name: @EnumLiteral(),
body: []const u8,
style: []const u8,
script: []const u8,
pub fn toElement(comptime self: @This()) html.Element {
return .transparent(.children(&.{
.native(.template, .{ .id = "@" ++ @tagName(self.name) }, .children(&.{
z.style.load(self.style),
z.body.load(self.body),
})),
z.script.load("Zenv.constructors['component__" ++ @tagName(self.name) ++ "'] = (Z) => {" ++ self.script ++ "}"),
}));
}
|