@thibezer/ui-components-kit 2.24.1 → 2.24.2

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 (151) hide show
  1. package/CHANGELOG.md +61 -1
  2. package/dist/botao.cjs +12 -1
  3. package/dist/botao.js +162 -3
  4. package/dist/camadas.cjs +311 -1
  5. package/dist/camadas.js +3244 -148
  6. package/dist/campo-texto.cjs +16 -1
  7. package/dist/campo-texto.js +308 -7
  8. package/dist/canvas.cjs +22 -22
  9. package/dist/canvas.js +230 -233
  10. package/dist/card.cjs +20 -1
  11. package/dist/card.js +145 -2
  12. package/dist/components/ui-canvas-prancha/index.d.ts +1 -1
  13. package/dist/components/ui-canvas-prancha/prancha-teclado.d.ts +18 -0
  14. package/dist/components/ui-canvas-prancha/ui-canvas-prancha-base.d.ts +4 -0
  15. package/dist/components/ui-editor-prancha/editor-modos.d.ts +10 -0
  16. package/dist/components/ui-editor-prancha/editor-tipos.d.ts +4 -0
  17. package/dist/components/ui-editor-prancha/index.d.ts +1 -0
  18. package/dist/components/ui-editor-prancha/ui-editor-prancha.d.ts +39 -6
  19. package/dist/core.cjs +1 -1
  20. package/dist/core.js +44 -55
  21. package/dist/{cores-utils-BrdynxRd.js → cores-utils-DMyqWvZh.js} +2 -2
  22. package/dist/cores.cjs +32 -1
  23. package/dist/cores.js +300 -13
  24. package/dist/custom-elements.json +1712 -1205
  25. package/dist/data.cjs +28 -1
  26. package/dist/data.js +286 -99
  27. package/dist/{feature_caixa-2Sxv3tGa.js → feature_caixa-BVc5LenS.js} +42 -42
  28. package/dist/{feature_desenho-BVHivWIB.js → feature_desenho-CC8Mp5Gp.js} +2 -2
  29. package/dist/feedback.cjs +52 -1
  30. package/dist/feedback.js +655 -25
  31. package/dist/forms.cjs +66 -1
  32. package/dist/forms.js +1216 -39
  33. package/dist/{geometria-px-DUs5FgLE.js → geometria-px-DHMPUsxC.js} +47 -47
  34. package/dist/index.cjs +67 -1
  35. package/dist/index.js +1476 -274
  36. package/dist/kit-base-CGqj9aiD.cjs +2 -0
  37. package/dist/kit-base-_THn4w3u.js +1079 -0
  38. package/dist/mapa.cjs +5 -5
  39. package/dist/mapa.js +16 -17
  40. package/dist/modal.cjs +18 -1
  41. package/dist/modal.js +235 -29
  42. package/dist/motor.js +49 -49
  43. package/dist/prancha-nucleo.cjs +3 -1
  44. package/dist/prancha-nucleo.js +3120 -277
  45. package/dist/prancha.cjs +38 -1
  46. package/dist/prancha.js +3233 -228
  47. package/dist/register.cjs +1 -1
  48. package/dist/register.js +3 -20
  49. package/dist/seletor-mapa-base.cjs +13 -13
  50. package/dist/seletor-mapa-base.js +3 -5
  51. package/dist/tabela.cjs +142 -1
  52. package/dist/tabela.js +3773 -92
  53. package/dist/tipos-elementos.d.ts +5 -1
  54. package/dist/tipos-vue.d.ts +4 -1
  55. package/dist/tools.cjs +16 -1
  56. package/dist/tools.js +1564 -26
  57. package/dist/ui-seletor-cor-BGw8SBPm.cjs +83 -0
  58. package/dist/{ui-seletor-cor-Cd8jkzXG.js → ui-seletor-cor-B_twSm-V.js} +8 -9
  59. package/dist/utils-ClVgqVyJ.cjs +1 -0
  60. package/dist/utils-DrHoxxmf.js +83 -0
  61. package/package.json +43 -2
  62. package/dist/acessibilidade-CSzX-DkG.cjs +0 -1
  63. package/dist/acessibilidade-CUlSXc2X.js +0 -38
  64. package/dist/altura-controle-ukMRPckR.cjs +0 -1
  65. package/dist/altura-controle-vxQiXG4q.js +0 -62
  66. package/dist/alvo-digitavel-CzCvNVQ3.js +0 -23
  67. package/dist/alvo-digitavel-DbH0hYFf.cjs +0 -1
  68. package/dist/degrade-CIxvOTUv.cjs +0 -1
  69. package/dist/degrade-gDa5sW__.js +0 -119
  70. package/dist/feature_caixa-CnYPKVFS.cjs +0 -1
  71. package/dist/feature_caixa-DCs9ZeSk.js +0 -1038
  72. package/dist/feature_historico-BAIYk1Me.cjs +0 -3
  73. package/dist/feature_historico-C4h9y5fu.js +0 -3039
  74. package/dist/form-atalhos-7JTYvumA.cjs +0 -1
  75. package/dist/form-atalhos-DDTlpgaB.js +0 -203
  76. package/dist/form-erros-CwPz7Jr4.cjs +0 -1
  77. package/dist/form-erros-DT5HklfD.js +0 -184
  78. package/dist/form-submissao-C-SPRKgT.js +0 -61
  79. package/dist/form-submissao-DxKO5MHI.cjs +0 -1
  80. package/dist/form-validacao-BlQFxUVj.js +0 -104
  81. package/dist/form-validacao-DIeyQVH5.cjs +0 -1
  82. package/dist/geometria-px-DKrWq_XY.js +0 -639
  83. package/dist/leaflet-CEPcxGWV.cjs +0 -1
  84. package/dist/leaflet-DOq10gfg.js +0 -84
  85. package/dist/leaflet-loader-94z5VsdY.cjs +0 -2
  86. package/dist/leaflet-loader-Cjcdgj5R.js +0 -21
  87. package/dist/listener-bag-D5omxZ9h.cjs +0 -1
  88. package/dist/listener-bag-DQgv7OON.js +0 -34
  89. package/dist/motor-By2te6PZ.js +0 -1400
  90. package/dist/motor-CkMxd378.cjs +0 -1
  91. package/dist/opcoes-CupvWVIm.js +0 -24
  92. package/dist/opcoes-vdAUY5OI.cjs +0 -1
  93. package/dist/parts-CaoQiCfI.js +0 -7
  94. package/dist/parts-vQa2873h.cjs +0 -1
  95. package/dist/prancha-paleta-BZ-9QDgh.js +0 -5276
  96. package/dist/prancha-paleta-Bb24vP71.cjs +0 -17
  97. package/dist/ssr-safe-5cWfJP-s.js +0 -10
  98. package/dist/ssr-safe-CiHD1adl.cjs +0 -1
  99. package/dist/svg-seguro-ChVJ2L2z.js +0 -74
  100. package/dist/svg-seguro-J2RM1Ssf.cjs +0 -1
  101. package/dist/ui-badge-DE58YSBY.cjs +0 -28
  102. package/dist/ui-badge-KgmI3jOD.js +0 -201
  103. package/dist/ui-botao-Dz8YvmiA.cjs +0 -12
  104. package/dist/ui-botao-zLkcMMyP.js +0 -168
  105. package/dist/ui-bus-CUd99VJi.js +0 -177
  106. package/dist/ui-bus-XqBLlTYQ.cjs +0 -1
  107. package/dist/ui-camadas-DoHPnbQm.js +0 -3133
  108. package/dist/ui-camadas-Vx7wYD4D.cjs +0 -311
  109. package/dist/ui-campo-texto-Dliyt9qr.cjs +0 -16
  110. package/dist/ui-campo-texto-btevggO3.js +0 -379
  111. package/dist/ui-card-7IEYbCN0.js +0 -150
  112. package/dist/ui-card-Bx8EyzYY.cjs +0 -20
  113. package/dist/ui-card-C-EJoKnm.js +0 -150
  114. package/dist/ui-card-DFnRp9bl.js +0 -146
  115. package/dist/ui-card-DrWVJQKw.cjs +0 -20
  116. package/dist/ui-card-DsIjHMmG.cjs +0 -20
  117. package/dist/ui-controle-cores-B1w_Yl69.cjs +0 -32
  118. package/dist/ui-controle-cores-BRjMvmMn.js +0 -291
  119. package/dist/ui-controle-cores-BcH9k2Fa.js +0 -292
  120. package/dist/ui-controle-cores-CvSTP6gJ.cjs +0 -32
  121. package/dist/ui-editor-prancha-CIngI6yI.js +0 -2886
  122. package/dist/ui-editor-prancha-DorSe6sC.cjs +0 -31
  123. package/dist/ui-linha-2kY7TNUJ.cjs +0 -38
  124. package/dist/ui-linha-B4mBRm1x.cjs +0 -61
  125. package/dist/ui-linha-DTEIIww4.js +0 -1167
  126. package/dist/ui-linha-KFF86FW5.js +0 -752
  127. package/dist/ui-modal-BrXzVZ65.js +0 -216
  128. package/dist/ui-modal-lARKzEVZ.cjs +0 -18
  129. package/dist/ui-paleta-ferramentas-Bu6JaT0s.js +0 -1245
  130. package/dist/ui-paleta-ferramentas-D3Jhwt26.cjs +0 -21
  131. package/dist/ui-paleta-ferramentas-DebHYiwd.js +0 -1615
  132. package/dist/ui-paleta-ferramentas-Dgejtluh.js +0 -1423
  133. package/dist/ui-paleta-ferramentas-hzyo8wBt.cjs +0 -22
  134. package/dist/ui-paleta-ferramentas-jWuICjW8.cjs +0 -22
  135. package/dist/ui-seletor-cor-0RLjcME6.cjs +0 -83
  136. package/dist/ui-seletor-cor-CMuuW-Ym.cjs +0 -83
  137. package/dist/ui-seletor-cor-DFIQ1sin.js +0 -405
  138. package/dist/ui-skeleton-BLEV6h3k.js +0 -653
  139. package/dist/ui-skeleton-B_XTaGrX.cjs +0 -52
  140. package/dist/ui-switch-BXIDwC-Y.cjs +0 -66
  141. package/dist/ui-switch-Ctxk-jKS.js +0 -1212
  142. package/dist/ui-tabela-CXxqbwXv.cjs +0 -7
  143. package/dist/ui-tabela-Cd0vOwnT.js +0 -1459
  144. package/dist/ui-tabela-propriedades-C5cIF5ES.js +0 -3779
  145. package/dist/ui-tabela-propriedades-CJyo568n.js +0 -3517
  146. package/dist/ui-tabela-propriedades-D96Djx-q.cjs +0 -136
  147. package/dist/ui-tabela-propriedades-Wa34hfIr.cjs +0 -142
  148. package/dist/ui-tabela-propriedades-ahQhQauu.js +0 -2329
  149. package/dist/ui-tabela-propriedades-w9JWhjHy.cjs +0 -142
  150. package/dist/zero-js-triggers-CJT988bR.js +0 -83
  151. package/dist/zero-js-triggers-CgM9IIQB.cjs +0 -1
