@navservice/core 1.110.0 → 1.111.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/es/index.js
CHANGED
|
@@ -694,6 +694,39 @@ class _hooks {
|
|
|
694
694
|
localStorage.setItem("theme", "light");
|
|
695
695
|
}
|
|
696
696
|
}
|
|
697
|
+
use_set_show_component() {
|
|
698
|
+
function aplicarVisibilidadeElemento(el) {
|
|
699
|
+
const valor = el.getAttribute("set-show-component");
|
|
700
|
+
if ("ocultar" === valor) el.style.display = "none";
|
|
701
|
+
else if ("exibir" === valor) el.style.display = "";
|
|
702
|
+
}
|
|
703
|
+
function aplicarVisibilidade(node = document) {
|
|
704
|
+
const elementos = node.querySelectorAll("[set-show-component]");
|
|
705
|
+
elementos.forEach(aplicarVisibilidadeElemento);
|
|
706
|
+
}
|
|
707
|
+
document.addEventListener("DOMContentLoaded", ()=>{
|
|
708
|
+
aplicarVisibilidade();
|
|
709
|
+
const observer = new MutationObserver((mutations)=>{
|
|
710
|
+
mutations.forEach((mutation)=>{
|
|
711
|
+
mutation.addedNodes.forEach((node)=>{
|
|
712
|
+
if (node instanceof HTMLElement) {
|
|
713
|
+
if (node.hasAttribute("set-show-component")) aplicarVisibilidadeElemento(node);
|
|
714
|
+
aplicarVisibilidade(node);
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
if ("attributes" === mutation.type && mutation.target instanceof HTMLElement && "set-show-component" === mutation.attributeName) aplicarVisibilidadeElemento(mutation.target);
|
|
718
|
+
});
|
|
719
|
+
});
|
|
720
|
+
observer.observe(document.body, {
|
|
721
|
+
childList: true,
|
|
722
|
+
subtree: true,
|
|
723
|
+
attributes: true,
|
|
724
|
+
attributeFilter: [
|
|
725
|
+
"set-show-component"
|
|
726
|
+
]
|
|
727
|
+
});
|
|
728
|
+
});
|
|
729
|
+
}
|
|
697
730
|
}
|
|
698
731
|
const utils_hooks = new _hooks;
|
|
699
732
|
const _environment = class {
|
package/build/lib/index.cjs
CHANGED
|
@@ -872,6 +872,48 @@ class _hooks {
|
|
|
872
872
|
localStorage.setItem("theme", "light");
|
|
873
873
|
}
|
|
874
874
|
}
|
|
875
|
+
use_set_show_component() {
|
|
876
|
+
function aplicarVisibilidadeElemento(el) {
|
|
877
|
+
const valor = el.getAttribute("set-show-component");
|
|
878
|
+
if (valor === "ocultar") {
|
|
879
|
+
el.style.display = "none";
|
|
880
|
+
} else if (valor === "exibir") {
|
|
881
|
+
el.style.display = "";
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
function aplicarVisibilidade(node = document) {
|
|
885
|
+
const elementos = node.querySelectorAll("[set-show-component]");
|
|
886
|
+
elementos.forEach(aplicarVisibilidadeElemento);
|
|
887
|
+
}
|
|
888
|
+
document.addEventListener("DOMContentLoaded", ()=>{
|
|
889
|
+
aplicarVisibilidade();
|
|
890
|
+
const observer = new MutationObserver((mutations)=>{
|
|
891
|
+
mutations.forEach((mutation)=>{
|
|
892
|
+
// 🔹 Se adicionou elemento novo
|
|
893
|
+
mutation.addedNodes.forEach((node)=>{
|
|
894
|
+
if (node instanceof HTMLElement) {
|
|
895
|
+
if (node.hasAttribute("set-show-component")) {
|
|
896
|
+
aplicarVisibilidadeElemento(node);
|
|
897
|
+
}
|
|
898
|
+
aplicarVisibilidade(node);
|
|
899
|
+
}
|
|
900
|
+
});
|
|
901
|
+
// 🔹 Se alterou o atributo
|
|
902
|
+
if (mutation.type === "attributes" && mutation.target instanceof HTMLElement && mutation.attributeName === "set-show-component") {
|
|
903
|
+
aplicarVisibilidadeElemento(mutation.target);
|
|
904
|
+
}
|
|
905
|
+
});
|
|
906
|
+
});
|
|
907
|
+
observer.observe(document.body, {
|
|
908
|
+
childList: true,
|
|
909
|
+
subtree: true,
|
|
910
|
+
attributes: true,
|
|
911
|
+
attributeFilter: [
|
|
912
|
+
"set-show-component"
|
|
913
|
+
]
|
|
914
|
+
});
|
|
915
|
+
});
|
|
916
|
+
}
|
|
875
917
|
}
|
|
876
918
|
/* export default */ const utils_hooks = (new _hooks);
|
|
877
919
|
|