@thibezer/ui-components-kit 2.12.2 → 2.12.4
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 +639 -584
- package/README.md +1 -1
- package/dist/camadas.cjs +60 -60
- package/dist/camadas.js +676 -579
- package/dist/canvas.cjs +20 -20
- package/dist/canvas.js +950 -940
- package/dist/components/ui-camadas/camadas-drag-drop.d.ts +2 -0
- package/dist/components/ui-camadas/camadas-hierarquia.d.ts +10 -0
- package/dist/components/ui-camadas/camadas-persistencia.d.ts +6 -1
- package/dist/components/ui-camadas/camadas-sincronizacao-dom.d.ts +5 -0
- package/dist/components/ui-cores/ui-seletor-cor.d.ts +2 -0
- package/dist/components/ui-tabela-propriedades/editores-basicos.d.ts +6 -0
- package/dist/components/ui-tabela-propriedades/propriedades-gerenciador-valores.d.ts +5 -2
- package/dist/components/ui-tabela-propriedades/propriedades-render-arvore.d.ts +2 -0
- package/dist/components/ui-tabela-propriedades/tipos.d.ts +6 -0
- package/dist/components/ui-tabela-propriedades/ui-tabela-propriedades.d.ts +6 -1
- package/dist/cores.cjs +1 -1
- package/dist/cores.js +2 -2
- package/dist/custom-elements.json +5072 -4890
- package/dist/data.cjs +1 -1
- package/dist/data.js +39 -38
- package/dist/gerencigeo-canvas/layer_pane_ops.d.ts +0 -6
- package/dist/gerencigeo-canvas/mapa_core.d.ts +1 -0
- package/dist/gerencigeo-canvas/renderers/tile_renderer.d.ts +2 -1
- package/dist/gerencigeo-canvas/renderers/wms_renderer.d.ts +2 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +100 -98
- package/dist/register.cjs +1 -1
- package/dist/register.js +3 -3
- package/dist/tabela.cjs +1 -1
- package/dist/tabela.js +31 -30
- package/dist/tipos-elementos.d.ts +3 -3
- package/dist/tipos-vue.d.ts +3 -3
- package/dist/ui-controle-cores-C_cVXxCn.js +291 -0
- package/dist/ui-controle-cores-CuDFS8Y8.cjs +32 -0
- package/dist/ui-seletor-cor-DPKqf5wb.cjs +82 -0
- package/dist/ui-seletor-cor-FYtRccnK.js +396 -0
- package/dist/ui-tabela-propriedades-C5YYnod1.js +3053 -0
- package/dist/ui-tabela-propriedades-DWOKznMN.cjs +142 -0
- package/package.json +187 -187
package/dist/tabela.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* empty css */
|
|
2
|
-
import { G as o, T as i, a as s, b as t, c as n, U as l, d as c, e as d, f as m, V as u, g as p, h as C, i as T, j as E, k as b, l as P, m as g, n as x, o as z, p as I, q as A, r as O, s as R, t as S, u as D, v as M, w as h, x as L, y as V, z as f, A as v, B as q, C as
|
|
2
|
+
import { G as o, T as i, a as s, b as t, c as n, U as l, d as c, e as d, f as m, V as u, g as p, h as C, i as T, j as E, k as b, l as P, m as g, n as x, o as z, p as I, q as A, r as O, s as R, t as S, u as D, v as M, w as h, x as L, y as V, z as f, A as v, B as q, C as N, D as U, E as w, F as H, H as _, I as y, J as F, K as j, L as k, M as B, N as G, O as W, P as X, Q as J, R as K, S as Q, W as Y, X as Z, Y as $, Z as aa, _ as ra, $ as ea, a0 as oa, a1 as ia, a2 as sa, a3 as ta, a4 as na, a5 as la, a6 as ca, a7 as da, a8 as ma, a9 as ua, aa as pa, ab as Ca, ac as Ta, ad as Ea, ae as ba, af as Pa, ag as ga, ah as xa, ai as za, aj as Ia, ak as Aa, al as Oa, am as Ra } from "./ui-tabela-propriedades-C5YYnod1.js";
|
|
3
3
|
export {
|
|
4
4
|
o as GerenciadorValoresPropriedades,
|
|
5
5
|
i as TEXTO_MISTO_PADRAO,
|
|
@@ -33,10 +33,10 @@ export {
|
|
|
33
33
|
f as criarEditorLineweight,
|
|
34
34
|
v as criarEditorNumero,
|
|
35
35
|
q as criarEditorReadonly,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
N as criarEditorSelecao,
|
|
37
|
+
U as criarEditorTexto,
|
|
38
|
+
w as criarEditorValor,
|
|
39
|
+
H as criarLinhaPropriedade,
|
|
40
40
|
_ as executarOrquestracaoCorpo,
|
|
41
41
|
y as executarOrquestracaoHeader,
|
|
42
42
|
F as executarRedimensionamentoColuna,
|
|
@@ -52,29 +52,30 @@ export {
|
|
|
52
52
|
Y as getTextAlign,
|
|
53
53
|
Z as inicializarScrollVirtualizacao,
|
|
54
54
|
$ as iniciarRedimensionamentoColuna,
|
|
55
|
-
aa as
|
|
56
|
-
ra as
|
|
57
|
-
ea as
|
|
58
|
-
oa as
|
|
59
|
-
ia as
|
|
60
|
-
sa as
|
|
61
|
-
ta as
|
|
62
|
-
na as
|
|
63
|
-
la as
|
|
64
|
-
ca as
|
|
65
|
-
da as
|
|
66
|
-
ma as
|
|
67
|
-
ua as
|
|
68
|
-
pa as
|
|
69
|
-
Ca as
|
|
70
|
-
Ta as
|
|
71
|
-
Ea as
|
|
72
|
-
ba as
|
|
73
|
-
Pa as
|
|
74
|
-
ga as
|
|
75
|
-
xa as
|
|
76
|
-
za as
|
|
77
|
-
Ia as
|
|
78
|
-
Aa as
|
|
79
|
-
Oa as
|
|
55
|
+
aa as interpretarEntradaNumerica,
|
|
56
|
+
ra as interpretarIndice,
|
|
57
|
+
ea as isValorMisto,
|
|
58
|
+
oa as limitarLarguraColuna,
|
|
59
|
+
ia as localizarIndiceItem,
|
|
60
|
+
sa as marcarSelectMisto,
|
|
61
|
+
ta as montarEstruturaDOM,
|
|
62
|
+
na as normalizarTexto,
|
|
63
|
+
la as obterCasasDecimais,
|
|
64
|
+
ca as obterPassoNumerico,
|
|
65
|
+
da as orquestrarEstruturaInicial,
|
|
66
|
+
ma as proximaDensidade,
|
|
67
|
+
ua as redimensionarColunaPorDelta,
|
|
68
|
+
pa as registrarAtualizadorEditor,
|
|
69
|
+
Ca as renderizarCategoriasETree,
|
|
70
|
+
Ta as renderizarCorpoTabela,
|
|
71
|
+
Ea as renderizarHeaderTabela,
|
|
72
|
+
ba as renderizarSeletorTipos,
|
|
73
|
+
Pa as sincronizarAtributosTabela,
|
|
74
|
+
ga as sincronizarPainelControles,
|
|
75
|
+
xa as sincronizarSelect,
|
|
76
|
+
za as textoMistoDe,
|
|
77
|
+
Ia as tratarMudancaAtributoTabela,
|
|
78
|
+
Aa as valorComum,
|
|
79
|
+
Oa as valorInicialDaPropriedade,
|
|
80
|
+
Ra as valoresIguais
|
|
80
81
|
};
|
|
@@ -896,7 +896,7 @@ export interface PropsUiPainelLateral {
|
|
|
896
896
|
/**
|
|
897
897
|
* `<ui-painel-propriedades>`
|
|
898
898
|
* Eventos: ui-densidade-alterada, ui-flutuante-alterado, ui-colapso-horizontal, ui-tipo-alterado, ui-editar-tipo-clique, ui-quick-select, ui-selecionar-objetos, ui-calculadora, ui-acao-clique, ui-ajuda, ui-aplicar, ui-categoria-toggle, ui-desfazer, ui-fechar, ui-mover, ui-propriedade-alterada, ui-redimensionar, ui-splitter-resize
|
|
899
|
-
* Parts (::part): acoes-cabecalho, ajuda, aplicar, base, cabecalho, categoria, categoria-aberta, categoria-cabecalho, categoria-conteudo, corpo, desfazer, editor, faixa-estreita, filtro, filtro-input, linha, linha-mista, linha-modificada, lista-categorias, rodape, rotulo, seletor-tipo, splitter, titulo, unidade, valor, vazio
|
|
899
|
+
* Parts (::part): acoes-cabecalho, ajuda, aplicar, base, cabecalho, categoria, categoria-aberta, categoria-cabecalho, categoria-conteudo, corpo, desfazer, editor, faixa-estreita, filtro, filtro-input, linha, linha-mista, linha-modificada, lista-categorias, restaurar, rodape, rotulo, seletor-tipo, splitter, titulo, unidade, valor, vazio
|
|
900
900
|
*/
|
|
901
901
|
export interface PropsUiPainelPropriedades {
|
|
902
902
|
titulo?: UIPainelPropriedades['titulo'];
|
|
@@ -979,7 +979,7 @@ export interface PropsUiPopover {
|
|
|
979
979
|
/**
|
|
980
980
|
* `<ui-propriedades>`
|
|
981
981
|
* Eventos: ui-densidade-alterada, ui-flutuante-alterado, ui-colapso-horizontal, ui-tipo-alterado, ui-editar-tipo-clique, ui-quick-select, ui-selecionar-objetos, ui-calculadora, ui-acao-clique, ui-ajuda, ui-aplicar, ui-categoria-toggle, ui-desfazer, ui-fechar, ui-mover, ui-propriedade-alterada, ui-redimensionar, ui-splitter-resize
|
|
982
|
-
* Parts (::part): acoes-cabecalho, ajuda, aplicar, base, cabecalho, categoria, categoria-aberta, categoria-cabecalho, categoria-conteudo, corpo, desfazer, editor, faixa-estreita, filtro, filtro-input, linha, linha-mista, linha-modificada, lista-categorias, rodape, rotulo, seletor-tipo, splitter, titulo, unidade, valor, vazio
|
|
982
|
+
* Parts (::part): acoes-cabecalho, ajuda, aplicar, base, cabecalho, categoria, categoria-aberta, categoria-cabecalho, categoria-conteudo, corpo, desfazer, editor, faixa-estreita, filtro, filtro-input, linha, linha-mista, linha-modificada, lista-categorias, restaurar, rodape, rotulo, seletor-tipo, splitter, titulo, unidade, valor, vazio
|
|
983
983
|
*/
|
|
984
984
|
export interface PropsUiPropriedades {
|
|
985
985
|
titulo?: UIPropriedades['titulo'];
|
|
@@ -1303,7 +1303,7 @@ export interface PropsUiTabela {
|
|
|
1303
1303
|
/**
|
|
1304
1304
|
* `<ui-tabela-propriedades>`
|
|
1305
1305
|
* Eventos: ui-densidade-alterada, ui-flutuante-alterado, ui-colapso-horizontal, ui-tipo-alterado, ui-editar-tipo-clique, ui-quick-select, ui-selecionar-objetos, ui-calculadora, ui-acao-clique, ui-ajuda, ui-aplicar, ui-categoria-toggle, ui-desfazer, ui-fechar, ui-mover, ui-propriedade-alterada, ui-redimensionar, ui-splitter-resize
|
|
1306
|
-
* Parts (::part): acoes-cabecalho, ajuda, aplicar, base, cabecalho, categoria, categoria-aberta, categoria-cabecalho, categoria-conteudo, corpo, desfazer, editor, faixa-estreita, filtro, filtro-input, linha, linha-mista, linha-modificada, lista-categorias, rodape, rotulo, seletor-tipo, splitter, titulo, unidade, valor, vazio
|
|
1306
|
+
* Parts (::part): acoes-cabecalho, ajuda, aplicar, base, cabecalho, categoria, categoria-aberta, categoria-cabecalho, categoria-conteudo, corpo, desfazer, editor, faixa-estreita, filtro, filtro-input, linha, linha-mista, linha-modificada, lista-categorias, restaurar, rodape, rotulo, seletor-tipo, splitter, titulo, unidade, valor, vazio
|
|
1307
1307
|
*/
|
|
1308
1308
|
export interface PropsUiTabelaPropriedades {
|
|
1309
1309
|
titulo?: UITabelaPropriedades['titulo'];
|
package/dist/tipos-vue.d.ts
CHANGED
|
@@ -862,7 +862,7 @@ type PropsVueUiPainelLateral = {
|
|
|
862
862
|
/**
|
|
863
863
|
* `<ui-painel-propriedades>`
|
|
864
864
|
* Eventos: ui-densidade-alterada, ui-flutuante-alterado, ui-colapso-horizontal, ui-tipo-alterado, ui-editar-tipo-clique, ui-quick-select, ui-selecionar-objetos, ui-calculadora, ui-acao-clique, ui-ajuda, ui-aplicar, ui-categoria-toggle, ui-desfazer, ui-fechar, ui-mover, ui-propriedade-alterada, ui-redimensionar, ui-splitter-resize
|
|
865
|
-
* Parts (::part): acoes-cabecalho, ajuda, aplicar, base, cabecalho, categoria, categoria-aberta, categoria-cabecalho, categoria-conteudo, corpo, desfazer, editor, faixa-estreita, filtro, filtro-input, linha, linha-mista, linha-modificada, lista-categorias, rodape, rotulo, seletor-tipo, splitter, titulo, unidade, valor, vazio
|
|
865
|
+
* Parts (::part): acoes-cabecalho, ajuda, aplicar, base, cabecalho, categoria, categoria-aberta, categoria-cabecalho, categoria-conteudo, corpo, desfazer, editor, faixa-estreita, filtro, filtro-input, linha, linha-mista, linha-modificada, lista-categorias, restaurar, rodape, rotulo, seletor-tipo, splitter, titulo, unidade, valor, vazio
|
|
866
866
|
*/
|
|
867
867
|
type PropsVueUiPainelPropriedades = {
|
|
868
868
|
titulo?: UIPainelPropriedades['titulo'];
|
|
@@ -939,7 +939,7 @@ type PropsVueUiPopover = {
|
|
|
939
939
|
/**
|
|
940
940
|
* `<ui-propriedades>`
|
|
941
941
|
* Eventos: ui-densidade-alterada, ui-flutuante-alterado, ui-colapso-horizontal, ui-tipo-alterado, ui-editar-tipo-clique, ui-quick-select, ui-selecionar-objetos, ui-calculadora, ui-acao-clique, ui-ajuda, ui-aplicar, ui-categoria-toggle, ui-desfazer, ui-fechar, ui-mover, ui-propriedade-alterada, ui-redimensionar, ui-splitter-resize
|
|
942
|
-
* Parts (::part): acoes-cabecalho, ajuda, aplicar, base, cabecalho, categoria, categoria-aberta, categoria-cabecalho, categoria-conteudo, corpo, desfazer, editor, faixa-estreita, filtro, filtro-input, linha, linha-mista, linha-modificada, lista-categorias, rodape, rotulo, seletor-tipo, splitter, titulo, unidade, valor, vazio
|
|
942
|
+
* Parts (::part): acoes-cabecalho, ajuda, aplicar, base, cabecalho, categoria, categoria-aberta, categoria-cabecalho, categoria-conteudo, corpo, desfazer, editor, faixa-estreita, filtro, filtro-input, linha, linha-mista, linha-modificada, lista-categorias, restaurar, rodape, rotulo, seletor-tipo, splitter, titulo, unidade, valor, vazio
|
|
943
943
|
*/
|
|
944
944
|
type PropsVueUiPropriedades = {
|
|
945
945
|
titulo?: UIPropriedades['titulo'];
|
|
@@ -1250,7 +1250,7 @@ type PropsVueUiTabela = {
|
|
|
1250
1250
|
/**
|
|
1251
1251
|
* `<ui-tabela-propriedades>`
|
|
1252
1252
|
* Eventos: ui-densidade-alterada, ui-flutuante-alterado, ui-colapso-horizontal, ui-tipo-alterado, ui-editar-tipo-clique, ui-quick-select, ui-selecionar-objetos, ui-calculadora, ui-acao-clique, ui-ajuda, ui-aplicar, ui-categoria-toggle, ui-desfazer, ui-fechar, ui-mover, ui-propriedade-alterada, ui-redimensionar, ui-splitter-resize
|
|
1253
|
-
* Parts (::part): acoes-cabecalho, ajuda, aplicar, base, cabecalho, categoria, categoria-aberta, categoria-cabecalho, categoria-conteudo, corpo, desfazer, editor, faixa-estreita, filtro, filtro-input, linha, linha-mista, linha-modificada, lista-categorias, rodape, rotulo, seletor-tipo, splitter, titulo, unidade, valor, vazio
|
|
1253
|
+
* Parts (::part): acoes-cabecalho, ajuda, aplicar, base, cabecalho, categoria, categoria-aberta, categoria-cabecalho, categoria-conteudo, corpo, desfazer, editor, faixa-estreita, filtro, filtro-input, linha, linha-mista, linha-modificada, lista-categorias, restaurar, rodape, rotulo, seletor-tipo, splitter, titulo, unidade, valor, vazio
|
|
1254
1254
|
*/
|
|
1255
1255
|
type PropsVueUiTabelaPropriedades = {
|
|
1256
1256
|
titulo?: UITabelaPropriedades['titulo'];
|
|
@@ -0,0 +1,291 @@
|
|
|
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 $, d as P, a as E } from "./ui-seletor-cor-FYtRccnK.js";
|
|
7
|
+
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-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 j extends w {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
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);
|
|
25
|
+
this.raiz = this.attachShadow({ mode: "open" });
|
|
26
|
+
}
|
|
27
|
+
static get observedAttributes() {
|
|
28
|
+
return ["preenchimento", "traco", "opacidade", "espessura-traco", "alvo", "padrao-preenchimento", "padrao-traco", "desabilitado"];
|
|
29
|
+
}
|
|
30
|
+
connectedCallback() {
|
|
31
|
+
this.renderizado || this.renderizar(), this.listeners.cleanup(), this.vincularEventos(), this.atualizar();
|
|
32
|
+
}
|
|
33
|
+
disconnectedCallback() {
|
|
34
|
+
this.fecharSeletor(!0), this.listeners.cleanup();
|
|
35
|
+
}
|
|
36
|
+
attributeChangedCallback(e, t, r) {
|
|
37
|
+
if (t !== r) {
|
|
38
|
+
if (e === "desabilitado") {
|
|
39
|
+
this.hasAttribute("desabilitado") && this.fecharSeletor(!1), this.atualizar();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
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);
|
|
48
|
+
else if (e === "padrao-preenchimento" || e === "padrao-traco") {
|
|
49
|
+
const a = m(r);
|
|
50
|
+
if (!a) return;
|
|
51
|
+
e === "padrao-preenchimento" ? this._padrao.preenchimento = a : this._padrao.traco = a, this.atualizar();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/* ---------- Propriedades ---------- */
|
|
57
|
+
get preenchimento() {
|
|
58
|
+
return this._preenchimento;
|
|
59
|
+
}
|
|
60
|
+
set preenchimento(e) {
|
|
61
|
+
this.definirCores({ preenchimento: e });
|
|
62
|
+
}
|
|
63
|
+
get traco() {
|
|
64
|
+
return this._traco;
|
|
65
|
+
}
|
|
66
|
+
set traco(e) {
|
|
67
|
+
this.definirCores({ traco: e });
|
|
68
|
+
}
|
|
69
|
+
get opacidade() {
|
|
70
|
+
return this._opacidade;
|
|
71
|
+
}
|
|
72
|
+
set opacidade(e) {
|
|
73
|
+
this.definirCores({ opacidade: e });
|
|
74
|
+
}
|
|
75
|
+
get espessuraTraco() {
|
|
76
|
+
return this._espessuraTraco;
|
|
77
|
+
}
|
|
78
|
+
set espessuraTraco(e) {
|
|
79
|
+
this.definirCores({ espessuraTraco: e });
|
|
80
|
+
}
|
|
81
|
+
get alvo() {
|
|
82
|
+
return this._alvo;
|
|
83
|
+
}
|
|
84
|
+
set alvo(e) {
|
|
85
|
+
this.definirAlvo(e);
|
|
86
|
+
}
|
|
87
|
+
/** @deprecated Ignorado: o seletor de cor não mostra mais amostras de cores. */
|
|
88
|
+
get coresProjeto() {
|
|
89
|
+
return [...this._coresProjeto];
|
|
90
|
+
}
|
|
91
|
+
set coresProjeto(e) {
|
|
92
|
+
this._coresProjeto = $(e);
|
|
93
|
+
}
|
|
94
|
+
/** Teclas exibidas nas dicas dos botões (ex.: `{ inverter: 'Shift+X' }`). */
|
|
95
|
+
get atalhos() {
|
|
96
|
+
return { ...this._atalhos };
|
|
97
|
+
}
|
|
98
|
+
set atalhos(e) {
|
|
99
|
+
this._atalhos = { ...e || {} }, this.atualizar();
|
|
100
|
+
}
|
|
101
|
+
get seletorAberto() {
|
|
102
|
+
var e;
|
|
103
|
+
return !!((e = this.seletor) != null && e.aberto);
|
|
104
|
+
}
|
|
105
|
+
/* ---------- Métodos (sem eventos) ---------- */
|
|
106
|
+
/** Define cores, opacidade e/ou espessura sem emitir eventos. Valores inválidos são ignorados; uma cor definida deixa de ser "mista". */
|
|
107
|
+
definirCores(e = {}) {
|
|
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 = P(e.opacidade, this._opacidade)), e.espessuraTraco !== void 0 && (this._espessuraTraco = g(e.espessuraTraco, this._espessuraTraco)), this.atualizar();
|
|
110
|
+
}
|
|
111
|
+
obterCores() {
|
|
112
|
+
return {
|
|
113
|
+
preenchimento: this._preenchimento,
|
|
114
|
+
traco: this._traco,
|
|
115
|
+
opacidade: this._opacidade,
|
|
116
|
+
espessuraTraco: this._espessuraTraco,
|
|
117
|
+
alvo: this._alvo
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/** Marca a amostra como ativa sem emitir eventos. */
|
|
121
|
+
definirAlvo(e) {
|
|
122
|
+
this._alvo = e === "traco" ? "traco" : "preenchimento", this.atualizar(), this.sincronizarSeletor();
|
|
123
|
+
}
|
|
124
|
+
/** Mostra "?" nas amostras cujas cores divergem na seleção atual. */
|
|
125
|
+
definirMisto(e = {}) {
|
|
126
|
+
this._misto = { preenchimento: !!e.preenchimento, traco: !!e.traco }, this.atualizar();
|
|
127
|
+
}
|
|
128
|
+
/* ---------- Ações (emitem eventos) ---------- */
|
|
129
|
+
/** Alterna o alvo ativo entre preenchimento e traço; emite `ui-alvo-change`. */
|
|
130
|
+
alternarAlvo() {
|
|
131
|
+
this.mudarAlvo(this._alvo === "traco" ? "preenchimento" : "traco");
|
|
132
|
+
}
|
|
133
|
+
/** Troca preenchimento e traço; emite `ui-cores-change` confirmado. */
|
|
134
|
+
inverter() {
|
|
135
|
+
const e = this._preenchimento;
|
|
136
|
+
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");
|
|
137
|
+
}
|
|
138
|
+
/** "Sem cor" no alvo indicado (padrão: o ativo); emite `ui-cores-change` confirmado. */
|
|
139
|
+
semCor(e = this._alvo) {
|
|
140
|
+
const t = e === "traco" ? "traco" : "preenchimento";
|
|
141
|
+
t === "traco" ? this._traco = "none" : this._preenchimento = "none", this._misto[t] = !1, this.atualizar(), this.emitirCores(!0, [t], "sem-cor");
|
|
142
|
+
}
|
|
143
|
+
/** Volta às cores de `padrao-preenchimento` e `padrao-traco`; emite `ui-cores-change` confirmado. */
|
|
144
|
+
restaurarPadrao() {
|
|
145
|
+
this._preenchimento = this._padrao.preenchimento, this._traco = this._padrao.traco, this._misto = { preenchimento: !1, traco: !1 }, this.atualizar(), this.emitirCores(!0, ["preenchimento", "traco"], "padrao");
|
|
146
|
+
}
|
|
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. */
|
|
148
|
+
abrirSeletor(e = this._alvo, t = !1) {
|
|
149
|
+
if (this.hasAttribute("desabilitado") || (this.mudarAlvo(e === "traco" ? "traco" : "preenchimento"), this.seletorAberto)) return;
|
|
150
|
+
const r = this.raiz.querySelector(`[data-alvo="${this._alvo}"]`) || this;
|
|
151
|
+
this.estadoAoAbrir = this.obterCores(), this.seletor = E({
|
|
152
|
+
ancora: r,
|
|
153
|
+
titulo: this.getAttribute("titulo-seletor") || "Cores e estilo",
|
|
154
|
+
modo: "duplo",
|
|
155
|
+
alvo: this._alvo,
|
|
156
|
+
preenchimento: this._preenchimento,
|
|
157
|
+
traco: this._traco,
|
|
158
|
+
opacidade: this._opacidade,
|
|
159
|
+
espessuraTraco: this._espessuraTraco,
|
|
160
|
+
misto: this._misto[this._alvo],
|
|
161
|
+
focar: t,
|
|
162
|
+
aoAlterar: (a) => this.aplicarDoSeletor(a, !1),
|
|
163
|
+
aoConfirmar: (a) => {
|
|
164
|
+
this.seletor = null, this.aplicarDoSeletor(a, !0);
|
|
165
|
+
},
|
|
166
|
+
aoCancelar: () => {
|
|
167
|
+
this.seletor = null, this.estadoAoAbrir = null;
|
|
168
|
+
},
|
|
169
|
+
aoTrocarAlvo: (a) => this.mudarAlvo(a)
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Fecha o seletor aberto por este controle. Com `confirmar` (padrão), grava o que foi editado;
|
|
174
|
+
* sem ele, cancela: as cores iniciais voltam (com um `ui-cores-change` não confirmado) e nada é confirmado.
|
|
175
|
+
*/
|
|
176
|
+
fecharSeletor(e = !0) {
|
|
177
|
+
const t = this.seletor;
|
|
178
|
+
t && (e ? t.fechar(!0) : t.elemento.cancelar());
|
|
179
|
+
}
|
|
180
|
+
/* ---------- Interno ---------- */
|
|
181
|
+
mudarAlvo(e) {
|
|
182
|
+
e !== this._alvo && (this._alvo = e, this.atualizar(), this.sincronizarSeletor(), this.dispatchEvent(new CustomEvent("ui-alvo-change", { detail: { alvo: e }, bubbles: !0, composed: !0 })));
|
|
183
|
+
}
|
|
184
|
+
/** Mantém a aba do seletor aberto igual ao alvo do controle. */
|
|
185
|
+
sincronizarSeletor() {
|
|
186
|
+
var e, t;
|
|
187
|
+
(t = (e = this.seletor) == null ? void 0 : e.elemento) == null || t.trocarAlvo(this._alvo);
|
|
188
|
+
}
|
|
189
|
+
aplicarDoSeletor(e, t) {
|
|
190
|
+
const r = (o) => {
|
|
191
|
+
const p = [];
|
|
192
|
+
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;
|
|
193
|
+
}, a = r(this.obterCores());
|
|
194
|
+
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) {
|
|
195
|
+
a.length && this.emitirCores(!1, a, "seletor");
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
this.emitirCores(!0, this.estadoAoAbrir ? r(this.estadoAoAbrir) : a, "seletor"), this.estadoAoAbrir = null;
|
|
199
|
+
}
|
|
200
|
+
emitirCores(e, t, r) {
|
|
201
|
+
const a = { ...this.obterCores(), confirmado: e, alterados: t, origem: r };
|
|
202
|
+
this.dispatchEvent(new CustomEvent("ui-cores-change", { detail: a, bubbles: !0, composed: !0 }));
|
|
203
|
+
}
|
|
204
|
+
dica(e, t) {
|
|
205
|
+
return t ? `${e} [${t}]` : e;
|
|
206
|
+
}
|
|
207
|
+
renderizar() {
|
|
208
|
+
this.raiz.innerHTML = `
|
|
209
|
+
<style>${M}</style>
|
|
210
|
+
<div class="pilha" part="pilha" role="group" aria-label="Cores de desenho">
|
|
211
|
+
<div class="amostras" part="amostras">
|
|
212
|
+
<button type="button" class="amostra amostra--traco" data-alvo="traco" part="amostra amostra-traco">
|
|
213
|
+
<span class="face face--traco"></span>
|
|
214
|
+
</button>
|
|
215
|
+
<button type="button" class="amostra amostra--preenchimento" data-alvo="preenchimento" part="amostra amostra-preenchimento">
|
|
216
|
+
<span class="face face--preenchimento"></span>
|
|
217
|
+
</button>
|
|
218
|
+
</div>
|
|
219
|
+
<div class="acoes" part="acoes">
|
|
220
|
+
<button type="button" class="acao acao--inverter" data-acao="inverter" part="acao acao-inverter" aria-label="Inverter preenchimento e traço">
|
|
221
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
222
|
+
<path d="m16 3 4 4-4 4"/><path d="M20 7H4"/><path d="m8 21-4-4 4-4"/><path d="M4 17h16"/>
|
|
223
|
+
</svg>
|
|
224
|
+
</button>
|
|
225
|
+
<button type="button" class="acao acao--sem-cor" data-acao="sem-cor" part="acao acao-sem-cor" aria-label="Sem cor">
|
|
226
|
+
<svg viewBox="0 0 24 24" fill="none" stroke-width="2.4" stroke-linecap="round" aria-hidden="true">
|
|
227
|
+
<circle cx="12" cy="12" r="8" stroke="currentColor"/>
|
|
228
|
+
<line x1="6.5" y1="6.5" x2="17.5" y2="17.5" stroke="#ef4444"/>
|
|
229
|
+
</svg>
|
|
230
|
+
</button>
|
|
231
|
+
<button type="button" class="acao acao--padrao" data-acao="padrao" part="acao acao-padrao" aria-label="Restaurar cores padrão">
|
|
232
|
+
<span class="icone-padrao" aria-hidden="true">
|
|
233
|
+
<span class="ponto ponto--preenchimento"></span>
|
|
234
|
+
<span class="ponto ponto--traco"></span>
|
|
235
|
+
</span>
|
|
236
|
+
</button>
|
|
237
|
+
</div>
|
|
238
|
+
</div>
|
|
239
|
+
`, this.renderizado = !0;
|
|
240
|
+
}
|
|
241
|
+
vincularEventos() {
|
|
242
|
+
const e = this.raiz;
|
|
243
|
+
e.querySelectorAll("[data-alvo]").forEach((r) => {
|
|
244
|
+
const a = r.dataset.alvo;
|
|
245
|
+
this.listeners.add(r, "click", (o) => {
|
|
246
|
+
o.stopPropagation(), a !== this._alvo ? this.mudarAlvo(a) : this.seletorAberto ? this.fecharSeletor(!0) : this.abrirSeletor(a);
|
|
247
|
+
}), this.listeners.add(r, "dblclick", (o) => {
|
|
248
|
+
o.stopPropagation(), this.abrirSeletor(a);
|
|
249
|
+
}), this.listeners.add(r, "keydown", (o) => {
|
|
250
|
+
o.key !== "Enter" && o.key !== " " || (o.preventDefault(), a === this._alvo && this.seletorAberto ? this.fecharSeletor(!0) : this.abrirSeletor(a, !0));
|
|
251
|
+
}), this.listeners.add(r, "keyup", (o) => {
|
|
252
|
+
o.key === " " && o.preventDefault();
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
const t = (r, a) => {
|
|
256
|
+
this.listeners.add(e.querySelector(`[data-acao="${r}"]`), "click", (o) => {
|
|
257
|
+
o.stopPropagation(), a();
|
|
258
|
+
});
|
|
259
|
+
};
|
|
260
|
+
t("inverter", () => this.inverter()), t("sem-cor", () => this.semCor()), t("padrao", () => this.restaurarPadrao());
|
|
261
|
+
}
|
|
262
|
+
atualizar() {
|
|
263
|
+
if (!this.renderizado) return;
|
|
264
|
+
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 = "") => {
|
|
265
|
+
const h = e.querySelector(`[data-alvo="${i}"]`), u = h == null ? void 0 : h.querySelector(".face");
|
|
266
|
+
if (!h || !u) return;
|
|
267
|
+
const _ = this._alvo === i;
|
|
268
|
+
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");
|
|
269
|
+
const A = i === "traco" ? "borderColor" : "backgroundColor";
|
|
270
|
+
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`);
|
|
271
|
+
const x = `${y}: ${a(n, c)}${z}`;
|
|
272
|
+
h.title = this.dica(`${x} — clique para ativar, clique de novo para editar`, t.alternar), h.setAttribute("aria-label", x);
|
|
273
|
+
}, p = this._preenchimento === "none" || this._misto.preenchimento ? "" : `, opacidade ${Math.round(this._opacidade * 100)}%`;
|
|
274
|
+
o("preenchimento", this._preenchimento, this._misto.preenchimento, "Preenchimento", p);
|
|
275
|
+
const C = this._traco === "none" || this._misto.traco ? "" : `, espessura ${this._espessuraTraco}px`;
|
|
276
|
+
o("traco", this._traco, this._misto.traco, "Traço / contorno", C);
|
|
277
|
+
const f = (i, n) => {
|
|
278
|
+
const c = e.querySelector(`[data-acao="${i}"]`);
|
|
279
|
+
c && (c.title = n, c.disabled = r);
|
|
280
|
+
};
|
|
281
|
+
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));
|
|
282
|
+
const b = e.querySelector(".ponto--preenchimento");
|
|
283
|
+
b && (b.style.backgroundColor = this._padrao.preenchimento === "none" ? "transparent" : this._padrao.preenchimento);
|
|
284
|
+
const v = e.querySelector(".ponto--traco");
|
|
285
|
+
v && (v.style.borderColor = this._padrao.traco === "none" ? "#ef4444" : this._padrao.traco);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
T("ui-controle-cores", j);
|
|
289
|
+
export {
|
|
290
|
+
j as U
|
|
291
|
+
};
|
|
@@ -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 i=(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-DPKqf5wb.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();i(this,"raiz");i(this,"listeners",new w.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:p.normalizarEspessura(r)});else if(e==="alvo")this.definirAlvo(r);else if(e==="padrao-preenchimento"||e==="padrao-traco"){const a=p.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=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],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=`
|
|
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 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=(s,n)=>n?"Misto (?) [várias cores na seleção]":s==="none"?"Sem cor":s,o=(s,n,c,y,A="")=>{const l=e.querySelector(`[data-alvo="${s}"]`),f=l==null?void 0:l.querySelector(".face");if(!l||!f)return;const _=this._alvo===s;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=s==="traco"?"borderColor":"backgroundColor";f.style[k]=c||n==="none"?"":n,s==="traco"&&n!=="none"&&!c&&(f.style.borderWidth=`${Math.max(2,Math.min(4.5,this._espessuraTraco))}px`);const x=`${y}: ${a(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)}%`;o("preenchimento",this._preenchimento,this._misto.preenchimento,"Preenchimento",d);const z=this._traco==="none"||this._misto.traco?"":`, espessura ${this._espessuraTraco}px`;o("traco",this._traco,this._misto.traco,"Traço / contorno",z);const m=(s,n)=>{const c=e.querySelector(`[data-acao="${s}"]`);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;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";var O=Object.defineProperty;var P=(s,t,e)=>t in s?O(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var d=(s,t,e)=>P(s,typeof t!="symbol"?t+"":t,e);const j=require("./ssr-safe-CiHD1adl.cjs"),A=require("./listener-bag-D5omxZ9h.cjs"),L=':host{--_t: var(--ui-cor-texto, #e1e1e6);--_t2: var(--ui-cor-texto-secundario, #9696a6);--_linha: var(--ui-cor-borda, rgba(255, 255, 255, .12));--_realce: color-mix(in srgb, var(--_t) 8%, transparent);--_realce-forte: color-mix(in srgb, var(--_t) 16%, transparent);--_campo: color-mix(in srgb, var(--ui-cor-fundo, #0b0b0d) 70%, transparent);--_destaque: var(--ui-cor-primaria, #00e08a);--_sobre-destaque: var(--ui-cor-texto-sobre-primaria, #000000);--_vermelho: #ef4444;position:fixed;top:0;left:0;z-index:var(--ui-seletor-cor-z, 10000);display:block;width:268px;max-height:calc(100vh - 20px);overflow-y:auto;box-sizing:border-box;padding:13px;background:var(--ui-seletor-cor-fundo, color-mix(in srgb, var(--ui-cor-fundo-menu, #16161a) 96%, transparent));backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px);border:1px solid var(--_linha);border-radius:12px;box-shadow:var(--ui-sombra-lg, 0 20px 48px -4px rgba(0, 0, 0, .7)),0 0 0 1px #ffffff0d,inset 0 1px #ffffff14;color:var(--_t);font-family:var(--ui-fonte-base, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);font-size:12px;-webkit-user-select:none;user-select:none;animation:ui-seletor-cor-entrada .18s cubic-bezier(.16,1,.3,1)}:host([hidden]){display:none}:host([inline]),:host([embutido]){position:relative;top:auto;left:auto;z-index:auto;animation:none;box-shadow:var(--ui-sombra-md, 0 8px 24px rgba(0, 0, 0, .45))}:host(:focus){outline:none}*,*:before,*:after{box-sizing:border-box}@keyframes ui-seletor-cor-entrada{0%{opacity:0;transform:scale(.96) translateY(-4px)}to{opacity:1;transform:scale(1) translateY(0)}}button{font-family:inherit}.cabecalho{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px;padding-bottom:8px;border-bottom:1px solid var(--_linha)}.titulo{display:flex;align-items:center;gap:7px;font-weight:600;font-size:12.5px;color:var(--_t);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;letter-spacing:.15px}.titulo svg{flex-shrink:0;color:var(--_destaque)}.fechar{display:flex;align-items:center;justify-content:center;width:22px;height:22px;flex-shrink:0;padding:0;background:transparent;border:none;border-radius:5px;color:var(--_t2);font-size:13px;cursor:pointer;transition:all .15s ease}.fechar:hover{background:var(--_realce-forte);color:var(--_t)}.abas{display:flex;gap:3px;margin-bottom:11px;padding:3px;background:var(--_campo);border:1px solid var(--_linha);border-radius:8px}.aba{flex:1;display:flex;align-items:center;justify-content:center;gap:6px;padding:5px 8px;background:transparent;border:none;border-radius:6px;color:var(--_t2);font-size:11px;font-weight:600;cursor:pointer;transition:all .15s ease}.aba:hover{background:var(--_realce);color:var(--_t)}.aba[aria-selected=true]{background:var(--_realce-forte);color:var(--_t);box-shadow:0 1px 3px #00000059}.aba-amostra{width:12px;height:12px;border:1px solid var(--_linha);border-radius:3px;flex-shrink:0}.aba-amostra--sem-cor{background:linear-gradient(to top right,transparent calc(50% - 1px),var(--_vermelho) calc(50% - 1px),var(--_vermelho) calc(50% + 1px),transparent calc(50% + 1px)),var(--_realce-forte)}.aba-amostra--traco{border:2.5px solid #ffffff;background:transparent}.previa{display:flex;height:42px;margin-bottom:11px;overflow:hidden;background:var(--_campo);border:1px solid var(--_linha);border-radius:8px;box-shadow:inset 0 1px 3px #0000004d}.previa-metade{flex:1;position:relative;display:flex;align-items:center;justify-content:center;background-image:linear-gradient(45deg,rgba(255,255,255,.05) 25%,transparent 25%),linear-gradient(-45deg,rgba(255,255,255,.05) 25%,transparent 25%),linear-gradient(45deg,transparent 75%,rgba(255,255,255,.05) 75%),linear-gradient(-45deg,transparent 75%,rgba(255,255,255,.05) 75%);background-size:10px 10px;background-position:0 0,0 5px,5px -5px,-5px 0;overflow:hidden}.previa-metade+.previa-metade{border-left:1px solid var(--_linha)}.previa-cor{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;transition:background-color .12s ease}.previa-cor--sem-cor{background:transparent!important}.previa-cor--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));opacity:.85}.previa-linha-traco{width:78%;height:var(--traco-px, 2.5px);min-height:1px;max-height:22px;background-color:var(--traco-cor, #ffffff);border-radius:999px;box-shadow:0 1px 3px #0006;transition:height .12s ease,background-color .12s ease}.previa-linha-traco--sem-cor{background:repeating-linear-gradient(90deg,var(--_vermelho) 0,var(--_vermelho) 4px,transparent 4px,transparent 8px);height:2px!important;opacity:.9}.previa-metade span.previa-badge{position:absolute;bottom:4px;z-index:3;padding:1px 5px;background:#000000b8;border:1px solid rgba(255,255,255,.1);border-radius:4px;font-size:9px;font-weight:700;letter-spacing:.4px;color:#ffffffe6;pointer-events:none}.linha-hex{display:flex;align-items:center;gap:8px;margin-bottom:11px}.hex{flex:1;position:relative;display:flex;align-items:center}.hex-prefixo{position:absolute;left:9px;color:var(--_t2);font-weight:600;font-size:11px;pointer-events:none}.hex input{width:100%;height:30px;padding:0 8px 0 21px;background:var(--_campo);border:1px solid var(--_linha);border-radius:6px;outline:none;color:var(--_t);font-family:var(--ui-fonte-codigo, ui-monospace, "Cascadia Mono", Consolas, monospace);font-size:12px;letter-spacing:.5px;text-transform:uppercase;-webkit-user-select:text;user-select:text;transition:border-color .15s ease,box-shadow .15s ease}.hex input::placeholder{color:var(--_t2);opacity:.7}.hex input:hover{border-color:color-mix(in srgb,var(--_t) 35%,transparent)}.hex input:focus{border-color:var(--_destaque);box-shadow:0 0 0 2px color-mix(in srgb,var(--_destaque) 25%,transparent)}.nativo{position:relative;display:flex;align-items:center;justify-content:center;width:30px;height:30px;flex-shrink:0;overflow:hidden;background:var(--_realce);border:1px solid var(--_linha);border-radius:6px;color:var(--_t2);cursor:pointer;transition:border-color .15s ease,color .15s ease,transform .1s ease}.nativo:hover,.nativo:focus-within{border-color:color-mix(in srgb,var(--_t) 45%,transparent);color:var(--_t);transform:scale(1.04)}.nativo input{position:absolute;top:-8px;right:-8px;bottom:-8px;left:-8px;width:150%;height:150%;opacity:0;cursor:pointer}.ajustes{display:flex;flex-direction:column;gap:6px;margin-bottom:11px}.ajustes:not(:has(.ajuste:not([hidden]))){display:none}.ajuste{display:flex;align-items:center;justify-content:space-between;gap:8px}.ajuste[hidden]{display:none}.ajuste-rotulo{color:var(--_t2);font-size:11px;font-weight:500}.ajuste-campo{display:flex;align-items:stretch;width:96px;height:26px;overflow:hidden;background:var(--_campo);border:1px solid var(--_linha);border-radius:6px;transition:border-color .15s ease,box-shadow .15s ease}.ajuste-campo:hover{border-color:color-mix(in srgb,var(--_t) 35%,transparent)}.ajuste-campo:focus-within{border-color:var(--_destaque);box-shadow:0 0 0 2px color-mix(in srgb,var(--_destaque) 25%,transparent)}.ajuste-passos{display:flex;flex-direction:column;flex-shrink:0;border-right:1px solid var(--_linha)}.ajuste-passos button{display:flex;flex:1;align-items:center;justify-content:center;width:16px;padding:0;background:transparent;border:none;color:var(--_t2);cursor:pointer}.ajuste-passos button:hover{background:var(--_realce-forte);color:var(--_t)}.ajuste-campo input{flex:1;min-width:0;padding:0 2px 0 7px;background:transparent;border:none;outline:none;color:var(--_t);font-family:var(--ui-fonte-codigo, ui-monospace, "Cascadia Mono", Consolas, monospace);font-size:12px;font-variant-numeric:tabular-nums;text-align:right;-webkit-user-select:text;user-select:text}.ajuste-unidade{display:flex;align-items:center;padding-right:7px;color:var(--_t2);font-size:11px;pointer-events:none}.sem-cor{width:30px;height:30px;flex-shrink:0;padding: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)),var(--_campo);border:1px solid var(--_linha);border-radius:6px;cursor:pointer;transition:border-color .15s ease,box-shadow .15s ease}.sem-cor:hover{border-color:color-mix(in srgb,var(--_t) 45%,transparent)}.sem-cor.ativo{border-color:var(--_vermelho);box-shadow:0 0 0 2px color-mix(in srgb,var(--_vermelho) 40%,transparent)}.rodape{display:flex;justify-content:flex-end;gap:6px;margin-top:11px;padding-top:9px;border-top:1px solid var(--_linha)}.rodape button{padding:6px 14px;border:none;border-radius:6px;font-size:11.5px;font-weight:600;cursor:pointer;transition:all .15s ease}.botao-concluir{background:var(--_destaque);color:var(--_sobre-destaque);box-shadow:0 1px 3px #0000004d}.botao-concluir:hover{filter:brightness(1.1);transform:translateY(-.5px)}.botao-concluir:active{transform:translateY(0)}.botao-cancelar{background:var(--_realce);color:var(--_t2)}.botao-cancelar:hover{background:var(--_realce-forte);color:var(--_t)}button:focus-visible,input:focus-visible,.nativo:focus-within{outline:2px solid var(--_destaque);outline-offset:1px}.hex input:focus-visible,.ajuste-campo input:focus-visible{outline:none}@media (prefers-reduced-motion: reduce){:host{animation:none}.ajuste-campo{transition:none}}',N=["#00e08a","#38bdf8","#3b82f6","#6366f1","#a855f7","#ec4899","#ef4444","#f97316","#eab308","#84cc16","#14b8a6","#ffffff","#94a3b8","#0f172a"];function _(s){if(typeof s!="string")return null;const t=s.trim().toLowerCase();if(t==="none"||t==="transparent")return"none";if(/^#[0-9a-f]{6}$/.test(t))return t;const e=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/.exec(t);return e?`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`:null}function E(s,t=.35){const e=typeof s=="string"?parseFloat(s):Number(s);return Number.isFinite(e)?Math.max(0,Math.min(1,e)):t}function z(s,t=2.5){const e=typeof s=="string"?parseFloat(s):Number(s);if(!Number.isFinite(e))return t;const a=Math.round(e*10)/10;return Math.max(.5,Math.min(50,a))}function T(s){if(!Array.isArray(s))return[];const t=new Set;for(const e of s){const a=_(e);a&&a!=="none"&&t.add(a)}return[...t]}function M(s){return String(s??"").replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t])}const F={opacidade:1,espessura:.5};class q extends j.SafeHTMLElement{constructor(){super();d(this,"raiz");d(this,"listeners",new A.ListenerBag);d(this,"aoDesconectar",null);d(this,"_titulo","Seletor de cor");d(this,"_duplo",!0);d(this,"_alvo","preenchimento");d(this,"_preenchimento","#00e08a");d(this,"_traco","#ffffff");d(this,"_opacidade",.35);d(this,"_mostrarOpacidade");d(this,"_espessura",2.5);d(this,"_mostrarEspessura");d(this,"_misto",!1);d(this,"inicial",{preenchimento:"#00e08a",traco:"#ffffff",opacidade:.35,espessuraTraco:2.5});this.raiz=this.attachShadow({mode:"open"})}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","-1"),this.renderizar()}disconnectedCallback(){var e;this.listeners.cleanup(),(e=this.aoDesconectar)==null||e.call(this)}configurar(e={}){this._titulo=e.titulo||"Seletor de cor";const a=e.preenchimento!==void 0&&e.traco!==void 0;this._duplo=e.modo?e.modo==="duplo":a,this._alvo=e.alvo==="traco"?"traco":"preenchimento";const o=_(e.cor);this._preenchimento=_(e.preenchimento)??(this._alvo==="preenchimento"?o:null)??"#00e08a",this._traco=_(e.traco)??(this._alvo==="traco"?o:null)??"#ffffff",this._opacidade=E(e.opacidade),this._mostrarOpacidade=e.mostrarOpacidade,this._espessura=z(e.espessuraTraco,2.5),this._mostrarEspessura=e.mostrarEspessura,this._misto=e.misto===!0,this.inicial={preenchimento:this._preenchimento,traco:this._traco,opacidade:this._opacidade,espessuraTraco:this._espessura},this.isConnected&&this.renderizar()}get alvo(){return this._alvo}get cor(){return this._alvo==="traco"?this._traco:this._preenchimento}get opacidade(){return this._opacidade}get espessura(){return this._espessura}obterEstado(){return{alvo:this._alvo,cor:this.cor,preenchimento:this._preenchimento,traco:this._traco,opacidade:this._opacidade,espessuraTraco:this._espessura}}trocarAlvo(e){const a=e==="traco"?"traco":"preenchimento";!this._duplo||a===this._alvo||(this._alvo=a,this.atualizarVisual(),this.emitir("ui-alvo-change",{alvo:a}))}definirCor(e){const a=_(e);a&&(this._alvo==="traco"?this._traco=a:this._preenchimento=a,this._misto=!1,this.atualizarVisual(),this.emitir("ui-cor-input",this.obterEstado()))}definirOpacidade(e){this._opacidade=E(e,this._opacidade),this.atualizarVisual(),this.emitir("ui-cor-input",this.obterEstado())}definirEspessura(e){this._espessura=z(e,this._espessura),this.atualizarVisual(),this.emitir("ui-cor-input",this.obterEstado())}confirmar(){this.emitir("ui-cor-confirmar",this.obterEstado())}cancelar(){this._preenchimento=this.inicial.preenchimento,this._traco=this.inicial.traco,this._opacidade=this.inicial.opacidade,this._espessura=this.inicial.espessuraTraco,this.atualizarVisual(),this.emitir("ui-cor-input",this.obterEstado()),this.emitir("ui-cor-cancelar",this.obterEstado())}get opacidadeVisivel(){return this._mostrarOpacidade??this._alvo==="preenchimento"}get espessuraVisivel(){return this._mostrarEspessura??this._alvo==="traco"}renderizar(){this.listeners.cleanup(),this.setAttribute("aria-label",this._titulo);const e=(a,o,l,i,n,v)=>`
|
|
2
|
+
<div class="ajuste ${a}">
|
|
3
|
+
<label class="ajuste-rotulo" for="${a}-entrada">${o}</label>
|
|
4
|
+
<div class="ajuste-campo">
|
|
5
|
+
<span class="ajuste-passos">
|
|
6
|
+
<button type="button" tabindex="-1" data-passo="${a}" data-direcao="1" aria-label="Aumentar ${o.toLowerCase()}">
|
|
7
|
+
<svg viewBox="0 0 10 6" width="8" height="5" aria-hidden="true"><path d="M1 5l4-4 4 4" fill="none" stroke="currentColor" stroke-width="1.6"/></svg>
|
|
8
|
+
</button>
|
|
9
|
+
<button type="button" tabindex="-1" data-passo="${a}" data-direcao="-1" aria-label="Diminuir ${o.toLowerCase()}">
|
|
10
|
+
<svg viewBox="0 0 10 6" width="8" height="5" aria-hidden="true"><path d="M1 1l4 4 4-4" fill="none" stroke="currentColor" stroke-width="1.6"/></svg>
|
|
11
|
+
</button>
|
|
12
|
+
</span>
|
|
13
|
+
<input type="text" id="${a}-entrada" class="${a}-entrada" inputmode="decimal" spellcheck="false" autocomplete="off"
|
|
14
|
+
role="spinbutton" aria-valuemin="${n}" aria-valuemax="${v}" aria-label="${i}" />
|
|
15
|
+
<span class="ajuste-unidade" aria-hidden="true">${l}</span>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
`;this.raiz.innerHTML=`
|
|
19
|
+
<style>${L}</style>
|
|
20
|
+
<div class="cabecalho">
|
|
21
|
+
<span class="titulo">
|
|
22
|
+
<svg viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
23
|
+
<path d="M12 2.69l5.66 5.66a8 8 0 1 1-11.31 0z"/>
|
|
24
|
+
</svg>
|
|
25
|
+
<span>${M(this._titulo)}</span>
|
|
26
|
+
</span>
|
|
27
|
+
<button type="button" class="fechar" data-acao="fechar" title="Fechar (Esc)" aria-label="Fechar">✕</button>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
${this._duplo?`
|
|
31
|
+
<div class="abas" role="tablist" aria-label="Alvo da cor">
|
|
32
|
+
<button type="button" class="aba" role="tab" data-alvo="preenchimento" title="Preenchimento">
|
|
33
|
+
<span class="aba-amostra aba-amostra--preenchimento"></span>
|
|
34
|
+
Preenchimento
|
|
35
|
+
</button>
|
|
36
|
+
<button type="button" class="aba" role="tab" data-alvo="traco" title="Traço / contorno">
|
|
37
|
+
<span class="aba-amostra aba-amostra--traco"></span>
|
|
38
|
+
Traço
|
|
39
|
+
</button>
|
|
40
|
+
</div>
|
|
41
|
+
`:""}
|
|
42
|
+
|
|
43
|
+
<div class="previa" aria-label="Comparativo de cor antes e depois">
|
|
44
|
+
<div class="previa-metade" title="Cor original">
|
|
45
|
+
<div class="previa-cor previa-cor--original">
|
|
46
|
+
<div class="previa-linha-traco previa-linha-traco--original"></div>
|
|
47
|
+
</div>
|
|
48
|
+
<span class="previa-badge">ORIGINAL</span>
|
|
49
|
+
</div>
|
|
50
|
+
<div class="previa-metade" title="Nova cor">
|
|
51
|
+
<div class="previa-cor previa-cor--nova">
|
|
52
|
+
<div class="previa-linha-traco previa-linha-traco--nova"></div>
|
|
53
|
+
</div>
|
|
54
|
+
<span class="previa-badge previa-rotulo-nova">NOVA</span>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<div class="linha-hex">
|
|
59
|
+
<label class="hex">
|
|
60
|
+
<span class="hex-prefixo">#</span>
|
|
61
|
+
<input type="text" class="hex-entrada" maxlength="7" spellcheck="false" autocomplete="off" aria-label="Cor em hexadecimal" />
|
|
62
|
+
</label>
|
|
63
|
+
<label class="nativo" title="Abrir o seletor de cor do sistema">
|
|
64
|
+
<svg viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
|
65
|
+
<circle cx="12" cy="12" r="10"/>
|
|
66
|
+
<path d="M12 2a10 10 0 0 1 10 10"/>
|
|
67
|
+
</svg>
|
|
68
|
+
<input type="color" class="nativo-entrada" aria-label="Seletor de cor do sistema" />
|
|
69
|
+
</label>
|
|
70
|
+
<button type="button" class="sem-cor" data-cor="none" aria-pressed="false" title="Sem cor (vazado / transparente)" aria-label="Sem cor (vazado / transparente)"></button>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<div class="ajustes">
|
|
74
|
+
${e("espessura","Espessura","px","Espessura do traçado em pixels",.5,50)}
|
|
75
|
+
${e("opacidade","Opacidade","%","Opacidade do preenchimento em porcentagem",0,100)}
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<div class="rodape">
|
|
79
|
+
<button type="button" class="botao-cancelar" data-acao="cancelar">Cancelar</button>
|
|
80
|
+
<button type="button" class="botao-concluir" data-acao="concluir">Concluir</button>
|
|
81
|
+
</div>
|
|
82
|
+
`,this.vincularEventos(),this.atualizarVisual()}atualizarVisual(){const e=x=>this.raiz.querySelector(x),a=this.cor,o=a==="none",l=this._alvo==="traco";this.raiz.querySelectorAll("[data-alvo]").forEach(x=>{x.setAttribute("aria-selected",String(x.dataset.alvo===this._alvo))});const i=e(".aba-amostra--preenchimento");i&&(i.classList.toggle("aba-amostra--sem-cor",this._preenchimento==="none"),i.style.backgroundColor=this._preenchimento==="none"?"":this._preenchimento);const n=e(".aba-amostra--traco");n&&(n.style.borderColor=this._traco==="none"?"#ef4444":this._traco,n.style.borderWidth=`${Math.max(1.5,Math.min(3.5,this._espessura))}px`);const v=e(".opacidade");v&&(v.hidden=!this.opacidadeVisivel);const c=e(".espessura");c&&(c.hidden=!this.espessuraVisivel);const m=l?this.inicial.traco:this.inicial.preenchimento,f=m==="none",p=e(".previa-cor--original"),r=e(".previa-cor--nova"),u=e(".previa-linha-traco--original"),h=e(".previa-linha-traco--nova");l?(p&&(p.style.backgroundColor="transparent",p.classList.remove("previa-cor--sem-cor")),r&&(r.style.backgroundColor="transparent",r.classList.remove("previa-cor--sem-cor")),u&&(u.style.display="block",u.classList.toggle("previa-linha-traco--sem-cor",f),u.style.setProperty("--traco-px",`${Math.max(1,this.inicial.espessuraTraco)}px`),u.style.setProperty("--traco-cor",f?"":m)),h&&(h.style.display="block",h.classList.toggle("previa-linha-traco--sem-cor",o),h.style.setProperty("--traco-px",`${Math.max(1,this._espessura)}px`),h.style.setProperty("--traco-cor",o?"":a))):(u&&(u.style.display="none"),h&&(h.style.display="none"),p&&(p.classList.toggle("previa-cor--sem-cor",f),p.style.backgroundColor=f?"":m,p.style.opacity=f?"":String(this.inicial.opacidade)),r&&(r.classList.toggle("previa-cor--sem-cor",o),r.style.backgroundColor=o?"":a,r.style.opacity=o?"":String(this._opacidade)));const y=e(".previa-rotulo-nova");y&&(y.textContent=this._misto?"MISTO (?)":"NOVA");const k=e(".hex-entrada");k&&!this.campoEmFoco(k)&&(k.value=o?"":a.slice(1).toUpperCase(),k.placeholder=o?"NENHUM":"00E08A");const S=e(".nativo-entrada");S&&(S.value=o?"#00e08a":a),["espessura","opacidade"].forEach(x=>{const w=e(`.${x}-entrada`);if(!w)return;const C=this.valorCampo(x);this.campoEmFoco(w)||(w.value=C),w.setAttribute("aria-valuenow",C),w.setAttribute("aria-valuetext",x==="opacidade"?`${C}%`:`${C} px`)});const g=e(".sem-cor");g==null||g.classList.toggle("ativo",o),g==null||g.setAttribute("aria-pressed",String(o))}campoEmFoco(e){try{return this.raiz.activeElement===e}catch{return!1}}vincularEventos(){const e=this.raiz;e.querySelectorAll("[data-alvo]").forEach(i=>{this.listeners.add(i,"click",()=>this.trocarAlvo(i.dataset.alvo))}),e.querySelectorAll("[data-cor]").forEach(i=>{this.listeners.add(i,"click",()=>this.definirCor(i.dataset.cor||""))}),e.querySelectorAll("[data-passo]").forEach(i=>{this.listeners.add(i,"click",n=>{this.ajustarPor(i.dataset.passo,Number(i.dataset.direcao),n.shiftKey)})}),["espessura","opacidade"].forEach(i=>{const n=e.querySelector(`.${i}-entrada`);if(!n)return;const v=(c,m)=>{this.ajustarPor(i,c,m),n.value=this.valorCampo(i)};this.listeners.add(n,"change",()=>this.lerCampo(i,n)),this.listeners.add(n,"keydown",c=>{c.key==="Enter"?(c.preventDefault(),this.lerCampo(i,n),n.select()):(c.key==="ArrowUp"||c.key==="ArrowDown")&&(c.preventDefault(),v(c.key==="ArrowUp"?1:-1,c.shiftKey),n.select())}),this.listeners.add(n,"wheel",c=>{!this.campoEmFoco(n)||c.deltaY===0||(c.preventDefault(),v(c.deltaY<0?1:-1,c.shiftKey))},{passive:!1})});const a=e.querySelector(".hex-entrada"),o=i=>{const n=a.value.trim().replace(/^#/,"");(/^[0-9a-f]{6}$/i.test(n)||i&&/^[0-9a-f]{3}$/i.test(n))&&this.definirCor(`#${n}`)};a&&(this.listeners.add(a,"input",()=>o(!1)),this.listeners.add(a,"change",()=>{o(!0),this.atualizarVisual()}),this.listeners.add(a,"keydown",i=>{i.key==="Enter"&&(i.preventDefault(),o(!0),this.confirmar())}));const l=e.querySelector(".nativo-entrada");l&&this.listeners.add(l,"input",()=>this.definirCor(l.value)),this.listeners.add(e.querySelector('[data-acao="fechar"]'),"click",()=>this.confirmar()),this.listeners.add(e.querySelector('[data-acao="concluir"]'),"click",()=>this.confirmar()),this.listeners.add(e.querySelector('[data-acao="cancelar"]'),"click",()=>this.cancelar())}valorCampo(e){return String(e==="opacidade"?Math.round(this._opacidade*100):this._espessura)}ajustarPor(e,a,o=!1){if(!Number.isFinite(a)||a===0)return;const l=Math.sign(a)*F[e]*(o?10:1);e==="opacidade"?this.definirOpacidade((Math.round(this._opacidade*100)+l)/100):this.definirEspessura(this._espessura+l)}lerCampo(e,a){const o=parseFloat(a.value.replace(",",".").replace(/[^\d.+-]/g,""));Number.isFinite(o)&&(e==="opacidade"?this.definirOpacidade(o/100):this.definirEspessura(o)),a.value=this.valorCampo(e)}emitir(e,a){this.dispatchEvent(new CustomEvent(e,{detail:a,bubbles:!0,composed:!0}))}}j.definirCustomElement("ui-seletor-cor",q);let b=null;function D(s){b==null||b.descartar();const t=document.createElement("ui-seletor-cor"),{ancora:e,focar:a,aoAlterar:o,aoConfirmar:l,aoCancelar:i,aoTrocarAlvo:n,...v}=s;t.configurar(v);const c=new A.ListenerBag;let m=!0;const f=()=>{if(!m)return!1;m=!1,c.cleanup();const r=document.activeElement===t;return t.remove(),r&&e instanceof HTMLElement&&e.isConnected&&e.focus({preventScroll:!0}),b===p&&(b=null),!0};t.aoDesconectar=()=>f();const p={elemento:t,get aberto(){return m},fechar(r=!0){r?t.confirmar():f()},descartar(){f()}};return c.add(t,"ui-cor-input",r=>o==null?void 0:o(r.detail)),c.add(t,"ui-cor-confirmar",r=>{f()&&(l==null||l(r.detail))}),c.add(t,"ui-cor-cancelar",r=>{f()&&(i==null||i(r.detail))}),c.add(t,"ui-alvo-change",r=>{r.stopPropagation(),n==null||n(r.detail.alvo)}),c.add(t,"pointerdown",r=>r.stopPropagation()),c.add(t,"click",r=>r.stopPropagation()),document.body.appendChild(t),$(t,e),b=p,a&&t.focus({preventScroll:!0}),c.add(window,"resize",()=>$(t,e)),c.add(window,"pointerdown",r=>{const u=r.composedPath();!u.includes(t)&&!u.includes(e)&&p.fechar(!0)},!0),c.add(window,"keydown",r=>{var h,y;if(r.key==="Escape"){r.preventDefault(),r.stopPropagation(),p.fechar(!0);return}const u=(y=(h=r.composedPath()[0])==null?void 0:h.matches)==null?void 0:y.call(h,'input[type="text"]');(r.key==="x"||r.key==="X")&&!r.ctrlKey&&!r.metaKey&&!r.altKey&&!r.shiftKey&&!u&&(r.preventDefault(),r.stopPropagation(),t.trocarAlvo(t.alvo==="preenchimento"?"traco":"preenchimento"))},!0),p}function V(s=!0){b==null||b.fechar(s)}function $(s,t){const a=t.getBoundingClientRect(),o=s.offsetWidth,l=s.offsetHeight;let i=a.right+10;i+o>window.innerWidth-10&&(i=Math.max(10,a.left-o-10));let n=a.top;n+l>window.innerHeight-10&&(n=Math.max(10,window.innerHeight-l-10)),s.style.left=`${Math.round(i)}px`,s.style.top=`${Math.round(n)}px`}exports.PALETA_CORES_PADRAO=N;exports.UISeletorCor=q;exports.abrirSeletorCor=D;exports.coresUnicas=T;exports.escaparHtml=M;exports.fecharSeletorCor=V;exports.normalizarCor=_;exports.normalizarEspessura=z;exports.normalizarOpacidade=E;
|