@@ -1,1245 +0,0 @@
1
- var tt = Object.defineProperty;
2
- var et = (o, s, t) => s in o ? tt(o, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[s] = t;
3
- var u = (o, s, t) => et(o, typeof s != "symbol" ? s + "" : s, t);
4
- import { L } from "./listener-bag-DQgv7OON.js";
5
- import { d as $, S as q } from "./ssr-safe-5cWfJP-s.js";
6
- import { A as U, a as P, e as W } from "./degrade-gDa5sW__.js";
7
- import { h as it } from "./svg-seguro-ChVJ2L2z.js";
8
- const rt = ':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)}', K = {
9
- 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>',
10
- 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>',
11
- 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>',
12
- 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>',
13
- 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>',
14
- 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>',
15
- 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>',
16
- 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>',
17
- 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>',
18
- 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>'
19
- };
20
- class at extends q {
21
- constructor() {
22
- super();
23
- u(this, "iconContainer");
24
- u(this, "svgContainer");
25
- u(this, "slotElement");
26
- u(this, "handleSlotChange", () => {
27
- this.syncState();
28
- });
29
- const t = this.attachShadow({ mode: "open" });
30
- t.innerHTML = `
31
- <style>${rt}</style>
32
- <span class="ui-icone" aria-hidden="true">
33
- <span class="ui-icone__svg" style="display: none;"></span>
34
- <slot></slot>
35
- </span>
36
- `, this.iconContainer = t.querySelector(".ui-icone"), this.svgContainer = t.querySelector(".ui-icone__svg"), this.slotElement = t.querySelector("slot");
37
- }
38
- static get observedAttributes() {
39
- return ["tamanho", "size", "cor", "color", "nome", "name"];
40
- }
41
- connectedCallback() {
42
- this.slotElement.addEventListener("slotchange", this.handleSlotChange), this.syncState();
43
- }
44
- disconnectedCallback() {
45
- this.slotElement.removeEventListener("slotchange", this.handleSlotChange);
46
- }
47
- attributeChangedCallback(t, e, i) {
48
- this.syncState();
49
- }
50
- resolveTamanhoPx() {
51
- const t = this.getAttribute("tamanho") || this.getAttribute("size") || "md";
52
- switch (t.toLowerCase()) {
53
- case "sm":
54
- return "16px";
55
- case "md":
56
- return "20px";
57
- case "lg":
58
- return "24px";
59
- case "xl":
60
- return "32px";
61
- default:
62
- return isNaN(Number(t)) ? t : `${t}px`;
63
- }
64
- }
65
- syncState() {
66
- const t = this.resolveTamanhoPx();
67
- this.style.setProperty("--ui-tamanho-icone", t);
68
- const e = this.getAttribute("cor") || this.getAttribute("color");
69
- 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");
70
- const r = this.getAttribute("nome") || this.getAttribute("name"), a = this.slotElement.assignedNodes().length > 0;
71
- r && K[r] && !a ? (this.svgContainer.innerHTML = K[r], this.svgContainer.style.display = "inline-flex") : (this.svgContainer.innerHTML = "", this.svgContainer.style.display = "none");
72
- }
73
- }
74
- $("ui-icone", at);
75
- const ot = ':host{display:block;position:relative;box-sizing:border-box;min-height:122px;font-family:var(--ui-fonte-base, "Inter", sans-serif);color:var(--ui-cor-texto, #e1e1e6)}:host([recolhido]){min-height:31px}.ui-ribbon{display:flex;flex-direction:column;background:var(--ui-degrade-interno, var(--ui-ribbon-fundo, var(--ui-fundo-superficie, 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}:host(.degrade),:host(.gradiente),:host([data-degrade]:not([data-degrade="false"])),.ui-ribbon[data-degrade]:not([data-degrade=false]){--ui-ribbon-fundo: var(--ui-gradiente-superficie)}.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;justify-content:center;flex-shrink:0;padding:0 var(--ui-espaco-sm, 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:center;gap:var(--ui-espaco-xs, 4px)}.ui-ribbon__grupo-rotulo{position:relative;display:flex;align-items:center;justify-content:center;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__grupo-rotulo:empty{display:none;padding:0}.ui-ribbon__lancador{position:absolute;right:0;top:50%;transform:translateY(-50%);display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;padding:0;border:0;background:transparent;color:var(--ui-cor-texto-secundario, #888899);cursor:pointer;border-radius:2px;opacity:.7}[dir=rtl] .ui-ribbon__lancador{right:auto;left:0}.ui-ribbon__lancador:hover{opacity:1;color:var(--ui-cor-texto, #e1e1e6);background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-ribbon__lancador:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:-1px}.ui-ribbon__grupo--colapsado{padding:0 4px;justify-content:center}.ui-ribbon__btn-colapsado{height:calc(100% - 6px);margin:3px 0}.ui-ribbon__keytip{position:absolute;z-index:100;padding:1px 4px;font-size:.625rem;font-weight:700;line-height:1;color:#111;background:#fef08a;border:1px solid #ca8a04;border-radius:2px;box-shadow:0 1px 3px #0006;pointer-events:none}.ui-ribbon__coluna{display:flex;flex-direction:column;justify-content:center;gap:2px}.ui-ribbon__separador{width:1px;height:68px;align-self:center;margin:0 var(--ui-espaco-xs, 4px);background:var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-ferr-btn--grande{flex-direction:column;min-width:52px;height:76px;padding:6px 8px;gap:3px;box-sizing:border-box;border-radius:var(--ui-raio-borda, 6px);justify-content:center;align-items:center}.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 8px;border-radius:var(--ui-raio-sm, 4px);justify-content:flex-start;box-sizing:border-box}.ui-ferr-btn--pequeno.ui-ferr-btn--so-icone{width:24px;padding:0;justify-content:center}.ui-ferr-split--pequeno{border-radius:var(--ui-raio-sm, 4px)}.ui-ferr-split--pequeno .ui-ferr-split__acao{border-radius:var(--ui-raio-sm, 4px) 0 0 var(--ui-raio-sm, 4px);padding:0 6px 0 8px}.ui-ferr-split--pequeno .ui-ferr-split__gatilho{border-radius:0 var(--ui-raio-sm, 4px) var(--ui-raio-sm, 4px) 0}.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}}', Y = '.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-degrade-interno, var(--ui-ferr-menu-fundo, var(--ui-fundo-elevado, 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}}.ui-ferr-tooltip{position:fixed;z-index:var(--ui-z-tooltip, 1200);pointer-events:none;display:none;align-items:center;gap:6px;padding:4px 8px;border-radius:var(--ui-raio-sm, 4px);background:var(--ui-degrade-interno, var(--ui-ferr-tooltip-fundo, var(--ui-fundo-elevado, var(--ui-cor-fundo-tooltip, #18181c))));color:var(--ui-cor-texto, #e1e1e6);font-family:var(--ui-fonte-base, "Inter", sans-serif);font-size:.6875rem;line-height:1.2;white-space:nowrap;border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .16));box-shadow:var(--ui-sombra-md, 0 4px 12px rgba(0, 0, 0, .35));opacity:0;transform:translateY(-2px);transition:opacity .12s ease,transform .12s ease}.ui-ferr-tooltip--visivel{display:inline-flex;opacity:1;transform:translateY(0)}.ui-ferr-tooltip__atalho{display:inline-flex;align-items:center;padding:1px 4px;border-radius:3px;background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08));color:var(--ui-cor-texto-secundario, #888899);font-family:inherit;font-size:.625rem;font-weight:600;border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08))}.ui-ferr-split{display:inline-flex;align-items:stretch;border-radius:var(--ui-raio-borda, 6px);position:relative}.ui-ferr-split--grande{flex-direction:column}.ui-ferr-split--grande .ui-ferr-split__acao{border-bottom-left-radius:0;border-bottom-right-radius:0}.ui-ferr-split--grande .ui-ferr-split__gatilho{height:16px;width:100%;border-top-left-radius:0;border-top-right-radius:0;border-top:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));padding:0;justify-content:center}.ui-ferr-split--pequeno{flex-direction:row}.ui-ferr-split--pequeno .ui-ferr-split__acao{border-top-right-radius:0;border-bottom-right-radius:0}.ui-ferr-split--pequeno .ui-ferr-split__gatilho{width:16px;height:24px;padding:0;border-top-left-radius:0;border-bottom-left-radius:0;border-left:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));justify-content:center}.ui-ferr-split:hover:not(:has(:disabled)){background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .04))}.ui-ferr-menu__caret-sub{width:0;height:0;margin-inline-start:auto;border-top:4px solid transparent;border-bottom:4px solid transparent;border-left:4px solid currentColor;opacity:.7}[dir=rtl] .ui-ferr-menu__caret-sub{border-left:0;border-right:4px solid currentColor}@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}}';
76
- function k(o, s) {
77
- if (!o) return null;
78
- const t = document.createElement("ui-icone");
79
- if (t.setAttribute("tamanho", String(s)), o.trimStart().startsWith("<")) {
80
- const e = it(o);
81
- if (!e) return null;
82
- t.appendChild(e);
83
- } else
84
- t.setAttribute("nome", o);
85
- return t;
86
- }
87
- const V = /* @__PURE__ */ new Set();
88
- function S(o) {
89
- return o.rotuloAcessivel ? o.rotuloAcessivel : o.rotulo ? o.rotulo : o.icone && !o.icone.trimStart().startsWith("<") ? o.icone : (V.has(o.id) || (V.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);
90
- }
91
- function R(o, s) {
92
- const t = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Set();
93
- 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.`);
94
- }
95
- function j(o, s = []) {
96
- for (const t of o)
97
- t.tipo !== "separador" && (s.push(t.id), t.filhos && j(t.filhos, s));
98
- return s;
99
- }
100
- function A(o, s) {
101
- o.disabled = !!s.disabled;
102
- const t = s.tipo, e = t === "toggle" || t === "ferramenta";
103
- e ? o.setAttribute("aria-pressed", String(!!s.ativo)) : o.removeAttribute("aria-pressed"), o.classList.toggle("ui-ferr-btn--ativo", e && !!s.ativo);
104
- }
105
- function F(o, s, t) {
106
- var n;
107
- const e = document.createElement("button");
108
- e.type = "button", e.className = `ui-ferr-btn ui-ferr-btn--${s}`, e.dataset.id = o.id, e.tabIndex = -1;
109
- const i = !!((n = o.filhos) != null && n.length), r = s !== "paleta" && !o.somenteIcone && !!o.rotulo;
110
- o.rotuloAcessivel ? e.setAttribute("aria-label", o.rotuloAcessivel) : r ? e.removeAttribute("aria-label") : e.setAttribute("aria-label", S(o)), o.atalho && e.setAttribute("aria-keyshortcuts", o.atalho), e.dataset.tooltip = S(o), o.atalho && (e.dataset.atalho = o.atalho);
111
- const a = k(o.icone, t);
112
- if (a) {
113
- const l = document.createElement("span");
114
- l.className = "ui-ferr-btn__icone", l.appendChild(a), e.appendChild(l);
115
- }
116
- if (s !== "paleta" && o.somenteIcone && e.classList.add("ui-ferr-btn--so-icone"), r) {
117
- const l = document.createElement("span");
118
- l.className = "ui-ferr-btn__rotulo", l.textContent = o.rotulo, e.appendChild(l);
119
- }
120
- if (i && !o.dividido) {
121
- if (s === "paleta")
122
- e.classList.add("ui-ferr-btn--grupo");
123
- else {
124
- const l = document.createElement("span");
125
- l.className = "ui-ferr-btn__caret", e.appendChild(l);
126
- }
127
- e.setAttribute("aria-haspopup", "menu"), e.setAttribute("aria-expanded", "false");
128
- }
129
- return A(e, o), e;
130
- }
131
- function st(o, s, t) {
132
- const e = document.createElement("div");
133
- e.className = `ui-ferr-split ui-ferr-split--${s}`, e.dataset.id = o.id;
134
- const i = F({ ...o, filhos: void 0, dividido: !1 }, s, t);
135
- i.classList.add("ui-ferr-split__acao"), i.dataset.split = "acao";
136
- const r = document.createElement("button");
137
- r.type = "button", r.className = `ui-ferr-btn ui-ferr-split__gatilho ui-ferr-btn--${s}`, r.dataset.id = o.id, r.dataset.split = "gatilho", r.tabIndex = -1, r.disabled = !!o.disabled, r.setAttribute("aria-haspopup", "menu"), r.setAttribute("aria-expanded", "false"), r.setAttribute("aria-label", `Opções de ${S(o)}`), r.dataset.tooltip = `Opções de ${S(o)}`;
138
- const a = document.createElement("span");
139
- return a.className = "ui-ferr-btn__caret", r.appendChild(a), e.appendChild(i), e.appendChild(r), e;
140
- }
141
- function m(o, s) {
142
- for (const t of o) {
143
- if (t.id === s) return t;
144
- if (t.filhos) {
145
- const e = m(t.filhos, s);
146
- if (e) return e;
147
- }
148
- }
149
- }
150
- function X(o, s) {
151
- if (!s || !s.trim()) return !1;
152
- const t = s.split("+").map((f) => f.trim()), e = t[t.length - 1], i = t.some((f) => /^(ctrl|control|cmd|meta)$/i.test(f)), r = t.some((f) => /^alt$/i.test(f)), a = t.some((f) => /^shift$/i.test(f)), n = o.ctrlKey || o.metaKey, l = o.altKey, c = o.shiftKey;
153
- if (i !== n || r !== l || a !== c) return !1;
154
- const d = e.toLowerCase(), p = (o.key || "").toLowerCase();
155
- return d === "esc" || d === "escape" ? p === "escape" : d === "del" || d === "delete" ? p === "delete" : d === "enter" ? p === "enter" : d === "space" || d === "espaço" ? p === " " || p === "space" : p === d;
156
- }
157
- function B(o) {
158
- const s = o.filter((t) => !t.disabled);
159
- o.forEach((t) => t.tabIndex = -1), s.length && (s[0].tabIndex = 0);
160
- }
161
- function J(o) {
162
- const s = o.find((t) => t.tabIndex === 0 && !t.disabled);
163
- s ? o.forEach((t) => {
164
- t !== s && (t.tabIndex = -1);
165
- }) : B(o);
166
- }
167
- function Q(o, s) {
168
- const t = o.find((e) => e === s || e.contains(s));
169
- !t || t.disabled || o.forEach((e) => e.tabIndex = e === t ? 0 : -1);
170
- }
171
- function N(o, s, t, e) {
172
- const i = s.filter((l) => !l.disabled), r = i.length, a = i.findIndex((l) => l === o.target);
173
- if (r === 0 || a < 0) return !1;
174
- let n = a;
175
- if (t.includes(o.key)) n = (a - 1 + r) % r;
176
- else if (e.includes(o.key)) n = (a + 1) % r;
177
- else if (o.key === "Home") n = 0;
178
- else if (o.key === "End") n = r - 1;
179
- else return !1;
180
- return o.preventDefault(), s.forEach((l) => l.tabIndex = -1), i[n].tabIndex = 0, i[n].focus(), !0;
181
- }
182
- function nt(o, s, t = !1) {
183
- const e = s.filter((l) => !l.disabled), i = e.length, r = e.findIndex((l) => l === o.target);
184
- if (i === 0 || r < 0) return !1;
185
- let a = r;
186
- const n = r % 2;
187
- if (o.key === "ArrowRight")
188
- t ? n === 1 && (a = r - 1) : n === 0 && r + 1 < i && (a = r + 1);
189
- else if (o.key === "ArrowLeft")
190
- t ? n === 0 && r + 1 < i && (a = r + 1) : n === 1 && (a = r - 1);
191
- else if (o.key === "ArrowDown")
192
- r + 2 < i ? a = r + 2 : r + 1 < i && n === 0 && (a = r + 1);
193
- else if (o.key === "ArrowUp")
194
- r - 2 >= 0 ? a = r - 2 : r - 1 >= 0 && n === 1 && (a = r - 1);
195
- else if (o.key === "Home")
196
- a = 0;
197
- else if (o.key === "End")
198
- a = i - 1;
199
- else
200
- return !1;
201
- return o.preventDefault(), s.forEach((l) => l.tabIndex = -1), e[a].tabIndex = 0, e[a].focus(), !0;
202
- }
203
- let lt = 0;
204
- class Z {
205
- constructor(s, t) {
206
- u(this, "el");
207
- u(this, "textoEl");
208
- u(this, "atalhoEl");
209
- u(this, "timer");
210
- u(this, "alvoAtual", null);
211
- u(this, "id", `ui-ferr-tooltip-${++lt}`);
212
- u(this, "listeners", new L());
213
- this.raiz = s, this.el = document.createElement("div"), this.el.className = "ui-ferr-tooltip", this.el.id = this.id, this.el.setAttribute("role", "tooltip"), this.el.setAttribute("aria-hidden", "true"), this.textoEl = document.createElement("span"), this.textoEl.className = "ui-ferr-tooltip__texto", this.atalhoEl = document.createElement("kbd"), this.atalhoEl.className = "ui-ferr-tooltip__atalho", this.el.appendChild(this.textoEl), this.el.appendChild(this.atalhoEl), this.raiz.appendChild(this.el), this.listeners.add(t, "pointerover", (e) => {
214
- const i = e.target.closest(".ui-ferr-btn, .ui-ribbon__fixar, .ui-ribbon__lancador");
215
- if (i && i !== this.alvoAtual) {
216
- const r = i.dataset.tooltip || i.getAttribute("aria-label") || "", a = i.dataset.atalho || i.getAttribute("aria-keyshortcuts") || "";
217
- r && this.agendar(i, r, a);
218
- }
219
- }), this.listeners.add(t, "pointerout", (e) => {
220
- const r = e.relatedTarget;
221
- this.alvoAtual && (!r || !this.alvoAtual.contains(r)) && this.esconder();
222
- }), this.listeners.add(t, "focusin", (e) => {
223
- const i = e.target.closest(".ui-ferr-btn, .ui-ribbon__fixar, .ui-ribbon__lancador");
224
- if (i) {
225
- const r = i.dataset.tooltip || i.getAttribute("aria-label") || "", a = i.dataset.atalho || i.getAttribute("aria-keyshortcuts") || "";
226
- r && this.mostrar(i, r, a);
227
- }
228
- }), this.listeners.add(t, "focusout", () => this.esconder()), this.listeners.add(t, "pointerdown", () => this.esconder()), this.listeners.add(t, "click", () => this.esconder()), this.listeners.add(window, "scroll", () => this.esconder(), !0), this.listeners.add(window, "resize", () => this.esconder());
229
- }
230
- agendar(s, t, e) {
231
- this.limparTimer(), this.timer = window.setTimeout(() => this.mostrar(s, t, e), 140);
232
- }
233
- mostrar(s, t, e) {
234
- if (this.limparTimer(), !s.isConnected || !t) return;
235
- this.alvoAtual = s, this.textoEl.textContent = t, e ? (this.atalhoEl.textContent = `(${e})`, this.atalhoEl.style.display = "") : (this.atalhoEl.textContent = "", this.atalhoEl.style.display = "none"), this.el.classList.add("ui-ferr-tooltip--visivel"), this.el.setAttribute("aria-hidden", "false"), s.setAttribute("aria-describedby", this.id);
236
- const i = s.getBoundingClientRect(), r = this.el.getBoundingClientRect();
237
- let a = i.bottom + 6, n = i.left + (i.width - (r.width || 80)) / 2;
238
- a + (r.height || 24) > window.innerHeight - 6 && (a = Math.max(6, i.top - (r.height || 24) - 6)), n < 6 ? n = 6 : n + (r.width || 80) > window.innerWidth - 6 && (n = Math.max(6, window.innerWidth - (r.width || 80) - 6)), this.el.style.top = `${a}px`, this.el.style.left = `${n}px`;
239
- }
240
- esconder() {
241
- this.limparTimer(), this.alvoAtual && (this.alvoAtual.removeAttribute("aria-describedby"), this.alvoAtual = null), this.el.classList.remove("ui-ferr-tooltip--visivel"), this.el.setAttribute("aria-hidden", "true");
242
- }
243
- limparTimer() {
244
- this.timer !== void 0 && (window.clearTimeout(this.timer), this.timer = void 0);
245
- }
246
- destruir() {
247
- this.esconder(), this.listeners.cleanup(), this.el.remove();
248
- }
249
- }
250
- let dt = 0;
251
- function M(o, s, t, e, i = {}) {
252
- var O;
253
- const r = i.lado ?? "baixo", a = new L(), n = document.createElement("div");
254
- n.className = "ui-ferr-menu", n.setAttribute("role", "menu"), n.id = `ui-ferr-menu-${++dt}`, n.setAttribute("aria-label", s.getAttribute("aria-label") || "Menu"), s.setAttribute("aria-controls", n.id);
255
- const l = [];
256
- let c = !1, d = null;
257
- const p = () => {
258
- d && (d.fechar(), d = null);
259
- }, f = () => {
260
- var h;
261
- c || (c = !0, p(), s.removeAttribute("aria-controls"), a.cleanup(), n.remove(), (h = i.onFechar) == null || h.call(i));
262
- }, g = getComputedStyle(s).direction === "rtl";
263
- t.forEach((h) => {
264
- var H;
265
- if (h.tipo === "separador") {
266
- const x = document.createElement("div");
267
- x.className = "ui-ferr-menu__sep", x.setAttribute("role", "separator"), n.appendChild(x);
268
- return;
269
- }
270
- const b = document.createElement("button");
271
- b.type = "button", b.className = "ui-ferr-menu__item";
272
- const E = h.tipo ?? i.tipoPadrao ?? "botao";
273
- E === "toggle" ? (b.setAttribute("role", "menuitemcheckbox"), b.setAttribute("aria-checked", String(!!h.ativo))) : E === "ferramenta" ? (b.setAttribute("role", "menuitemradio"), b.setAttribute("aria-checked", String(!!h.ativo))) : b.setAttribute("role", "menuitem"), b.dataset.id = h.id, b.disabled = !!h.disabled, h.atalho && b.setAttribute("aria-keyshortcuts", h.atalho), h.ativo && b.classList.add("ui-ferr-menu__item--ativo");
274
- const C = document.createElement("span");
275
- C.className = "ui-ferr-menu__icone";
276
- const z = k(h.icone, 14);
277
- z && C.appendChild(z), b.appendChild(C);
278
- const v = document.createElement("span");
279
- if (v.className = "ui-ferr-menu__rotulo", v.textContent = S(h), b.appendChild(v), h.atalho) {
280
- const x = document.createElement("span");
281
- x.className = "ui-ferr-menu__atalho", x.textContent = h.atalho, b.appendChild(x);
282
- }
283
- if (!!((H = h.filhos) != null && H.length)) {
284
- b.classList.add("ui-ferr-menu__item--has-sub"), b.setAttribute("aria-haspopup", "menu"), b.setAttribute("aria-expanded", "false");
285
- const x = document.createElement("span");
286
- x.className = "ui-ferr-menu__caret-sub", b.appendChild(x);
287
- const G = (T) => {
288
- (d == null ? void 0 : d.ancora) !== b && (p(), b.setAttribute("aria-expanded", "true"), d = M(o, b, h.filhos, e, {
289
- lado: g ? "esquerda" : "direita",
290
- focar: T,
291
- tipoPadrao: i.tipoPadrao,
292
- onFechar: () => {
293
- b.setAttribute("aria-expanded", "false"), d = null;
294
- }
295
- }));
296
- };
297
- b.addEventListener("pointerenter", () => G(!1)), b.addEventListener("click", (T) => {
298
- T.stopPropagation(), G(!0);
299
- });
300
- } else
301
- b.addEventListener("pointerenter", p), b.addEventListener("click", (x) => {
302
- x.stopPropagation(), f(), s.focus(), e(h);
303
- });
304
- l.push(b), n.appendChild(b);
305
- }), o.appendChild(n);
306
- const _ = s.getBoundingClientRect(), w = n.getBoundingClientRect();
307
- let I = r === "baixo" ? _.bottom + 2 : _.top, y = r === "direita" ? _.right + 4 : r === "esquerda" ? _.left - w.width - 4 : g ? _.right - w.width : _.left;
308
- w.width && y + w.width > window.innerWidth - 4 && (y = Math.max(4, window.innerWidth - w.width - 4)), y < 4 && (y = 4), w.height && I + w.height > window.innerHeight - 4 && (I = Math.max(4, window.innerHeight - w.height - 4)), n.style.top = `${I}px`, n.style.left = `${y}px`;
309
- const D = () => l.filter((h) => !h.disabled);
310
- return a.add(n, "keydown", (h) => {
311
- const b = D(), E = b.findIndex((v) => v === h.target), C = g ? "ArrowLeft" : "ArrowRight", z = g ? "ArrowRight" : "ArrowLeft";
312
- if (h.key === "Escape")
313
- h.preventDefault(), h.stopPropagation(), f(), s.focus();
314
- else if (h.key === "Tab")
315
- f();
316
- else if (b.length && (h.key === "ArrowDown" || h.key === "ArrowUp")) {
317
- h.preventDefault(), p();
318
- const v = h.key === "ArrowDown" ? 1 : -1;
319
- b[(E + v + b.length) % b.length].focus();
320
- } else if (b.length && h.key === C) {
321
- const v = b[E];
322
- v != null && v.classList.contains("ui-ferr-menu__item--has-sub") && (h.preventDefault(), v.click());
323
- } else h.key === z && (r === "direita" || r === "esquerda") ? (h.preventDefault(), h.stopPropagation(), f(), s.focus()) : b.length && h.key === "Home" ? (h.preventDefault(), b[0].focus()) : b.length && h.key === "End" && (h.preventDefault(), b[b.length - 1].focus());
324
- }), a.add(document, "pointerdown", (h) => {
325
- const b = h.composedPath();
326
- !b.includes(n) && !b.includes(s) && !(d != null && d.elemento.contains(h.target)) && f();
327
- }, !0), a.add(window, "resize", f), a.add(window, "scroll", (h) => {
328
- h.target instanceof Node && n.contains(h.target) || f();
329
- }, !0), i.focar && ((O = D()[0]) == null || O.focus()), { elemento: n, ancora: s, fechar: f, focarPrimeiro: () => {
330
- var h;
331
- return (h = D()[0]) == null ? void 0 : h.focus();
332
- } };
333
- }
334
- const ut = 3;
335
- function ct({ aba: o, ativa: s, idBotao: t, idPainel: e }) {
336
- const i = document.createElement("button");
337
- return i.type = "button", i.className = "ui-ribbon__aba", i.setAttribute("role", "tab"), i.dataset.id = o.id, i.id = t, s && i.setAttribute("aria-controls", e), i.textContent = o.rotulo, i.tabIndex = s ? 0 : -1, i.setAttribute("aria-selected", String(s)), i.classList.toggle("ui-ribbon__aba--ativa", s), i.classList.toggle("ui-ribbon__aba--contextual", !!o.contextual), i;
338
- }
339
- const ht = '<svg viewBox="0 0 24 24"><path d="M4 6h16M4 12h16M4 18h16" stroke="currentColor" stroke-width="2" fill="none"/></svg>', pt = '<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M4 12h8V4M12 12l-7-7"/></svg>', bt = (o) => o.rotuloLancador || `Mais opções de ${o.rotulo || "ferramentas"}`;
340
- function ft(o, s) {
341
- s.classList.add("ui-ribbon__grupo--colapsado");
342
- const t = document.createElement("button");
343
- t.type = "button", t.className = "ui-ferr-btn ui-ferr-btn--grande ui-ribbon__btn-colapsado", t.dataset.grupoColapsado = o.id, t.dataset.tooltip = o.rotulo, t.setAttribute("aria-haspopup", "menu"), t.setAttribute("aria-expanded", "false");
344
- const e = k(o.icone, 24) || k(ht, 24);
345
- if (e) {
346
- const a = document.createElement("span");
347
- a.className = "ui-ferr-btn__icone", a.appendChild(e), t.appendChild(a);
348
- }
349
- const i = document.createElement("span");
350
- i.className = "ui-ferr-btn__rotulo", i.textContent = o.rotulo, t.appendChild(i);
351
- const r = document.createElement("span");
352
- return r.className = "ui-ferr-btn__caret", t.appendChild(r), s.appendChild(t), s;
353
- }
354
- function mt(o, s, t = {}) {
355
- const e = document.createElement("div");
356
- if (e.className = "ui-ribbon__grupo", e.setAttribute("role", "group"), e.setAttribute("aria-label", o.rotulo), e.dataset.id = o.id, t.colapsado) return ft(o, e);
357
- const i = (c, d, p) => {
358
- var f;
359
- return c.dividido && ((f = c.filhos) != null && f.length) && t.criarDividido ? t.criarDividido(c, d, p) : s(c, d, p);
360
- }, r = document.createElement("div");
361
- r.className = "ui-ribbon__grupo-itens";
362
- let a = null, n = 0;
363
- const l = () => {
364
- a && r.appendChild(a), a = null, n = 0;
365
- };
366
- if (o.itens.forEach((c) => {
367
- if (c.tipo === "separador") {
368
- l();
369
- const d = document.createElement("div");
370
- d.className = "ui-ribbon__separador", d.setAttribute("role", "separator"), r.appendChild(d);
371
- } else c.tamanho === "grande" ? (l(), r.appendChild(i(c, "grande", 24))) : (a || (a = document.createElement("div"), a.className = "ui-ribbon__coluna"), a.appendChild(i(c, "pequeno", 16)), ++n === ut && l());
372
- }), l(), o.rotulo || o.lancadorDialogo) {
373
- const c = document.createElement("div");
374
- if (c.className = "ui-ribbon__grupo-rotulo", o.rotulo && (c.textContent = o.rotulo), o.lancadorDialogo) {
375
- const d = document.createElement("button");
376
- d.type = "button", d.className = "ui-ribbon__lancador", d.dataset.lancador = o.id;
377
- const p = bt(o);
378
- d.setAttribute("aria-label", p), d.dataset.tooltip = p;
379
- const f = k(pt, 10);
380
- f && d.appendChild(f), c.appendChild(d);
381
- }
382
- return e.appendChild(r), e.appendChild(c), e;
383
- }
384
- return e.appendChild(r), e;
385
- }
386
- function gt(o, s, t, e, i = !1) {
387
- if (s < 0 || t <= 0) return null;
388
- if (i && (o === "Enter" || o === " ")) return { tipo: "ativar", indice: s };
389
- const [r, a] = e ? ["ArrowLeft", "ArrowRight"] : ["ArrowRight", "ArrowLeft"];
390
- return o === r ? { tipo: "ir-para", indice: (s + 1) % t } : o === a ? { tipo: "ir-para", indice: (s - 1 + t) % t } : o === "Home" ? { tipo: "ir-para", indice: 0 } : o === "End" ? { tipo: "ir-para", indice: t - 1 } : o === "ArrowDown" ? { tipo: "descer" } : null;
391
- }
392
- let vt = 0;
393
- class xt extends q {
394
- constructor() {
395
- super();
396
- u(this, "rootElement");
397
- u(this, "abasElement");
398
- u(this, "gruposElement");
399
- u(this, "painelElement");
400
- u(this, "fixarElement");
401
- u(this, "uid", `ui-ribbon-${++vt}`);
402
- u(this, "_abaPendente", "");
403
- u(this, "_pronto", !1);
404
- u(this, "_modoControlado", !1);
405
- u(this, "_abas", []);
406
- u(this, "_abaAtiva", "");
407
- u(this, "menu", null);
408
- u(this, "listeners", new L());
409
- u(this, "tooltip", null);
410
- u(this, "observerResize", null);
411
- u(this, "gruposColapsados", /* @__PURE__ */ new Set());
412
- u(this, "keytipsAtivas", !1);
413
- u(this, "handleFocusInGrupos", (t) => Q(this.botoesPainel(), t.target));
414
- /* ---------- Interação ---------- */
415
- u(this, "handleClickAbas", (t) => {
416
- const e = t.target.closest(".ui-ribbon__aba");
417
- e != null && e.dataset.id && (this.selecionarAba(e.dataset.id), this.recolhido && this.rootElement.classList.toggle("ui-ribbon--aberto"));
418
- });
419
- u(this, "handleClickFixar", () => {
420
- this.recolhido = !this.recolhido;
421
- });
422
- u(this, "handleDblClickAbas", (t) => {
423
- t.target.closest(".ui-ribbon__aba") && (this.recolhido = !this.recolhido);
424
- });
425
- u(this, "handleKeyDownAbas", (t) => {
426
- var a, n;
427
- const e = Array.from(this.abasElement.querySelectorAll(".ui-ribbon__aba")), i = gt(t.key, e.findIndex((l) => l === t.target), e.length, this.rtl, this.ativacaoManual);
428
- if (!i) return;
429
- if (t.preventDefault(), i.tipo === "descer") {
430
- this.recolhido && this.rootElement.classList.add("ui-ribbon--aberto"), (a = this.botoesPainel().find((l) => !l.disabled)) == null || a.focus();
431
- return;
432
- }
433
- if (i.tipo === "ativar") {
434
- const l = e[i.indice].dataset.id;
435
- l && this.selecionarAba(l);
436
- return;
437
- }
438
- const r = e[i.indice].dataset.id;
439
- if (this.ativacaoManual) {
440
- e.forEach((l) => l.tabIndex = -1), e[i.indice].tabIndex = 0, e[i.indice].focus();
441
- return;
442
- }
443
- r && this.selecionarAba(r), (n = this.abasElement.querySelector(`.ui-ribbon__aba[data-id="${CSS.escape(r ?? "")}"]`)) == null || n.focus();
444
- });
445
- u(this, "handleClickGrupos", (t) => {
446
- var c;
447
- const e = t.target, i = this._abas.find((d) => d.id === this._abaAtiva), r = e.closest(".ui-ribbon__btn-colapsado");
448
- if (r) {
449
- const d = i == null ? void 0 : i.grupos.find((p) => p.id === r.dataset.grupoColapsado);
450
- d && this.alternarMenuGrupoColapsado(r, d);
451
- return;
452
- }
453
- const a = e.closest(".ui-ribbon__lancador");
454
- if (a) {
455
- const d = i == null ? void 0 : i.grupos.find((p) => p.id === a.dataset.lancador);
456
- d && this.dispatchEvent(new CustomEvent("ui-grupo-dialogo", {
457
- detail: { id: typeof d.lancadorDialogo == "string" ? d.lancadorDialogo : d.id, grupo: d },
458
- bubbles: !0,
459
- composed: !0
460
- }));
461
- return;
462
- }
463
- const n = e.closest(".ui-ferr-split__gatilho");
464
- if (n) {
465
- const d = n.closest(".ui-ferr-split"), p = d == null ? void 0 : d.dataset.id, f = i && m(i.grupos.flatMap((g) => g.itens), p ?? "");
466
- f && ((c = f.filhos) != null && c.length) && this.alternarMenu(n, f, !1);
467
- return;
468
- }
469
- const l = e.closest(".ui-ferr-btn");
470
- l != null && l.dataset.id && this.acionar(l, t.detail === 0);
471
- });
472
- u(this, "handleKeyDownGrupos", (t) => {
473
- var r;
474
- const e = this.botoesPainel();
475
- if (this.rtl ? N(t, e, ["ArrowRight"], ["ArrowLeft"]) : N(t, e, ["ArrowLeft"], ["ArrowRight"])) return;
476
- const i = t.target instanceof HTMLButtonElement ? t.target : null;
477
- (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));
478
- });
479
- u(this, "handleEscape", (t) => {
480
- t.key === "Escape" && !this.menu && this.rootElement.classList.remove("ui-ribbon--aberto");
481
- });
482
- u(this, "handlePointerDownFora", (t) => {
483
- !this.recolhido || !this.rootElement.classList.contains("ui-ribbon--aberto") || t.composedPath().includes(this) || this.rootElement.classList.remove("ui-ribbon--aberto");
484
- });
485
- u(this, "handleAtalho", (t) => {
486
- if (!this.hasAttribute("atalhos") && !this.hasAttribute("keytips") || t.defaultPrevented) return;
487
- const e = t.composedPath(), i = e[0];
488
- if (i && (/^(INPUT|TEXTAREA|SELECT)$/.test(i.tagName) || i.isContentEditable) || e.some((d) => {
489
- var f, g;
490
- const p = (f = d.getAttribute) == null ? void 0 : f.call(d, "role");
491
- return ((g = d.getAttribute) == null ? void 0 : g.call(d, "aria-modal")) === "true" || p === "textbox" || p === "searchbox" || p === "combobox" || p === "spinbutton";
492
- })) return;
493
- if (this.hasAttribute("keytips") && (t.key === "Alt" || t.key === "F10") && !t.ctrlKey && !t.shiftKey && !t.metaKey) {
494
- t.preventDefault(), this.alternarKeyTips();
495
- return;
496
- }
497
- if (!this.hasAttribute("atalhos")) return;
498
- const a = this._abas.find((d) => d.id === this._abaAtiva);
499
- if (!a) return;
500
- const l = a.grupos.flatMap((d) => d.itens).find((d) => !d.disabled && X(t, d.atalho));
501
- if (!l) return;
502
- t.preventDefault();
503
- const c = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(l.id)}"]`);
504
- c ? this.acionar(c, !1) : this.emitir(l);
505
- });
506
- const t = this.attachShadow({ mode: "open" });
507
- t.innerHTML = `
508
- <style>${Y}${ot}</style>
509
- <div class="ui-ribbon" part="base">
510
- <div class="ui-ribbon__cabecalho" part="cabecalho">
511
- <div class="ui-ribbon__abas" part="abas" role="tablist"></div>
512
- <button type="button" class="ui-ribbon__fixar" part="fixar"></button>
513
- </div>
514
- <div class="ui-ribbon__painel" part="painel" role="tabpanel">
515
- <div class="ui-ribbon__grupos" part="grupos" role="toolbar" aria-label="Ferramentas"></div>
516
- </div>
517
- </div>
518
- `, 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`;
519
- }
520
- static get observedAttributes() {
521
- return [
522
- "aba-ativa",
523
- "recolhido",
524
- "compacto",
525
- "ativacao-manual",
526
- "copiar-dados",
527
- "modo-controlado",
528
- "atalhos",
529
- "keytips",
530
- "aria-label",
531
- "rotulo-abas",
532
- "rotulo-fixar",
533
- "rotulo-expandir",
534
- ...U
535
- ];
536
- }
537
- connectedCallback() {
538
- var e;
539
- this.listeners.cleanup(), (e = this.tooltip) == null || e.destruir(), this.tooltip = new Z(this.shadowRoot, this.rootElement), 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), this.listeners.add(document, "keydown", this.handleAtalho), this.iniciarResizeObserver();
540
- const t = this.getAttribute("aba-ativa");
541
- t && !this._abaAtiva && (this._abaPendente = t), P(this, this.rootElement), this.aplicarRotulos(), this.renderizar(), this._pronto = !0;
542
- }
543
- disconnectedCallback() {
544
- var t, e;
545
- this._pronto = !1, this.fecharMenu(), (t = this.observerResize) == null || t.disconnect(), this.observerResize = null, (e = this.tooltip) == null || e.destruir(), this.tooltip = null, this.listeners.cleanup();
546
- }
547
- attributeChangedCallback(t, e, i) {
548
- if (e !== i) {
549
- if (W(t)) {
550
- P(this, this.rootElement);
551
- return;
552
- }
553
- if (t === "aba-ativa") {
554
- if (!i || i === this._abaAtiva) return;
555
- this._abas.some((r) => r.id === i && !r.oculta) ? (this._abaPendente = "", this.selecionarAba(i, !1)) : (this._abaPendente = i, this.abasVisiveis().length && this.renderizar());
556
- } else t === "recolhido" ? (this.rootElement.classList.remove("ui-ribbon--aberto"), this.aplicarRotulos(), this._pronto && e === null != (i === null) && this.dispatchEvent(
557
- new CustomEvent("ui-recolhido-change", {
558
- detail: { recolhido: i !== null },
559
- bubbles: !0,
560
- composed: !0
561
- })
562
- )) : (t === "aria-label" || t === "rotulo-abas" || t === "rotulo-fixar" || t === "rotulo-expandir") && this.aplicarRotulos();
563
- }
564
- }
565
- aplicarRotulos() {
566
- this.gruposElement.setAttribute("aria-label", this.getAttribute("aria-label") || "Ferramentas"), this.abasElement.setAttribute("aria-label", this.getAttribute("rotulo-abas") || "Abas");
567
- 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";
568
- 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);
569
- }
570
- /* ---------- API pública ---------- */
571
- get modoControlado() {
572
- return this._modoControlado || this.hasAttribute("modo-controlado") || this.hasAttribute("copiar-dados");
573
- }
574
- set modoControlado(t) {
575
- this._modoControlado = !!t;
576
- }
577
- get copiarDados() {
578
- return this.modoControlado;
579
- }
580
- set copiarDados(t) {
581
- this.modoControlado = t;
582
- }
583
- get ativacaoManual() {
584
- return this.hasAttribute("ativacao-manual");
585
- }
586
- set ativacaoManual(t) {
587
- t ? this.setAttribute("ativacao-manual", "") : this.removeAttribute("ativacao-manual");
588
- }
589
- get abas() {
590
- return this._abas;
591
- }
592
- set abas(t) {
593
- const e = Array.isArray(t) ? t : [];
594
- this._abas = this.modoControlado ? e.map((i) => ({
595
- ...i,
596
- grupos: i.grupos.map((r) => ({
597
- ...r,
598
- itens: r.itens.map((a) => {
599
- var n;
600
- return {
601
- ...a,
602
- filhos: (n = a.filhos) == null ? void 0 : n.map((l) => ({ ...l }))
603
- };
604
- })
605
- }))
606
- })) : e, R(this._abas.map((i) => i.id), "<ui-ribbon> abas"), R(
607
- this._abas.flatMap((i) => i.grupos.flatMap((r) => j(r.itens))),
608
- "<ui-ribbon> itens"
609
- ), this.gruposColapsados.clear(), this.renderizar();
610
- }
611
- get abaAtiva() {
612
- return this._abaAtiva;
613
- }
614
- set abaAtiva(t) {
615
- this.selecionarAba(t);
616
- }
617
- get recolhido() {
618
- return this.hasAttribute("recolhido");
619
- }
620
- set recolhido(t) {
621
- t ? this.setAttribute("recolhido", "") : this.removeAttribute("recolhido");
622
- }
623
- get compacto() {
624
- return this.hasAttribute("compacto");
625
- }
626
- set compacto(t) {
627
- t ? this.setAttribute("compacto", "") : this.removeAttribute("compacto");
628
- }
629
- selecionarAba(t, e = !0) {
630
- const i = this._abas.find((r) => r.id === t && !r.oculta);
631
- if (!i) {
632
- t && this._abas.length && console.warn(`[ui-ribbon] selecionarAba("${t}"): aba inexistente ou oculta.`);
633
- return;
634
- }
635
- i.id !== this._abaAtiva && (this._abaPendente = "", this.fecharMenu(), this.gruposColapsados.clear(), this._abaAtiva = i.id, this.getAttribute("aba-ativa") !== i.id && this.setAttribute("aba-ativa", i.id), this.renderizar(), e && this.dispatchEvent(
636
- new CustomEvent("ui-aba-change", {
637
- detail: { id: i.id, aba: i },
638
- bubbles: !0,
639
- composed: !0
640
- })
641
- ));
642
- }
643
- definirAbaVisivel(t, e) {
644
- const i = this._abas.find((n) => n.id === t);
645
- if (!i) return;
646
- const r = this._abaAtiva;
647
- i.oculta = !e, !e && r === t && (this._abaAtiva = ""), this.renderizar();
648
- const a = this._abas.find((n) => n.id === this._abaAtiva);
649
- !e && r === t && a && this.dispatchEvent(
650
- new CustomEvent("ui-aba-change", { detail: { id: a.id, aba: a }, bubbles: !0, composed: !0 })
651
- );
652
- }
653
- /** Atualiza um item (estado ou aparência) sem precisar recriar as abas. */
654
- atualizarItem(t, e) {
655
- const i = this._abas.flatMap((c) => c.grupos.flatMap((d) => d.itens)), r = m(i, t);
656
- if (!r) {
657
- console.warn(`[ui-ribbon] atualizarItem("${t}"): item não encontrado.`);
658
- return;
659
- }
660
- Object.assign(r, e);
661
- const a = this._abas.find((c) => c.id === this._abaAtiva);
662
- if (!a || !m(a.grupos.flatMap((c) => c.itens), t)) return;
663
- const n = Object.keys(e).every((c) => c === "ativo" || c === "disabled"), l = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(t)}"]`);
664
- n ? l && (A(l, this.efetivo(r)), J(this.botoesPainel())) : this.comFoco(() => this.renderizarPainel());
665
- }
666
- efetivo(t) {
667
- var e;
668
- return (e = t.filhos) != null && e.length ? { ...t, tipo: "menu" } : t;
669
- }
670
- /* ---------- Foco preservado em re-renderizações ---------- */
671
- capturarFoco() {
672
- var e, i;
673
- const t = (e = this.shadowRoot) == null ? void 0 : e.activeElement;
674
- 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;
675
- }
676
- comFoco(t) {
677
- const e = this.capturarFoco();
678
- if (t(), !e) return;
679
- const i = this.shadowRoot.querySelector(`${e.seletor}[data-id="${CSS.escape(e.id)}"]`);
680
- i && !i.disabled && i.focus();
681
- }
682
- /* ---------- Renderização ---------- */
683
- abasVisiveis() {
684
- return this._abas.filter((t) => !t.oculta);
685
- }
686
- renderizar() {
687
- var e;
688
- const t = this.abasVisiveis();
689
- 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(() => {
690
- this.renderizarAbas(), this.renderizarPainel();
691
- });
692
- }
693
- renderizarAbas() {
694
- this.abasElement.innerHTML = "", this.abasVisiveis().forEach((t) => {
695
- this.abasElement.appendChild(ct({
696
- aba: t,
697
- ativa: t.id === this._abaAtiva,
698
- idBotao: this.idAba(t.id),
699
- idPainel: this.painelElement.id
700
- }));
701
- });
702
- }
703
- idAba(t) {
704
- return `${this.uid}-aba-${t.replace(/\s+/g, "_")}`;
705
- }
706
- renderizarPainel() {
707
- this.fecharMenu(), this.gruposElement.innerHTML = "";
708
- const t = this._abas.find((e) => e.id === this._abaAtiva);
709
- if (!t) {
710
- this.painelElement.removeAttribute("aria-labelledby");
711
- return;
712
- }
713
- this.painelElement.setAttribute("aria-labelledby", this.idAba(t.id)), t.grupos.forEach((e) => this.gruposElement.appendChild(mt(
714
- e,
715
- (i, r, a) => this.criarBotao(i, r, a),
716
- {
717
- colapsado: this.gruposColapsados.has(e.id),
718
- criarDividido: (i, r, a) => st(this.efetivo(i), r, a)
719
- }
720
- ))), B(this.botoesPainel());
721
- }
722
- iniciarResizeObserver() {
723
- typeof ResizeObserver > "u" || (this.observerResize = new ResizeObserver(() => {
724
- this.ajustarColapsoGrupos();
725
- }), this.observerResize.observe(this.painelElement));
726
- }
727
- ajustarColapsoGrupos() {
728
- const t = this._abas.find((i) => i.id === this._abaAtiva);
729
- if (!t || !t.grupos.length) return;
730
- const e = this.gruposElement;
731
- if (e.scrollWidth > e.clientWidth) {
732
- const i = [...t.grupos].filter((r) => !this.gruposColapsados.has(r.id)).sort((r, a) => (r.prioridade ?? 0) - (a.prioridade ?? 0));
733
- i.length > 0 && (this.gruposColapsados.add(i[0].id), this.renderizarPainel());
734
- } else if (this.gruposColapsados.size > 0) {
735
- const i = [...t.grupos].filter((r) => this.gruposColapsados.has(r.id)).sort((r, a) => (a.prioridade ?? 0) - (r.prioridade ?? 0));
736
- i.length > 0 && (this.gruposColapsados.delete(i[0].id), this.renderizarPainel(), e.scrollWidth > e.clientWidth && (this.gruposColapsados.add(i[0].id), this.renderizarPainel()));
737
- }
738
- }
739
- alternarMenuGrupoColapsado(t, e) {
740
- var r;
741
- const i = ((r = this.menu) == null ? void 0 : r.ancora) === t;
742
- this.fecharMenu(), !i && (t.setAttribute("aria-expanded", "true"), this.menu = M(
743
- this.shadowRoot,
744
- t,
745
- e.itens,
746
- (a) => {
747
- const n = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(a.id)}"]`);
748
- if (n) this.acionar(n, !1);
749
- else {
750
- const l = a.ativo;
751
- a.tipo === "toggle" ? a.ativo = !l : a.tipo === "ferramenta" && (a.ativo = !0), this.emitir(a) || (a.ativo = l);
752
- }
753
- this.rootElement.classList.remove("ui-ribbon--aberto");
754
- },
755
- {
756
- lado: "baixo",
757
- onFechar: () => {
758
- t.setAttribute("aria-expanded", "false"), this.menu = null;
759
- }
760
- }
761
- ));
762
- }
763
- criarBotao(t, e, i) {
764
- return F(this.efetivo(t), e, i);
765
- }
766
- botoesPainel() {
767
- return Array.from(this.gruposElement.querySelectorAll(".ui-ferr-btn"));
768
- }
769
- get rtl() {
770
- return getComputedStyle(this).direction === "rtl";
771
- }
772
- alternarKeyTips() {
773
- if (this.keytipsAtivas = !this.keytipsAtivas, this.shadowRoot.querySelectorAll(".ui-ribbon__keytip").forEach((e) => e.remove()), !this.keytipsAtivas) return;
774
- Array.from(this.abasElement.querySelectorAll(".ui-ribbon__aba")).forEach((e, i) => {
775
- const r = document.createElement("span");
776
- r.className = "ui-ribbon__keytip", r.textContent = String(i + 1), r.style.top = "2px", r.style.left = "4px", e.style.position = "relative", e.appendChild(r);
777
- });
778
- }
779
- acionar(t, e) {
780
- var n;
781
- const i = this._abas.find((l) => l.id === this._abaAtiva), r = i == null ? void 0 : i.grupos.find((l) => m(l.itens, t.dataset.id)), a = r && m(r.itens, t.dataset.id);
782
- if (!(!a || a.disabled)) {
783
- if ((n = a.filhos) != null && n.length && !a.dividido) {
784
- this.alternarMenu(t, a, e);
785
- return;
786
- }
787
- if (a.tipo === "toggle") {
788
- const l = a.ativo;
789
- a.ativo = !l, A(t, a), this.emitir(a) || (a.ativo = l, A(t, a));
790
- } else if (a.tipo === "ferramenta") {
791
- const l = a.ativo, c = r ? r.exclusivo !== !1 : !0, d = c && r ? r.itens.filter((p) => p.tipo === "ferramenta" && p.id !== a.id && p.ativo) : [];
792
- a.ativo = !0, A(t, a), c && d.forEach((p) => {
793
- p.ativo = !1;
794
- const f = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(p.id)}"]`);
795
- f && A(f, p);
796
- }), this.emitir(a) || (a.ativo = l, A(t, a), c && d.forEach((p) => {
797
- p.ativo = !0;
798
- const f = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(p.id)}"]`);
799
- f && A(f, p);
800
- }));
801
- } else
802
- this.emitir(a);
803
- this.rootElement.classList.remove("ui-ribbon--aberto");
804
- }
805
- }
806
- alternarMenu(t, e, i) {
807
- var a;
808
- const r = ((a = this.menu) == null ? void 0 : a.ancora) === t;
809
- this.fecharMenu(), !r && (t.setAttribute("aria-expanded", "true"), this.menu = M(
810
- this.shadowRoot,
811
- t,
812
- e.filhos,
813
- (n) => {
814
- if (n.tipo === "toggle") {
815
- const l = n.ativo;
816
- n.ativo = !l, this.emitir(n, e) || (n.ativo = l);
817
- } else
818
- this.emitir(n, e);
819
- this.rootElement.classList.remove("ui-ribbon--aberto");
820
- },
821
- {
822
- lado: "baixo",
823
- focar: i,
824
- onFechar: () => {
825
- t.setAttribute("aria-expanded", "false"), this.menu = null;
826
- }
827
- }
828
- ));
829
- }
830
- fecharMenu() {
831
- var t;
832
- (t = this.menu) == null || t.fechar(), this.menu = null;
833
- }
834
- /** Retorna false se o consumidor cancelou o evento (preventDefault). */
835
- emitir(t, e) {
836
- return this.dispatchEvent(
837
- new CustomEvent("ui-ferramenta", {
838
- detail: { id: t.id, item: t, pai: e, ativo: t.ativo, origem: "ribbon", aba: this._abaAtiva },
839
- bubbles: !0,
840
- composed: !0,
841
- cancelable: !0
842
- })
843
- );
844
- }
845
- }
846
- $("ui-ribbon", xt);
847
- const _t = ':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-degrade-interno, var(--ui-paleta-fundo, var(--ui-fundo-superficie, 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}}:host(.degrade),:host(.gradiente),:host([data-degrade]:not([data-degrade="false"])),.ui-paleta[data-degrade]:not([data-degrade=false]){--ui-paleta-fundo: var(--ui-gradiente-superficie)}', At = 380, wt = 8, yt = 50;
848
- class Et {
849
- constructor() {
850
- u(this, "timer");
851
- u(this, "timerSupressao");
852
- u(this, "inicio", null);
853
- u(this, "suprimir", !1);
854
- }
855
- /** Começa a contar; `aoDisparar` roda se o ponteiro ficar parado até `TEMPO_PRESSAO_LONGA_MS`. */
856
- iniciar(s, t, e) {
857
- this.cancelar(), window.clearTimeout(this.timerSupressao), this.inicio = { x: s, y: t }, this.timer = window.setTimeout(() => {
858
- this.suprimir = !0, e();
859
- }, At);
860
- }
861
- /** Arrastar/rolar com o dedo cancela o clique longo. */
862
- mover(s, t) {
863
- this.timer === void 0 || !this.inicio || Math.hypot(s - this.inicio.x, t - this.inicio.y) > wt && this.cancelar();
864
- }
865
- /** Fim do gesto: cancela a contagem e, se o flyout abriu, descarta a supressão logo após o `click` residual. */
866
- fim() {
867
- this.cancelar(), this.suprimir && (window.clearTimeout(this.timerSupressao), this.timerSupressao = window.setTimeout(() => {
868
- this.suprimir = !1;
869
- }, yt));
870
- }
871
- cancelar() {
872
- this.timer !== void 0 && (window.clearTimeout(this.timer), this.timer = void 0), this.inicio = null;
873
- }
874
- /** `true` (uma única vez) se o próximo `click` deve ser ignorado por ser o resíduo de uma pressão longa. */
875
- consumirSupressao() {
876
- return this.suprimir ? (this.suprimir = !1, window.clearTimeout(this.timerSupressao), !0) : !1;
877
- }
878
- destruir() {
879
- this.cancelar(), window.clearTimeout(this.timerSupressao), this.suprimir = !1;
880
- }
881
- }
882
- function Ct(o, s) {
883
- return o.find(s) ?? o[0];
884
- }
885
- const kt = /* @__PURE__ */ new Set(["textbox", "searchbox", "combobox", "spinbutton"]);
886
- function St(o) {
887
- const s = o[0];
888
- return s && (/^(INPUT|TEXTAREA|SELECT)$/.test(s.tagName) || s.isContentEditable) ? !0 : o.some((t) => {
889
- var r, a;
890
- const e = t, i = (r = e.getAttribute) == null ? void 0 : r.call(e, "role");
891
- return ((a = e.getAttribute) == null ? void 0 : a.call(e, "aria-modal")) === "true" || !!i && kt.has(i);
892
- });
893
- }
894
- function zt(o, s, t, e) {
895
- const i = typeof o == "string" ? { key: o, ctrlKey: !1, metaKey: !1, altKey: !1, shiftKey: !1 } : o;
896
- if (!i || !i.key) return null;
897
- const r = s.filter((l) => !l.disabled && X(i, l.atalho));
898
- if (r.length === 0) return null;
899
- let a = r[0];
900
- if (r.length > 1) {
901
- const l = r.findIndex((c) => c.id === e);
902
- a = r[(l + 1) % r.length];
903
- }
904
- const n = t.find((l) => {
905
- var c;
906
- return (c = l.filhos) == null ? void 0 : c.some((d) => d.id === a.id);
907
- });
908
- return { alvo: a, pai: n };
909
- }
910
- const Pt = { sm: 16, md: 18, lg: 22 };
911
- class Mt extends q {
912
- constructor() {
913
- super();
914
- u(this, "rootElement");
915
- u(this, "_ferramentas", []);
916
- u(this, "_ativo", "");
917
- u(this, "_pendente", "");
918
- u(this, "visiveis", /* @__PURE__ */ new Map());
919
- // id do grupo → id do filho exibido
920
- u(this, "menu", null);
921
- u(this, "pressao", new Et());
922
- u(this, "listeners", new L());
923
- u(this, "tooltip", null);
924
- u(this, "_modoControlado", !1);
925
- u(this, "handleClick", (t) => {
926
- if (this.pressao.consumirSupressao()) return;
927
- const e = t.target.closest(".ui-ferr-btn"), i = e != null && e.dataset.id ? m(this._ferramentas, e.dataset.id) : void 0;
928
- if (!e || !i) return;
929
- const r = e.dataset.grupo ? m(this._ferramentas, e.dataset.grupo) : void 0;
930
- this.acionar(i, r);
931
- });
932
- u(this, "handleFocusIn", (t) => Q(this.botoes(), t.target));
933
- u(this, "handlePointerDown", (t) => {
934
- const e = t;
935
- if (e.pointerType === "mouse" && e.button !== 0) return;
936
- const i = t.target.closest(".ui-ferr-btn--grupo");
937
- !i || i.disabled || this.pressao.iniciar(e.clientX ?? 0, e.clientY ?? 0, () => this.abrirFlyout(i, !1));
938
- });
939
- u(this, "handlePointerMove", (t) => {
940
- const e = t;
941
- this.pressao.mover(e.clientX ?? 0, e.clientY ?? 0);
942
- });
943
- u(this, "handlePointerFim", () => this.pressao.fim());
944
- u(this, "handleContextMenu", (t) => {
945
- const e = t.target.closest(".ui-ferr-btn--grupo");
946
- e && (t.preventDefault(), this.pressao.cancelar(), this.abrirFlyout(e, !1));
947
- });
948
- u(this, "handleKeyDown", (t) => {
949
- var l;
950
- const e = this.getAttribute("orientacao") === "horizontal", i = getComputedStyle(this).direction === "rtl", r = this.colunas;
951
- if (!e && r === 2) {
952
- if (nt(t, this.botoes(), i)) return;
953
- } else {
954
- const c = e ? [i ? "ArrowRight" : "ArrowLeft"] : ["ArrowUp"], d = e ? [i ? "ArrowLeft" : "ArrowRight"] : ["ArrowDown"];
955
- if (N(t, this.botoes(), c, d)) return;
956
- }
957
- const a = e ? "ArrowDown" : i ? "ArrowLeft" : "ArrowRight", n = t.target instanceof HTMLButtonElement ? t.target : null;
958
- n != null && n.dataset.grupo && t.key === a && (t.preventDefault(), ((l = this.menu) == null ? void 0 : l.ancora) === n ? this.menu.focarPrimeiro() : this.abrirFlyout(n, !0));
959
- });
960
- u(this, "handleAtalho", (t) => {
961
- if (!this.hasAttribute("atalhos") || t.defaultPrevented || St(t.composedPath()) || !this.donaDosAtalhos()) return;
962
- const e = zt(t, this.todasFerramentas(), this._ferramentas, this._ativo);
963
- e && (t.preventDefault(), this.acionar(e.alvo, e.pai));
964
- });
965
- const t = this.attachShadow({ mode: "open" });
966
- t.innerHTML = `
967
- <style>${Y}${_t}</style>
968
- <div class="ui-paleta ui-paleta--vertical" part="base" role="toolbar" aria-orientation="vertical" aria-label="Ferramentas"></div>
969
- `, this.rootElement = t.querySelector(".ui-paleta");
970
- }
971
- static get observedAttributes() {
972
- return ["valor", "value", "orientacao", "colunas", "tamanho", "size", "aria-label", "copiar-dados", "modo-controlado", ...U];
973
- }
974
- connectedCallback() {
975
- var e;
976
- this.listeners.cleanup(), (e = this.tooltip) == null || e.destruir(), this.tooltip = new Z(this.shadowRoot, this.rootElement), 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);
977
- const t = this.getAttribute("valor") || this.getAttribute("value");
978
- t && !this._ativo && (this._pendente = t), P(this, this.rootElement), this.aplicarPendente(), this.renderizar();
979
- }
980
- disconnectedCallback() {
981
- var t;
982
- this.pressao.destruir(), this.fecharMenu(), (t = this.tooltip) == null || t.destruir(), this.tooltip = null, this.listeners.cleanup();
983
- }
984
- attributeChangedCallback(t, e, i) {
985
- if (e !== i) {
986
- if (W(t)) {
987
- P(this, this.rootElement);
988
- return;
989
- }
990
- if (t === "valor" || t === "value") {
991
- const r = this.getAttribute("valor") || this.getAttribute("value") || "";
992
- r ? r !== this._ativo && this.ativar(r, !1) : this.limpar(!1);
993
- } else
994
- this.renderizar();
995
- }
996
- }
997
- /* ---------- API pública ---------- */
998
- /**
999
- * Quando `true` ou atributo `copiar-dados` / `modo-controlado`: clona a árvore de itens
1000
- * para não mutar os objetos fornecidos pelo consumidor (Item 11).
1001
- */
1002
- get modoControlado() {
1003
- return this._modoControlado || this.hasAttribute("modo-controlado") || this.hasAttribute("copiar-dados");
1004
- }
1005
- set modoControlado(t) {
1006
- this._modoControlado = !!t;
1007
- }
1008
- get copiarDados() {
1009
- return this.modoControlado;
1010
- }
1011
- set copiarDados(t) {
1012
- this.modoControlado = t;
1013
- }
1014
- get ferramentas() {
1015
- return this._ferramentas;
1016
- }
1017
- set ferramentas(t) {
1018
- const e = Array.isArray(t) ? t : [];
1019
- this._ferramentas = this.modoControlado ? e.map((i) => {
1020
- var r;
1021
- return { ...i, filhos: (r = i.filhos) == null ? void 0 : r.map((a) => ({ ...a })) };
1022
- }) : e, R(j(this._ferramentas), "<ui-paleta-ferramentas> ferramentas"), this.visiveis.clear(), this._pendente ? this.aplicarPendente() : this._ativo && this.definirAtivoInterno(this._ativo), this.renderizar();
1023
- }
1024
- get valor() {
1025
- return this._ativo;
1026
- }
1027
- set valor(t) {
1028
- this.ativar(t);
1029
- }
1030
- get value() {
1031
- return this.valor;
1032
- }
1033
- set value(t) {
1034
- this.valor = t;
1035
- }
1036
- get orientacao() {
1037
- return this.getAttribute("orientacao") === "horizontal" ? "horizontal" : "vertical";
1038
- }
1039
- set orientacao(t) {
1040
- this.setAttribute("orientacao", t);
1041
- }
1042
- get colunas() {
1043
- return this.getAttribute("colunas") === "2" ? 2 : 1;
1044
- }
1045
- set colunas(t) {
1046
- this.setAttribute("colunas", String(t));
1047
- }
1048
- get tamanho() {
1049
- const t = this.getAttribute("tamanho") || this.getAttribute("size") || "md";
1050
- return t === "sm" || t === "lg" ? t : "md";
1051
- }
1052
- set tamanho(t) {
1053
- this.setAttribute("tamanho", t);
1054
- }
1055
- /**
1056
- * Ativa uma ferramenta (exclusiva). Se estiver dentro de um grupo, ela passa a ser a exibida.
1057
- * `id` vazio limpa a seleção. Se as `ferramentas` ainda não foram definidas, o valor fica pendente.
1058
- */
1059
- ativar(t, e = !0) {
1060
- if (!t) {
1061
- this.limpar(e);
1062
- return;
1063
- }
1064
- const i = m(this._ferramentas, t);
1065
- if (!i) {
1066
- this._ferramentas.length ? console.warn(`[ui-paleta-ferramentas] ativar("${t}"): ferramenta não encontrada.`) : this._pendente = t;
1067
- return;
1068
- }
1069
- if (i.disabled || (i.tipo ?? "ferramenta") !== "ferramenta") {
1070
- console.warn(`[ui-paleta-ferramentas] ativar("${t}"): só ferramentas habilitadas (tipo "ferramenta") podem ser ativadas.`);
1071
- return;
1072
- }
1073
- this._pendente = "";
1074
- const r = this._ativo;
1075
- this.definirAtivoInterno(t), this.refletirValor(t), this.renderizar(), e && r !== t && this.emitirMudanca(t, i, r);
1076
- }
1077
- /** Remove a seleção atual (nenhuma ferramenta ativa). Equivale a `valor = ''`. */
1078
- limpar(t = !0) {
1079
- const e = this._ativo;
1080
- !e && !this._pendente || (this._ativo = "", this._pendente = "", this.removeAttribute("valor"), this.removeAttribute("value"), this.renderizar(), t && e && this.emitirMudanca("", null, e));
1081
- }
1082
- atualizarItem(t, e) {
1083
- var n;
1084
- const i = m(this._ferramentas, t);
1085
- if (!i) {
1086
- console.warn(`[ui-paleta-ferramentas] atualizarItem("${t}"): item não encontrado.`);
1087
- return;
1088
- }
1089
- Object.assign(i, e);
1090
- const r = Object.keys(e).every((l) => l === "ativo" || l === "disabled"), a = this._ferramentas.find((l) => {
1091
- var c;
1092
- return (c = l.filhos) == null ? void 0 : c.some((d) => d.id === t);
1093
- });
1094
- if (r && !(a && "disabled" in e)) {
1095
- const l = this.botoes().find((c) => c.dataset.id === t || c.dataset.grupo === t);
1096
- if (l) {
1097
- A(l, this.itemParaBotao(a ?? i)), J(this.botoes());
1098
- return;
1099
- }
1100
- if (a || (n = i.filhos) != null && n.length) return;
1101
- }
1102
- this.renderizar();
1103
- }
1104
- /* ---------- Estado interno ---------- */
1105
- refletirValor(t) {
1106
- const e = this.hasAttribute("value") && !this.hasAttribute("valor") ? "value" : "valor";
1107
- this.getAttribute(e) !== t && this.setAttribute(e, t);
1108
- }
1109
- aplicarPendente() {
1110
- if (!this._pendente) return;
1111
- const t = m(this._ferramentas, this._pendente);
1112
- 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 = "");
1113
- }
1114
- definirAtivoInterno(t) {
1115
- this._ativo = t;
1116
- const e = this._ferramentas.find((i) => {
1117
- var r;
1118
- return (r = i.filhos) == null ? void 0 : r.some((a) => a.id === t);
1119
- });
1120
- e && this.visiveis.set(e.id, t);
1121
- }
1122
- emitirMudanca(t, e, i) {
1123
- const r = { valor: t, item: e, anterior: i };
1124
- this.dispatchEvent(new CustomEvent("ui-change", { detail: r, bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("ui-selecionar", { detail: r, bubbles: !0, composed: !0 }));
1125
- }
1126
- /** Filho exibido de um grupo: o último usado, pulando separadores e itens desabilitados. */
1127
- itemExibido(t) {
1128
- var a;
1129
- if (!((a = t.filhos) != null && a.length)) return t;
1130
- const e = (n) => n.tipo !== "separador" && !n.disabled, i = this.visiveis.get(t.id), r = t.filhos.find((n) => n.id === i);
1131
- return (r && e(r) ? r : void 0) ?? t.filhos.find(e) ?? t.filhos.find((n) => n.tipo !== "separador") ?? t.filhos[0];
1132
- }
1133
- itemParaBotao(t) {
1134
- const e = this.itemExibido(t), i = e.tipo ?? "ferramenta";
1135
- return {
1136
- ...e,
1137
- tipo: i,
1138
- ativo: i === "ferramenta" ? e.id === this._ativo : e.ativo,
1139
- filhos: t.filhos
1140
- };
1141
- }
1142
- todasFerramentas() {
1143
- return this._ferramentas.flatMap((t) => {
1144
- var e;
1145
- return (e = t.filhos) != null && e.length ? t.filhos : [t];
1146
- }).filter((t) => t.tipo !== "separador");
1147
- }
1148
- /* ---------- Renderização ---------- */
1149
- renderizar() {
1150
- var c;
1151
- const t = (c = this.shadowRoot) == null ? void 0 : c.activeElement, e = t && t.classList.contains("ui-ferr-btn") ? { id: t.dataset.id ?? "", grupo: t.dataset.grupo ?? "" } : null;
1152
- this.fecharMenu();
1153
- const i = this.orientacao, r = this.tamanho, a = this.colunas;
1154
- this.rootElement.className = `ui-paleta ui-paleta--${i} ui-paleta--${r}`, a === 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 = "";
1155
- const n = Pt[r] ?? 18;
1156
- this._ferramentas.forEach((d) => {
1157
- var g;
1158
- if (d.tipo === "separador") {
1159
- const _ = document.createElement("div");
1160
- _.className = "ui-paleta__sep", _.setAttribute("role", "separator"), this.rootElement.appendChild(_);
1161
- return;
1162
- }
1163
- const p = this.itemExibido(d), f = F(this.itemParaBotao(d), "paleta", n);
1164
- f.dataset.id = p.id, (g = d.filhos) != null && g.length && (f.dataset.grupo = d.id), this.rootElement.appendChild(f);
1165
- }), B(this.botoes());
1166
- const l = this.botoes().find((d) => d.dataset.id === this._ativo && !d.disabled);
1167
- if (l && (this.botoes().forEach((d) => d.tabIndex = -1), l.tabIndex = 0), e) {
1168
- const d = this.botoes().find((p) => e.grupo ? p.dataset.grupo === e.grupo : p.dataset.id === e.id);
1169
- d && !d.disabled && d.focus();
1170
- }
1171
- }
1172
- botoes() {
1173
- return Array.from(this.rootElement.querySelectorAll(".ui-ferr-btn"));
1174
- }
1175
- /** Reflete no botão o estado atual do item (sem recriar o DOM). */
1176
- atualizarBotaoDe(t, e) {
1177
- const i = this.botoes().find((r) => r.dataset.id === t.id);
1178
- i && A(i, this.itemParaBotao(e ?? t));
1179
- }
1180
- /* ---------- Interação ---------- */
1181
- acionar(t, e) {
1182
- if (t.disabled) return;
1183
- const i = t.tipo ?? "ferramenta", r = this._ativo, a = t.ativo;
1184
- i === "ferramenta" ? this.ativar(t.id) : i === "toggle" && (t.ativo = !t.ativo, this.atualizarBotaoDe(t, e)), this.dispatchEvent(
1185
- new CustomEvent("ui-ferramenta", {
1186
- detail: {
1187
- id: t.id,
1188
- item: t,
1189
- pai: e,
1190
- ativo: i === "ferramenta" ? !0 : t.ativo,
1191
- origem: "paleta"
1192
- },
1193
- bubbles: !0,
1194
- composed: !0,
1195
- cancelable: !0
1196
- })
1197
- ) || (i === "ferramenta" && r !== t.id ? r ? this.ativar(r) : this.limpar() : i === "toggle" && (t.ativo = a, this.atualizarBotaoDe(t, e)));
1198
- }
1199
- /** Várias paletas com `atalhos` na página: só a que contém o foco (ou a primeira no DOM) responde. */
1200
- donaDosAtalhos() {
1201
- const t = Array.from(document.querySelectorAll("ui-paleta-ferramentas[atalhos]"));
1202
- return t.length <= 1 ? !0 : Ct(t, (e) => {
1203
- var i;
1204
- return e.matches(":focus-within") || !!((i = e.shadowRoot) != null && i.activeElement);
1205
- }) === this;
1206
- }
1207
- abrirFlyout(t, e) {
1208
- var a;
1209
- const i = t.dataset.grupo ? m(this._ferramentas, t.dataset.grupo) : void 0;
1210
- if (!((a = i == null ? void 0 : i.filhos) != null && a.length)) return;
1211
- this.fecharMenu();
1212
- const r = i.filhos.map((n) => ({
1213
- ...n,
1214
- ativo: (n.tipo ?? "ferramenta") === "ferramenta" ? n.id === this._ativo : n.ativo
1215
- }));
1216
- t.setAttribute("aria-expanded", "true"), this.menu = M(
1217
- this.shadowRoot,
1218
- t,
1219
- r,
1220
- (n) => {
1221
- var c;
1222
- const l = m(i.filhos, n.id);
1223
- l && (this.acionar(l, i), (c = this.botoes().find((d) => d.dataset.grupo === i.id)) == null || c.focus());
1224
- },
1225
- {
1226
- lado: this.getAttribute("orientacao") === "horizontal" ? "baixo" : "direita",
1227
- focar: e,
1228
- tipoPadrao: "ferramenta",
1229
- onFechar: () => {
1230
- t.setAttribute("aria-expanded", "false"), this.menu = null;
1231
- }
1232
- }
1233
- );
1234
- }
1235
- fecharMenu() {
1236
- var t;
1237
- (t = this.menu) == null || t.fechar(), this.menu = null;
1238
- }
1239
- }
1240
- $("ui-paleta-ferramentas", Mt);
1241
- export {
1242
- at as U,
1243
- Mt as a,
1244
- xt as b
1245
- };