From 008f090e1de2773d501a8210bd54acc7d977ebf7 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Thu, 8 Oct 2026 20:05:11 +0200 Subject: Component: add namespace option --- src/z/Component.zig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/z') diff --git a/src/z/Component.zig b/src/z/Component.zig index 70d6e1d..408a76b 100644 --- a/src/z/Component.zig +++ b/src/z/Component.zig @@ -6,6 +6,7 @@ const Object = @import("Object.zig"); const Self = @This(); +namespace: []const u8 = "app", name: []const u8, html: Fragment, css: []const u8, @@ -172,7 +173,7 @@ pub fn toElement(self: *const Self) []const Element { .{}, &.{.text( std.fmt.comptimePrint( - \\customElements.define("app-{s}", class extends HTMLElement {{ + \\customElements.define("{s}-{s}", class extends HTMLElement {{ \\ constructor() {{ \\ super(); \\ this.attachShadow({{ mode: 'open' }}); @@ -189,7 +190,7 @@ pub fn toElement(self: *const Self) []const Element { \\ }}); \\ }} \\}}) - , .{ self.name, self.name, self.name }), + , .{ self.namespace, self.name, self.name, self.name }), )}, ), }; -- cgit v1.2.3-70-g09d2