@thibezer/ui-components-kit 2.24.0 → 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.
- package/CHANGELOG.md +69 -1
- package/dist/botao.cjs +12 -1
- package/dist/botao.js +162 -3
- package/dist/camadas.cjs +311 -1
- package/dist/camadas.js +3244 -148
- package/dist/campo-texto.cjs +16 -1
- package/dist/campo-texto.js +308 -7
- package/dist/canvas.cjs +22 -22
- package/dist/canvas.js +230 -233
- package/dist/card.cjs +20 -1
- package/dist/card.js +145 -2
- package/dist/components/ui-canvas-prancha/index.d.ts +1 -1
- package/dist/components/ui-canvas-prancha/prancha-teclado.d.ts +18 -0
- package/dist/components/ui-canvas-prancha/ui-canvas-prancha-base.d.ts +4 -0
- package/dist/components/ui-card/ui-card.d.ts +4 -0
- package/dist/components/ui-editor-prancha/editor-modos.d.ts +10 -0
- package/dist/components/ui-editor-prancha/editor-tipos.d.ts +4 -0
- package/dist/components/ui-editor-prancha/index.d.ts +1 -0
- package/dist/components/ui-editor-prancha/ui-editor-prancha.d.ts +39 -6
- package/dist/core.cjs +1 -1
- package/dist/core.js +44 -55
- package/dist/{cores-utils-BrdynxRd.js → cores-utils-DMyqWvZh.js} +2 -2
- package/dist/cores.cjs +32 -1
- package/dist/cores.js +300 -13
- package/dist/custom-elements.json +33962 -33439
- package/dist/data.cjs +28 -1
- package/dist/data.js +286 -99
- package/dist/{feature_caixa-2Sxv3tGa.js → feature_caixa-BVc5LenS.js} +42 -42
- package/dist/{feature_desenho-BVHivWIB.js → feature_desenho-CC8Mp5Gp.js} +2 -2
- package/dist/feedback.cjs +52 -1
- package/dist/feedback.js +655 -25
- package/dist/forms.cjs +66 -1
- package/dist/forms.js +1216 -39
- package/dist/{geometria-px-DUs5FgLE.js → geometria-px-DHMPUsxC.js} +47 -47
- package/dist/index.cjs +67 -1
- package/dist/index.js +1476 -274
- package/dist/kit-base-CGqj9aiD.cjs +2 -0
- package/dist/kit-base-_THn4w3u.js +1079 -0
- package/dist/mapa.cjs +5 -5
- package/dist/mapa.js +16 -17
- package/dist/modal.cjs +18 -1
- package/dist/modal.js +235 -29
- package/dist/motor.js +49 -49
- package/dist/prancha-nucleo.cjs +3 -1
- package/dist/prancha-nucleo.js +3120 -277
- package/dist/prancha.cjs +38 -1
- package/dist/prancha.js +3233 -228
- package/dist/register.cjs +1 -1
- package/dist/register.js +3 -20
- package/dist/seletor-mapa-base.cjs +13 -13
- package/dist/seletor-mapa-base.js +3 -5
- package/dist/tabela.cjs +142 -1
- package/dist/tabela.js +3773 -92
- package/dist/tipos-elementos.d.ts +5 -1
- package/dist/tipos-vue.d.ts +4 -1
- package/dist/tools.cjs +16 -1
- package/dist/tools.js +1564 -26
- package/dist/ui-seletor-cor-BGw8SBPm.cjs +83 -0
- package/dist/{ui-seletor-cor-Cd8jkzXG.js → ui-seletor-cor-B_twSm-V.js} +8 -9
- package/dist/utils-ClVgqVyJ.cjs +1 -0
- package/dist/utils-DrHoxxmf.js +83 -0
- package/package.json +43 -2
- package/dist/acessibilidade-CSzX-DkG.cjs +0 -1
- package/dist/acessibilidade-CUlSXc2X.js +0 -38
- package/dist/altura-controle-ukMRPckR.cjs +0 -1
- package/dist/altura-controle-vxQiXG4q.js +0 -62
- package/dist/alvo-digitavel-CzCvNVQ3.js +0 -23
- package/dist/alvo-digitavel-DbH0hYFf.cjs +0 -1
- package/dist/degrade-CIxvOTUv.cjs +0 -1
- package/dist/degrade-gDa5sW__.js +0 -119
- package/dist/feature_caixa-CnYPKVFS.cjs +0 -1
- package/dist/feature_caixa-DCs9ZeSk.js +0 -1038
- package/dist/feature_historico-BAIYk1Me.cjs +0 -3
- package/dist/feature_historico-C4h9y5fu.js +0 -3039
- package/dist/form-atalhos-7JTYvumA.cjs +0 -1
- package/dist/form-atalhos-DDTlpgaB.js +0 -203
- package/dist/form-erros-CwPz7Jr4.cjs +0 -1
- package/dist/form-erros-DT5HklfD.js +0 -184
- package/dist/form-submissao-C-SPRKgT.js +0 -61
- package/dist/form-submissao-DxKO5MHI.cjs +0 -1
- package/dist/form-validacao-BlQFxUVj.js +0 -104
- package/dist/form-validacao-DIeyQVH5.cjs +0 -1
- package/dist/geometria-px-DKrWq_XY.js +0 -639
- package/dist/leaflet-CEPcxGWV.cjs +0 -1
- package/dist/leaflet-DOq10gfg.js +0 -84
- package/dist/leaflet-loader-94z5VsdY.cjs +0 -2
- package/dist/leaflet-loader-Cjcdgj5R.js +0 -21
- package/dist/listener-bag-D5omxZ9h.cjs +0 -1
- package/dist/listener-bag-DQgv7OON.js +0 -34
- package/dist/motor-By2te6PZ.js +0 -1400
- package/dist/motor-CkMxd378.cjs +0 -1
- package/dist/opcoes-CupvWVIm.js +0 -24
- package/dist/opcoes-vdAUY5OI.cjs +0 -1
- package/dist/parts-CaoQiCfI.js +0 -7
- package/dist/parts-vQa2873h.cjs +0 -1
- package/dist/prancha-paleta-BZ-9QDgh.js +0 -5276
- package/dist/prancha-paleta-Bb24vP71.cjs +0 -17
- package/dist/ssr-safe-5cWfJP-s.js +0 -10
- package/dist/ssr-safe-CiHD1adl.cjs +0 -1
- package/dist/svg-seguro-ChVJ2L2z.js +0 -74
- package/dist/svg-seguro-J2RM1Ssf.cjs +0 -1
- package/dist/ui-badge-DE58YSBY.cjs +0 -28
- package/dist/ui-badge-KgmI3jOD.js +0 -201
- package/dist/ui-botao-Dz8YvmiA.cjs +0 -12
- package/dist/ui-botao-zLkcMMyP.js +0 -168
- package/dist/ui-bus-CUd99VJi.js +0 -177
- package/dist/ui-bus-XqBLlTYQ.cjs +0 -1
- package/dist/ui-camadas-DoHPnbQm.js +0 -3133
- package/dist/ui-camadas-Vx7wYD4D.cjs +0 -311
- package/dist/ui-campo-texto-Dliyt9qr.cjs +0 -16
- package/dist/ui-campo-texto-btevggO3.js +0 -379
- package/dist/ui-card-7IEYbCN0.js +0 -150
- package/dist/ui-card-Bx8EyzYY.cjs +0 -20
- package/dist/ui-card-DFnRp9bl.js +0 -146
- package/dist/ui-card-DrWVJQKw.cjs +0 -20
- package/dist/ui-controle-cores-B1w_Yl69.cjs +0 -32
- package/dist/ui-controle-cores-BRjMvmMn.js +0 -291
- package/dist/ui-controle-cores-BcH9k2Fa.js +0 -292
- package/dist/ui-controle-cores-CvSTP6gJ.cjs +0 -32
- package/dist/ui-editor-prancha-CIngI6yI.js +0 -2886
- package/dist/ui-editor-prancha-DorSe6sC.cjs +0 -31
- package/dist/ui-linha-2kY7TNUJ.cjs +0 -38
- package/dist/ui-linha-B4mBRm1x.cjs +0 -61
- package/dist/ui-linha-DTEIIww4.js +0 -1167
- package/dist/ui-linha-KFF86FW5.js +0 -752
- package/dist/ui-modal-BrXzVZ65.js +0 -216
- package/dist/ui-modal-lARKzEVZ.cjs +0 -18
- package/dist/ui-paleta-ferramentas-Bu6JaT0s.js +0 -1245
- package/dist/ui-paleta-ferramentas-D3Jhwt26.cjs +0 -21
- package/dist/ui-paleta-ferramentas-DebHYiwd.js +0 -1615
- package/dist/ui-paleta-ferramentas-Dgejtluh.js +0 -1423
- package/dist/ui-paleta-ferramentas-hzyo8wBt.cjs +0 -22
- package/dist/ui-paleta-ferramentas-jWuICjW8.cjs +0 -22
- package/dist/ui-seletor-cor-0RLjcME6.cjs +0 -83
- package/dist/ui-seletor-cor-CMuuW-Ym.cjs +0 -83
- package/dist/ui-seletor-cor-DFIQ1sin.js +0 -405
- package/dist/ui-skeleton-BLEV6h3k.js +0 -653
- package/dist/ui-skeleton-B_XTaGrX.cjs +0 -52
- package/dist/ui-switch-BXIDwC-Y.cjs +0 -66
- package/dist/ui-switch-Ctxk-jKS.js +0 -1212
- package/dist/ui-tabela-CXxqbwXv.cjs +0 -7
- package/dist/ui-tabela-Cd0vOwnT.js +0 -1459
- package/dist/ui-tabela-propriedades-C5cIF5ES.js +0 -3779
- package/dist/ui-tabela-propriedades-CJyo568n.js +0 -3517
- package/dist/ui-tabela-propriedades-D96Djx-q.cjs +0 -136
- package/dist/ui-tabela-propriedades-Wa34hfIr.cjs +0 -142
- package/dist/ui-tabela-propriedades-ahQhQauu.js +0 -2329
- package/dist/ui-tabela-propriedades-w9JWhjHy.cjs +0 -142
- package/dist/zero-js-triggers-CJT988bR.js +0 -83
- package/dist/zero-js-triggers-CgM9IIQB.cjs +0 -1
package/dist/cores.js
CHANGED
|
@@ -1,16 +1,303 @@
|
|
|
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
4
|
/* empty css */
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
+
import { b as g, n as m, c as T, a as w } from "./cores-utils-DMyqWvZh.js";
|
|
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-_THn4w3u.js";
|
|
8
|
+
import { a as E } from "./ui-seletor-cor-B_twSm-V.js";
|
|
9
|
+
import { U as F, f as G } from "./ui-seletor-cor-B_twSm-V.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 {
|
|
12
|
+
constructor() {
|
|
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);
|
|
28
|
+
this.raiz = this.attachShadow({ mode: "open" });
|
|
29
|
+
}
|
|
30
|
+
static get observedAttributes() {
|
|
31
|
+
return ["preenchimento", "traco", "opacidade", "espessura-traco", "alvo", "padrao-preenchimento", "padrao-traco", "desabilitado"];
|
|
32
|
+
}
|
|
33
|
+
connectedCallback() {
|
|
34
|
+
this.renderizado || this.renderizar(), this.listeners.cleanup(), this.vincularEventos(), this.atualizar();
|
|
35
|
+
}
|
|
36
|
+
disconnectedCallback() {
|
|
37
|
+
this.fecharSeletor(!0), this.listeners.cleanup();
|
|
38
|
+
}
|
|
39
|
+
attributeChangedCallback(e, t, r) {
|
|
40
|
+
if (t !== r) {
|
|
41
|
+
if (e === "desabilitado") {
|
|
42
|
+
this.hasAttribute("desabilitado") && this.fecharSeletor(!1), this.atualizar();
|
|
43
|
+
return;
|
|
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);
|
|
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();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/* ---------- Propriedades ---------- */
|
|
60
|
+
get preenchimento() {
|
|
61
|
+
return this._preenchimento;
|
|
62
|
+
}
|
|
63
|
+
set preenchimento(e) {
|
|
64
|
+
this.definirCores({ preenchimento: e });
|
|
65
|
+
}
|
|
66
|
+
get traco() {
|
|
67
|
+
return this._traco;
|
|
68
|
+
}
|
|
69
|
+
set traco(e) {
|
|
70
|
+
this.definirCores({ traco: e });
|
|
71
|
+
}
|
|
72
|
+
get opacidade() {
|
|
73
|
+
return this._opacidade;
|
|
74
|
+
}
|
|
75
|
+
set opacidade(e) {
|
|
76
|
+
this.definirCores({ opacidade: e });
|
|
77
|
+
}
|
|
78
|
+
get espessuraTraco() {
|
|
79
|
+
return this._espessuraTraco;
|
|
80
|
+
}
|
|
81
|
+
set espessuraTraco(e) {
|
|
82
|
+
this.definirCores({ espessuraTraco: e });
|
|
83
|
+
}
|
|
84
|
+
get alvo() {
|
|
85
|
+
return this._alvo;
|
|
86
|
+
}
|
|
87
|
+
set alvo(e) {
|
|
88
|
+
this.definirAlvo(e);
|
|
89
|
+
}
|
|
90
|
+
/** @deprecated Ignorado: o seletor de cor não mostra mais amostras de cores. */
|
|
91
|
+
get coresProjeto() {
|
|
92
|
+
return [...this._coresProjeto];
|
|
93
|
+
}
|
|
94
|
+
set coresProjeto(e) {
|
|
95
|
+
this._coresProjeto = T(e);
|
|
96
|
+
}
|
|
97
|
+
/** Teclas exibidas nas dicas dos botões (ex.: `{ inverter: 'Shift+X' }`). */
|
|
98
|
+
get atalhos() {
|
|
99
|
+
return { ...this._atalhos };
|
|
100
|
+
}
|
|
101
|
+
set atalhos(e) {
|
|
102
|
+
this._atalhos = { ...e || {} }, this.atualizar();
|
|
103
|
+
}
|
|
104
|
+
get seletorAberto() {
|
|
105
|
+
var e;
|
|
106
|
+
return !!((e = this.seletor) != null && e.aberto);
|
|
107
|
+
}
|
|
108
|
+
/* ---------- Métodos (sem eventos) ---------- */
|
|
109
|
+
/** Define cores, opacidade e/ou espessura sem emitir eventos. Valores inválidos são ignorados; uma cor definida deixa de ser "mista". */
|
|
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();
|
|
113
|
+
}
|
|
114
|
+
obterCores() {
|
|
115
|
+
return {
|
|
116
|
+
preenchimento: this._preenchimento,
|
|
117
|
+
traco: this._traco,
|
|
118
|
+
opacidade: this._opacidade,
|
|
119
|
+
espessuraTraco: this._espessuraTraco,
|
|
120
|
+
alvo: this._alvo
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/** Marca a amostra como ativa sem emitir eventos. */
|
|
124
|
+
definirAlvo(e) {
|
|
125
|
+
this._alvo = e === "traco" ? "traco" : "preenchimento", this.atualizar(), this.sincronizarSeletor();
|
|
126
|
+
}
|
|
127
|
+
/** Mostra "?" nas amostras cujas cores divergem na seleção atual. */
|
|
128
|
+
definirMisto(e = {}) {
|
|
129
|
+
this._misto = { preenchimento: !!e.preenchimento, traco: !!e.traco }, this.atualizar();
|
|
130
|
+
}
|
|
131
|
+
/* ---------- Ações (emitem eventos) ---------- */
|
|
132
|
+
/** Alterna o alvo ativo entre preenchimento e traço; emite `ui-alvo-change`. */
|
|
133
|
+
alternarAlvo() {
|
|
134
|
+
this.mudarAlvo(this._alvo === "traco" ? "preenchimento" : "traco");
|
|
135
|
+
}
|
|
136
|
+
/** Troca preenchimento e traço; emite `ui-cores-change` confirmado. */
|
|
137
|
+
inverter() {
|
|
138
|
+
const e = this._preenchimento;
|
|
139
|
+
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");
|
|
140
|
+
}
|
|
141
|
+
/** "Sem cor" no alvo indicado (padrão: o ativo); emite `ui-cores-change` confirmado. */
|
|
142
|
+
semCor(e = this._alvo) {
|
|
143
|
+
const t = e === "traco" ? "traco" : "preenchimento";
|
|
144
|
+
t === "traco" ? this._traco = "none" : this._preenchimento = "none", this._misto[t] = !1, this.atualizar(), this.emitirCores(!0, [t], "sem-cor");
|
|
145
|
+
}
|
|
146
|
+
/** Volta às cores de `padrao-preenchimento` e `padrao-traco`; emite `ui-cores-change` confirmado. */
|
|
147
|
+
restaurarPadrao() {
|
|
148
|
+
this._preenchimento = this._padrao.preenchimento, this._traco = this._padrao.traco, this._misto = { preenchimento: !1, traco: !1 }, this.atualizar(), this.emitirCores(!0, ["preenchimento", "traco"], "padrao");
|
|
149
|
+
}
|
|
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
|
+
abrirSeletor(e = this._alvo, t = !1) {
|
|
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;
|
|
154
|
+
this.estadoAoAbrir = this.obterCores(), this.seletor = E({
|
|
155
|
+
ancora: r,
|
|
156
|
+
titulo: this.getAttribute("titulo-seletor") || "Cores e estilo",
|
|
157
|
+
modo: "duplo",
|
|
158
|
+
alvo: this._alvo,
|
|
159
|
+
preenchimento: this._preenchimento,
|
|
160
|
+
traco: this._traco,
|
|
161
|
+
opacidade: this._opacidade,
|
|
162
|
+
espessuraTraco: this._espessuraTraco,
|
|
163
|
+
misto: this._misto[this._alvo],
|
|
164
|
+
focar: t,
|
|
165
|
+
aoAlterar: (a) => this.aplicarDoSeletor(a, !1),
|
|
166
|
+
aoConfirmar: (a) => {
|
|
167
|
+
this.seletor = null, this.aplicarDoSeletor(a, !0);
|
|
168
|
+
},
|
|
169
|
+
aoCancelar: () => {
|
|
170
|
+
this.seletor = null, this.estadoAoAbrir = null;
|
|
171
|
+
},
|
|
172
|
+
aoTrocarAlvo: (a) => this.mudarAlvo(a)
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Fecha o seletor aberto por este controle. Com `confirmar` (padrão), grava o que foi editado;
|
|
177
|
+
* sem ele, cancela: as cores iniciais voltam (com um `ui-cores-change` não confirmado) e nada é confirmado.
|
|
178
|
+
*/
|
|
179
|
+
fecharSeletor(e = !0) {
|
|
180
|
+
const t = this.seletor;
|
|
181
|
+
t && (e ? t.fechar(!0) : t.elemento.cancelar());
|
|
182
|
+
}
|
|
183
|
+
/* ---------- Interno ---------- */
|
|
184
|
+
mudarAlvo(e) {
|
|
185
|
+
e !== this._alvo && (this._alvo = e, this.atualizar(), this.sincronizarSeletor(), this.dispatchEvent(new CustomEvent("ui-alvo-change", { detail: { alvo: e }, bubbles: !0, composed: !0 })));
|
|
186
|
+
}
|
|
187
|
+
/** Mantém a aba do seletor aberto igual ao alvo do controle. */
|
|
188
|
+
sincronizarSeletor() {
|
|
189
|
+
var e, t;
|
|
190
|
+
(t = (e = this.seletor) == null ? void 0 : e.elemento) == null || t.trocarAlvo(this._alvo);
|
|
191
|
+
}
|
|
192
|
+
aplicarDoSeletor(e, t) {
|
|
193
|
+
const r = (o) => {
|
|
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");
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
this.emitirCores(!0, this.estadoAoAbrir ? r(this.estadoAoAbrir) : a, "seletor"), this.estadoAoAbrir = null;
|
|
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 }));
|
|
206
|
+
}
|
|
207
|
+
dica(e, t) {
|
|
208
|
+
return t ? `${e} [${t}]` : e;
|
|
209
|
+
}
|
|
210
|
+
renderizar() {
|
|
211
|
+
this.raiz.innerHTML = `
|
|
212
|
+
<style>${M}</style>
|
|
213
|
+
<div class="pilha" part="pilha" role="group" aria-label="Cores de desenho">
|
|
214
|
+
<div class="amostras" part="amostras">
|
|
215
|
+
<button type="button" class="amostra amostra--traco" data-alvo="traco" part="amostra amostra-traco">
|
|
216
|
+
<span class="face face--traco"></span>
|
|
217
|
+
</button>
|
|
218
|
+
<button type="button" class="amostra amostra--preenchimento" data-alvo="preenchimento" part="amostra amostra-preenchimento">
|
|
219
|
+
<span class="face face--preenchimento"></span>
|
|
220
|
+
</button>
|
|
221
|
+
</div>
|
|
222
|
+
<div class="acoes" part="acoes">
|
|
223
|
+
<button type="button" class="acao acao--inverter" data-acao="inverter" part="acao acao-inverter" aria-label="Inverter preenchimento e traço">
|
|
224
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
225
|
+
<path d="m16 3 4 4-4 4"/><path d="M20 7H4"/><path d="m8 21-4-4 4-4"/><path d="M4 17h16"/>
|
|
226
|
+
</svg>
|
|
227
|
+
</button>
|
|
228
|
+
<button type="button" class="acao acao--sem-cor" data-acao="sem-cor" part="acao acao-sem-cor" aria-label="Sem cor">
|
|
229
|
+
<svg viewBox="0 0 24 24" fill="none" stroke-width="2.4" stroke-linecap="round" aria-hidden="true">
|
|
230
|
+
<circle cx="12" cy="12" r="8" stroke="currentColor"/>
|
|
231
|
+
<line x1="6.5" y1="6.5" x2="17.5" y2="17.5" stroke="#ef4444"/>
|
|
232
|
+
</svg>
|
|
233
|
+
</button>
|
|
234
|
+
<button type="button" class="acao acao--padrao" data-acao="padrao" part="acao acao-padrao" aria-label="Restaurar cores padrão">
|
|
235
|
+
<span class="icone-padrao" aria-hidden="true">
|
|
236
|
+
<span class="ponto ponto--preenchimento"></span>
|
|
237
|
+
<span class="ponto ponto--traco"></span>
|
|
238
|
+
</span>
|
|
239
|
+
</button>
|
|
240
|
+
</div>
|
|
241
|
+
</div>
|
|
242
|
+
`, this.renderizado = !0;
|
|
243
|
+
}
|
|
244
|
+
vincularEventos() {
|
|
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();
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
const t = (r, a) => {
|
|
259
|
+
this.listeners.add(e.querySelector(`[data-acao="${r}"]`), "click", (o) => {
|
|
260
|
+
o.stopPropagation(), a();
|
|
261
|
+
});
|
|
262
|
+
};
|
|
263
|
+
t("inverter", () => this.inverter()), t("sem-cor", () => this.semCor()), t("padrao", () => this.restaurarPadrao());
|
|
264
|
+
}
|
|
265
|
+
atualizar() {
|
|
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");
|
|
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}`;
|
|
275
|
+
l.title = this.dica(`${x} — clique para ativar, clique de novo para editar`, t.alternar), l.setAttribute("aria-label", x);
|
|
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);
|
|
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));
|
|
285
|
+
const b = e.querySelector(".ponto--preenchimento");
|
|
286
|
+
b && (b.style.backgroundColor = this._padrao.preenchimento === "none" ? "transparent" : this._padrao.preenchimento);
|
|
287
|
+
const v = e.querySelector(".ponto--traco");
|
|
288
|
+
v && (v.style.borderColor = this._padrao.traco === "none" ? "#ef4444" : this._padrao.traco);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
$("ui-controle-cores", j);
|
|
5
292
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
293
|
+
O as PALETA_CORES_PADRAO,
|
|
294
|
+
j as UIControleCores,
|
|
295
|
+
F as UISeletorCor,
|
|
296
|
+
E as abrirSeletorCor,
|
|
297
|
+
T as coresUnicas,
|
|
298
|
+
N as escaparHtml,
|
|
299
|
+
G as fecharSeletorCor,
|
|
300
|
+
m as normalizarCor,
|
|
301
|
+
g as normalizarEspessura,
|
|
302
|
+
w as normalizarOpacidade
|
|
16
303
|
};
|