@thibezer/ui-components-kit 2.10.0 → 2.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -0
- package/README.md +2 -2
- package/dist/camadas.cjs +1 -1
- package/dist/camadas.js +1 -1
- package/dist/canvas.cjs +62 -62
- package/dist/canvas.js +2449 -2094
- package/dist/components/ui-canvas-cad/cad-feicoes-edicao.d.ts +13 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-ponteiro.d.ts +8 -2
- package/dist/components/ui-canvas-cad/cad-feicoes-teclado.d.ts +19 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-tipos.d.ts +1 -1
- package/dist/components/ui-canvas-cad/cad-feicoes.d.ts +12 -1
- package/dist/components/ui-canvas-cad/cad-ferramentas-barra.d.ts +8 -1
- package/dist/components/ui-canvas-cad/cad-snap.d.ts +2 -0
- package/dist/components/ui-canvas-cad/ui-canvas-cad.d.ts +7 -0
- package/dist/components/ui-cores/cores-utils.d.ts +2 -0
- package/dist/components/ui-cores/tipos.d.ts +9 -2
- package/dist/components/ui-cores/ui-controle-cores.d.ts +9 -4
- package/dist/components/ui-cores/ui-seletor-cor.d.ts +12 -9
- package/dist/components/ui-tabela-propriedades/editores-basicos.d.ts +1 -1
- package/dist/components/ui-tabela-propriedades/propriedades-dom-utils.d.ts +5 -0
- package/dist/components/ui-tabela-propriedades/propriedades-gerenciador-valores.d.ts +3 -3
- package/dist/components/ui-tabela-propriedades/propriedades-valor-misto.d.ts +25 -0
- package/dist/components/ui-tabela-propriedades/tipos.d.ts +5 -0
- package/dist/components/ui-tabela-propriedades/ui-tabela-propriedades.d.ts +7 -0
- package/dist/cores.cjs +1 -1
- package/dist/cores.js +12 -11
- package/dist/custom-elements.json +9165 -8544
- package/dist/data.cjs +1 -1
- package/dist/data.js +72 -64
- package/dist/gerencigeo-canvas/feature_desenho.d.ts +2 -0
- package/dist/gerencigeo-canvas/feature_desenho_controle.d.ts +3 -0
- package/dist/gerencigeo-canvas/feature_editor_vertices.d.ts +51 -4
- package/dist/index.cjs +1 -1
- package/dist/index.js +154 -145
- package/dist/{motor-CFI84lM2.js → motor-BKT2eStP.js} +3 -3
- package/dist/motor.js +1 -1
- package/dist/register.cjs +1 -1
- package/dist/register.js +3 -3
- package/dist/tabela.cjs +1 -1
- package/dist/tabela.js +66 -58
- package/dist/tipos-elementos.d.ts +4 -0
- package/dist/tipos-vue.d.ts +2 -0
- package/dist/ui-controle-cores-CohlwXJK.cjs +32 -0
- package/dist/{ui-controle-cores-BEUKOq4n.js → ui-controle-cores-DMtTUtLk.js} +98 -81
- package/dist/ui-seletor-cor-D9iI7yew.js +413 -0
- package/dist/ui-seletor-cor-Ft06TEUH.cjs +110 -0
- package/dist/ui-tabela-propriedades-B8AwlpqL.cjs +141 -0
- package/dist/{ui-tabela-propriedades-DoL4SE0r.js → ui-tabela-propriedades-DuaC4sFX.js} +1295 -1195
- package/package.json +1 -1
- package/dist/ui-controle-cores-BLhrZHMh.cjs +0 -32
- package/dist/ui-seletor-cor-2yGryC_Z.cjs +0 -86
- package/dist/ui-seletor-cor-BuyhoDZz.js +0 -345
- package/dist/ui-tabela-propriedades-CjK2gG14.cjs +0 -141
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";var S=Object.defineProperty;var T=(u,h,e)=>h in u?S(u,h,{enumerable:!0,configurable:!0,writable:!0,value:e}):u[h]=e;var s=(u,h,e)=>T(u,typeof h!="symbol"?h+"":h,e);const g=require("./ssr-safe-CiHD1adl.cjs"),w=require("./listener-bag-D5omxZ9h.cjs"),p=require("./ui-seletor-cor-Ft06TEUH.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-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 C extends g.SafeHTMLElement{constructor(){super();s(this,"raiz");s(this,"listeners",new w.ListenerBag);s(this,"renderizado",!1);s(this,"_preenchimento","#00e08a");s(this,"_traco","#ffffff");s(this,"_opacidade",.35);s(this,"_espessuraTraco",2.5);s(this,"_alvo","preenchimento");s(this,"_misto",{preenchimento:!1,traco:!1});s(this,"_padrao",{preenchimento:"#00e08a",traco:"#ffffff"});s(this,"_coresProjeto",[]);s(this,"_atalhos",{});s(this,"seletor",null);s(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:p.normalizarEspessura(r)});else if(e==="alvo")this.definirAlvo(r);else if(e==="padrao-preenchimento"||e==="padrao-traco"){const o=p.normalizarCor(r);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=p.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=p.normalizarCor(e.preenchimento),r=p.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=p.normalizarOpacidade(e.opacidade,this._opacidade)),e.espessuraTraco!==void 0&&(this._espessuraTraco=p.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=p.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],coresProjeto:this._coresProjeto,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 r=a=>{const d=[];return e.preenchimento!==a.preenchimento&&d.push("preenchimento"),e.traco!==a.traco&&d.push("traco"),e.opacidade!==a.opacidade&&d.push("opacidade"),e.espessuraTraco!==void 0&&Math.abs(e.espessuraTraco-a.espessuraTraco)>.05&&d.push("espessuraTraco"),d},o=r(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?r(this.estadoAoAbrir):o,"seletor"),this.estadoAoAbrir=null}emitirCores(e,t,r){const o={...this.obterCores(),confirmado:e,alterados:t,origem:r};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
|
+
<style>${q}</style>
|
|
3
|
+
<div class="pilha" part="pilha" role="group" aria-label="Cores de desenho">
|
|
4
|
+
<div class="amostras" part="amostras">
|
|
5
|
+
<button type="button" class="amostra amostra--traco" data-alvo="traco" part="amostra amostra-traco">
|
|
6
|
+
<span class="face face--traco"></span>
|
|
7
|
+
</button>
|
|
8
|
+
<button type="button" class="amostra amostra--preenchimento" data-alvo="preenchimento" part="amostra amostra-preenchimento">
|
|
9
|
+
<span class="face face--preenchimento"></span>
|
|
10
|
+
</button>
|
|
11
|
+
</div>
|
|
12
|
+
<div class="acoes" part="acoes">
|
|
13
|
+
<button type="button" class="acao acao--inverter" data-acao="inverter" part="acao acao-inverter" aria-label="Inverter preenchimento e traço">
|
|
14
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
15
|
+
<path d="m16 3 4 4-4 4"/><path d="M20 7H4"/><path d="m8 21-4-4 4-4"/><path d="M4 17h16"/>
|
|
16
|
+
</svg>
|
|
17
|
+
</button>
|
|
18
|
+
<button type="button" class="acao acao--sem-cor" data-acao="sem-cor" part="acao acao-sem-cor" aria-label="Sem cor">
|
|
19
|
+
<svg viewBox="0 0 24 24" fill="none" stroke-width="2.4" stroke-linecap="round" aria-hidden="true">
|
|
20
|
+
<circle cx="12" cy="12" r="8" stroke="currentColor"/>
|
|
21
|
+
<line x1="6.5" y1="6.5" x2="17.5" y2="17.5" stroke="#ef4444"/>
|
|
22
|
+
</svg>
|
|
23
|
+
</button>
|
|
24
|
+
<button type="button" class="acao acao--padrao" data-acao="padrao" part="acao acao-padrao" aria-label="Restaurar cores padrão">
|
|
25
|
+
<span class="icone-padrao" aria-hidden="true">
|
|
26
|
+
<span class="ponto ponto--preenchimento"></span>
|
|
27
|
+
<span class="ponto ponto--traco"></span>
|
|
28
|
+
</span>
|
|
29
|
+
</button>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
`,this.renderizado=!0}vincularEventos(){const e=this.raiz;e.querySelectorAll("[data-alvo]").forEach(r=>{const o=r.dataset.alvo;this.listeners.add(r,"click",a=>{a.stopPropagation(),o!==this._alvo?this.mudarAlvo(o):this.seletorAberto?this.fecharSeletor(!0):this.abrirSeletor(o)}),this.listeners.add(r,"dblclick",a=>{a.stopPropagation(),this.abrirSeletor(o)}),this.listeners.add(r,"keydown",a=>{a.key!=="Enter"&&a.key!==" "||(a.preventDefault(),o===this._alvo&&this.seletorAberto?this.fecharSeletor(!0):this.abrirSeletor(o,!0))}),this.listeners.add(r,"keyup",a=>{a.key===" "&&a.preventDefault()})});const t=(r,o)=>{this.listeners.add(e.querySelector(`[data-acao="${r}"]`),"click",a=>{a.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,r=this.hasAttribute("desabilitado"),o=(i,n)=>n?"Misto (?) [várias cores na seleção]":i==="none"?"Sem cor":i,a=(i,n,c,y,A="")=>{const l=e.querySelector(`[data-alvo="${i}"]`),f=l==null?void 0:l.querySelector(".face");if(!l||!f)return;const _=this._alvo===i;l.classList.toggle("amostra--ativa",_),l.setAttribute("aria-pressed",String(_)),l.disabled=r,f.classList.toggle("face--misto",c),f.classList.toggle("face--sem-cor",!c&&n==="none");const k=i==="traco"?"borderColor":"backgroundColor";f.style[k]=c||n==="none"?"":n,i==="traco"&&n!=="none"&&!c&&(f.style.borderWidth=`${Math.max(2,Math.min(4.5,this._espessuraTraco))}px`);const x=`${y}: ${o(n,c)}${A}`;l.title=this.dica(`${x} — clique para ativar, clique de novo para editar`,t.alternar),l.setAttribute("aria-label",x)},d=this._preenchimento==="none"||this._misto.preenchimento?"":`, opacidade ${Math.round(this._opacidade*100)}%`;a("preenchimento",this._preenchimento,this._misto.preenchimento,"Preenchimento",d);const z=this._traco==="none"||this._misto.traco?"":`, espessura ${this._espessuraTraco}px`;a("traco",this._traco,this._misto.traco,"Traço / contorno",z);const m=(i,n)=>{const c=e.querySelector(`[data-acao="${i}"]`);c&&(c.title=n,c.disabled=r)};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));const b=e.querySelector(".ponto--preenchimento");b&&(b.style.backgroundColor=this._padrao.preenchimento==="none"?"transparent":this._padrao.preenchimento);const v=e.querySelector(".ponto--traco");v&&(v.style.borderColor=this._padrao.traco==="none"?"#ef4444":this._padrao.traco)}}g.definirCustomElement("ui-controle-cores",C);exports.UIControleCores=C;
|
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { d as
|
|
5
|
-
import { L as
|
|
6
|
-
import {
|
|
1
|
+
var k = Object.defineProperty;
|
|
2
|
+
var S = (d, l, e) => l in d ? k(d, l, { enumerable: !0, configurable: !0, writable: !0, value: e }) : d[l] = e;
|
|
3
|
+
var s = (d, l, e) => S(d, typeof l != "symbol" ? l + "" : l, e);
|
|
4
|
+
import { d as T, S as w } from "./ssr-safe-5cWfJP-s.js";
|
|
5
|
+
import { L as q } from "./listener-bag-DQgv7OON.js";
|
|
6
|
+
import { b as g, n as m, c as P, d as $, a as E } from "./ui-seletor-cor-D9iI7yew.js";
|
|
7
7
|
const j = ':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-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}}';
|
|
8
|
-
class
|
|
8
|
+
class M extends w {
|
|
9
9
|
constructor() {
|
|
10
10
|
super();
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
11
|
+
s(this, "raiz");
|
|
12
|
+
s(this, "listeners", new q());
|
|
13
|
+
s(this, "renderizado", !1);
|
|
14
|
+
s(this, "_preenchimento", "#00e08a");
|
|
15
|
+
s(this, "_traco", "#ffffff");
|
|
16
|
+
s(this, "_opacidade", 0.35);
|
|
17
|
+
s(this, "_espessuraTraco", 2.5);
|
|
18
|
+
s(this, "_alvo", "preenchimento");
|
|
19
|
+
s(this, "_misto", { preenchimento: !1, traco: !1 });
|
|
20
|
+
s(this, "_padrao", { preenchimento: "#00e08a", traco: "#ffffff" });
|
|
21
|
+
s(this, "_coresProjeto", []);
|
|
22
|
+
s(this, "_atalhos", {});
|
|
23
|
+
s(this, "seletor", null);
|
|
24
|
+
s(this, "estadoAoAbrir", null);
|
|
24
25
|
this.raiz = this.attachShadow({ mode: "open" });
|
|
25
26
|
}
|
|
26
27
|
static get observedAttributes() {
|
|
27
|
-
return ["preenchimento", "traco", "opacidade", "alvo", "padrao-preenchimento", "padrao-traco", "desabilitado"];
|
|
28
|
+
return ["preenchimento", "traco", "opacidade", "espessura-traco", "alvo", "padrao-preenchimento", "padrao-traco", "desabilitado"];
|
|
28
29
|
}
|
|
29
30
|
connectedCallback() {
|
|
30
31
|
this.renderizado || this.renderizar(), this.listeners.cleanup(), this.vincularEventos(), this.atualizar();
|
|
@@ -32,21 +33,22 @@ class E extends S {
|
|
|
32
33
|
disconnectedCallback() {
|
|
33
34
|
this.fecharSeletor(!0), this.listeners.cleanup();
|
|
34
35
|
}
|
|
35
|
-
attributeChangedCallback(e, t,
|
|
36
|
-
if (t !==
|
|
36
|
+
attributeChangedCallback(e, t, r) {
|
|
37
|
+
if (t !== r) {
|
|
37
38
|
if (e === "desabilitado") {
|
|
38
39
|
this.hasAttribute("desabilitado") && this.fecharSeletor(!1), this.atualizar();
|
|
39
40
|
return;
|
|
40
41
|
}
|
|
41
|
-
if (
|
|
42
|
-
if (e === "preenchimento") this.definirCores({ preenchimento:
|
|
43
|
-
else if (e === "traco") this.definirCores({ traco:
|
|
44
|
-
else if (e === "opacidade") this.definirCores({ opacidade: Number(
|
|
45
|
-
else if (e === "
|
|
42
|
+
if (r !== null) {
|
|
43
|
+
if (e === "preenchimento") this.definirCores({ preenchimento: r });
|
|
44
|
+
else if (e === "traco") this.definirCores({ traco: r });
|
|
45
|
+
else if (e === "opacidade") this.definirCores({ opacidade: Number(r) });
|
|
46
|
+
else if (e === "espessura-traco") this.definirCores({ espessuraTraco: g(r) });
|
|
47
|
+
else if (e === "alvo") this.definirAlvo(r);
|
|
46
48
|
else if (e === "padrao-preenchimento" || e === "padrao-traco") {
|
|
47
|
-
const
|
|
48
|
-
if (!
|
|
49
|
-
e === "padrao-preenchimento" ? this._padrao.preenchimento =
|
|
49
|
+
const a = m(r);
|
|
50
|
+
if (!a) return;
|
|
51
|
+
e === "padrao-preenchimento" ? this._padrao.preenchimento = a : this._padrao.traco = a, this.atualizar();
|
|
50
52
|
}
|
|
51
53
|
}
|
|
52
54
|
}
|
|
@@ -70,6 +72,12 @@ class E extends S {
|
|
|
70
72
|
set opacidade(e) {
|
|
71
73
|
this.definirCores({ opacidade: e });
|
|
72
74
|
}
|
|
75
|
+
get espessuraTraco() {
|
|
76
|
+
return this._espessuraTraco;
|
|
77
|
+
}
|
|
78
|
+
set espessuraTraco(e) {
|
|
79
|
+
this.definirCores({ espessuraTraco: e });
|
|
80
|
+
}
|
|
73
81
|
get alvo() {
|
|
74
82
|
return this._alvo;
|
|
75
83
|
}
|
|
@@ -81,7 +89,7 @@ class E extends S {
|
|
|
81
89
|
return [...this._coresProjeto];
|
|
82
90
|
}
|
|
83
91
|
set coresProjeto(e) {
|
|
84
|
-
this._coresProjeto =
|
|
92
|
+
this._coresProjeto = P(e);
|
|
85
93
|
}
|
|
86
94
|
/** Teclas exibidas nas dicas dos botões (ex.: `{ inverter: 'Shift+X' }`). */
|
|
87
95
|
get atalhos() {
|
|
@@ -95,13 +103,19 @@ class E extends S {
|
|
|
95
103
|
return !!((e = this.seletor) != null && e.aberto);
|
|
96
104
|
}
|
|
97
105
|
/* ---------- Métodos (sem eventos) ---------- */
|
|
98
|
-
/** Define cores e/ou
|
|
106
|
+
/** Define cores, opacidade e/ou espessura sem emitir eventos. Valores inválidos são ignorados; uma cor definida deixa de ser "mista". */
|
|
99
107
|
definirCores(e = {}) {
|
|
100
|
-
const t =
|
|
101
|
-
t && (this._preenchimento = t, this._misto.preenchimento = !1),
|
|
108
|
+
const t = m(e.preenchimento), r = m(e.traco);
|
|
109
|
+
t && (this._preenchimento = t, this._misto.preenchimento = !1), r && (this._traco = r, this._misto.traco = !1), e.opacidade !== void 0 && (this._opacidade = $(e.opacidade, this._opacidade)), e.espessuraTraco !== void 0 && (this._espessuraTraco = g(e.espessuraTraco, this._espessuraTraco)), this.atualizar();
|
|
102
110
|
}
|
|
103
111
|
obterCores() {
|
|
104
|
-
return {
|
|
112
|
+
return {
|
|
113
|
+
preenchimento: this._preenchimento,
|
|
114
|
+
traco: this._traco,
|
|
115
|
+
opacidade: this._opacidade,
|
|
116
|
+
espessuraTraco: this._espessuraTraco,
|
|
117
|
+
alvo: this._alvo
|
|
118
|
+
};
|
|
105
119
|
}
|
|
106
120
|
/** Marca a amostra como ativa sem emitir eventos. */
|
|
107
121
|
definirAlvo(e) {
|
|
@@ -133,26 +147,27 @@ class E extends S {
|
|
|
133
147
|
/** 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. */
|
|
134
148
|
abrirSeletor(e = this._alvo, t = !1) {
|
|
135
149
|
if (this.hasAttribute("desabilitado") || (this.mudarAlvo(e === "traco" ? "traco" : "preenchimento"), this.seletorAberto)) return;
|
|
136
|
-
const
|
|
137
|
-
this.estadoAoAbrir = this.obterCores(), this.seletor =
|
|
138
|
-
ancora:
|
|
150
|
+
const r = this.raiz.querySelector(`[data-alvo="${this._alvo}"]`) || this;
|
|
151
|
+
this.estadoAoAbrir = this.obterCores(), this.seletor = E({
|
|
152
|
+
ancora: r,
|
|
139
153
|
titulo: this.getAttribute("titulo-seletor") || "Cores e estilo",
|
|
140
154
|
modo: "duplo",
|
|
141
155
|
alvo: this._alvo,
|
|
142
156
|
preenchimento: this._preenchimento,
|
|
143
157
|
traco: this._traco,
|
|
144
158
|
opacidade: this._opacidade,
|
|
159
|
+
espessuraTraco: this._espessuraTraco,
|
|
145
160
|
misto: this._misto[this._alvo],
|
|
146
161
|
coresProjeto: this._coresProjeto,
|
|
147
162
|
focar: t,
|
|
148
|
-
aoAlterar: (
|
|
149
|
-
aoConfirmar: (
|
|
150
|
-
this.seletor = null, this.aplicarDoSeletor(
|
|
163
|
+
aoAlterar: (a) => this.aplicarDoSeletor(a, !1),
|
|
164
|
+
aoConfirmar: (a) => {
|
|
165
|
+
this.seletor = null, this.aplicarDoSeletor(a, !0);
|
|
151
166
|
},
|
|
152
167
|
aoCancelar: () => {
|
|
153
168
|
this.seletor = null, this.estadoAoAbrir = null;
|
|
154
169
|
},
|
|
155
|
-
aoTrocarAlvo: (
|
|
170
|
+
aoTrocarAlvo: (a) => this.mudarAlvo(a)
|
|
156
171
|
});
|
|
157
172
|
}
|
|
158
173
|
/**
|
|
@@ -173,19 +188,19 @@ class E extends S {
|
|
|
173
188
|
(t = (e = this.seletor) == null ? void 0 : e.elemento) == null || t.trocarAlvo(this._alvo);
|
|
174
189
|
}
|
|
175
190
|
aplicarDoSeletor(e, t) {
|
|
176
|
-
const
|
|
191
|
+
const r = (o) => {
|
|
177
192
|
const p = [];
|
|
178
|
-
return e.preenchimento !==
|
|
179
|
-
},
|
|
180
|
-
if (this._preenchimento = e.preenchimento, this._traco = e.traco, this._opacidade = e.opacidade,
|
|
181
|
-
|
|
193
|
+
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;
|
|
194
|
+
}, a = r(this.obterCores());
|
|
195
|
+
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) {
|
|
196
|
+
a.length && this.emitirCores(!1, a, "seletor");
|
|
182
197
|
return;
|
|
183
198
|
}
|
|
184
|
-
this.emitirCores(!0, this.estadoAoAbrir ?
|
|
199
|
+
this.emitirCores(!0, this.estadoAoAbrir ? r(this.estadoAoAbrir) : a, "seletor"), this.estadoAoAbrir = null;
|
|
185
200
|
}
|
|
186
|
-
emitirCores(e, t,
|
|
187
|
-
const
|
|
188
|
-
this.dispatchEvent(new CustomEvent("ui-cores-change", { detail:
|
|
201
|
+
emitirCores(e, t, r) {
|
|
202
|
+
const a = { ...this.obterCores(), confirmado: e, alterados: t, origem: r };
|
|
203
|
+
this.dispatchEvent(new CustomEvent("ui-cores-change", { detail: a, bubbles: !0, composed: !0 }));
|
|
189
204
|
}
|
|
190
205
|
dica(e, t) {
|
|
191
206
|
return t ? `${e} [${t}]` : e;
|
|
@@ -226,50 +241,52 @@ class E extends S {
|
|
|
226
241
|
}
|
|
227
242
|
vincularEventos() {
|
|
228
243
|
const e = this.raiz;
|
|
229
|
-
e.querySelectorAll("[data-alvo]").forEach((
|
|
230
|
-
const
|
|
231
|
-
this.listeners.add(
|
|
232
|
-
|
|
233
|
-
}), this.listeners.add(
|
|
234
|
-
|
|
235
|
-
}), this.listeners.add(
|
|
236
|
-
|
|
237
|
-
}), this.listeners.add(
|
|
238
|
-
|
|
244
|
+
e.querySelectorAll("[data-alvo]").forEach((r) => {
|
|
245
|
+
const a = r.dataset.alvo;
|
|
246
|
+
this.listeners.add(r, "click", (o) => {
|
|
247
|
+
o.stopPropagation(), a !== this._alvo ? this.mudarAlvo(a) : this.seletorAberto ? this.fecharSeletor(!0) : this.abrirSeletor(a);
|
|
248
|
+
}), this.listeners.add(r, "dblclick", (o) => {
|
|
249
|
+
o.stopPropagation(), this.abrirSeletor(a);
|
|
250
|
+
}), this.listeners.add(r, "keydown", (o) => {
|
|
251
|
+
o.key !== "Enter" && o.key !== " " || (o.preventDefault(), a === this._alvo && this.seletorAberto ? this.fecharSeletor(!0) : this.abrirSeletor(a, !0));
|
|
252
|
+
}), this.listeners.add(r, "keyup", (o) => {
|
|
253
|
+
o.key === " " && o.preventDefault();
|
|
239
254
|
});
|
|
240
255
|
});
|
|
241
|
-
const t = (
|
|
242
|
-
this.listeners.add(e.querySelector(`[data-acao="${
|
|
243
|
-
|
|
256
|
+
const t = (r, a) => {
|
|
257
|
+
this.listeners.add(e.querySelector(`[data-acao="${r}"]`), "click", (o) => {
|
|
258
|
+
o.stopPropagation(), a();
|
|
244
259
|
});
|
|
245
260
|
};
|
|
246
261
|
t("inverter", () => this.inverter()), t("sem-cor", () => this.semCor()), t("padrao", () => this.restaurarPadrao());
|
|
247
262
|
}
|
|
248
263
|
atualizar() {
|
|
249
264
|
if (!this.renderizado) return;
|
|
250
|
-
const e = this.raiz, t = this._atalhos,
|
|
251
|
-
const
|
|
252
|
-
if (!
|
|
253
|
-
const _ = this._alvo ===
|
|
254
|
-
|
|
255
|
-
const
|
|
256
|
-
u.style[
|
|
257
|
-
const x = `${
|
|
258
|
-
|
|
265
|
+
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, y, z = "") => {
|
|
266
|
+
const h = e.querySelector(`[data-alvo="${i}"]`), u = h == null ? void 0 : h.querySelector(".face");
|
|
267
|
+
if (!h || !u) return;
|
|
268
|
+
const _ = this._alvo === i;
|
|
269
|
+
h.classList.toggle("amostra--ativa", _), h.setAttribute("aria-pressed", String(_)), h.disabled = r, u.classList.toggle("face--misto", c), u.classList.toggle("face--sem-cor", !c && n === "none");
|
|
270
|
+
const A = i === "traco" ? "borderColor" : "backgroundColor";
|
|
271
|
+
u.style[A] = c || n === "none" ? "" : n, i === "traco" && n !== "none" && !c && (u.style.borderWidth = `${Math.max(2, Math.min(4.5, this._espessuraTraco))}px`);
|
|
272
|
+
const x = `${y}: ${a(n, c)}${z}`;
|
|
273
|
+
h.title = this.dica(`${x} — clique para ativar, clique de novo para editar`, t.alternar), h.setAttribute("aria-label", x);
|
|
259
274
|
}, p = this._preenchimento === "none" || this._misto.preenchimento ? "" : `, opacidade ${Math.round(this._opacidade * 100)}%`;
|
|
260
|
-
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
|
|
275
|
+
o("preenchimento", this._preenchimento, this._misto.preenchimento, "Preenchimento", p);
|
|
276
|
+
const C = this._traco === "none" || this._misto.traco ? "" : `, espessura ${this._espessuraTraco}px`;
|
|
277
|
+
o("traco", this._traco, this._misto.traco, "Traço / contorno", C);
|
|
278
|
+
const f = (i, n) => {
|
|
279
|
+
const c = e.querySelector(`[data-acao="${i}"]`);
|
|
280
|
+
c && (c.title = n, c.disabled = r);
|
|
264
281
|
};
|
|
265
|
-
|
|
282
|
+
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));
|
|
266
283
|
const b = e.querySelector(".ponto--preenchimento");
|
|
267
284
|
b && (b.style.backgroundColor = this._padrao.preenchimento === "none" ? "transparent" : this._padrao.preenchimento);
|
|
268
285
|
const v = e.querySelector(".ponto--traco");
|
|
269
286
|
v && (v.style.borderColor = this._padrao.traco === "none" ? "#ef4444" : this._padrao.traco);
|
|
270
287
|
}
|
|
271
288
|
}
|
|
272
|
-
|
|
289
|
+
T("ui-controle-cores", M);
|
|
273
290
|
export {
|
|
274
|
-
|
|
291
|
+
M as U
|
|
275
292
|
};
|