diff options
Diffstat (limited to 'src/z/root.zig')
| -rw-r--r-- | src/z/root.zig | 63 |
1 files changed, 13 insertions, 50 deletions
diff --git a/src/z/root.zig b/src/z/root.zig index 1fa8d99..6ca6302 100644 --- a/src/z/root.zig +++ b/src/z/root.zig @@ -1,56 +1,19 @@ -const std = @import("std"); +const builtin = @import("builtin"); -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 wasm = wasm_struct: { + if (builtin.target.cpu.arch.isWasm()) { + break :wasm_struct struct { + pub const env = @import("env/root.zig"); + pub const Env = @import("Env/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; + export const bit_length: u8 = @sizeOf(usize); + }; } - 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; + break :wasm_struct struct {}; +}; - return element; -} +pub const env = wasm.env; +pub const Env = wasm.Env; -test { - _ = std.testing.refAllDecls(@This()); -} +pub const app = @import("app/root.zig"); |