diff options
Diffstat (limited to 'src/z/root.zig')
| -rw-r--r-- | src/z/root.zig | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/src/z/root.zig b/src/z/root.zig deleted file mode 100644 index 1fa8d99..0000000 --- a/src/z/root.zig +++ /dev/null @@ -1,56 +0,0 @@ -const std = @import("std"); - -pub const Minifier = @import("Minifier.zig"); -pub const Component = @import("Component.zig"); -pub const File = @import("File.zig"); -pub const parser = @import("parser/root.zig"); - -const Element = @import("html").Element; - -pub const script: File = .{ - .tag = .script, - .minifier = .js, -}; -pub const style: File = .{ - .tag = .style, - .minifier = .css, -}; -pub const body: File = .{ - .tag = .body, - .minifier = .html, -}; - -pub const html: File = .{ - .tag = null, - .minifier = .html, -}; - -pub fn env(comptime components: []const Component) Element { - var children: []const Element = &.{ - script.load(@embedFile("z.js")), - script.load(@embedFile("rest.js")), - }; - - inline for (components) |c| { - const child: []const Element = &.{c.toElement()}; - children = children ++ child; - } - - return .transparent(.children(children)); -} - -pub fn component(kind: @EnumLiteral(), attrs: anytype, content: Element.Content) Element { - var element: Element = .native(.@"z-component", attrs, content); - - const type_attr: []const Element.Attribute = &.{.{ - .name = "type", - .value = @tagName(kind), - }}; - element.attributes = type_attr ++ element.attributes; - - return element; -} - -test { - _ = std.testing.refAllDecls(@This()); -} |