use web_sys::Element;
pub fn stamp_plugin_host_state(viewer: &Element, plugin: &Element) {
let _ = plugin.toggle_attribute_with_force("settings", viewer.has_attribute("settings"));
let _ = plugin
.class_list()
.toggle_with_force("shift-active", viewer.class_list().contains("shift-active"));
}
pub fn stamp_plugin_host_state_all(viewer: &Element) {
let children = viewer.children();
for i in 0..children.length() {
let Some(el) = children.item(i) else {
continue;
};
let is_plugin = el.tag_name().starts_with("PERSPECTIVE-VIEWER-")
&& el
.get_attribute("slot")
.is_some_and(|slot| !slot.starts_with("tab-"));
if is_plugin {
stamp_plugin_host_state(viewer, &el);
}
}
}