diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2026-10-08 20:05:11 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2026-10-08 20:05:55 +0200 |
| commit | 008f090e1de2773d501a8210bd54acc7d977ebf7 (patch) | |
| tree | f62ab34861970425d1e4666b3f81cc17d84d1e4f /src/z | |
| parent | 7e22857bc903f24823ae8c02affdd879714c3a26 (diff) | |
Component: add namespace option
Diffstat (limited to 'src/z')
| -rw-r--r-- | src/z/Component.zig | 5 |
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 }), )}, ), }; |