@thibezer/ui-components-kit 2.26.1 → 2.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -92,6 +92,12 @@ export declare class UICanvasCAD extends SafeHTMLElement {
92
92
  */
93
93
  get aceitarOrigem(): boolean;
94
94
  set aceitarOrigem(val: boolean);
95
+ /**
96
+ * Atributo `sem-popup-sigef`: o clique com a camada SIGEF ativa não abre o popup do kit; o componente só consulta o
97
+ * Geoportal do INCRA e emite `ui-sigef-parcelas` (`SigefParcelasDetail`: `consultando` → `concluida` | `erro`, com as
98
+ * parcelas já organizadas) para o app montar o próprio popup. Sem o atributo, o popup do kit continua como antes.
99
+ */
100
+ private aplicarPopupSigef;
95
101
  /**
96
102
  * Quando os popups abrem (atributo `popups`): `sob-demanda` (padrão) só por duplo clique sobre a feição/camada ou por
97
103
  * `abrirPopupFeicao()`, sem mover o mapa; `automatico` abre ao clicar e o Leaflet ajusta a vista (comportamento antigo);
@@ -11,7 +11,11 @@ import { AlvoCor, AtalhosControleCores, ValorCor } from './tipos';
11
11
  * - O kit não registra atalhos de teclado; quem usa chama `alternarAlvo()`, `inverter()`,
12
12
  * `semCor()` e `restaurarPadrao()` e pode exibir as teclas nas dicas via `atalhos`.
13
13
  *
14
- * Atributos: preenchimento, traco, opacidade, espessura-traco, alvo (preenchimento|traco), padrao-preenchimento,
14
+ * Layout (atributo `layout`): `lado` (padrão, ações em coluna ao lado), `abaixo` (ações em linha sob as amostras,
15
+ * para colunas estreitas), `compacto` (só as amostras; ações pela API) e `mini` (uma amostra só, a do alvo ativo;
16
+ * alterne o alvo por `alternarAlvo()`). `auto` ocupa a largura do contêiner sem transbordar: a amostra encolhe e as ações passam de ao lado para abaixo (< 66px) e somem (< 40px). Tamanhos: `--ui-controle-cores-amostra`, `--ui-controle-cores-acao`.
17
+ *
18
+ * Atributos: layout, preenchimento, traco, opacidade, espessura-traco, alvo (preenchimento|traco), padrao-preenchimento,
15
19
  * padrao-traco, titulo-seletor, so-traco, desabilitado
16
20
  * Propriedades: preenchimento, traco, opacidade, espessuraTraco, alvo, coresProjeto, atalhos, seletorAberto
17
21
  * Métodos: definirCores(), obterCores(), definirAlvo(), alternarAlvo(), definirMisto(), inverter(),
package/dist/cores.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var T=Object.defineProperty;var w=(u,p,e)=>p in u?T(u,p,{enumerable:!0,configurable:!0,writable:!0,value:e}):u[p]=e;var i=(u,p,e)=>w(u,typeof p!="symbol"?p+"":p,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});;/* empty css */const s=require("./cores-utils-BmkzhA1v.cjs"),v=require("./kit-base-BmkPi5Rz.cjs"),f=require("./ui-seletor-cor-D_ifitEN.cjs"),q=':host{--_a: var(--ui-controle-cores-amostra, 26px);--_pilha: calc(var(--_a) * 5 / 3);--_borda: color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 30%, transparent);--_borda-forte: color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 70%, transparent);--_base: var(--ui-fundo-superficie, var(--ui-cor-superficie, #1d1d22));--_destaque: var(--ui-cor-primaria, #00e08a);--_vermelho: #ef4444;display:inline-block;flex-shrink:0;-webkit-user-select:none;user-select:none}:host([hidden]){display:none}*,*:before,*:after{box-sizing:border-box}.pilha{display:flex;align-items:stretch;gap:6px}.amostras{position:relative;flex:none;width:var(--_pilha);height:var(--_pilha)}.amostra{position:absolute;width:var(--_a);height:var(--_a);padding:0;background:var(--_base);border:1px solid var(--_borda);border-radius:6px;cursor:pointer;transition:transform .15s ease,border-color .15s ease,box-shadow .15s ease,opacity .15s ease}.amostra--traco{right:0;bottom:0;z-index:1}.amostra--preenchimento{top:0;left:0;z-index:2;box-shadow:0 2px 6px #00000059}.amostra:hover{border-color:var(--_borda-forte);transform:scale(1.05)}.amostra:focus-visible{outline:2px solid var(--ui-cor-texto, #e1e1e6);outline-offset:2px}.amostra--ativa,.amostra--ativa:hover{z-index:3;border-color:var(--_destaque);box-shadow:0 0 0 1.5px var(--_destaque),0 2px 6px #00000059}:host([so-traco]) .amostra--preenchimento{opacity:.4}.face{position:absolute;top:3px;right:3px;bottom:3px;left:3px;border-radius:3.5px;pointer-events:none}.face--traco{background:transparent;border:4px solid #ffffff}.face--sem-cor{background:repeating-conic-gradient(#3a3a45,#3a3a45 25%,#24242b 0%,#24242b 50%) 50% / 6px 6px!important;border-color:#ef44448c!important;overflow:hidden}.face--sem-cor:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;background:linear-gradient(to top right,transparent calc(50% - 1px),var(--_vermelho) calc(50% - 1px),var(--_vermelho) calc(50% + 1px),transparent calc(50% + 1px))}.face--misto{display:flex;align-items:center;justify-content:center;background:#2e2e38!important;border-color:#64748b!important}.face--misto:after{content:"?";color:#fff;font-size:12px;font-weight:800;line-height:1;text-shadow:0 1px 2px rgba(0,0,0,.8)}.acoes{display:flex;flex:none;flex-direction:column;gap:2px;width:16px}.acao{display:flex;flex:1;align-items:center;justify-content:center;min-height:0;padding:0;background:transparent;border:0;border-radius:4px;color:var(--ui-cor-texto-secundario, #9696a6);cursor:pointer;transition:color .15s ease,background .15s ease}.acao:hover{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 12%,transparent);color:var(--_destaque)}.acao:focus-visible{outline:2px solid var(--ui-cor-texto, #e1e1e6);outline-offset:1px}.acao svg{width:12px;height:12px}.acao--sem-cor:hover{background:#ef444433;color:var(--_vermelho)}.icone-padrao{position:relative;width:11px;height:11px}.ponto{position:absolute;width:7px;height:7px;border-radius:1.5px}.ponto--preenchimento{top:0;left:0;background:#00e08a;border:1px solid var(--_borda-forte)}.ponto--traco{right:0;bottom:0;background:var(--_base);border:1.5px solid #ffffff}:host([desabilitado]) .pilha{opacity:.5}:host([desabilitado]) .amostra,:host([desabilitado]) .acao{cursor:not-allowed;pointer-events:none}@media (prefers-reduced-motion: reduce){.amostra,.acao{transition:none}.amostra:hover{transform:none}}';class z extends v.SafeHTMLElement{constructor(){super();i(this,"raiz");i(this,"listeners",new v.ListenerBag);i(this,"renderizado",!1);i(this,"_preenchimento","#00e08a");i(this,"_traco","#ffffff");i(this,"_opacidade",.35);i(this,"_espessuraTraco",2.5);i(this,"_alvo","preenchimento");i(this,"_misto",{preenchimento:!1,traco:!1});i(this,"_padrao",{preenchimento:"#00e08a",traco:"#ffffff"});i(this,"_coresProjeto",[]);i(this,"_atalhos",{});i(this,"seletor",null);i(this,"estadoAoAbrir",null);this.raiz=this.attachShadow({mode:"open"})}static get observedAttributes(){return["preenchimento","traco","opacidade","espessura-traco","alvo","padrao-preenchimento","padrao-traco","desabilitado"]}connectedCallback(){this.renderizado||this.renderizar(),this.listeners.cleanup(),this.vincularEventos(),this.atualizar()}disconnectedCallback(){this.fecharSeletor(!0),this.listeners.cleanup()}attributeChangedCallback(e,t,r){if(t!==r){if(e==="desabilitado"){this.hasAttribute("desabilitado")&&this.fecharSeletor(!1),this.atualizar();return}if(r!==null){if(e==="preenchimento")this.definirCores({preenchimento:r});else if(e==="traco")this.definirCores({traco:r});else if(e==="opacidade")this.definirCores({opacidade:Number(r)});else if(e==="espessura-traco")this.definirCores({espessuraTraco:s.normalizarEspessura(r)});else if(e==="alvo")this.definirAlvo(r);else if(e==="padrao-preenchimento"||e==="padrao-traco"){const a=s.normalizarCor(r);if(!a)return;e==="padrao-preenchimento"?this._padrao.preenchimento=a:this._padrao.traco=a,this.atualizar()}}}}get preenchimento(){return this._preenchimento}set preenchimento(e){this.definirCores({preenchimento:e})}get traco(){return this._traco}set traco(e){this.definirCores({traco:e})}get opacidade(){return this._opacidade}set opacidade(e){this.definirCores({opacidade:e})}get espessuraTraco(){return this._espessuraTraco}set espessuraTraco(e){this.definirCores({espessuraTraco:e})}get alvo(){return this._alvo}set alvo(e){this.definirAlvo(e)}get coresProjeto(){return[...this._coresProjeto]}set coresProjeto(e){this._coresProjeto=s.coresUnicas(e)}get atalhos(){return{...this._atalhos}}set atalhos(e){this._atalhos={...e||{}},this.atualizar()}get seletorAberto(){var e;return!!((e=this.seletor)!=null&&e.aberto)}definirCores(e={}){const t=s.normalizarCor(e.preenchimento),r=s.normalizarCor(e.traco);t&&(this._preenchimento=t,this._misto.preenchimento=!1),r&&(this._traco=r,this._misto.traco=!1),e.opacidade!==void 0&&(this._opacidade=s.normalizarOpacidade(e.opacidade,this._opacidade)),e.espessuraTraco!==void 0&&(this._espessuraTraco=s.normalizarEspessura(e.espessuraTraco,this._espessuraTraco)),this.atualizar()}obterCores(){return{preenchimento:this._preenchimento,traco:this._traco,opacidade:this._opacidade,espessuraTraco:this._espessuraTraco,alvo:this._alvo}}definirAlvo(e){this._alvo=e==="traco"?"traco":"preenchimento",this.atualizar(),this.sincronizarSeletor()}definirMisto(e={}){this._misto={preenchimento:!!e.preenchimento,traco:!!e.traco},this.atualizar()}alternarAlvo(){this.mudarAlvo(this._alvo==="traco"?"preenchimento":"traco")}inverter(){const e=this._preenchimento;this._preenchimento=this._traco,this._traco=e,this._misto={preenchimento:this._misto.traco,traco:this._misto.preenchimento},this.atualizar(),this.emitirCores(!0,["preenchimento","traco"],"inverter")}semCor(e=this._alvo){const t=e==="traco"?"traco":"preenchimento";t==="traco"?this._traco="none":this._preenchimento="none",this._misto[t]=!1,this.atualizar(),this.emitirCores(!0,[t],"sem-cor")}restaurarPadrao(){this._preenchimento=this._padrao.preenchimento,this._traco=this._padrao.traco,this._misto={preenchimento:!1,traco:!1},this.atualizar(),this.emitirCores(!0,["preenchimento","traco"],"padrao")}abrirSeletor(e=this._alvo,t=!1){if(this.hasAttribute("desabilitado")||(this.mudarAlvo(e==="traco"?"traco":"preenchimento"),this.seletorAberto))return;const r=this.raiz.querySelector(`[data-alvo="${this._alvo}"]`)||this;this.estadoAoAbrir=this.obterCores(),this.seletor=f.abrirSeletorCor({ancora:r,titulo:this.getAttribute("titulo-seletor")||"Cores e estilo",modo:"duplo",alvo:this._alvo,preenchimento:this._preenchimento,traco:this._traco,opacidade:this._opacidade,espessuraTraco:this._espessuraTraco,misto:this._misto[this._alvo],focar:t,aoAlterar:a=>this.aplicarDoSeletor(a,!1),aoConfirmar:a=>{this.seletor=null,this.aplicarDoSeletor(a,!0)},aoCancelar:()=>{this.seletor=null,this.estadoAoAbrir=null},aoTrocarAlvo:a=>this.mudarAlvo(a)})}fecharSeletor(e=!0){const t=this.seletor;t&&(e?t.fechar(!0):t.elemento.cancelar())}mudarAlvo(e){e!==this._alvo&&(this._alvo=e,this.atualizar(),this.sincronizarSeletor(),this.dispatchEvent(new CustomEvent("ui-alvo-change",{detail:{alvo:e},bubbles:!0,composed:!0})))}sincronizarSeletor(){var e,t;(t=(e=this.seletor)==null?void 0:e.elemento)==null||t.trocarAlvo(this._alvo)}aplicarDoSeletor(e,t){const r=o=>{const d=[];return e.preenchimento!==o.preenchimento&&d.push("preenchimento"),e.traco!==o.traco&&d.push("traco"),e.opacidade!==o.opacidade&&d.push("opacidade"),e.espessuraTraco!==void 0&&Math.abs(e.espessuraTraco-o.espessuraTraco)>.05&&d.push("espessuraTraco"),d},a=r(this.obterCores());if(this._preenchimento=e.preenchimento,this._traco=e.traco,this._opacidade=e.opacidade,e.espessuraTraco!==void 0&&(this._espessuraTraco=e.espessuraTraco),a.includes("preenchimento")&&(this._misto.preenchimento=!1),a.includes("traco")&&(this._misto.traco=!1),this.atualizar(),!t){a.length&&this.emitirCores(!1,a,"seletor");return}this.emitirCores(!0,this.estadoAoAbrir?r(this.estadoAoAbrir):a,"seletor"),this.estadoAoAbrir=null}emitirCores(e,t,r){const a={...this.obterCores(),confirmado:e,alterados:t,origem:r};this.dispatchEvent(new CustomEvent("ui-cores-change",{detail:a,bubbles:!0,composed:!0}))}dica(e,t){return t?`${e} [${t}]`:e}renderizar(){this.raiz.innerHTML=`
1
+ "use strict";var k=Object.defineProperty;var T=(u,p,e)=>p in u?k(u,p,{enumerable:!0,configurable:!0,writable:!0,value:e}):u[p]=e;var i=(u,p,e)=>T(u,typeof p!="symbol"?p+"":p,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});;/* empty css */const s=require("./cores-utils-BmkzhA1v.cjs"),v=require("./kit-base-BmkPi5Rz.cjs"),f=require("./ui-seletor-cor-D_ifitEN.cjs"),q=':host{--_a: var(--ui-controle-cores-amostra, 26px);--_pilha: calc(var(--_a) * 5 / 3);--_borda: color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 30%, transparent);--_borda-forte: color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 70%, transparent);--_base: var(--ui-fundo-superficie, var(--ui-cor-superficie, #1d1d22));--_destaque: var(--ui-cor-primaria, #00e08a);--_vermelho: #ef4444;display:inline-block;flex-shrink:0;-webkit-user-select:none;user-select:none}:host([hidden]){display:none}*,*:before,*:after{box-sizing:border-box}.pilha{display:flex;align-items:stretch;gap:6px}.amostras{position:relative;flex:none;width:var(--_pilha);height:var(--_pilha)}.amostra{position:absolute;width:var(--_a);height:var(--_a);padding:0;background:var(--_base);border:1px solid var(--_borda);border-radius:6px;cursor:pointer;transition:transform .15s ease,border-color .15s ease,box-shadow .15s ease,opacity .15s ease}.amostra--traco{right:0;bottom:0;z-index:1}.amostra--preenchimento{top:0;left:0;z-index:2;box-shadow:0 2px 6px #00000059}.amostra:hover{border-color:var(--_borda-forte);transform:scale(1.05)}.amostra:focus-visible{outline:2px solid var(--ui-cor-texto, #e1e1e6);outline-offset:2px}.amostra--ativa,.amostra--ativa:hover{z-index:3;border-color:var(--_destaque);box-shadow:0 0 0 1.5px var(--_destaque),0 2px 6px #00000059}:host([so-traco]) .amostra--preenchimento{opacity:.4}.face{position:absolute;top:3px;right:3px;bottom:3px;left:3px;border-radius:3.5px;pointer-events:none}.face--traco{background:transparent;border:4px solid #ffffff}.face--sem-cor{background:repeating-conic-gradient(#3a3a45,#3a3a45 25%,#24242b 0%,#24242b 50%) 50% / 6px 6px!important;border-color:#ef44448c!important;overflow:hidden}.face--sem-cor:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;background:linear-gradient(to top right,transparent calc(50% - 1px),var(--_vermelho) calc(50% - 1px),var(--_vermelho) calc(50% + 1px),transparent calc(50% + 1px))}.face--misto{display:flex;align-items:center;justify-content:center;background:#2e2e38!important;border-color:#64748b!important}.face--misto:after{content:"?";color:#fff;font-size:12px;font-weight:800;line-height:1;text-shadow:0 1px 2px rgba(0,0,0,.8)}.acoes{display:flex;flex:none;flex-direction:column;gap:2px;width:16px}.acao{display:flex;flex:1;align-items:center;justify-content:center;min-height:0;padding:0;background:transparent;border:0;border-radius:4px;color:var(--ui-cor-texto-secundario, #9696a6);cursor:pointer;transition:color .15s ease,background .15s ease}.acao:hover{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 12%,transparent);color:var(--_destaque)}.acao:focus-visible{outline:2px solid var(--ui-cor-texto, #e1e1e6);outline-offset:1px}.acao svg{width:12px;height:12px}.acao--sem-cor:hover{background:#ef444433;color:var(--_vermelho)}.icone-padrao{position:relative;width:11px;height:11px}.ponto{position:absolute;width:7px;height:7px;border-radius:1.5px}.ponto--preenchimento{top:0;left:0;background:#00e08a;border:1px solid var(--_borda-forte)}.ponto--traco{right:0;bottom:0;background:var(--_base);border:1.5px solid #ffffff}:host([layout="abaixo"]) .pilha{flex-direction:column;align-items:flex-start;gap:4px}:host([layout="abaixo"]) .acoes{flex-direction:row;width:var(--_pilha);height:var(--ui-controle-cores-acao, 22px)}:host([layout="abaixo"]) .acao svg{width:14px;height:14px}:host([layout="abaixo"]) .icone-padrao{width:13px;height:13px}:host([layout="compacto"]) .acoes{display:none}:host([layout="auto"]){display:block;width:100%;max-width:100%;min-width:0;container-type:inline-size}:host([layout="auto"]) .pilha{--_a: min(var(--ui-controle-cores-amostra, 26px), 60cqw);--_pilha: calc(var(--_a) * 5 / 3);justify-content:center;flex-direction:column;align-items:center;gap:4px}:host([layout="auto"]) .acoes{flex-direction:row;width:var(--_pilha);height:var(--ui-controle-cores-acao, 22px)}:host([layout="auto"]) .acao{min-width:0}:host([layout="auto"]) .acao svg{max-width:100%}@container (min-width: 66px){:host([layout="auto"]) .pilha{--_a: min(var(--ui-controle-cores-amostra, 26px), calc((100cqw - 22px) * 3 / 5));flex-direction:row;align-items:stretch;gap:6px}:host([layout="auto"]) .acoes{flex-direction:column;width:16px;height:auto}}@container (max-width: 39px){:host([layout="auto"]) .acoes{display:none}}:host([layout="mini"]){--_pilha: var(--_a)}:host([layout="mini"]) .acoes{display:none}:host([layout="mini"]) .amostra{top:0;left:0;right:auto;bottom:auto;opacity:0;pointer-events:none}:host([layout="mini"]) .amostra--ativa{opacity:1;pointer-events:auto}:host([layout="mini"]) .amostra--ativa:hover{transform:none}:host([desabilitado]) .pilha{opacity:.5}:host([desabilitado]) .amostra,:host([desabilitado]) .acao{cursor:not-allowed;pointer-events:none}@media (prefers-reduced-motion: reduce){.amostra,.acao{transition:none}.amostra:hover{transform:none}}';class C extends v.SafeHTMLElement{constructor(){super();i(this,"raiz");i(this,"listeners",new v.ListenerBag);i(this,"renderizado",!1);i(this,"_preenchimento","#00e08a");i(this,"_traco","#ffffff");i(this,"_opacidade",.35);i(this,"_espessuraTraco",2.5);i(this,"_alvo","preenchimento");i(this,"_misto",{preenchimento:!1,traco:!1});i(this,"_padrao",{preenchimento:"#00e08a",traco:"#ffffff"});i(this,"_coresProjeto",[]);i(this,"_atalhos",{});i(this,"seletor",null);i(this,"estadoAoAbrir",null);this.raiz=this.attachShadow({mode:"open"})}static get observedAttributes(){return["preenchimento","traco","opacidade","espessura-traco","alvo","padrao-preenchimento","padrao-traco","desabilitado"]}connectedCallback(){this.renderizado||this.renderizar(),this.listeners.cleanup(),this.vincularEventos(),this.atualizar()}disconnectedCallback(){this.fecharSeletor(!0),this.listeners.cleanup()}attributeChangedCallback(e,t,a){if(t!==a){if(e==="desabilitado"){this.hasAttribute("desabilitado")&&this.fecharSeletor(!1),this.atualizar();return}if(a!==null){if(e==="preenchimento")this.definirCores({preenchimento:a});else if(e==="traco")this.definirCores({traco:a});else if(e==="opacidade")this.definirCores({opacidade:Number(a)});else if(e==="espessura-traco")this.definirCores({espessuraTraco:s.normalizarEspessura(a)});else if(e==="alvo")this.definirAlvo(a);else if(e==="padrao-preenchimento"||e==="padrao-traco"){const o=s.normalizarCor(a);if(!o)return;e==="padrao-preenchimento"?this._padrao.preenchimento=o:this._padrao.traco=o,this.atualizar()}}}}get preenchimento(){return this._preenchimento}set preenchimento(e){this.definirCores({preenchimento:e})}get traco(){return this._traco}set traco(e){this.definirCores({traco:e})}get opacidade(){return this._opacidade}set opacidade(e){this.definirCores({opacidade:e})}get espessuraTraco(){return this._espessuraTraco}set espessuraTraco(e){this.definirCores({espessuraTraco:e})}get alvo(){return this._alvo}set alvo(e){this.definirAlvo(e)}get coresProjeto(){return[...this._coresProjeto]}set coresProjeto(e){this._coresProjeto=s.coresUnicas(e)}get atalhos(){return{...this._atalhos}}set atalhos(e){this._atalhos={...e||{}},this.atualizar()}get seletorAberto(){var e;return!!((e=this.seletor)!=null&&e.aberto)}definirCores(e={}){const t=s.normalizarCor(e.preenchimento),a=s.normalizarCor(e.traco);t&&(this._preenchimento=t,this._misto.preenchimento=!1),a&&(this._traco=a,this._misto.traco=!1),e.opacidade!==void 0&&(this._opacidade=s.normalizarOpacidade(e.opacidade,this._opacidade)),e.espessuraTraco!==void 0&&(this._espessuraTraco=s.normalizarEspessura(e.espessuraTraco,this._espessuraTraco)),this.atualizar()}obterCores(){return{preenchimento:this._preenchimento,traco:this._traco,opacidade:this._opacidade,espessuraTraco:this._espessuraTraco,alvo:this._alvo}}definirAlvo(e){this._alvo=e==="traco"?"traco":"preenchimento",this.atualizar(),this.sincronizarSeletor()}definirMisto(e={}){this._misto={preenchimento:!!e.preenchimento,traco:!!e.traco},this.atualizar()}alternarAlvo(){this.mudarAlvo(this._alvo==="traco"?"preenchimento":"traco")}inverter(){const e=this._preenchimento;this._preenchimento=this._traco,this._traco=e,this._misto={preenchimento:this._misto.traco,traco:this._misto.preenchimento},this.atualizar(),this.emitirCores(!0,["preenchimento","traco"],"inverter")}semCor(e=this._alvo){const t=e==="traco"?"traco":"preenchimento";t==="traco"?this._traco="none":this._preenchimento="none",this._misto[t]=!1,this.atualizar(),this.emitirCores(!0,[t],"sem-cor")}restaurarPadrao(){this._preenchimento=this._padrao.preenchimento,this._traco=this._padrao.traco,this._misto={preenchimento:!1,traco:!1},this.atualizar(),this.emitirCores(!0,["preenchimento","traco"],"padrao")}abrirSeletor(e=this._alvo,t=!1){if(this.hasAttribute("desabilitado")||(this.mudarAlvo(e==="traco"?"traco":"preenchimento"),this.seletorAberto))return;const a=this.raiz.querySelector(`[data-alvo="${this._alvo}"]`)||this;this.estadoAoAbrir=this.obterCores(),this.seletor=f.abrirSeletorCor({ancora:a,titulo:this.getAttribute("titulo-seletor")||"Cores e estilo",modo:"duplo",alvo:this._alvo,preenchimento:this._preenchimento,traco:this._traco,opacidade:this._opacidade,espessuraTraco:this._espessuraTraco,misto:this._misto[this._alvo],focar:t,aoAlterar:o=>this.aplicarDoSeletor(o,!1),aoConfirmar:o=>{this.seletor=null,this.aplicarDoSeletor(o,!0)},aoCancelar:()=>{this.seletor=null,this.estadoAoAbrir=null},aoTrocarAlvo:o=>this.mudarAlvo(o)})}fecharSeletor(e=!0){const t=this.seletor;t&&(e?t.fechar(!0):t.elemento.cancelar())}mudarAlvo(e){e!==this._alvo&&(this._alvo=e,this.atualizar(),this.sincronizarSeletor(),this.dispatchEvent(new CustomEvent("ui-alvo-change",{detail:{alvo:e},bubbles:!0,composed:!0})))}sincronizarSeletor(){var e,t;(t=(e=this.seletor)==null?void 0:e.elemento)==null||t.trocarAlvo(this._alvo)}aplicarDoSeletor(e,t){const a=r=>{const d=[];return e.preenchimento!==r.preenchimento&&d.push("preenchimento"),e.traco!==r.traco&&d.push("traco"),e.opacidade!==r.opacidade&&d.push("opacidade"),e.espessuraTraco!==void 0&&Math.abs(e.espessuraTraco-r.espessuraTraco)>.05&&d.push("espessuraTraco"),d},o=a(this.obterCores());if(this._preenchimento=e.preenchimento,this._traco=e.traco,this._opacidade=e.opacidade,e.espessuraTraco!==void 0&&(this._espessuraTraco=e.espessuraTraco),o.includes("preenchimento")&&(this._misto.preenchimento=!1),o.includes("traco")&&(this._misto.traco=!1),this.atualizar(),!t){o.length&&this.emitirCores(!1,o,"seletor");return}this.emitirCores(!0,this.estadoAoAbrir?a(this.estadoAoAbrir):o,"seletor"),this.estadoAoAbrir=null}emitirCores(e,t,a){const o={...this.obterCores(),confirmado:e,alterados:t,origem:a};this.dispatchEvent(new CustomEvent("ui-cores-change",{detail:o,bubbles:!0,composed:!0}))}dica(e,t){return t?`${e} [${t}]`:e}renderizar(){this.raiz.innerHTML=`
2
2
  <style>${q}</style>
3
3
  <div class="pilha" part="pilha" role="group" aria-label="Cores de desenho">
4
4
  <div class="amostras" part="amostras">
@@ -29,4 +29,4 @@
29
29
  </button>
30
30
  </div>
31
31
  </div>
32
- `,this.renderizado=!0}vincularEventos(){const e=this.raiz;e.querySelectorAll("[data-alvo]").forEach(r=>{const a=r.dataset.alvo;this.listeners.add(r,"click",o=>{o.stopPropagation(),a!==this._alvo?this.mudarAlvo(a):this.seletorAberto?this.fecharSeletor(!0):this.abrirSeletor(a)}),this.listeners.add(r,"dblclick",o=>{o.stopPropagation(),this.abrirSeletor(a)}),this.listeners.add(r,"keydown",o=>{o.key!=="Enter"&&o.key!==" "||(o.preventDefault(),a===this._alvo&&this.seletorAberto?this.fecharSeletor(!0):this.abrirSeletor(a,!0))}),this.listeners.add(r,"keyup",o=>{o.key===" "&&o.preventDefault()})});const t=(r,a)=>{this.listeners.add(e.querySelector(`[data-acao="${r}"]`),"click",o=>{o.stopPropagation(),a()})};t("inverter",()=>this.inverter()),t("sem-cor",()=>this.semCor()),t("padrao",()=>this.restaurarPadrao())}atualizar(){if(!this.renderizado)return;const e=this.raiz,t=this._atalhos,r=this.hasAttribute("desabilitado"),a=(n,c)=>c?"Misto (?) [várias cores na seleção]":n==="none"?"Sem cor":n,o=(n,c,l,S,y="")=>{const h=e.querySelector(`[data-alvo="${n}"]`),m=h==null?void 0:h.querySelector(".face");if(!h||!m)return;const g=this._alvo===n;h.classList.toggle("amostra--ativa",g),h.setAttribute("aria-pressed",String(g)),h.disabled=r,m.classList.toggle("face--misto",l),m.classList.toggle("face--sem-cor",!l&&c==="none");const k=n==="traco"?"borderColor":"backgroundColor";m.style[k]=l||c==="none"?"":c,n==="traco"&&c!=="none"&&!l&&(m.style.borderWidth=`${Math.max(2,Math.min(4.5,this._espessuraTraco))}px`);const C=`${S}: ${a(c,l)}${y}`;h.title=this.dica(`${C} — clique para ativar, clique de novo para editar`,t.alternar),h.setAttribute("aria-label",C)},d=this._preenchimento==="none"||this._misto.preenchimento?"":`, opacidade ${Math.round(this._opacidade*100)}%`;o("preenchimento",this._preenchimento,this._misto.preenchimento,"Preenchimento",d);const A=this._traco==="none"||this._misto.traco?"":`, espessura ${this._espessuraTraco}px`;o("traco",this._traco,this._misto.traco,"Traço / contorno",A);const b=(n,c)=>{const l=e.querySelector(`[data-acao="${n}"]`);l&&(l.title=c,l.disabled=r)};b("inverter",this.dica("Inverter preenchimento e traço",t.inverter)),b("sem-cor",this.dica("Sem cor no alvo ativo",t.semCor)),b("padrao",this.dica("Restaurar cores padrão",t.padrao));const _=e.querySelector(".ponto--preenchimento");_&&(_.style.backgroundColor=this._padrao.preenchimento==="none"?"transparent":this._padrao.preenchimento);const x=e.querySelector(".ponto--traco");x&&(x.style.borderColor=this._padrao.traco==="none"?"#ef4444":this._padrao.traco)}}v.definirCustomElement("ui-controle-cores",z);exports.PALETA_CORES_PADRAO=s.PALETA_CORES_PADRAO;exports.coresUnicas=s.coresUnicas;exports.escaparHtml=s.escaparHtml;exports.normalizarCor=s.normalizarCor;exports.normalizarEspessura=s.normalizarEspessura;exports.normalizarOpacidade=s.normalizarOpacidade;exports.UISeletorCor=f.UISeletorCor;exports.abrirSeletorCor=f.abrirSeletorCor;exports.fecharSeletorCor=f.fecharSeletorCor;exports.UIControleCores=z;
32
+ `,this.renderizado=!0}vincularEventos(){const e=this.raiz;e.querySelectorAll("[data-alvo]").forEach(a=>{const o=a.dataset.alvo;this.listeners.add(a,"click",r=>{r.stopPropagation(),o!==this._alvo?this.mudarAlvo(o):this.seletorAberto?this.fecharSeletor(!0):this.abrirSeletor(o)}),this.listeners.add(a,"dblclick",r=>{r.stopPropagation(),this.abrirSeletor(o)}),this.listeners.add(a,"keydown",r=>{r.key!=="Enter"&&r.key!==" "||(r.preventDefault(),o===this._alvo&&this.seletorAberto?this.fecharSeletor(!0):this.abrirSeletor(o,!0))}),this.listeners.add(a,"keyup",r=>{r.key===" "&&r.preventDefault()})});const t=(a,o)=>{this.listeners.add(e.querySelector(`[data-acao="${a}"]`),"click",r=>{r.stopPropagation(),o()})};t("inverter",()=>this.inverter()),t("sem-cor",()=>this.semCor()),t("padrao",()=>this.restaurarPadrao())}atualizar(){if(!this.renderizado)return;const e=this.raiz,t=this._atalhos,a=this.hasAttribute("desabilitado"),o=(n,c)=>c?"Misto (?) [várias cores na seleção]":n==="none"?"Sem cor":n,r=(n,c,l,A,S="")=>{const h=e.querySelector(`[data-alvo="${n}"]`),m=h==null?void 0:h.querySelector(".face");if(!h||!m)return;const g=this._alvo===n;h.classList.toggle("amostra--ativa",g),h.setAttribute("aria-pressed",String(g)),h.disabled=a,m.classList.toggle("face--misto",l),m.classList.toggle("face--sem-cor",!l&&c==="none");const w=n==="traco"?"borderColor":"backgroundColor";m.style[w]=l||c==="none"?"":c,n==="traco"&&c!=="none"&&!l&&(m.style.borderWidth=`${Math.max(2,Math.min(4.5,this._espessuraTraco))}px`);const y=`${A}: ${o(c,l)}${S}`;h.title=this.dica(`${y} — clique para ativar, clique de novo para editar`,t.alternar),h.setAttribute("aria-label",y)},d=this._preenchimento==="none"||this._misto.preenchimento?"":`, opacidade ${Math.round(this._opacidade*100)}%`;r("preenchimento",this._preenchimento,this._misto.preenchimento,"Preenchimento",d);const z=this._traco==="none"||this._misto.traco?"":`, espessura ${this._espessuraTraco}px`;r("traco",this._traco,this._misto.traco,"Traço / contorno",z);const b=(n,c)=>{const l=e.querySelector(`[data-acao="${n}"]`);l&&(l.title=c,l.disabled=a)};b("inverter",this.dica("Inverter preenchimento e traço",t.inverter)),b("sem-cor",this.dica("Sem cor no alvo ativo",t.semCor)),b("padrao",this.dica("Restaurar cores padrão",t.padrao));const _=e.querySelector(".ponto--preenchimento");_&&(_.style.backgroundColor=this._padrao.preenchimento==="none"?"transparent":this._padrao.preenchimento);const x=e.querySelector(".ponto--traco");x&&(x.style.borderColor=this._padrao.traco==="none"?"#ef4444":this._padrao.traco)}}v.definirCustomElement("ui-controle-cores",C);exports.PALETA_CORES_PADRAO=s.PALETA_CORES_PADRAO;exports.coresUnicas=s.coresUnicas;exports.escaparHtml=s.escaparHtml;exports.normalizarCor=s.normalizarCor;exports.normalizarEspessura=s.normalizarEspessura;exports.normalizarOpacidade=s.normalizarOpacidade;exports.UISeletorCor=f.UISeletorCor;exports.abrirSeletorCor=f.abrirSeletorCor;exports.fecharSeletorCor=f.fecharSeletorCor;exports.UIControleCores=C;
package/dist/cores.js CHANGED
@@ -1,30 +1,30 @@
1
- var k = Object.defineProperty;
2
- var S = (d, h, e) => h in d ? k(d, h, { enumerable: !0, configurable: !0, writable: !0, value: e }) : d[h] = e;
3
- var s = (d, h, e) => S(d, typeof h != "symbol" ? h + "" : h, e);
1
+ var z = Object.defineProperty;
2
+ var k = (d, h, e) => h in d ? z(d, h, { enumerable: !0, configurable: !0, writable: !0, value: e }) : d[h] = e;
3
+ var i = (d, h, e) => k(d, typeof h != "symbol" ? h + "" : h, e);
4
4
  /* empty css */
5
- import { b as g, n as m, c as T, a as w } from "./cores-utils-DMyqWvZh.js";
5
+ import { b as g, n as f, c as S, a as T } from "./cores-utils-DMyqWvZh.js";
6
6
  import { P as O, e as N } from "./cores-utils-DMyqWvZh.js";
7
- import { S as P, L as q, d as $ } from "./kit-base-CBXA66aM.js";
7
+ import { S as q, L as P, d as $ } from "./kit-base-CBXA66aM.js";
8
8
  import { a as E } from "./ui-seletor-cor-CPjA9vhZ.js";
9
9
  import { U as F, f as G } from "./ui-seletor-cor-CPjA9vhZ.js";
10
- const M = ':host{--_a: var(--ui-controle-cores-amostra, 26px);--_pilha: calc(var(--_a) * 5 / 3);--_borda: color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 30%, transparent);--_borda-forte: color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 70%, transparent);--_base: var(--ui-fundo-superficie, var(--ui-cor-superficie, #1d1d22));--_destaque: var(--ui-cor-primaria, #00e08a);--_vermelho: #ef4444;display:inline-block;flex-shrink:0;-webkit-user-select:none;user-select:none}:host([hidden]){display:none}*,*:before,*:after{box-sizing:border-box}.pilha{display:flex;align-items:stretch;gap:6px}.amostras{position:relative;flex:none;width:var(--_pilha);height:var(--_pilha)}.amostra{position:absolute;width:var(--_a);height:var(--_a);padding:0;background:var(--_base);border:1px solid var(--_borda);border-radius:6px;cursor:pointer;transition:transform .15s ease,border-color .15s ease,box-shadow .15s ease,opacity .15s ease}.amostra--traco{right:0;bottom:0;z-index:1}.amostra--preenchimento{top:0;left:0;z-index:2;box-shadow:0 2px 6px #00000059}.amostra:hover{border-color:var(--_borda-forte);transform:scale(1.05)}.amostra:focus-visible{outline:2px solid var(--ui-cor-texto, #e1e1e6);outline-offset:2px}.amostra--ativa,.amostra--ativa:hover{z-index:3;border-color:var(--_destaque);box-shadow:0 0 0 1.5px var(--_destaque),0 2px 6px #00000059}:host([so-traco]) .amostra--preenchimento{opacity:.4}.face{position:absolute;top:3px;right:3px;bottom:3px;left:3px;border-radius:3.5px;pointer-events:none}.face--traco{background:transparent;border:4px solid #ffffff}.face--sem-cor{background:repeating-conic-gradient(#3a3a45,#3a3a45 25%,#24242b 0%,#24242b 50%) 50% / 6px 6px!important;border-color:#ef44448c!important;overflow:hidden}.face--sem-cor:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;background:linear-gradient(to top right,transparent calc(50% - 1px),var(--_vermelho) calc(50% - 1px),var(--_vermelho) calc(50% + 1px),transparent calc(50% + 1px))}.face--misto{display:flex;align-items:center;justify-content:center;background:#2e2e38!important;border-color:#64748b!important}.face--misto:after{content:"?";color:#fff;font-size:12px;font-weight:800;line-height:1;text-shadow:0 1px 2px rgba(0,0,0,.8)}.acoes{display:flex;flex:none;flex-direction:column;gap:2px;width:16px}.acao{display:flex;flex:1;align-items:center;justify-content:center;min-height:0;padding:0;background:transparent;border:0;border-radius:4px;color:var(--ui-cor-texto-secundario, #9696a6);cursor:pointer;transition:color .15s ease,background .15s ease}.acao:hover{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 12%,transparent);color:var(--_destaque)}.acao:focus-visible{outline:2px solid var(--ui-cor-texto, #e1e1e6);outline-offset:1px}.acao svg{width:12px;height:12px}.acao--sem-cor:hover{background:#ef444433;color:var(--_vermelho)}.icone-padrao{position:relative;width:11px;height:11px}.ponto{position:absolute;width:7px;height:7px;border-radius:1.5px}.ponto--preenchimento{top:0;left:0;background:#00e08a;border:1px solid var(--_borda-forte)}.ponto--traco{right:0;bottom:0;background:var(--_base);border:1.5px solid #ffffff}:host([desabilitado]) .pilha{opacity:.5}:host([desabilitado]) .amostra,:host([desabilitado]) .acao{cursor:not-allowed;pointer-events:none}@media (prefers-reduced-motion: reduce){.amostra,.acao{transition:none}.amostra:hover{transform:none}}';
11
- class j extends P {
10
+ const M = ':host{--_a: var(--ui-controle-cores-amostra, 26px);--_pilha: calc(var(--_a) * 5 / 3);--_borda: color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 30%, transparent);--_borda-forte: color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 70%, transparent);--_base: var(--ui-fundo-superficie, var(--ui-cor-superficie, #1d1d22));--_destaque: var(--ui-cor-primaria, #00e08a);--_vermelho: #ef4444;display:inline-block;flex-shrink:0;-webkit-user-select:none;user-select:none}:host([hidden]){display:none}*,*:before,*:after{box-sizing:border-box}.pilha{display:flex;align-items:stretch;gap:6px}.amostras{position:relative;flex:none;width:var(--_pilha);height:var(--_pilha)}.amostra{position:absolute;width:var(--_a);height:var(--_a);padding:0;background:var(--_base);border:1px solid var(--_borda);border-radius:6px;cursor:pointer;transition:transform .15s ease,border-color .15s ease,box-shadow .15s ease,opacity .15s ease}.amostra--traco{right:0;bottom:0;z-index:1}.amostra--preenchimento{top:0;left:0;z-index:2;box-shadow:0 2px 6px #00000059}.amostra:hover{border-color:var(--_borda-forte);transform:scale(1.05)}.amostra:focus-visible{outline:2px solid var(--ui-cor-texto, #e1e1e6);outline-offset:2px}.amostra--ativa,.amostra--ativa:hover{z-index:3;border-color:var(--_destaque);box-shadow:0 0 0 1.5px var(--_destaque),0 2px 6px #00000059}:host([so-traco]) .amostra--preenchimento{opacity:.4}.face{position:absolute;top:3px;right:3px;bottom:3px;left:3px;border-radius:3.5px;pointer-events:none}.face--traco{background:transparent;border:4px solid #ffffff}.face--sem-cor{background:repeating-conic-gradient(#3a3a45,#3a3a45 25%,#24242b 0%,#24242b 50%) 50% / 6px 6px!important;border-color:#ef44448c!important;overflow:hidden}.face--sem-cor:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;background:linear-gradient(to top right,transparent calc(50% - 1px),var(--_vermelho) calc(50% - 1px),var(--_vermelho) calc(50% + 1px),transparent calc(50% + 1px))}.face--misto{display:flex;align-items:center;justify-content:center;background:#2e2e38!important;border-color:#64748b!important}.face--misto:after{content:"?";color:#fff;font-size:12px;font-weight:800;line-height:1;text-shadow:0 1px 2px rgba(0,0,0,.8)}.acoes{display:flex;flex:none;flex-direction:column;gap:2px;width:16px}.acao{display:flex;flex:1;align-items:center;justify-content:center;min-height:0;padding:0;background:transparent;border:0;border-radius:4px;color:var(--ui-cor-texto-secundario, #9696a6);cursor:pointer;transition:color .15s ease,background .15s ease}.acao:hover{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 12%,transparent);color:var(--_destaque)}.acao:focus-visible{outline:2px solid var(--ui-cor-texto, #e1e1e6);outline-offset:1px}.acao svg{width:12px;height:12px}.acao--sem-cor:hover{background:#ef444433;color:var(--_vermelho)}.icone-padrao{position:relative;width:11px;height:11px}.ponto{position:absolute;width:7px;height:7px;border-radius:1.5px}.ponto--preenchimento{top:0;left:0;background:#00e08a;border:1px solid var(--_borda-forte)}.ponto--traco{right:0;bottom:0;background:var(--_base);border:1.5px solid #ffffff}:host([layout="abaixo"]) .pilha{flex-direction:column;align-items:flex-start;gap:4px}:host([layout="abaixo"]) .acoes{flex-direction:row;width:var(--_pilha);height:var(--ui-controle-cores-acao, 22px)}:host([layout="abaixo"]) .acao svg{width:14px;height:14px}:host([layout="abaixo"]) .icone-padrao{width:13px;height:13px}:host([layout="compacto"]) .acoes{display:none}:host([layout="auto"]){display:block;width:100%;max-width:100%;min-width:0;container-type:inline-size}:host([layout="auto"]) .pilha{--_a: min(var(--ui-controle-cores-amostra, 26px), 60cqw);--_pilha: calc(var(--_a) * 5 / 3);justify-content:center;flex-direction:column;align-items:center;gap:4px}:host([layout="auto"]) .acoes{flex-direction:row;width:var(--_pilha);height:var(--ui-controle-cores-acao, 22px)}:host([layout="auto"]) .acao{min-width:0}:host([layout="auto"]) .acao svg{max-width:100%}@container (min-width: 66px){:host([layout="auto"]) .pilha{--_a: min(var(--ui-controle-cores-amostra, 26px), calc((100cqw - 22px) * 3 / 5));flex-direction:row;align-items:stretch;gap:6px}:host([layout="auto"]) .acoes{flex-direction:column;width:16px;height:auto}}@container (max-width: 39px){:host([layout="auto"]) .acoes{display:none}}:host([layout="mini"]){--_pilha: var(--_a)}:host([layout="mini"]) .acoes{display:none}:host([layout="mini"]) .amostra{top:0;left:0;right:auto;bottom:auto;opacity:0;pointer-events:none}:host([layout="mini"]) .amostra--ativa{opacity:1;pointer-events:auto}:host([layout="mini"]) .amostra--ativa:hover{transform:none}:host([desabilitado]) .pilha{opacity:.5}:host([desabilitado]) .amostra,:host([desabilitado]) .acao{cursor:not-allowed;pointer-events:none}@media (prefers-reduced-motion: reduce){.amostra,.acao{transition:none}.amostra:hover{transform:none}}';
11
+ class j extends q {
12
12
  constructor() {
13
13
  super();
14
- s(this, "raiz");
15
- s(this, "listeners", new q());
16
- s(this, "renderizado", !1);
17
- s(this, "_preenchimento", "#00e08a");
18
- s(this, "_traco", "#ffffff");
19
- s(this, "_opacidade", 0.35);
20
- s(this, "_espessuraTraco", 2.5);
21
- s(this, "_alvo", "preenchimento");
22
- s(this, "_misto", { preenchimento: !1, traco: !1 });
23
- s(this, "_padrao", { preenchimento: "#00e08a", traco: "#ffffff" });
24
- s(this, "_coresProjeto", []);
25
- s(this, "_atalhos", {});
26
- s(this, "seletor", null);
27
- s(this, "estadoAoAbrir", null);
14
+ i(this, "raiz");
15
+ i(this, "listeners", new P());
16
+ i(this, "renderizado", !1);
17
+ i(this, "_preenchimento", "#00e08a");
18
+ i(this, "_traco", "#ffffff");
19
+ i(this, "_opacidade", 0.35);
20
+ i(this, "_espessuraTraco", 2.5);
21
+ i(this, "_alvo", "preenchimento");
22
+ i(this, "_misto", { preenchimento: !1, traco: !1 });
23
+ i(this, "_padrao", { preenchimento: "#00e08a", traco: "#ffffff" });
24
+ i(this, "_coresProjeto", []);
25
+ i(this, "_atalhos", {});
26
+ i(this, "seletor", null);
27
+ i(this, "estadoAoAbrir", null);
28
28
  this.raiz = this.attachShadow({ mode: "open" });
29
29
  }
30
30
  static get observedAttributes() {
@@ -36,22 +36,22 @@ class j extends P {
36
36
  disconnectedCallback() {
37
37
  this.fecharSeletor(!0), this.listeners.cleanup();
38
38
  }
39
- attributeChangedCallback(e, t, r) {
40
- if (t !== r) {
39
+ attributeChangedCallback(e, t, a) {
40
+ if (t !== a) {
41
41
  if (e === "desabilitado") {
42
42
  this.hasAttribute("desabilitado") && this.fecharSeletor(!1), this.atualizar();
43
43
  return;
44
44
  }
45
- if (r !== null) {
46
- if (e === "preenchimento") this.definirCores({ preenchimento: r });
47
- else if (e === "traco") this.definirCores({ traco: r });
48
- else if (e === "opacidade") this.definirCores({ opacidade: Number(r) });
49
- else if (e === "espessura-traco") this.definirCores({ espessuraTraco: g(r) });
50
- else if (e === "alvo") this.definirAlvo(r);
45
+ if (a !== null) {
46
+ if (e === "preenchimento") this.definirCores({ preenchimento: a });
47
+ else if (e === "traco") this.definirCores({ traco: a });
48
+ else if (e === "opacidade") this.definirCores({ opacidade: Number(a) });
49
+ else if (e === "espessura-traco") this.definirCores({ espessuraTraco: g(a) });
50
+ else if (e === "alvo") this.definirAlvo(a);
51
51
  else if (e === "padrao-preenchimento" || e === "padrao-traco") {
52
- const a = m(r);
53
- if (!a) return;
54
- e === "padrao-preenchimento" ? this._padrao.preenchimento = a : this._padrao.traco = a, this.atualizar();
52
+ const o = f(a);
53
+ if (!o) return;
54
+ e === "padrao-preenchimento" ? this._padrao.preenchimento = o : this._padrao.traco = o, this.atualizar();
55
55
  }
56
56
  }
57
57
  }
@@ -92,7 +92,7 @@ class j extends P {
92
92
  return [...this._coresProjeto];
93
93
  }
94
94
  set coresProjeto(e) {
95
- this._coresProjeto = T(e);
95
+ this._coresProjeto = S(e);
96
96
  }
97
97
  /** Teclas exibidas nas dicas dos botões (ex.: `{ inverter: 'Shift+X' }`). */
98
98
  get atalhos() {
@@ -108,8 +108,8 @@ class j extends P {
108
108
  /* ---------- Métodos (sem eventos) ---------- */
109
109
  /** Define cores, opacidade e/ou espessura sem emitir eventos. Valores inválidos são ignorados; uma cor definida deixa de ser "mista". */
110
110
  definirCores(e = {}) {
111
- const t = m(e.preenchimento), r = m(e.traco);
112
- t && (this._preenchimento = t, this._misto.preenchimento = !1), r && (this._traco = r, this._misto.traco = !1), e.opacidade !== void 0 && (this._opacidade = w(e.opacidade, this._opacidade)), e.espessuraTraco !== void 0 && (this._espessuraTraco = g(e.espessuraTraco, this._espessuraTraco)), this.atualizar();
111
+ const t = f(e.preenchimento), a = f(e.traco);
112
+ t && (this._preenchimento = t, this._misto.preenchimento = !1), a && (this._traco = a, this._misto.traco = !1), e.opacidade !== void 0 && (this._opacidade = T(e.opacidade, this._opacidade)), e.espessuraTraco !== void 0 && (this._espessuraTraco = g(e.espessuraTraco, this._espessuraTraco)), this.atualizar();
113
113
  }
114
114
  obterCores() {
115
115
  return {
@@ -150,9 +150,9 @@ class j extends P {
150
150
  /** Abre o seletor de cor ancorado na amostra do alvo (que passa a ser o ativo). Com `focar`, leva o foco do teclado para o painel. */
151
151
  abrirSeletor(e = this._alvo, t = !1) {
152
152
  if (this.hasAttribute("desabilitado") || (this.mudarAlvo(e === "traco" ? "traco" : "preenchimento"), this.seletorAberto)) return;
153
- const r = this.raiz.querySelector(`[data-alvo="${this._alvo}"]`) || this;
153
+ const a = this.raiz.querySelector(`[data-alvo="${this._alvo}"]`) || this;
154
154
  this.estadoAoAbrir = this.obterCores(), this.seletor = E({
155
- ancora: r,
155
+ ancora: a,
156
156
  titulo: this.getAttribute("titulo-seletor") || "Cores e estilo",
157
157
  modo: "duplo",
158
158
  alvo: this._alvo,
@@ -162,14 +162,14 @@ class j extends P {
162
162
  espessuraTraco: this._espessuraTraco,
163
163
  misto: this._misto[this._alvo],
164
164
  focar: t,
165
- aoAlterar: (a) => this.aplicarDoSeletor(a, !1),
166
- aoConfirmar: (a) => {
167
- this.seletor = null, this.aplicarDoSeletor(a, !0);
165
+ aoAlterar: (o) => this.aplicarDoSeletor(o, !1),
166
+ aoConfirmar: (o) => {
167
+ this.seletor = null, this.aplicarDoSeletor(o, !0);
168
168
  },
169
169
  aoCancelar: () => {
170
170
  this.seletor = null, this.estadoAoAbrir = null;
171
171
  },
172
- aoTrocarAlvo: (a) => this.mudarAlvo(a)
172
+ aoTrocarAlvo: (o) => this.mudarAlvo(o)
173
173
  });
174
174
  }
175
175
  /**
@@ -190,19 +190,19 @@ class j extends P {
190
190
  (t = (e = this.seletor) == null ? void 0 : e.elemento) == null || t.trocarAlvo(this._alvo);
191
191
  }
192
192
  aplicarDoSeletor(e, t) {
193
- const r = (o) => {
193
+ const a = (r) => {
194
194
  const p = [];
195
- return e.preenchimento !== o.preenchimento && p.push("preenchimento"), e.traco !== o.traco && p.push("traco"), e.opacidade !== o.opacidade && p.push("opacidade"), e.espessuraTraco !== void 0 && Math.abs(e.espessuraTraco - o.espessuraTraco) > 0.05 && p.push("espessuraTraco"), p;
196
- }, a = r(this.obterCores());
197
- if (this._preenchimento = e.preenchimento, this._traco = e.traco, this._opacidade = e.opacidade, e.espessuraTraco !== void 0 && (this._espessuraTraco = e.espessuraTraco), a.includes("preenchimento") && (this._misto.preenchimento = !1), a.includes("traco") && (this._misto.traco = !1), this.atualizar(), !t) {
198
- a.length && this.emitirCores(!1, a, "seletor");
195
+ return e.preenchimento !== r.preenchimento && p.push("preenchimento"), e.traco !== r.traco && p.push("traco"), e.opacidade !== r.opacidade && p.push("opacidade"), e.espessuraTraco !== void 0 && Math.abs(e.espessuraTraco - r.espessuraTraco) > 0.05 && p.push("espessuraTraco"), p;
196
+ }, o = a(this.obterCores());
197
+ if (this._preenchimento = e.preenchimento, this._traco = e.traco, this._opacidade = e.opacidade, e.espessuraTraco !== void 0 && (this._espessuraTraco = e.espessuraTraco), o.includes("preenchimento") && (this._misto.preenchimento = !1), o.includes("traco") && (this._misto.traco = !1), this.atualizar(), !t) {
198
+ o.length && this.emitirCores(!1, o, "seletor");
199
199
  return;
200
200
  }
201
- this.emitirCores(!0, this.estadoAoAbrir ? r(this.estadoAoAbrir) : a, "seletor"), this.estadoAoAbrir = null;
201
+ this.emitirCores(!0, this.estadoAoAbrir ? a(this.estadoAoAbrir) : o, "seletor"), this.estadoAoAbrir = null;
202
202
  }
203
- emitirCores(e, t, r) {
204
- const a = { ...this.obterCores(), confirmado: e, alterados: t, origem: r };
205
- this.dispatchEvent(new CustomEvent("ui-cores-change", { detail: a, bubbles: !0, composed: !0 }));
203
+ emitirCores(e, t, a) {
204
+ const o = { ...this.obterCores(), confirmado: e, alterados: t, origem: a };
205
+ this.dispatchEvent(new CustomEvent("ui-cores-change", { detail: o, bubbles: !0, composed: !0 }));
206
206
  }
207
207
  dica(e, t) {
208
208
  return t ? `${e} [${t}]` : e;
@@ -243,45 +243,45 @@ class j extends P {
243
243
  }
244
244
  vincularEventos() {
245
245
  const e = this.raiz;
246
- e.querySelectorAll("[data-alvo]").forEach((r) => {
247
- const a = r.dataset.alvo;
248
- this.listeners.add(r, "click", (o) => {
249
- o.stopPropagation(), a !== this._alvo ? this.mudarAlvo(a) : this.seletorAberto ? this.fecharSeletor(!0) : this.abrirSeletor(a);
250
- }), this.listeners.add(r, "dblclick", (o) => {
251
- o.stopPropagation(), this.abrirSeletor(a);
252
- }), this.listeners.add(r, "keydown", (o) => {
253
- o.key !== "Enter" && o.key !== " " || (o.preventDefault(), a === this._alvo && this.seletorAberto ? this.fecharSeletor(!0) : this.abrirSeletor(a, !0));
254
- }), this.listeners.add(r, "keyup", (o) => {
255
- o.key === " " && o.preventDefault();
246
+ e.querySelectorAll("[data-alvo]").forEach((a) => {
247
+ const o = a.dataset.alvo;
248
+ this.listeners.add(a, "click", (r) => {
249
+ r.stopPropagation(), o !== this._alvo ? this.mudarAlvo(o) : this.seletorAberto ? this.fecharSeletor(!0) : this.abrirSeletor(o);
250
+ }), this.listeners.add(a, "dblclick", (r) => {
251
+ r.stopPropagation(), this.abrirSeletor(o);
252
+ }), this.listeners.add(a, "keydown", (r) => {
253
+ r.key !== "Enter" && r.key !== " " || (r.preventDefault(), o === this._alvo && this.seletorAberto ? this.fecharSeletor(!0) : this.abrirSeletor(o, !0));
254
+ }), this.listeners.add(a, "keyup", (r) => {
255
+ r.key === " " && r.preventDefault();
256
256
  });
257
257
  });
258
- const t = (r, a) => {
259
- this.listeners.add(e.querySelector(`[data-acao="${r}"]`), "click", (o) => {
260
- o.stopPropagation(), a();
258
+ const t = (a, o) => {
259
+ this.listeners.add(e.querySelector(`[data-acao="${a}"]`), "click", (r) => {
260
+ r.stopPropagation(), o();
261
261
  });
262
262
  };
263
263
  t("inverter", () => this.inverter()), t("sem-cor", () => this.semCor()), t("padrao", () => this.restaurarPadrao());
264
264
  }
265
265
  atualizar() {
266
266
  if (!this.renderizado) return;
267
- const e = this.raiz, t = this._atalhos, r = this.hasAttribute("desabilitado"), a = (i, n) => n ? "Misto (?) [várias cores na seleção]" : i === "none" ? "Sem cor" : i, o = (i, n, c, A, y = "") => {
268
- const l = e.querySelector(`[data-alvo="${i}"]`), u = l == null ? void 0 : l.querySelector(".face");
267
+ const e = this.raiz, t = this._atalhos, a = this.hasAttribute("desabilitado"), o = (s, n) => n ? "Misto (?) [várias cores na seleção]" : s === "none" ? "Sem cor" : s, r = (s, n, c, C, w = "") => {
268
+ const l = e.querySelector(`[data-alvo="${s}"]`), u = l == null ? void 0 : l.querySelector(".face");
269
269
  if (!l || !u) return;
270
- const _ = this._alvo === i;
271
- l.classList.toggle("amostra--ativa", _), l.setAttribute("aria-pressed", String(_)), l.disabled = r, u.classList.toggle("face--misto", c), u.classList.toggle("face--sem-cor", !c && n === "none");
272
- const z = i === "traco" ? "borderColor" : "backgroundColor";
273
- u.style[z] = c || n === "none" ? "" : n, i === "traco" && n !== "none" && !c && (u.style.borderWidth = `${Math.max(2, Math.min(4.5, this._espessuraTraco))}px`);
274
- const x = `${A}: ${a(n, c)}${y}`;
270
+ const _ = this._alvo === s;
271
+ l.classList.toggle("amostra--ativa", _), l.setAttribute("aria-pressed", String(_)), l.disabled = a, u.classList.toggle("face--misto", c), u.classList.toggle("face--sem-cor", !c && n === "none");
272
+ const A = s === "traco" ? "borderColor" : "backgroundColor";
273
+ u.style[A] = c || n === "none" ? "" : n, s === "traco" && n !== "none" && !c && (u.style.borderWidth = `${Math.max(2, Math.min(4.5, this._espessuraTraco))}px`);
274
+ const x = `${C}: ${o(n, c)}${w}`;
275
275
  l.title = this.dica(`${x} — clique para ativar, clique de novo para editar`, t.alternar), l.setAttribute("aria-label", x);
276
276
  }, p = this._preenchimento === "none" || this._misto.preenchimento ? "" : `, opacidade ${Math.round(this._opacidade * 100)}%`;
277
- o("preenchimento", this._preenchimento, this._misto.preenchimento, "Preenchimento", p);
278
- const C = this._traco === "none" || this._misto.traco ? "" : `, espessura ${this._espessuraTraco}px`;
279
- o("traco", this._traco, this._misto.traco, "Traço / contorno", C);
280
- const f = (i, n) => {
281
- const c = e.querySelector(`[data-acao="${i}"]`);
282
- c && (c.title = n, c.disabled = r);
277
+ r("preenchimento", this._preenchimento, this._misto.preenchimento, "Preenchimento", p);
278
+ const y = this._traco === "none" || this._misto.traco ? "" : `, espessura ${this._espessuraTraco}px`;
279
+ r("traco", this._traco, this._misto.traco, "Traço / contorno", y);
280
+ const m = (s, n) => {
281
+ const c = e.querySelector(`[data-acao="${s}"]`);
282
+ c && (c.title = n, c.disabled = a);
283
283
  };
284
- f("inverter", this.dica("Inverter preenchimento e traço", t.inverter)), f("sem-cor", this.dica("Sem cor no alvo ativo", t.semCor)), f("padrao", this.dica("Restaurar cores padrão", t.padrao));
284
+ m("inverter", this.dica("Inverter preenchimento e traço", t.inverter)), m("sem-cor", this.dica("Sem cor no alvo ativo", t.semCor)), m("padrao", this.dica("Restaurar cores padrão", t.padrao));
285
285
  const b = e.querySelector(".ponto--preenchimento");
286
286
  b && (b.style.backgroundColor = this._padrao.preenchimento === "none" ? "transparent" : this._padrao.preenchimento);
287
287
  const v = e.querySelector(".ponto--traco");
@@ -294,10 +294,10 @@ export {
294
294
  j as UIControleCores,
295
295
  F as UISeletorCor,
296
296
  E as abrirSeletorCor,
297
- T as coresUnicas,
297
+ S as coresUnicas,
298
298
  N as escaparHtml,
299
299
  G as fecharSeletorCor,
300
- m as normalizarCor,
300
+ f as normalizarCor,
301
301
  g as normalizarEspessura,
302
- w as normalizarOpacidade
302
+ T as normalizarOpacidade
303
303
  };