@navservice/core 1.109.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.
@@ -298,6 +298,7 @@ const _token = new class {
298
298
  plano_status: payload?.plano_status
299
299
  };
300
300
  c.set("usuario_auth", setar_token);
301
+ c.set("token", token);
301
302
  return await next();
302
303
  } catch (error) {
303
304
  return _set_response.c.INVALID_TOKEN({
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 {
@@ -17,6 +17,7 @@ declare namespace t {
17
17
  };
18
18
  Variables: {
19
19
  usuario_auth: TypeControllerUsuario.TokenPayload;
20
+ token: string;
20
21
  };
21
22
  };
22
23
  type Context = HonoContext<Env>;
@@ -1,6 +1,7 @@
1
1
  declare class _hooks {
2
2
  use_is_mobile(): boolean;
3
3
  use_dark_mode(): void;
4
+ use_set_show_component(): void;
4
5
  }
5
6
  declare const _default: _hooks;
6
7
  export default _default;
@@ -177,6 +177,7 @@ declare const utils: {
177
177
  hooks: {
178
178
  use_is_mobile(): boolean;
179
179
  use_dark_mode(): void;
180
+ use_set_show_component(): void;
180
181
  };
181
182
  environment: {
182
183
  set(key: import("..").TypesCore.Geral.BaseUrl, props: string): void;
@@ -365,6 +365,7 @@ const _token = new class _token {
365
365
  plano_status: payload?.plano_status
366
366
  };
367
367
  c.set("usuario_auth", setar_token);
368
+ c.set("token", token);
368
369
  return await next();
369
370
  } catch (error) {
370
371
  return _set_response.c.INVALID_TOKEN({
@@ -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
 
@@ -17,6 +17,7 @@ declare namespace t {
17
17
  };
18
18
  Variables: {
19
19
  usuario_auth: TypeControllerUsuario.TokenPayload;
20
+ token: string;
20
21
  };
21
22
  };
22
23
  type Context = HonoContext<Env>;
@@ -1,6 +1,7 @@
1
1
  declare class _hooks {
2
2
  use_is_mobile(): boolean;
3
3
  use_dark_mode(): void;
4
+ use_set_show_component(): void;
4
5
  }
5
6
  declare const _default: _hooks;
6
7
  export default _default;
@@ -177,6 +177,7 @@ declare const utils: {
177
177
  hooks: {
178
178
  use_is_mobile(): boolean;
179
179
  use_dark_mode(): void;
180
+ use_set_show_component(): void;
180
181
  };
181
182
  environment: {
182
183
  set(key: import("..").TypesCore.Geral.BaseUrl, props: string): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navservice/core",
3
- "version": "1.109.0",
3
+ "version": "1.111.0",
4
4
  "description": "Service core de todos os micro serviços",
5
5
  "type": "module",
6
6
  "exports": {