aboutsummaryrefslogtreecommitdiff
path: root/src/z/Component.zig
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2026-10-08 20:05:11 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2026-10-08 20:05:55 +0200
commit008f090e1de2773d501a8210bd54acc7d977ebf7 (patch)
treef62ab34861970425d1e4666b3f81cc17d84d1e4f /src/z/Component.zig
parent7e22857bc903f24823ae8c02affdd879714c3a26 (diff)
Component: add namespace option
Diffstat (limited to 'src/z/Component.zig')
-rw-r--r--src/z/Component.zig5
1 files changed, 3 insertions, 2 deletions
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 }),
)},
),
};