@thibezer/ui-components-kit 2.17.1 → 2.17.3

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.
Files changed (126) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/camadas.cjs +80 -83
  3. package/dist/camadas.js +1131 -869
  4. package/dist/components/ui-camadas/camadas-arvore-renderer.d.ts +1 -0
  5. package/dist/components/ui-camadas/camadas-atualizacao-incremental.d.ts +1 -0
  6. package/dist/components/ui-camadas/camadas-colecao.d.ts +1 -0
  7. package/dist/components/ui-camadas/camadas-drag-drop.d.ts +2 -0
  8. package/dist/components/ui-camadas/camadas-drop-ops.d.ts +34 -0
  9. package/dist/components/ui-camadas/camadas-lembranca.d.ts +2 -1
  10. package/dist/components/ui-camadas/camadas-persistencia.d.ts +3 -0
  11. package/dist/components/ui-camadas/ui-camadas.d.ts +1 -0
  12. package/dist/custom-elements.json +4531 -4079
  13. package/dist/tipos-elementos.d.ts +3 -0
  14. package/dist/tipos-vue.d.ts +3 -0
  15. package/package.json +1 -1
  16. package/dist/form-validacao-BIOXxt-1.js +0 -140
  17. package/dist/form-validacao-ytRYSF3E.cjs +0 -1
  18. package/dist/gerencigeo-canvas/layer_defaults.d.ts +0 -3
  19. package/dist/gerencigeo-canvas/layer_instance_ops.d.ts +0 -6
  20. package/dist/gerencigeo-canvas/layer_state_ops.d.ts +0 -6
  21. package/dist/leaflet-DcO7uRC-.cjs +0 -1
  22. package/dist/leaflet-PPDKB6Dd.js +0 -69
  23. package/dist/motor-BCWqlv3e.cjs +0 -1
  24. package/dist/motor-CXjQjVba.js +0 -1386
  25. package/dist/svg-seguro-BsbNQqpd.js +0 -50
  26. package/dist/svg-seguro-C76iLlAZ.cjs +0 -1
  27. package/dist/ui-badge-1UU8vT-b.js +0 -198
  28. package/dist/ui-badge-B5J_c5P5.js +0 -197
  29. package/dist/ui-badge-BxT-sDmV.cjs +0 -28
  30. package/dist/ui-badge-C0eKBI8E.js +0 -183
  31. package/dist/ui-badge-CKKKPdt8.cjs +0 -28
  32. package/dist/ui-badge-DC4y6Dik.cjs +0 -28
  33. package/dist/ui-botao-BOOnP8ds.cjs +0 -12
  34. package/dist/ui-botao-D24oXySA.cjs +0 -12
  35. package/dist/ui-botao-DfqSivHl.js +0 -165
  36. package/dist/ui-botao-Dsj08jjw.js +0 -165
  37. package/dist/ui-botao-OGJV6Vfk.js +0 -165
  38. package/dist/ui-botao-bU_bf6SU.js +0 -166
  39. package/dist/ui-botao-psS1juof.cjs +0 -12
  40. package/dist/ui-botao-xTbH5mpH.cjs +0 -12
  41. package/dist/ui-campo-texto-19tIrmBK.js +0 -377
  42. package/dist/ui-campo-texto-CH8mzX61.cjs +0 -16
  43. package/dist/ui-campo-texto-Cnn2UAkS.cjs +0 -16
  44. package/dist/ui-campo-texto-DVU_sWV1.cjs +0 -16
  45. package/dist/ui-campo-texto-Uu2dJE_0.js +0 -379
  46. package/dist/ui-campo-texto-W5M0gNE4.js +0 -377
  47. package/dist/ui-card-0wu4rjEX.cjs +0 -20
  48. package/dist/ui-card-B86lJXTP.cjs +0 -20
  49. package/dist/ui-card-BYyYxxY1.cjs +0 -20
  50. package/dist/ui-card-C_o5_0cB.js +0 -111
  51. package/dist/ui-card-CojoGXaT.js +0 -144
  52. package/dist/ui-card-DRtpOo3l.js +0 -143
  53. package/dist/ui-controle-cores-B4R6ct4I.js +0 -291
  54. package/dist/ui-controle-cores-BS0WYPdi.js +0 -572
  55. package/dist/ui-controle-cores-Bq_XUrIQ.cjs +0 -32
  56. package/dist/ui-controle-cores-BtA6yzu3.js +0 -291
  57. package/dist/ui-controle-cores-C8um-If9.cjs +0 -32
  58. package/dist/ui-controle-cores-CHMKGemo.cjs +0 -141
  59. package/dist/ui-controle-cores-C_cVXxCn.js +0 -291
  60. package/dist/ui-controle-cores-CuDFS8Y8.cjs +0 -32
  61. package/dist/ui-controle-cores-Dog7ERYv.js +0 -697
  62. package/dist/ui-controle-cores-Er6ZcQ7U.cjs +0 -111
  63. package/dist/ui-linha-BxhEBn27.js +0 -749
  64. package/dist/ui-linha-C306zxWG.cjs +0 -19
  65. package/dist/ui-linha-C_azWkcG.js +0 -517
  66. package/dist/ui-linha-CcalUBDw.cjs +0 -38
  67. package/dist/ui-linha-DAz6DBcl.cjs +0 -38
  68. package/dist/ui-linha-DkxwMhD-.js +0 -749
  69. package/dist/ui-modal-4nU-tXjO.cjs +0 -18
  70. package/dist/ui-modal-BkYvNP0G.js +0 -214
  71. package/dist/ui-modal-BwB9fksp.js +0 -214
  72. package/dist/ui-modal-CUNbpbZ1.cjs +0 -18
  73. package/dist/ui-modal-CvGFGh1h.cjs +0 -18
  74. package/dist/ui-modal-DBOtSTbR.js +0 -238
  75. package/dist/ui-paleta-ferramentas-BXXrI1Y7.js +0 -1233
  76. package/dist/ui-paleta-ferramentas-CEZYcN4J.js +0 -624
  77. package/dist/ui-paleta-ferramentas-CU4icLl0.js +0 -1171
  78. package/dist/ui-paleta-ferramentas-Ccmo-rB5.cjs +0 -21
  79. package/dist/ui-paleta-ferramentas-CsPMTY0G.cjs +0 -21
  80. package/dist/ui-paleta-ferramentas-DLwZHIDv.cjs +0 -21
  81. package/dist/ui-paleta-ferramentas-DNN5i6nL.js +0 -860
  82. package/dist/ui-paleta-ferramentas-Dbj1kBS9.cjs +0 -18
  83. package/dist/ui-paleta-ferramentas-DbwdWVtT.js +0 -1173
  84. package/dist/ui-paleta-ferramentas-bvqxj1Yd.cjs +0 -21
  85. package/dist/ui-segmented-D6b6zxVs.cjs +0 -19
  86. package/dist/ui-segmented-DyF5YLsV.js +0 -418
  87. package/dist/ui-segmented-rn9RxRGM.cjs +0 -19
  88. package/dist/ui-segmented-wUraId2e.js +0 -412
  89. package/dist/ui-seletor-cor-C4U2eqxY.cjs +0 -82
  90. package/dist/ui-seletor-cor-D2_C6Aor.js +0 -391
  91. package/dist/ui-seletor-cor-DPKqf5wb.cjs +0 -82
  92. package/dist/ui-seletor-cor-FYtRccnK.js +0 -396
  93. package/dist/ui-skeleton-B2Rgrv8o.js +0 -648
  94. package/dist/ui-skeleton-DEHwpDqa.js +0 -648
  95. package/dist/ui-skeleton-DI4_9WOX.js +0 -428
  96. package/dist/ui-skeleton-DiOxTBZK.cjs +0 -52
  97. package/dist/ui-skeleton-SPYqku8P.cjs +0 -52
  98. package/dist/ui-skeleton-W9uwIceA.js +0 -585
  99. package/dist/ui-skeleton-elhKIh2B.cjs +0 -33
  100. package/dist/ui-skeleton-sIphhOSx.cjs +0 -52
  101. package/dist/ui-switch-BL-x_-SM.js +0 -1202
  102. package/dist/ui-switch-BcOqOkiV.js +0 -856
  103. package/dist/ui-switch-C0i_3QXu.cjs +0 -66
  104. package/dist/ui-switch-D7iPKDj-.cjs +0 -53
  105. package/dist/ui-switch-DAIgOhqr.cjs +0 -66
  106. package/dist/ui-switch-_F8yubdX.js +0 -1203
  107. package/dist/ui-tabela-propriedades-2bq2nX-b.js +0 -3202
  108. package/dist/ui-tabela-propriedades-8IAYmk3P.cjs +0 -142
  109. package/dist/ui-tabela-propriedades-B8AwlpqL.cjs +0 -141
  110. package/dist/ui-tabela-propriedades-BBr5sqki.cjs +0 -145
  111. package/dist/ui-tabela-propriedades-BecPqC-e.cjs +0 -141
  112. package/dist/ui-tabela-propriedades-BoYXzP5Z.js +0 -3191
  113. package/dist/ui-tabela-propriedades-BokvDD3b.js +0 -2648
  114. package/dist/ui-tabela-propriedades-Boy7I5yW.js +0 -2412
  115. package/dist/ui-tabela-propriedades-C-PeuW1i.cjs +0 -141
  116. package/dist/ui-tabela-propriedades-C5YYnod1.js +0 -3053
  117. package/dist/ui-tabela-propriedades-CnfW9DZG.cjs +0 -142
  118. package/dist/ui-tabela-propriedades-CyPyKXtB.js +0 -3013
  119. package/dist/ui-tabela-propriedades-DWOKznMN.cjs +0 -142
  120. package/dist/ui-tabela-propriedades-Df9ajC6M.js +0 -2648
  121. package/dist/ui-tabela-propriedades-DqvPilK_.cjs +0 -142
  122. package/dist/ui-tabela-propriedades-DuaC4sFX.js +0 -2767
  123. package/dist/ui-toast-Bp_NlM5G.js +0 -156
  124. package/dist/ui-toast-DGTZKne5.cjs +0 -20
  125. package/dist/zero-js-triggers-C_KrvFOQ.js +0 -244
  126. package/dist/zero-js-triggers-C_gtaojZ.cjs +0 -1
