feat(build): accept domain ids on keyed targets

Let generated string-keyed targets accept displayable domain ids directly, removing caller-side to_string noise from keyed partial append/replace flows.

req: codegen/002

req: dx/006
This commit is contained in:
slhx agent
2026-06-02 07:34:00 +02:00
parent dfd8020617
commit 339ca769fb
3 changed files with 8 additions and 6 deletions
+6 -4
View File
@@ -426,10 +426,12 @@ impl Resources {
out.push_str(&format!("{inner} pub const fn new(slot: ::slhx::KeyedSlot<K, T>) -> Self {{ Self {{ slot }} }}\n"));
out.push_str(&format!("{inner} pub const fn slot(self) -> ::slhx::KeyedSlot<K, T> {{ self.slot }}\n"));
out.push_str(&format!("{inner} pub const fn id(self) -> ::slhx::ResourceId {{ self.slot.id() }}\n"));
out.push_str(&format!("{inner} pub fn append(self, key: K, view: &impl ::hemplate::Hemplate) -> impl ::slhx::IntoEffect {{ super::append(self.slot, key, view) }}\n"));
out.push_str(&format!("{inner} pub fn prepend(self, key: K, view: &impl ::hemplate::Hemplate) -> impl ::slhx::IntoEffect {{ super::prepend(self.slot, key, view) }}\n"));
out.push_str(&format!("{inner} pub fn replace(self, key: K, view: &impl ::hemplate::Hemplate) -> impl ::slhx::IntoEffect {{ super::replace(self.slot, key, view) }}\n"));
out.push_str(&format!("{inner} pub fn remove(self, key: K) -> impl ::slhx::IntoEffect {{ self.slot.remove(key) }}\n"));
out.push_str(&format!("{inner}}}\n"));
out.push_str(&format!("{inner}impl<T> KeyedSlotTarget<::std::string::String, T> {{\n"));
out.push_str(&format!("{inner} pub fn append(self, key: impl ::std::string::ToString, view: &impl ::hemplate::Hemplate) -> impl ::slhx::IntoEffect {{ self.slot.append_html(key.to_string(), super::render(view)) }}\n"));
out.push_str(&format!("{inner} pub fn prepend(self, key: impl ::std::string::ToString, view: &impl ::hemplate::Hemplate) -> impl ::slhx::IntoEffect {{ self.slot.prepend_html(key.to_string(), super::render(view)) }}\n"));
out.push_str(&format!("{inner} pub fn replace(self, key: impl ::std::string::ToString, view: &impl ::hemplate::Hemplate) -> impl ::slhx::IntoEffect {{ self.slot.replace_html(key.to_string(), super::render(view)) }}\n"));
out.push_str(&format!("{inner} pub fn remove(self, key: impl ::std::string::ToString) -> impl ::slhx::IntoEffect {{ self.slot.remove(key.to_string()) }}\n"));
out.push_str(&format!("{inner}}}\n"));
for res in self.slots.values().filter(|res| component_matches(res, component)) {
if res.keyed {