@@ -1,860 +0,0 @@
1
- var V = Object.defineProperty;
2
- var G = (o, s, t) => s in o ? V(o, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[s] = t;
3
- var c = (o, s, t) => G(o, typeof s != "symbol" ? s + "" : s, t);
4
- import { L as S } from "./listener-bag-DQgv7OON.js";
5
- import { d as z, S as M } from "./ssr-safe-5cWfJP-s.js";
6
- import { h as U } from "./svg-seguro-BsbNQqpd.js";
7
- const K = ':host{display:inline-flex;align-items:center;justify-content:center;vertical-align:middle;line-height:1;color:inherit;flex-shrink:0;width:var(--ui-tamanho-icone, 20px);height:var(--ui-tamanho-icone, 20px);box-sizing:border-box}.ui-icone{display:inline-flex;align-items:center;justify-content:center;width:100%;height:100%;color:inherit;font-size:var(--ui-tamanho-icone, 20px)}::slotted(svg),.ui-icone svg{width:100%!important;height:100%!important;display:block;shape-rendering:geometricPrecision}:host([cor="primaria"]),:host([color="primaria"]){color:var(--ui-cor-primaria, #00E08A)}:host([cor="secundaria"]),:host([color="secundaria"]){color:var(--ui-cor-texto-secundario, #888899)}:host([cor="erro"]),:host([color="erro"]){color:var(--ui-cor-texto-erro, #ff5555)}:host([cor="sucesso"]),:host([color="sucesso"]){color:var(--ui-cor-texto-sucesso, #00E08A)}:host([cor="alerta"]),:host([color="alerta"]){color:var(--ui-cor-texto-alerta, #ffb86c)}', D = {
8
- search: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
9
- check: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>',
10
- eye: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path><circle cx="12" cy="12" r="3"></circle></svg>',
11
- eyeOff: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"></path><line x1="1" y1="1" x2="23" y2="23"></line></svg>',
12
- lock: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>',
13
- trash: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path></svg>',
14
- gear: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>',
15
- bell: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path><path d="M13.73 21a2 2 0 0 1-3.46 0"></path></svg>',
16
- alert: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>',
17
- close: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>'
18
- };
19
- class Y extends M {
20
- constructor() {
21
- super();
22
- c(this, "iconContainer");
23
- c(this, "svgContainer");
24
- c(this, "slotElement");
25
- c(this, "handleSlotChange", () => {
26
- this.syncState();
27
- });
28
- const t = this.attachShadow({ mode: "open" });
29
- t.innerHTML = `
30
- <style>${K}</style>
31
- <span class="ui-icone" aria-hidden="true">
32
- <span class="ui-icone__svg" style="display: none;"></span>
33
- <slot></slot>
34
- </span>
35
- `, this.iconContainer = t.querySelector(".ui-icone"), this.svgContainer = t.querySelector(".ui-icone__svg"), this.slotElement = t.querySelector("slot");
36
- }
37
- static get observedAttributes() {
38
- return ["tamanho", "size", "cor", "color", "nome", "name"];
39
- }
40
- connectedCallback() {
41
- this.slotElement.addEventListener("slotchange", this.handleSlotChange), this.syncState();
42
- }
43
- disconnectedCallback() {
44
- this.slotElement.removeEventListener("slotchange", this.handleSlotChange);
45
- }
46
- attributeChangedCallback(t, e, i) {
47
- this.syncState();
48
- }
49
- resolveTamanhoPx() {
50
- const t = this.getAttribute("tamanho") || this.getAttribute("size") || "md";
51
- switch (t.toLowerCase()) {
52
- case "sm":
53
- return "16px";
54
- case "md":
55
- return "20px";
56
- case "lg":
57
- return "24px";
58
- case "xl":
59
- return "32px";
60
- default:
61
- return isNaN(Number(t)) ? t : `${t}px`;
62
- }
63
- }
64
- syncState() {
65
- const t = this.resolveTamanhoPx();
66
- this.style.setProperty("--ui-tamanho-icone", t);
67
- const e = this.getAttribute("cor") || this.getAttribute("color");
68
- e ? (this.style.setProperty("--ui-cor-icone", e), this.iconContainer.style.color = e) : (this.style.removeProperty("--ui-cor-icone"), this.iconContainer.style.color = ""), this.hasAttribute("aria-label") || this.hasAttribute("label") ? this.iconContainer.removeAttribute("aria-hidden") : this.iconContainer.setAttribute("aria-hidden", "true");
69
- const r = this.getAttribute("nome") || this.getAttribute("name"), l = this.slotElement.assignedNodes().length > 0;
70
- r && D[r] && !l ? (this.svgContainer.innerHTML = D[r], this.svgContainer.style.display = "inline-flex") : (this.svgContainer.innerHTML = "", this.svgContainer.style.display = "none");
71
- }
72
- }
73
- z("ui-icone", Y);
74
- const W = ':host{display:block;position:relative;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif);color:var(--ui-cor-texto, #e1e1e6)}.ui-ribbon{display:flex;flex-direction:column;background:var(--ui-cor-superficie, #141417);border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));-webkit-user-select:none;user-select:none}.ui-ribbon__cabecalho{display:flex;align-items:stretch;height:30px;box-sizing:border-box;box-shadow:inset 0 -1px 0 var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-ribbon__abas{display:flex;flex:1;min-width:0;align-items:flex-end;gap:2px;padding:0 8px;box-sizing:border-box;overflow-x:auto;scrollbar-width:none;background:linear-gradient(to right,var(--ui-cor-superficie, #141417) 20px,transparent) left top / 28px calc(100% - 1px) no-repeat local,linear-gradient(to left,var(--ui-cor-superficie, #141417) 20px,transparent) right top / 28px calc(100% - 1px) no-repeat local,linear-gradient(to right,rgba(0,0,0,.35),transparent) left top / 14px calc(100% - 1px) no-repeat scroll,linear-gradient(to left,rgba(0,0,0,.35),transparent) right top / 14px calc(100% - 1px) no-repeat scroll}.ui-ribbon__abas::-webkit-scrollbar{display:none}.ui-ribbon__aba{position:relative;flex-shrink:0;height:28px;margin-bottom:1px;padding:0 14px;border:0;border-radius:6px 6px 0 0;background:transparent;color:var(--ui-cor-texto-secundario, #888899);font:inherit;font-size:.75rem;font-weight:600;white-space:nowrap;cursor:pointer;transition:background-color .12s ease,color .12s ease}.ui-ribbon__aba:hover{color:var(--ui-cor-texto, #e1e1e6);background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-ribbon__aba:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:-2px}.ui-ribbon__aba--ativa,.ui-ribbon__aba--ativa:hover{height:30px;margin-bottom:0;color:var(--ui-cor-texto, #e1e1e6);background:var(--ui-cor-fundo-elevado, #1a1a1e);box-shadow:inset 1px 0 0 var(--ui-cor-borda, rgba(255, 255, 255, .12)),inset -1px 0 0 var(--ui-cor-borda, rgba(255, 255, 255, .12)),inset 0 1px 0 var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-ribbon__aba--ativa:after{content:"";position:absolute;inset-inline:8px;bottom:1px;height:2px;border-radius:2px 2px 0 0;background:var(--ui-cor-primaria, #00E08A)}.ui-ribbon__aba--contextual{color:var(--ui-cor-primaria, #00E08A)}.ui-ribbon__aba--contextual:before{content:"";position:absolute;inset-inline:0;top:0;height:2px;border-radius:6px 6px 0 0;background:var(--ui-cor-primaria, #00E08A)}.ui-ribbon__fixar{display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;align-self:center;width:28px;height:24px;margin-inline:2px 6px;padding:0;border:0;border-radius:var(--ui-raio-sm, 4px);background:transparent;color:var(--ui-cor-texto-secundario, #888899);cursor:pointer}.ui-ribbon__fixar:hover{color:var(--ui-cor-texto, #e1e1e6);background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-ribbon__fixar:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:-2px}.ui-ribbon__fixar:before{content:"";width:6px;height:6px;border:solid currentColor;border-width:2px 0 0 2px;transform:translateY(2px) rotate(45deg)}:host([recolhido]) .ui-ribbon__fixar:before{transform:translateY(-2px) rotate(225deg)}.ui-ribbon__painel{background:var(--ui-cor-fundo-elevado, #1a1a1e);overflow-x:auto;scrollbar-width:thin;scrollbar-color:var(--ui-cor-borda, rgba(255, 255, 255, .2)) transparent}.ui-ribbon__grupos{display:flex;align-items:stretch;width:max-content;min-width:100%;min-height:92px;padding:4px 8px;box-sizing:border-box}.ui-ribbon__grupo{display:flex;flex-direction:column;flex-shrink:0;padding:0 8px;border-inline-end:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-ribbon__grupo:last-child{border-inline-end:0}.ui-ribbon__grupo-itens{display:flex;flex:1;align-items:stretch;gap:2px}.ui-ribbon__grupo-rotulo{padding:3px 0 1px;color:var(--ui-cor-texto-secundario, #888899);font-size:.6875rem;line-height:1.2;text-align:center;white-space:nowrap}.ui-ribbon__coluna{display:flex;flex-direction:column;justify-content:center;gap:0}.ui-ribbon__separador{width:1px;margin:4px 3px;background:var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-ferr-btn--grande{flex-direction:column;min-width:52px;padding:4px 6px;gap:3px}.ui-ferr-btn--grande .ui-ferr-btn__rotulo{max-width:72px;white-space:normal;text-align:center;line-height:1.15;overflow-wrap:anywhere}.ui-ferr-btn--pequeno{height:24px;padding:0 6px;justify-content:flex-start}.ui-ferr-btn--pequeno.ui-ferr-btn--so-icone{width:24px;padding:0;justify-content:center}.ui-ribbon__grupos .ui-ferr-btn:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:-2px;box-shadow:none}:host([recolhido]) .ui-ribbon__painel{display:none;position:absolute;top:100%;inset-inline:0;z-index:var(--ui-z-docked-bar, 600);border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));box-shadow:var(--ui-sombra-lg, 0 8px 24px rgba(0, 0, 0, .35))}:host([recolhido]) .ui-ribbon--aberto .ui-ribbon__painel{display:block}:host([recolhido]) .ui-ribbon__aba--ativa:after{display:none}:host([compacto]) .ui-ribbon__grupos{min-height:0;padding-block:2px}:host([compacto]) .ui-ribbon__grupo-rotulo{display:none}:host([compacto]) .ui-ferr-btn--grande{min-width:44px}@media (max-width: 720px){.ui-ferr-btn--pequeno:has(.ui-ferr-btn__icone) .ui-ferr-btn__rotulo{display:none}.ui-ferr-btn--pequeno:has(.ui-ferr-btn__icone){min-width:28px;justify-content:center;padding:0 4px}}@media (pointer: coarse){.ui-ribbon__cabecalho{height:38px}.ui-ribbon__aba{height:36px}.ui-ribbon__aba--ativa,.ui-ribbon__aba--ativa:hover{height:38px}.ui-ferr-btn--pequeno{height:32px}.ui-ferr-btn--pequeno.ui-ferr-btn--so-icone{width:32px}.ui-ribbon__fixar{width:36px;height:32px}}@media (prefers-reduced-motion: reduce){.ui-ribbon__aba{transition:none}}@media (forced-colors: active){.ui-ribbon__aba--ativa:after,.ui-ribbon__aba--contextual:before{background:Highlight;forced-color-adjust:none}.ui-ribbon__aba--ativa,.ui-ribbon__aba--ativa:hover{box-shadow:none;border:1px solid CanvasText;border-bottom-color:Canvas}.ui-ribbon__aba:focus-visible,.ui-ribbon__fixar:focus-visible,.ui-ribbon__grupos .ui-ferr-btn:focus-visible{outline-color:Highlight}}', q = '.ui-ferr-btn{position:relative;display:inline-flex;align-items:center;justify-content:center;gap:4px;box-sizing:border-box;padding:0;border:1px solid transparent;border-radius:var(--ui-raio-borda, 6px);background:transparent;color:var(--ui-cor-texto, #e1e1e6);font-family:var(--ui-fonte-base, "Inter", sans-serif);font-size:.75rem;line-height:1;cursor:pointer;-webkit-user-select:none;user-select:none;touch-action:manipulation;-webkit-tap-highlight-color:transparent;transition:background-color .12s ease,border-color .12s ease,color .12s ease}.ui-ferr-btn:hover:not(:disabled){background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-ferr-btn:active:not(:disabled){background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 14%,transparent)}.ui-ferr-btn:focus-visible{outline:2px solid transparent;outline-offset:2px;box-shadow:0 0 0 2px var(--ui-cor-fundo, #0b0b0d),0 0 0 4px var(--ui-cor-primaria, #00E08A)}.ui-ferr-btn:disabled{opacity:.4;cursor:not-allowed}.ui-ferr-btn--ativo{background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 18%,transparent);border-color:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 55%,transparent)}.ui-ferr-btn.ui-ferr-btn--ativo:hover:not(:disabled){background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 28%,transparent)}.ui-ferr-btn.ui-ferr-btn--ativo:active:not(:disabled){background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 36%,transparent)}.ui-ferr-btn.ui-ferr-btn--ativo:disabled{background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08));border-color:var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-ferr-btn__icone{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.ui-ferr-btn__rotulo{white-space:nowrap}.ui-ferr-btn__caret{width:0;height:0;flex-shrink:0;border-left:3px solid transparent;border-right:3px solid transparent;border-top:4px solid currentColor;opacity:.7}.ui-ferr-menu{position:fixed;z-index:var(--ui-z-popover, 1050);display:flex;flex-direction:column;gap:1px;min-width:180px;max-height:calc(100vh - 8px);overflow-y:auto;padding:4px;box-sizing:border-box;background:var(--ui-cor-fundo-menu, #18181c);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 6px);box-shadow:var(--ui-sombra-lg, 0 8px 24px rgba(0, 0, 0, .35));font-family:var(--ui-fonte-base, "Inter", sans-serif);color:var(--ui-cor-texto, #e1e1e6)}.ui-ferr-menu__item{position:relative;display:flex;align-items:center;gap:8px;width:100%;height:28px;padding:0 8px;box-sizing:border-box;border:0;border-radius:var(--ui-raio-sm, 4px);background:transparent;color:inherit;font:inherit;font-size:.75rem;text-align:start;cursor:pointer}.ui-ferr-menu__item:hover:not(:disabled){background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-ferr-menu__item:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:-2px;background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-ferr-menu__item:disabled{opacity:.4;cursor:not-allowed}.ui-ferr-menu__item--ativo,.ui-ferr-menu__item[aria-checked=true]{color:var(--ui-cor-primaria, #00E08A);font-weight:600}.ui-ferr-menu__item--ativo:after,.ui-ferr-menu__item[aria-checked=true]:after{content:"";flex-shrink:0;width:4px;height:8px;margin-inline-start:4px;border:solid currentColor;border-width:0 2px 2px 0;transform:rotate(45deg) translateY(-1px)}.ui-ferr-menu__icone{display:inline-flex;width:16px;justify-content:center}.ui-ferr-menu__rotulo{flex:1}.ui-ferr-menu__atalho{margin-inline-start:16px;color:var(--ui-cor-texto-secundario, #888899);font-size:.6875rem;font-variant-numeric:tabular-nums}.ui-ferr-menu__sep{height:1px;margin:3px 2px;background:var(--ui-cor-borda, rgba(255, 255, 255, .12))}@media (pointer: coarse){.ui-ferr-menu__item{height:36px}}@media (prefers-reduced-motion: reduce){.ui-ferr-btn{transition:none}}@media (forced-colors: active){.ui-ferr-btn:focus-visible,.ui-ferr-menu__item:focus-visible{outline:2px solid Highlight}.ui-ferr-btn--ativo{background:Highlight;color:HighlightText;border-color:ButtonText;forced-color-adjust:none}.ui-ferr-btn:disabled,.ui-ferr-menu__item:disabled{opacity:1;color:GrayText}.ui-ferr-menu{border-color:CanvasText}.ui-ferr-menu__item:hover:not(:disabled){background:Highlight;color:HighlightText}}';
75
- function j(o, s) {
76
- if (!o) return null;
77
- const t = document.createElement("ui-icone");
78
- if (t.setAttribute("tamanho", String(s)), o.trimStart().startsWith("<")) {
79
- const e = U(o);
80
- if (!e) return null;
81
- t.appendChild(e);
82
- } else
83
- t.setAttribute("nome", o);
84
- return t;
85
- }
86
- const N = /* @__PURE__ */ new Set();
87
- function I(o) {
88
- return o.rotuloAcessivel ? o.rotuloAcessivel : o.rotulo ? o.rotulo : o.icone && !o.icone.trimStart().startsWith("<") ? o.icone : (N.has(o.id) || (N.add(o.id), console.warn(`[ui-barra-ferramentas] O item "${o.id}" não tem "rotulo" nem "rotuloAcessivel": o id será usado como nome acessível.`)), o.id);
89
- }
90
- function X(o) {
91
- const s = I(o);
92
- return o.atalho ? `${s} (${o.atalho})` : s;
93
- }
94
- function C(o, s) {
95
- const t = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Set();
96
- o.forEach((i) => t.has(i) ? e.add(i) : t.add(i)), e.size && console.warn(`[ui-barra-ferramentas] ${s}: ids duplicados (${[...e].join(", ")}). Use ids únicos, senão atualizarItem() e os eventos podem atingir o item errado.`);
97
- }
98
- function L(o, s = []) {
99
- for (const t of o)
100
- t.tipo !== "separador" && (s.push(t.id), t.filhos && L(t.filhos, s));
101
- return s;
102
- }
103
- function A(o, s) {
104
- o.disabled = !!s.disabled;
105
- const t = s.tipo, e = t === "toggle" || t === "ferramenta";
106
- e ? o.setAttribute("aria-pressed", String(!!s.ativo)) : o.removeAttribute("aria-pressed"), o.classList.toggle("ui-ferr-btn--ativo", e && !!s.ativo);
107
- }
108
- function H(o, s, t) {
109
- var a;
110
- const e = document.createElement("button");
111
- e.type = "button", e.className = `ui-ferr-btn ui-ferr-btn--${s}`, e.dataset.id = o.id, e.tabIndex = -1, e.setAttribute("aria-label", I(o)), o.atalho && e.setAttribute("aria-keyshortcuts", o.atalho), e.title = X(o);
112
- const i = j(o.icone, t);
113
- if (i) {
114
- const n = document.createElement("span");
115
- n.className = "ui-ferr-btn__icone", n.appendChild(i), e.appendChild(n);
116
- }
117
- const r = !!((a = o.filhos) != null && a.length), l = s !== "paleta" && !o.somenteIcone && !!o.rotulo;
118
- if (s !== "paleta" && o.somenteIcone && e.classList.add("ui-ferr-btn--so-icone"), l) {
119
- const n = document.createElement("span");
120
- n.className = "ui-ferr-btn__rotulo", n.textContent = o.rotulo, e.appendChild(n);
121
- }
122
- if (r) {
123
- if (s === "paleta")
124
- e.classList.add("ui-ferr-btn--grupo");
125
- else {
126
- const n = document.createElement("span");
127
- n.className = "ui-ferr-btn__caret", e.appendChild(n);
128
- }
129
- e.setAttribute("aria-haspopup", "menu"), e.setAttribute("aria-expanded", "false");
130
- }
131
- return A(e, o), e;
132
- }
133
- function g(o, s) {
134
- for (const t of o) {
135
- if (t.id === s) return t;
136
- if (t.filhos) {
137
- const e = g(t.filhos, s);
138
- if (e) return e;
139
- }
140
- }
141
- }
142
- function T(o) {
143
- const s = o.filter((t) => !t.disabled);
144
- o.forEach((t) => t.tabIndex = -1), s.length && (s[0].tabIndex = 0);
145
- }
146
- function B(o) {
147
- const s = o.find((t) => t.tabIndex === 0 && !t.disabled);
148
- s ? o.forEach((t) => {
149
- t !== s && (t.tabIndex = -1);
150
- }) : T(o);
151
- }
152
- function R(o, s) {
153
- const t = o.find((e) => e === s || e.contains(s));
154
- !t || t.disabled || o.forEach((e) => e.tabIndex = e === t ? 0 : -1);
155
- }
156
- function P(o, s, t, e) {
157
- const i = s.filter((n) => !n.disabled), r = i.length, l = i.findIndex((n) => n === o.target);
158
- if (r === 0 || l < 0) return !1;
159
- let a = l;
160
- if (t.includes(o.key)) a = (l - 1 + r) % r;
161
- else if (e.includes(o.key)) a = (l + 1) % r;
162
- else if (o.key === "Home") a = 0;
163
- else if (o.key === "End") a = r - 1;
164
- else return !1;
165
- return o.preventDefault(), s.forEach((n) => n.tabIndex = -1), i[a].tabIndex = 0, i[a].focus(), !0;
166
- }
167
- let J = 0;
168
- function O(o, s, t, e, i = {}) {
169
- var F;
170
- const r = i.lado ?? "baixo", l = new S(), a = document.createElement("div");
171
- a.className = "ui-ferr-menu", a.setAttribute("role", "menu"), a.id = `ui-ferr-menu-${++J}`, a.setAttribute("aria-label", s.getAttribute("aria-label") || "Menu"), s.setAttribute("aria-controls", a.id);
172
- const n = [];
173
- let h = !1;
174
- const u = () => {
175
- var d;
176
- h || (h = !0, s.removeAttribute("aria-controls"), l.cleanup(), a.remove(), (d = i.onFechar) == null || d.call(i));
177
- };
178
- t.forEach((d) => {
179
- if (d.tipo === "separador") {
180
- const v = document.createElement("div");
181
- v.className = "ui-ferr-menu__sep", v.setAttribute("role", "separator"), a.appendChild(v);
182
- return;
183
- }
184
- const b = document.createElement("button");
185
- b.type = "button", b.className = "ui-ferr-menu__item";
186
- const y = d.tipo ?? i.tipoPadrao ?? "botao";
187
- y === "toggle" ? (b.setAttribute("role", "menuitemcheckbox"), b.setAttribute("aria-checked", String(!!d.ativo))) : y === "ferramenta" ? (b.setAttribute("role", "menuitemradio"), b.setAttribute("aria-checked", String(!!d.ativo))) : b.setAttribute("role", "menuitem"), b.dataset.id = d.id, b.disabled = !!d.disabled, d.atalho && b.setAttribute("aria-keyshortcuts", d.atalho), d.ativo && b.classList.add("ui-ferr-menu__item--ativo");
188
- const _ = document.createElement("span");
189
- _.className = "ui-ferr-menu__icone";
190
- const $ = j(d.icone, 14);
191
- $ && _.appendChild($), b.appendChild(_);
192
- const k = document.createElement("span");
193
- if (k.className = "ui-ferr-menu__rotulo", k.textContent = I(d), b.appendChild(k), d.atalho) {
194
- const v = document.createElement("span");
195
- v.className = "ui-ferr-menu__atalho", v.textContent = d.atalho, b.appendChild(v);
196
- }
197
- b.addEventListener("click", (v) => {
198
- v.stopPropagation(), u(), s.focus(), e(d);
199
- }), n.push(b), a.appendChild(b);
200
- }), o.appendChild(a);
201
- const p = s.getBoundingClientRect(), m = getComputedStyle(s).direction === "rtl", f = a.getBoundingClientRect();
202
- let x = r === "direita" ? p.top : p.bottom + 2, w = r === "direita" ? m ? p.left - f.width - 4 : p.right + 4 : m ? p.right - f.width : p.left;
203
- f.width && w + f.width > window.innerWidth - 4 && (w = Math.max(4, window.innerWidth - f.width - 4)), w < 4 && (w = 4), f.height && x + f.height > window.innerHeight - 4 && (x = Math.max(4, window.innerHeight - f.height - 4)), a.style.top = `${x}px`, a.style.left = `${w}px`;
204
- const E = () => n.filter((d) => !d.disabled);
205
- return l.add(a, "keydown", (d) => {
206
- const b = E(), y = b.findIndex((_) => _ === d.target);
207
- if (d.key === "Escape")
208
- d.preventDefault(), d.stopPropagation(), u(), s.focus();
209
- else if (d.key === "Tab")
210
- u();
211
- else if (b.length && (d.key === "ArrowDown" || d.key === "ArrowUp")) {
212
- d.preventDefault();
213
- const _ = d.key === "ArrowDown" ? 1 : -1;
214
- b[(y + _ + b.length) % b.length].focus();
215
- } else b.length && d.key === "Home" ? (d.preventDefault(), b[0].focus()) : b.length && d.key === "End" && (d.preventDefault(), b[b.length - 1].focus());
216
- }), l.add(document, "pointerdown", (d) => {
217
- const b = d.composedPath();
218
- !b.includes(a) && !b.includes(s) && u();
219
- }, !0), l.add(window, "resize", u), l.add(window, "scroll", (d) => {
220
- d.target instanceof Node && a.contains(d.target) || u();
221
- }, !0), l.add(window, "blur", u), i.focar && ((F = E()[0]) == null || F.focus()), { elemento: a, ancora: s, fechar: u, focarPrimeiro: () => {
222
- var d;
223
- return (d = E()[0]) == null ? void 0 : d.focus();
224
- } };
225
- }
226
- let Q = 0;
227
- class Z extends M {
228
- constructor() {
229
- super();
230
- c(this, "rootElement");
231
- c(this, "abasElement");
232
- c(this, "gruposElement");
233
- c(this, "painelElement");
234
- c(this, "fixarElement");
235
- c(this, "uid", `ui-ribbon-${++Q}`);
236
- c(this, "_abaPendente", "");
237
- c(this, "_pronto", !1);
238
- c(this, "_abas", []);
239
- c(this, "_abaAtiva", "");
240
- c(this, "menu", null);
241
- c(this, "listeners", new S());
242
- c(this, "handleFocusInGrupos", (t) => R(this.botoesPainel(), t.target));
243
- /* ---------- Interação ---------- */
244
- c(this, "handleClickAbas", (t) => {
245
- const e = t.target.closest(".ui-ribbon__aba");
246
- e != null && e.dataset.id && (this.selecionarAba(e.dataset.id), this.recolhido && this.rootElement.classList.toggle("ui-ribbon--aberto"));
247
- });
248
- c(this, "handleClickFixar", () => {
249
- this.recolhido = !this.recolhido;
250
- });
251
- c(this, "handleDblClickAbas", (t) => {
252
- t.target.closest(".ui-ribbon__aba") && (this.recolhido = !this.recolhido);
253
- });
254
- c(this, "handleKeyDownAbas", (t) => {
255
- var h, u;
256
- const e = Array.from(this.abasElement.querySelectorAll(".ui-ribbon__aba")), i = e.findIndex((p) => p === t.target);
257
- if (i < 0) return;
258
- let r = i;
259
- const [l, a] = this.rtl ? ["ArrowLeft", "ArrowRight"] : ["ArrowRight", "ArrowLeft"];
260
- if (t.key === l) r = (i + 1) % e.length;
261
- else if (t.key === a) r = (i - 1 + e.length) % e.length;
262
- else if (t.key === "Home") r = 0;
263
- else if (t.key === "End") r = e.length - 1;
264
- else if (t.key === "ArrowDown") {
265
- t.preventDefault(), this.recolhido && this.rootElement.classList.add("ui-ribbon--aberto"), (h = this.botoesPainel().find((p) => !p.disabled)) == null || h.focus();
266
- return;
267
- } else return;
268
- t.preventDefault();
269
- const n = e[r].dataset.id;
270
- n && this.selecionarAba(n), (u = this.abasElement.querySelector(`.ui-ribbon__aba[data-id="${CSS.escape(n ?? "")}"]`)) == null || u.focus();
271
- });
272
- c(this, "handleClickGrupos", (t) => {
273
- const e = t.target.closest(".ui-ferr-btn");
274
- e != null && e.dataset.id && this.acionar(e, t.detail === 0);
275
- });
276
- c(this, "handleKeyDownGrupos", (t) => {
277
- var r;
278
- const e = this.botoesPainel();
279
- if (this.rtl ? P(t, e, ["ArrowRight"], ["ArrowLeft"]) : P(t, e, ["ArrowLeft"], ["ArrowRight"])) return;
280
- const i = t.target instanceof HTMLButtonElement ? t.target : null;
281
- (i == null ? void 0 : i.getAttribute("aria-haspopup")) === "menu" && t.key === "ArrowDown" && (t.preventDefault(), ((r = this.menu) == null ? void 0 : r.ancora) === i ? this.menu.focarPrimeiro() : this.acionar(i, !0));
282
- });
283
- c(this, "handleEscape", (t) => {
284
- t.key === "Escape" && !this.menu && this.rootElement.classList.remove("ui-ribbon--aberto");
285
- });
286
- c(this, "handlePointerDownFora", (t) => {
287
- !this.recolhido || !this.rootElement.classList.contains("ui-ribbon--aberto") || t.composedPath().includes(this) || this.rootElement.classList.remove("ui-ribbon--aberto");
288
- });
289
- const t = this.attachShadow({ mode: "open" });
290
- t.innerHTML = `
291
- <style>${q}${W}</style>
292
- <div class="ui-ribbon">
293
- <div class="ui-ribbon__cabecalho">
294
- <div class="ui-ribbon__abas" role="tablist"></div>
295
- <button type="button" class="ui-ribbon__fixar"></button>
296
- </div>
297
- <div class="ui-ribbon__painel" role="tabpanel">
298
- <div class="ui-ribbon__grupos" role="toolbar" aria-label="Ferramentas"></div>
299
- </div>
300
- </div>
301
- `, this.rootElement = t.querySelector(".ui-ribbon"), this.abasElement = t.querySelector(".ui-ribbon__abas"), this.gruposElement = t.querySelector(".ui-ribbon__grupos"), this.painelElement = t.querySelector(".ui-ribbon__painel"), this.fixarElement = t.querySelector(".ui-ribbon__fixar"), this.painelElement.id = `${this.uid}-painel`;
302
- }
303
- static get observedAttributes() {
304
- return ["aba-ativa", "recolhido", "compacto", "aria-label", "rotulo-abas", "rotulo-fixar", "rotulo-expandir"];
305
- }
306
- connectedCallback() {
307
- this.listeners.cleanup(), this.listeners.add(this.abasElement, "click", this.handleClickAbas), this.listeners.add(this.fixarElement, "click", this.handleClickFixar), this.listeners.add(this.abasElement, "dblclick", this.handleDblClickAbas), this.listeners.add(this.abasElement, "keydown", this.handleKeyDownAbas), this.listeners.add(this.gruposElement, "click", this.handleClickGrupos), this.listeners.add(this.gruposElement, "keydown", this.handleKeyDownGrupos), this.listeners.add(document, "pointerdown", this.handlePointerDownFora, !0), this.listeners.add(this.rootElement, "keydown", this.handleEscape), this.listeners.add(this.gruposElement, "focusin", this.handleFocusInGrupos);
308
- const t = this.getAttribute("aba-ativa");
309
- t && !this._abaAtiva && (this._abaPendente = t), this.aplicarRotulos(), this.renderizar(), this._pronto = !0;
310
- }
311
- disconnectedCallback() {
312
- this._pronto = !1, this.fecharMenu(), this.listeners.cleanup();
313
- }
314
- attributeChangedCallback(t, e, i) {
315
- if (e !== i)
316
- if (t === "aba-ativa") {
317
- if (!i || i === this._abaAtiva) return;
318
- this._abas.some((r) => r.id === i && !r.oculta) ? (this._abaPendente = "", this.selecionarAba(i, !1)) : (this._abaPendente = i, this.abasVisiveis().length && this.renderizar());
319
- } else t === "recolhido" ? (this.rootElement.classList.remove("ui-ribbon--aberto"), this.aplicarRotulos(), this._pronto && e === null != (i === null) && this.dispatchEvent(
320
- new CustomEvent("ui-recolhido-change", {
321
- detail: { recolhido: i !== null },
322
- bubbles: !0,
323
- composed: !0
324
- })
325
- )) : (t === "aria-label" || t === "rotulo-abas" || t === "rotulo-fixar" || t === "rotulo-expandir") && this.aplicarRotulos();
326
- }
327
- aplicarRotulos() {
328
- this.gruposElement.setAttribute("aria-label", this.getAttribute("aria-label") || "Ferramentas"), this.abasElement.setAttribute("aria-label", this.getAttribute("rotulo-abas") || "Abas");
329
- const t = this.hasAttribute("recolhido"), e = t ? this.getAttribute("rotulo-expandir") || "Fixar faixa de opções" : this.getAttribute("rotulo-fixar") || "Recolher faixa de opções";
330
- this.fixarElement.setAttribute("aria-label", e), this.fixarElement.title = e, this.fixarElement.setAttribute("aria-expanded", String(!t)), this.fixarElement.setAttribute("aria-controls", this.painelElement.id);
331
- }
332
- /* ---------- API pública ---------- */
333
- get abas() {
334
- return this._abas;
335
- }
336
- set abas(t) {
337
- this._abas = Array.isArray(t) ? t : [], C(this._abas.map((e) => e.id), "<ui-ribbon> abas"), C(
338
- this._abas.flatMap((e) => e.grupos.flatMap((i) => L(i.itens))),
339
- "<ui-ribbon> itens"
340
- ), this.renderizar();
341
- }
342
- get abaAtiva() {
343
- return this._abaAtiva;
344
- }
345
- set abaAtiva(t) {
346
- this.selecionarAba(t);
347
- }
348
- get recolhido() {
349
- return this.hasAttribute("recolhido");
350
- }
351
- set recolhido(t) {
352
- t ? this.setAttribute("recolhido", "") : this.removeAttribute("recolhido");
353
- }
354
- get compacto() {
355
- return this.hasAttribute("compacto");
356
- }
357
- set compacto(t) {
358
- t ? this.setAttribute("compacto", "") : this.removeAttribute("compacto");
359
- }
360
- selecionarAba(t, e = !0) {
361
- const i = this._abas.find((r) => r.id === t && !r.oculta);
362
- if (!i) {
363
- t && this._abas.length && console.warn(`[ui-ribbon] selecionarAba("${t}"): aba inexistente ou oculta.`);
364
- return;
365
- }
366
- i.id !== this._abaAtiva && (this._abaPendente = "", this.fecharMenu(), this._abaAtiva = i.id, this.getAttribute("aba-ativa") !== i.id && this.setAttribute("aba-ativa", i.id), this.renderizar(), e && this.dispatchEvent(
367
- new CustomEvent("ui-aba-change", {
368
- detail: { id: i.id, aba: i },
369
- bubbles: !0,
370
- composed: !0
371
- })
372
- ));
373
- }
374
- definirAbaVisivel(t, e) {
375
- const i = this._abas.find((a) => a.id === t);
376
- if (!i) return;
377
- const r = this._abaAtiva;
378
- i.oculta = !e, !e && r === t && (this._abaAtiva = ""), this.renderizar();
379
- const l = this._abas.find((a) => a.id === this._abaAtiva);
380
- !e && r === t && l && this.dispatchEvent(
381
- new CustomEvent("ui-aba-change", { detail: { id: l.id, aba: l }, bubbles: !0, composed: !0 })
382
- );
383
- }
384
- /** Atualiza um item (estado ou aparência) sem precisar recriar as abas. */
385
- atualizarItem(t, e) {
386
- const i = this._abas.flatMap((h) => h.grupos.flatMap((u) => u.itens)), r = g(i, t);
387
- if (!r) {
388
- console.warn(`[ui-ribbon] atualizarItem("${t}"): item não encontrado.`);
389
- return;
390
- }
391
- Object.assign(r, e);
392
- const l = this._abas.find((h) => h.id === this._abaAtiva);
393
- if (!l || !g(l.grupos.flatMap((h) => h.itens), t)) return;
394
- const a = Object.keys(e).every((h) => h === "ativo" || h === "disabled"), n = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(t)}"]`);
395
- a ? n && (A(n, this.efetivo(r)), B(this.botoesPainel())) : this.comFoco(() => this.renderizarPainel());
396
- }
397
- efetivo(t) {
398
- var e;
399
- return (e = t.filhos) != null && e.length ? { ...t, tipo: "menu" } : t;
400
- }
401
- /* ---------- Foco preservado em re-renderizações ---------- */
402
- capturarFoco() {
403
- var e, i;
404
- const t = (e = this.shadowRoot) == null ? void 0 : e.activeElement;
405
- return (i = t == null ? void 0 : t.dataset) != null && i.id ? t.classList.contains("ui-ribbon__aba") ? { seletor: ".ui-ribbon__aba", id: t.dataset.id } : t.classList.contains("ui-ferr-btn") ? { seletor: ".ui-ferr-btn", id: t.dataset.id } : null : null;
406
- }
407
- comFoco(t) {
408
- const e = this.capturarFoco();
409
- if (t(), !e) return;
410
- const i = this.shadowRoot.querySelector(`${e.seletor}[data-id="${CSS.escape(e.id)}"]`);
411
- i && !i.disabled && i.focus();
412
- }
413
- /* ---------- Renderização ---------- */
414
- abasVisiveis() {
415
- return this._abas.filter((t) => !t.oculta);
416
- }
417
- renderizar() {
418
- var e;
419
- const t = this.abasVisiveis();
420
- this._abaPendente && t.length && (t.some((i) => i.id === this._abaPendente) ? (this._abaAtiva = this._abaPendente, this._abaPendente = "") : this._abas.some((i) => i.id === this._abaPendente) || (console.warn(`[ui-ribbon] aba-ativa="${this._abaPendente}" não existe em "abas".`), this._abaPendente = "")), t.some((i) => i.id === this._abaAtiva) || (this._abaAtiva = ((e = t[0]) == null ? void 0 : e.id) ?? ""), this._abaAtiva && !this._abaPendente && this.getAttribute("aba-ativa") !== this._abaAtiva && this.setAttribute("aba-ativa", this._abaAtiva), this.comFoco(() => {
421
- this.renderizarAbas(), this.renderizarPainel();
422
- });
423
- }
424
- renderizarAbas() {
425
- this.abasElement.innerHTML = "", this.abasVisiveis().forEach((t) => {
426
- const e = t.id === this._abaAtiva, i = document.createElement("button");
427
- i.type = "button", i.className = "ui-ribbon__aba", i.setAttribute("role", "tab"), i.dataset.id = t.id, i.id = this.idAba(t.id), e && i.setAttribute("aria-controls", this.painelElement.id), i.textContent = t.rotulo, i.tabIndex = e ? 0 : -1, i.setAttribute("aria-selected", String(e)), i.classList.toggle("ui-ribbon__aba--ativa", e), i.classList.toggle("ui-ribbon__aba--contextual", !!t.contextual), this.abasElement.appendChild(i);
428
- });
429
- }
430
- idAba(t) {
431
- return `${this.uid}-aba-${t.replace(/\s+/g, "_")}`;
432
- }
433
- renderizarPainel() {
434
- this.fecharMenu(), this.gruposElement.innerHTML = "";
435
- const t = this._abas.find((e) => e.id === this._abaAtiva);
436
- if (!t) {
437
- this.painelElement.removeAttribute("aria-labelledby");
438
- return;
439
- }
440
- this.painelElement.setAttribute("aria-labelledby", this.idAba(t.id)), t.grupos.forEach((e) => this.gruposElement.appendChild(this.criarGrupo(e))), T(this.botoesPainel());
441
- }
442
- criarGrupo(t) {
443
- const e = document.createElement("div");
444
- e.className = "ui-ribbon__grupo", e.setAttribute("role", "group"), e.setAttribute("aria-label", t.rotulo), e.dataset.id = t.id;
445
- const i = document.createElement("div");
446
- i.className = "ui-ribbon__grupo-itens";
447
- let r = null, l = 0;
448
- const a = () => {
449
- r && i.appendChild(r), r = null, l = 0;
450
- };
451
- t.itens.forEach((h) => {
452
- if (h.tipo === "separador") {
453
- a();
454
- const u = document.createElement("div");
455
- u.className = "ui-ribbon__separador", u.setAttribute("role", "separator"), i.appendChild(u);
456
- } else h.tamanho === "grande" ? (a(), i.appendChild(this.criarBotao(h, "grande", 24))) : (r || (r = document.createElement("div"), r.className = "ui-ribbon__coluna"), r.appendChild(this.criarBotao(h, "pequeno", 16)), ++l === 3 && a());
457
- }), a();
458
- const n = document.createElement("div");
459
- return n.className = "ui-ribbon__grupo-rotulo", n.textContent = t.rotulo, e.appendChild(i), e.appendChild(n), e;
460
- }
461
- criarBotao(t, e, i) {
462
- return H(this.efetivo(t), e, i);
463
- }
464
- botoesPainel() {
465
- return Array.from(this.gruposElement.querySelectorAll(".ui-ferr-btn"));
466
- }
467
- get rtl() {
468
- return getComputedStyle(this).direction === "rtl";
469
- }
470
- acionar(t, e) {
471
- var l;
472
- const i = this._abas.find((a) => a.id === this._abaAtiva), r = i && g(i.grupos.flatMap((a) => a.itens), t.dataset.id);
473
- if (!(!r || r.disabled)) {
474
- if ((l = r.filhos) != null && l.length) {
475
- this.alternarMenu(t, r, e);
476
- return;
477
- }
478
- if (r.tipo === "toggle") {
479
- const a = r.ativo;
480
- r.ativo = !a, A(t, r), this.emitir(r) || (r.ativo = a, A(t, r));
481
- } else
482
- this.emitir(r);
483
- this.rootElement.classList.remove("ui-ribbon--aberto");
484
- }
485
- }
486
- alternarMenu(t, e, i) {
487
- var l;
488
- const r = ((l = this.menu) == null ? void 0 : l.ancora) === t;
489
- this.fecharMenu(), !r && (t.setAttribute("aria-expanded", "true"), this.menu = O(
490
- this.shadowRoot,
491
- t,
492
- e.filhos,
493
- (a) => {
494
- if (a.tipo === "toggle") {
495
- const n = a.ativo;
496
- a.ativo = !n, this.emitir(a, e) || (a.ativo = n);
497
- } else
498
- this.emitir(a, e);
499
- this.rootElement.classList.remove("ui-ribbon--aberto");
500
- },
501
- {
502
- lado: "baixo",
503
- focar: i,
504
- onFechar: () => {
505
- t.setAttribute("aria-expanded", "false"), this.menu = null;
506
- }
507
- }
508
- ));
509
- }
510
- fecharMenu() {
511
- var t;
512
- (t = this.menu) == null || t.fechar(), this.menu = null;
513
- }
514
- /** Retorna false se o consumidor cancelou o evento (preventDefault). */
515
- emitir(t, e) {
516
- return this.dispatchEvent(
517
- new CustomEvent("ui-ferramenta", {
518
- detail: { id: t.id, item: t, pai: e, ativo: t.ativo, origem: "ribbon", aba: this._abaAtiva },
519
- bubbles: !0,
520
- composed: !0,
521
- cancelable: !0
522
- })
523
- );
524
- }
525
- }
526
- z("ui-ribbon", Z);
527
- const tt = ':host{display:inline-flex;flex-direction:column;max-width:100%;max-height:100%;vertical-align:top;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif);color:var(--ui-cor-texto, #e1e1e6)}.ui-paleta{--ui-paleta-btn: 34px;--ui-paleta-padding: 4px;--ui-paleta-raio: var(--ui-paleta-raio-borda, 10px);--ui-paleta-btn-raio: var(--ui-paleta-raio-botao, max(2px, calc(var(--ui-paleta-raio) - var(--ui-paleta-padding))));display:flex;flex-direction:column;align-items:center;gap:2px;padding:var(--ui-paleta-padding);box-sizing:border-box;background:var(--ui-cor-superficie, #141417);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-paleta-raio);-webkit-user-select:none;user-select:none;min-width:0;min-height:0;max-width:100%;overflow:auto;scrollbar-width:thin}.ui-paleta--horizontal{flex-direction:row}.ui-paleta--sm{--ui-paleta-btn: 28px;--ui-paleta-raio: var(--ui-paleta-raio-borda, 8px)}.ui-paleta--lg{--ui-paleta-btn: 42px;--ui-paleta-raio: var(--ui-paleta-raio-borda, 12px)}.ui-paleta--cols-2{display:grid;grid-template-columns:repeat(2,var(--ui-paleta-btn));justify-content:center}.ui-paleta--cols-2 .ui-paleta__sep{grid-column:1 / -1}.ui-ferr-btn--grupo:after{content:"";position:absolute;inset-inline-end:3px;bottom:3px;width:0;height:0;border-inline-start:6px solid transparent;border-bottom:6px solid currentColor;opacity:.8;pointer-events:none;transition:opacity .12s ease,transform .12s ease}.ui-ferr-btn--grupo:hover:after,.ui-ferr-btn--grupo:focus-visible:after,.ui-ferr-btn--grupo[aria-expanded=true]:after{opacity:1;transform:scale(1.2);transform-origin:bottom right}.ui-paleta__sep{grid-column:1 / -1}.ui-paleta .ui-ferr-btn{width:var(--ui-paleta-btn);height:var(--ui-paleta-btn);border-radius:var(--ui-paleta-btn-raio)}.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo,.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:hover:not(:disabled),.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:active:not(:disabled){background:var(--ui-cor-primaria, #00E08A);border-color:transparent;color:var(--ui-cor-texto-sobre-primaria, #000000)}.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:hover:not(:disabled){background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 86%,#fff)}.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:active:not(:disabled){background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 80%,#000)}.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:disabled{background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08));color:inherit}.ui-ferr-btn--grupo:after{content:"";position:absolute;right:3px;bottom:3px;width:0;height:0;border-left:5px solid transparent;border-bottom:5px solid currentColor;opacity:.7;pointer-events:none}.ui-paleta__sep{width:70%;height:1px;margin:3px 0;background:var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-paleta--horizontal .ui-paleta__sep{width:1px;height:70%;margin:0 3px}@media (pointer: coarse){.ui-paleta{--ui-paleta-btn: 40px}.ui-paleta--sm{--ui-paleta-btn: 36px}.ui-paleta--lg{--ui-paleta-btn: 48px}}@media (prefers-reduced-motion: reduce){.ui-ferr-btn--grupo:after{transition:none}}@media (forced-colors: active){.ui-paleta{border-color:CanvasText}.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo,.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:hover:not(:disabled),.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:active:not(:disabled){background:Highlight;color:HighlightText;border-color:ButtonText;forced-color-adjust:none}.ui-paleta__sep{background:CanvasText}}', et = 380, it = 8, rt = 50, at = { sm: 16, md: 18, lg: 22 };
528
- class ot extends M {
529
- constructor() {
530
- super();
531
- c(this, "rootElement");
532
- c(this, "_ferramentas", []);
533
- c(this, "_ativo", "");
534
- c(this, "_pendente", "");
535
- c(this, "visiveis", /* @__PURE__ */ new Map());
536
- // id do grupo → id do filho exibido
537
- c(this, "menu", null);
538
- c(this, "timerPressao");
539
- c(this, "timerSupressao");
540
- c(this, "inicioPressao", null);
541
- c(this, "suprimirClique", !1);
542
- c(this, "listeners", new S());
543
- c(this, "handleClick", (t) => {
544
- if (this.suprimirClique) {
545
- this.suprimirClique = !1, window.clearTimeout(this.timerSupressao);
546
- return;
547
- }
548
- const e = t.target.closest(".ui-ferr-btn"), i = e != null && e.dataset.id ? g(this._ferramentas, e.dataset.id) : void 0;
549
- if (!e || !i) return;
550
- const r = e.dataset.grupo ? g(this._ferramentas, e.dataset.grupo) : void 0;
551
- this.acionar(i, r);
552
- });
553
- c(this, "handleFocusIn", (t) => R(this.botoes(), t.target));
554
- c(this, "handlePointerDown", (t) => {
555
- const e = t;
556
- if (e.pointerType === "mouse" && e.button !== 0) return;
557
- const i = t.target.closest(".ui-ferr-btn--grupo");
558
- !i || i.disabled || (this.cancelarPressao(), window.clearTimeout(this.timerSupressao), this.inicioPressao = { x: e.clientX ?? 0, y: e.clientY ?? 0 }, this.timerPressao = window.setTimeout(() => {
559
- this.suprimirClique = !0, this.abrirFlyout(i, !1);
560
- }, et));
561
- });
562
- /** Arrastar/rolar com o dedo cancela o clique longo. */
563
- c(this, "handlePointerMove", (t) => {
564
- if (this.timerPressao === void 0 || !this.inicioPressao) return;
565
- const e = t, i = (e.clientX ?? 0) - this.inicioPressao.x, r = (e.clientY ?? 0) - this.inicioPressao.y;
566
- Math.hypot(i, r) > it && this.cancelarPressao();
567
- });
568
- /** Fim do gesto: cancela o timer e, se o flyout abriu, descarta a supressão logo após o `click` residual. */
569
- c(this, "handlePointerFim", () => {
570
- this.cancelarPressao(), this.suprimirClique && (window.clearTimeout(this.timerSupressao), this.timerSupressao = window.setTimeout(() => {
571
- this.suprimirClique = !1;
572
- }, rt));
573
- });
574
- c(this, "cancelarPressao", () => {
575
- this.timerPressao !== void 0 && (window.clearTimeout(this.timerPressao), this.timerPressao = void 0), this.inicioPressao = null;
576
- });
577
- c(this, "handleContextMenu", (t) => {
578
- const e = t.target.closest(".ui-ferr-btn--grupo");
579
- e && (t.preventDefault(), this.cancelarPressao(), this.abrirFlyout(e, !1));
580
- });
581
- c(this, "handleKeyDown", (t) => {
582
- var h;
583
- const e = this.getAttribute("orientacao") === "horizontal", i = getComputedStyle(this).direction === "rtl", r = e ? [i ? "ArrowRight" : "ArrowLeft"] : ["ArrowUp"], l = e ? [i ? "ArrowLeft" : "ArrowRight"] : ["ArrowDown"];
584
- if (P(t, this.botoes(), r, l)) return;
585
- const a = e ? "ArrowDown" : i ? "ArrowLeft" : "ArrowRight", n = t.target instanceof HTMLButtonElement ? t.target : null;
586
- n != null && n.dataset.grupo && t.key === a && (t.preventDefault(), ((h = this.menu) == null ? void 0 : h.ancora) === n ? this.menu.focarPrimeiro() : this.abrirFlyout(n, !0));
587
- });
588
- c(this, "handleAtalho", (t) => {
589
- if (!this.hasAttribute("atalhos") || t.ctrlKey || t.metaKey || t.altKey || t.defaultPrevented) return;
590
- const e = t.composedPath(), i = e[0];
591
- if (i && (/^(INPUT|TEXTAREA|SELECT)$/.test(i.tagName) || i.isContentEditable) || e.some((u) => {
592
- var m, f;
593
- const p = (m = u.getAttribute) == null ? void 0 : m.call(u, "role");
594
- return ((f = u.getAttribute) == null ? void 0 : f.call(u, "aria-modal")) === "true" || p === "textbox" || p === "searchbox" || p === "combobox" || p === "spinbutton";
595
- })) return;
596
- const l = (t.key || "").toUpperCase();
597
- if (l.length !== 1) return;
598
- const a = this.todasFerramentas().filter((u) => {
599
- var p;
600
- return !u.disabled && ((p = u.atalho) == null ? void 0 : p.toUpperCase()) === l;
601
- });
602
- if (!a.length) return;
603
- t.preventDefault();
604
- let n = a[0];
605
- if (a.length > 1) {
606
- const u = a.findIndex((p) => p.id === this._ativo);
607
- n = a[(u + 1) % a.length];
608
- }
609
- const h = this._ferramentas.find((u) => {
610
- var p;
611
- return (p = u.filhos) == null ? void 0 : p.some((m) => m.id === n.id);
612
- });
613
- this.acionar(n, h);
614
- });
615
- const t = this.attachShadow({ mode: "open" });
616
- t.innerHTML = `
617
- <style>${q}${tt}</style>
618
- <div class="ui-paleta ui-paleta--vertical" role="toolbar" aria-orientation="vertical" aria-label="Ferramentas"></div>
619
- `, this.rootElement = t.querySelector(".ui-paleta");
620
- }
621
- static get observedAttributes() {
622
- return ["valor", "value", "orientacao", "colunas", "tamanho", "size", "aria-label"];
623
- }
624
- connectedCallback() {
625
- this.listeners.cleanup(), this.listeners.add(this.rootElement, "click", this.handleClick), this.listeners.add(this.rootElement, "pointerdown", this.handlePointerDown), this.listeners.add(this.rootElement, "pointermove", this.handlePointerMove), this.listeners.add(this.rootElement, "pointerup", this.handlePointerFim), this.listeners.add(this.rootElement, "pointerleave", this.handlePointerFim), this.listeners.add(this.rootElement, "pointercancel", this.handlePointerFim), this.listeners.add(this.rootElement, "contextmenu", this.handleContextMenu), this.listeners.add(this.rootElement, "keydown", this.handleKeyDown), this.listeners.add(this.rootElement, "focusin", this.handleFocusIn), this.listeners.add(document, "keydown", this.handleAtalho);
626
- const t = this.getAttribute("valor") || this.getAttribute("value");
627
- t && !this._ativo && (this._pendente = t), this.aplicarPendente(), this.renderizar();
628
- }
629
- disconnectedCallback() {
630
- this.cancelarPressao(), window.clearTimeout(this.timerSupressao), this.suprimirClique = !1, this.fecharMenu(), this.listeners.cleanup();
631
- }
632
- attributeChangedCallback(t, e, i) {
633
- if (e !== i)
634
- if (t === "valor" || t === "value") {
635
- const r = this.getAttribute("valor") || this.getAttribute("value") || "";
636
- r ? r !== this._ativo && this.ativar(r, !1) : this.limpar(!1);
637
- } else
638
- this.renderizar();
639
- }
640
- /* ---------- API pública ---------- */
641
- get ferramentas() {
642
- return this._ferramentas;
643
- }
644
- set ferramentas(t) {
645
- this._ferramentas = Array.isArray(t) ? t : [], C(L(this._ferramentas), "<ui-paleta-ferramentas> ferramentas"), this.visiveis.clear(), this._pendente ? this.aplicarPendente() : this._ativo && this.definirAtivoInterno(this._ativo), this.renderizar();
646
- }
647
- get valor() {
648
- return this._ativo;
649
- }
650
- set valor(t) {
651
- this.ativar(t);
652
- }
653
- get value() {
654
- return this.valor;
655
- }
656
- set value(t) {
657
- this.valor = t;
658
- }
659
- get orientacao() {
660
- return this.getAttribute("orientacao") === "horizontal" ? "horizontal" : "vertical";
661
- }
662
- set orientacao(t) {
663
- this.setAttribute("orientacao", t);
664
- }
665
- get colunas() {
666
- return this.getAttribute("colunas") === "2" ? 2 : 1;
667
- }
668
- set colunas(t) {
669
- this.setAttribute("colunas", String(t));
670
- }
671
- get tamanho() {
672
- const t = this.getAttribute("tamanho") || this.getAttribute("size") || "md";
673
- return t === "sm" || t === "lg" ? t : "md";
674
- }
675
- set tamanho(t) {
676
- this.setAttribute("tamanho", t);
677
- }
678
- /**
679
- * Ativa uma ferramenta (exclusiva). Se estiver dentro de um grupo, ela passa a ser a exibida.
680
- * `id` vazio limpa a seleção. Se as `ferramentas` ainda não foram definidas, o valor fica pendente.
681
- */
682
- ativar(t, e = !0) {
683
- if (!t) {
684
- this.limpar(e);
685
- return;
686
- }
687
- const i = g(this._ferramentas, t);
688
- if (!i) {
689
- this._ferramentas.length ? console.warn(`[ui-paleta-ferramentas] ativar("${t}"): ferramenta não encontrada.`) : this._pendente = t;
690
- return;
691
- }
692
- if (i.disabled || (i.tipo ?? "ferramenta") !== "ferramenta") {
693
- console.warn(`[ui-paleta-ferramentas] ativar("${t}"): só ferramentas habilitadas (tipo "ferramenta") podem ser ativadas.`);
694
- return;
695
- }
696
- this._pendente = "";
697
- const r = this._ativo;
698
- this.definirAtivoInterno(t), this.refletirValor(t), this.renderizar(), e && r !== t && this.emitirMudanca(t, i, r);
699
- }
700
- /** Remove a seleção atual (nenhuma ferramenta ativa). Equivale a `valor = ''`. */
701
- limpar(t = !0) {
702
- const e = this._ativo;
703
- !e && !this._pendente || (this._ativo = "", this._pendente = "", this.removeAttribute("valor"), this.removeAttribute("value"), this.renderizar(), t && e && this.emitirMudanca("", null, e));
704
- }
705
- atualizarItem(t, e) {
706
- var a;
707
- const i = g(this._ferramentas, t);
708
- if (!i) {
709
- console.warn(`[ui-paleta-ferramentas] atualizarItem("${t}"): item não encontrado.`);
710
- return;
711
- }
712
- Object.assign(i, e);
713
- const r = Object.keys(e).every((n) => n === "ativo" || n === "disabled"), l = this._ferramentas.find((n) => {
714
- var h;
715
- return (h = n.filhos) == null ? void 0 : h.some((u) => u.id === t);
716
- });
717
- if (r && !(l && "disabled" in e)) {
718
- const n = this.botoes().find((h) => h.dataset.id === t || h.dataset.grupo === t);
719
- if (n) {
720
- A(n, this.itemParaBotao(l ?? i)), B(this.botoes());
721
- return;
722
- }
723
- if (l || (a = i.filhos) != null && a.length) return;
724
- }
725
- this.renderizar();
726
- }
727
- /* ---------- Estado interno ---------- */
728
- refletirValor(t) {
729
- const e = this.hasAttribute("value") && !this.hasAttribute("valor") ? "value" : "valor";
730
- this.getAttribute(e) !== t && this.setAttribute(e, t);
731
- }
732
- aplicarPendente() {
733
- if (!this._pendente) return;
734
- const t = g(this._ferramentas, this._pendente);
735
- t && !t.disabled && (t.tipo ?? "ferramenta") === "ferramenta" ? (this.definirAtivoInterno(this._pendente), this._pendente = "") : this._ferramentas.length && (console.warn(`[ui-paleta-ferramentas] valor="${this._pendente}" não é uma ferramenta ativável em "ferramentas".`), this._pendente = "");
736
- }
737
- definirAtivoInterno(t) {
738
- this._ativo = t;
739
- const e = this._ferramentas.find((i) => {
740
- var r;
741
- return (r = i.filhos) == null ? void 0 : r.some((l) => l.id === t);
742
- });
743
- e && this.visiveis.set(e.id, t);
744
- }
745
- emitirMudanca(t, e, i) {
746
- const r = { valor: t, item: e, anterior: i };
747
- this.dispatchEvent(new CustomEvent("ui-change", { detail: r, bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("ui-selecionar", { detail: r, bubbles: !0, composed: !0 }));
748
- }
749
- /** Filho exibido de um grupo: o último usado, pulando separadores e itens desabilitados. */
750
- itemExibido(t) {
751
- var l;
752
- if (!((l = t.filhos) != null && l.length)) return t;
753
- const e = (a) => a.tipo !== "separador" && !a.disabled, i = this.visiveis.get(t.id), r = t.filhos.find((a) => a.id === i);
754
- return (r && e(r) ? r : void 0) ?? t.filhos.find(e) ?? t.filhos.find((a) => a.tipo !== "separador") ?? t.filhos[0];
755
- }
756
- itemParaBotao(t) {
757
- const e = this.itemExibido(t), i = e.tipo ?? "ferramenta";
758
- return {
759
- ...e,
760
- tipo: i,
761
- ativo: i === "ferramenta" ? e.id === this._ativo : e.ativo,
762
- filhos: t.filhos
763
- };
764
- }
765
- todasFerramentas() {
766
- return this._ferramentas.flatMap((t) => {
767
- var e;
768
- return (e = t.filhos) != null && e.length ? t.filhos : [t];
769
- }).filter((t) => t.tipo !== "separador");
770
- }
771
- /* ---------- Renderização ---------- */
772
- renderizar() {
773
- var h;
774
- const t = (h = this.shadowRoot) == null ? void 0 : h.activeElement, e = t && t.classList.contains("ui-ferr-btn") ? { id: t.dataset.id ?? "", grupo: t.dataset.grupo ?? "" } : null;
775
- this.fecharMenu();
776
- const i = this.orientacao, r = this.tamanho, l = this.colunas;
777
- this.rootElement.className = `ui-paleta ui-paleta--${i} ui-paleta--${r}`, l === 2 && i === "vertical" && this.rootElement.classList.add("ui-paleta--cols-2"), this.rootElement.setAttribute("aria-orientation", i), this.rootElement.setAttribute("aria-label", this.getAttribute("aria-label") || "Ferramentas"), this.rootElement.innerHTML = "";
778
- const a = at[r] ?? 18;
779
- this._ferramentas.forEach((u) => {
780
- var f;
781
- if (u.tipo === "separador") {
782
- const x = document.createElement("div");
783
- x.className = "ui-paleta__sep", x.setAttribute("role", "separator"), this.rootElement.appendChild(x);
784
- return;
785
- }
786
- const p = this.itemExibido(u), m = H(this.itemParaBotao(u), "paleta", a);
787
- m.dataset.id = p.id, (f = u.filhos) != null && f.length && (m.dataset.grupo = u.id), this.rootElement.appendChild(m);
788
- }), T(this.botoes());
789
- const n = this.botoes().find((u) => u.dataset.id === this._ativo && !u.disabled);
790
- if (n && (this.botoes().forEach((u) => u.tabIndex = -1), n.tabIndex = 0), e) {
791
- const u = this.botoes().find((p) => e.grupo ? p.dataset.grupo === e.grupo : p.dataset.id === e.id);
792
- u && !u.disabled && u.focus();
793
- }
794
- }
795
- botoes() {
796
- return Array.from(this.rootElement.querySelectorAll(".ui-ferr-btn"));
797
- }
798
- /** Reflete no botão o estado atual do item (sem recriar o DOM). */
799
- atualizarBotaoDe(t, e) {
800
- const i = this.botoes().find((r) => r.dataset.id === t.id);
801
- i && A(i, this.itemParaBotao(e ?? t));
802
- }
803
- /* ---------- Interação ---------- */
804
- acionar(t, e) {
805
- if (t.disabled) return;
806
- const i = t.tipo ?? "ferramenta", r = this._ativo, l = t.ativo;
807
- i === "ferramenta" ? this.ativar(t.id) : i === "toggle" && (t.ativo = !t.ativo, this.atualizarBotaoDe(t, e)), this.dispatchEvent(
808
- new CustomEvent("ui-ferramenta", {
809
- detail: {
810
- id: t.id,
811
- item: t,
812
- pai: e,
813
- ativo: i === "ferramenta" ? !0 : t.ativo,
814
- origem: "paleta"
815
- },
816
- bubbles: !0,
817
- composed: !0,
818
- cancelable: !0
819
- })
820
- ) || (i === "ferramenta" && r !== t.id ? r ? this.ativar(r) : this.limpar() : i === "toggle" && (t.ativo = l, this.atualizarBotaoDe(t, e)));
821
- }
822
- abrirFlyout(t, e) {
823
- var l;
824
- const i = t.dataset.grupo ? g(this._ferramentas, t.dataset.grupo) : void 0;
825
- if (!((l = i == null ? void 0 : i.filhos) != null && l.length)) return;
826
- this.fecharMenu();
827
- const r = i.filhos.map((a) => ({
828
- ...a,
829
- ativo: (a.tipo ?? "ferramenta") === "ferramenta" ? a.id === this._ativo : a.ativo
830
- }));
831
- t.setAttribute("aria-expanded", "true"), this.menu = O(
832
- this.shadowRoot,
833
- t,
834
- r,
835
- (a) => {
836
- var h;
837
- const n = g(i.filhos, a.id);
838
- n && (this.acionar(n, i), (h = this.botoes().find((u) => u.dataset.grupo === i.id)) == null || h.focus());
839
- },
840
- {
841
- lado: this.getAttribute("orientacao") === "horizontal" ? "baixo" : "direita",
842
- focar: e,
843
- tipoPadrao: "ferramenta",
844
- onFechar: () => {
845
- t.setAttribute("aria-expanded", "false"), this.menu = null;
846
- }
847
- }
848
- );
849
- }
850
- fecharMenu() {
851
- var t;
852
- (t = this.menu) == null || t.fechar(), this.menu = null;
853
- }
854
- }
855
- z("ui-paleta-ferramentas", ot);
856
- export {
857
- Y as U,
858
- ot as a,
859
- Z as b
860
- };