@thibezer/ui-components-kit 2.24.1 → 2.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +83 -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 +26 -0
- package/dist/components/ui-canvas-prancha/ui-canvas-prancha-base.d.ts +9 -0
- package/dist/components/ui-canvas-prancha/ui-canvas-prancha.d.ts +2 -2
- package/dist/components/ui-editor-prancha/editor-barra.d.ts +19 -0
- package/dist/components/ui-editor-prancha/editor-modos.d.ts +35 -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 +63 -7
- package/dist/core/alvo-digitavel.d.ts +3 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +43 -54
- 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 +11945 -11071
- 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-BmkPi5Rz.cjs +2 -0
- package/dist/kit-base-CBXA66aM.js +1084 -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 +3470 -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 +7 -3
- package/dist/tipos-vue.d.ts +6 -3
- package/dist/tools.cjs +16 -1
- package/dist/tools.js +1564 -26
- package/dist/{ui-seletor-cor-Cd8jkzXG.js → ui-seletor-cor-CPjA9vhZ.js} +8 -9
- package/dist/ui-seletor-cor-D_ifitEN.cjs +83 -0
- 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-C-EJoKnm.js +0 -150
- package/dist/ui-card-DFnRp9bl.js +0 -146
- package/dist/ui-card-DrWVJQKw.cjs +0 -20
- package/dist/ui-card-DsIjHMmG.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/ui-bus-CUd99VJi.js
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
var u = Object.defineProperty;
|
|
2
|
-
var c = (o, e, t) => e in o ? u(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
-
var a = (o, e, t) => c(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
class f {
|
|
5
|
-
constructor() {
|
|
6
|
-
a(this, "provedorToast", null);
|
|
7
|
-
a(this, "listeners", /* @__PURE__ */ new Map());
|
|
8
|
-
a(this, "_observandoSistema", !1);
|
|
9
|
-
this.observarTemaDoSistema();
|
|
10
|
-
}
|
|
11
|
-
on(e, t) {
|
|
12
|
-
return this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set()), this.listeners.get(e).add(t), () => this.off(e, t);
|
|
13
|
-
}
|
|
14
|
-
once(e, t) {
|
|
15
|
-
const r = (i) => {
|
|
16
|
-
this.off(e, r), t(i);
|
|
17
|
-
};
|
|
18
|
-
this.on(e, r);
|
|
19
|
-
}
|
|
20
|
-
off(e, t) {
|
|
21
|
-
const r = this.listeners.get(e);
|
|
22
|
-
r && (r.delete(t), r.size === 0 && this.listeners.delete(e));
|
|
23
|
-
}
|
|
24
|
-
emit(e, t) {
|
|
25
|
-
const r = this.listeners.get(e);
|
|
26
|
-
r && r.forEach((i) => {
|
|
27
|
-
try {
|
|
28
|
-
i(t);
|
|
29
|
-
} catch (s) {
|
|
30
|
-
console.error(`[UIBus] Erro ao executar ouvinte do evento "${e}":`, s);
|
|
31
|
-
}
|
|
32
|
-
}), typeof window < "u" && window.dispatchEvent(
|
|
33
|
-
new CustomEvent(`uibus:${e}`, {
|
|
34
|
-
detail: t,
|
|
35
|
-
bubbles: !0,
|
|
36
|
-
composed: !0
|
|
37
|
-
})
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
/* ====================================================
|
|
41
|
-
Métodos de Atalho e Ações de Alta Produtividade
|
|
42
|
-
==================================================== */
|
|
43
|
-
/**
|
|
44
|
-
* Abre um modal pelo seu ID no documento.
|
|
45
|
-
*/
|
|
46
|
-
abrirModal(e) {
|
|
47
|
-
if (typeof document > "u") return !1;
|
|
48
|
-
const t = document.getElementById(e);
|
|
49
|
-
return t && typeof t.abrir == "function" ? (t.abrir(), this.emit("modal:aberto", { id: e }), !0) : t ? (t.setAttribute("aberto", ""), this.emit("modal:aberto", { id: e }), !0) : (console.warn(`[UIBus] Modal com ID "${e}" não encontrado no DOM.`), !1);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Fecha um modal pelo seu ID ou todos os modais abertos se nenhum ID for passado.
|
|
53
|
-
* Retorna `false` se o modal não existir ou continuar aberto (`bloquear-fechamento`).
|
|
54
|
-
*/
|
|
55
|
-
fecharModal(e) {
|
|
56
|
-
if (typeof document > "u") return !1;
|
|
57
|
-
if (e) {
|
|
58
|
-
const t = document.getElementById(e);
|
|
59
|
-
return t && typeof t.fechar == "function" ? (t.fechar(), t.hasAttribute("aberto") || t.hasAttribute("open") ? !1 : (this.emit("modal:fechado", { id: e }), !0)) : t ? (t.removeAttribute("aberto"), t.removeAttribute("open"), this.emit("modal:fechado", { id: e }), !0) : !1;
|
|
60
|
-
} else
|
|
61
|
-
return document.querySelectorAll(
|
|
62
|
-
"ui-modal[aberto], ui-modal[open], ui-dialog[aberto], ui-dialog[open]"
|
|
63
|
-
).forEach((r) => {
|
|
64
|
-
typeof r.fechar == "function" ? r.fechar() : (r.removeAttribute("aberto"), r.removeAttribute("open"));
|
|
65
|
-
}), this.emit("modal:fechado-todos"), !0;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Abre um painel lateral (drawer / sheet) pelo seu ID no documento.
|
|
69
|
-
*/
|
|
70
|
-
abrirDrawer(e) {
|
|
71
|
-
if (typeof document > "u") return !1;
|
|
72
|
-
const t = document.getElementById(e);
|
|
73
|
-
return t && typeof t.abrir == "function" ? (t.abrir(), this.emit("drawer:aberto", { id: e }), !0) : t ? (t.setAttribute("aberto", ""), this.emit("drawer:aberto", { id: e }), !0) : (console.warn(`[UIBus] Drawer com ID "${e}" não encontrado no DOM.`), !1);
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Fecha um painel lateral (drawer / sheet) pelo seu ID ou todos se nenhum for passado.
|
|
77
|
-
*/
|
|
78
|
-
fecharDrawer(e) {
|
|
79
|
-
if (typeof document > "u") return !1;
|
|
80
|
-
if (e) {
|
|
81
|
-
const t = document.getElementById(e);
|
|
82
|
-
return t && typeof t.fechar == "function" ? (t.fechar(), this.emit("drawer:fechado", { id: e }), !0) : t ? (t.removeAttribute("aberto"), t.removeAttribute("open"), this.emit("drawer:fechado", { id: e }), !0) : !1;
|
|
83
|
-
} else
|
|
84
|
-
return document.querySelectorAll(
|
|
85
|
-
"ui-drawer[aberto], ui-drawer[open], ui-sheet[aberto], ui-sheet[open]"
|
|
86
|
-
).forEach((r) => {
|
|
87
|
-
typeof r.fechar == "function" ? r.fechar() : (r.removeAttribute("aberto"), r.removeAttribute("open"));
|
|
88
|
-
}), this.emit("drawer:fechado-todos"), !0;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Dispara uma notificação toast flutuante inteligente.
|
|
92
|
-
*/
|
|
93
|
-
notificar(e) {
|
|
94
|
-
const t = this.provedorToast;
|
|
95
|
-
if (t)
|
|
96
|
-
try {
|
|
97
|
-
t(typeof e == "string" ? { mensagem: e, tipo: "info" } : e);
|
|
98
|
-
} catch (r) {
|
|
99
|
-
console.error("Erro ao exibir toast:", r);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Registra (ou remove, com `null`) o provedor que materializa os toasts.
|
|
104
|
-
* O `ui-toast` se registra sozinho ao ser carregado; sem provedor, `notificar` é no-op.
|
|
105
|
-
*/
|
|
106
|
-
registrarProvedorToast(e) {
|
|
107
|
-
this.provedorToast = e;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Copia um texto para a área de transferência do usuário e exibe feedback opcional.
|
|
111
|
-
*/
|
|
112
|
-
async copiar(e, t) {
|
|
113
|
-
if (typeof navigator > "u" || !navigator.clipboard)
|
|
114
|
-
return !1;
|
|
115
|
-
try {
|
|
116
|
-
return await navigator.clipboard.writeText(e), t !== void 0 && this.notificar({
|
|
117
|
-
tipo: "sucesso",
|
|
118
|
-
mensagem: t || "Copiado para a área de transferência!"
|
|
119
|
-
}), this.emit("clipboard:copiado", { texto: e }), !0;
|
|
120
|
-
} catch (r) {
|
|
121
|
-
return console.error("[UIBus] Falha ao copiar texto:", r), this.notificar({
|
|
122
|
-
tipo: "erro",
|
|
123
|
-
mensagem: "Não foi possível copiar o texto."
|
|
124
|
-
}), !1;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Altera a densidade visual global do kit (compacta, normal ou relaxada).
|
|
129
|
-
*/
|
|
130
|
-
definirDensidade(e) {
|
|
131
|
-
let t = 34;
|
|
132
|
-
typeof e == "number" ? t = Math.max(15, e) : e === "compacta" ? t = 26 : e === "relaxada" ? t = 42 : t = 34, !(typeof document > "u") && (document.documentElement.style.setProperty("--ui-altura-minima", `${t}px`), document.documentElement.style.setProperty("--ui-campo-altura", `${t}px`), document.documentElement.setAttribute("data-ui-densidade", typeof e == "string" ? e : "custom"), this.emit("densidade:alterada", { densidade: e, alturaPx: t }));
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Tema em vigor: o forçado na raiz (`data-tema`, `data-theme`, `.dark`/`.light`)
|
|
136
|
-
* ou, sem nenhum, o do sistema operacional (`prefers-color-scheme`).
|
|
137
|
-
*/
|
|
138
|
-
obterTema() {
|
|
139
|
-
if (typeof document > "u") return "escuro";
|
|
140
|
-
const e = n(document.documentElement);
|
|
141
|
-
return e || (m() ? "claro" : "escuro");
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Define o tema global. Sem argumento, alterna o tema em vigor;
|
|
145
|
-
* `'auto'` remove o tema forçado e volta a seguir o sistema operacional.
|
|
146
|
-
*/
|
|
147
|
-
definirTema(e) {
|
|
148
|
-
if (typeof document > "u") return e === "claro" ? "claro" : "escuro";
|
|
149
|
-
const t = document.documentElement;
|
|
150
|
-
if (e === "auto")
|
|
151
|
-
t.removeAttribute("data-tema"), t.removeAttribute("data-theme"), t.classList.remove("dark", "light");
|
|
152
|
-
else {
|
|
153
|
-
const i = e || (this.obterTema() === "escuro" ? "claro" : "escuro");
|
|
154
|
-
t.setAttribute("data-tema", i), t.classList.toggle("dark", i === "escuro"), t.classList.toggle("light", i === "claro");
|
|
155
|
-
}
|
|
156
|
-
const r = this.obterTema();
|
|
157
|
-
return this.emit("tema:alterado", { tema: r }), r;
|
|
158
|
-
}
|
|
159
|
-
/** Com o tema seguindo o SO, avisa `tema:alterado` quando o usuário troca o tema do sistema. */
|
|
160
|
-
observarTemaDoSistema() {
|
|
161
|
-
var e, t;
|
|
162
|
-
this._observandoSistema || typeof window > "u" || typeof window.matchMedia != "function" || (this._observandoSistema = !0, (t = (e = window.matchMedia("(prefers-color-scheme: light)")).addEventListener) == null || t.call(e, "change", () => {
|
|
163
|
-
n(document.documentElement) || this.emit("tema:alterado", { tema: this.obterTema() });
|
|
164
|
-
}));
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
function n(o) {
|
|
168
|
-
const e = o.getAttribute("data-tema") || o.getAttribute("data-theme");
|
|
169
|
-
return e === "escuro" || e === "dark" ? "escuro" : e === "claro" || e === "light" ? "claro" : o.classList.contains("dark") ? "escuro" : o.classList.contains("light") ? "claro" : null;
|
|
170
|
-
}
|
|
171
|
-
function m() {
|
|
172
|
-
return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-color-scheme: light)").matches;
|
|
173
|
-
}
|
|
174
|
-
const l = new f();
|
|
175
|
-
export {
|
|
176
|
-
l as U
|
|
177
|
-
};
|
package/dist/ui-bus-XqBLlTYQ.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var u=Object.defineProperty;var c=(o,e,t)=>e in o?u(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var a=(o,e,t)=>c(o,typeof e!="symbol"?e+"":e,t);class f{constructor(){a(this,"provedorToast",null);a(this,"listeners",new Map);a(this,"_observandoSistema",!1);this.observarTemaDoSistema()}on(e,t){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t),()=>this.off(e,t)}once(e,t){const r=i=>{this.off(e,r),t(i)};this.on(e,r)}off(e,t){const r=this.listeners.get(e);r&&(r.delete(t),r.size===0&&this.listeners.delete(e))}emit(e,t){const r=this.listeners.get(e);r&&r.forEach(i=>{try{i(t)}catch(s){console.error(`[UIBus] Erro ao executar ouvinte do evento "${e}":`,s)}}),typeof window<"u"&&window.dispatchEvent(new CustomEvent(`uibus:${e}`,{detail:t,bubbles:!0,composed:!0}))}abrirModal(e){if(typeof document>"u")return!1;const t=document.getElementById(e);return t&&typeof t.abrir=="function"?(t.abrir(),this.emit("modal:aberto",{id:e}),!0):t?(t.setAttribute("aberto",""),this.emit("modal:aberto",{id:e}),!0):(console.warn(`[UIBus] Modal com ID "${e}" não encontrado no DOM.`),!1)}fecharModal(e){if(typeof document>"u")return!1;if(e){const t=document.getElementById(e);return t&&typeof t.fechar=="function"?(t.fechar(),t.hasAttribute("aberto")||t.hasAttribute("open")?!1:(this.emit("modal:fechado",{id:e}),!0)):t?(t.removeAttribute("aberto"),t.removeAttribute("open"),this.emit("modal:fechado",{id:e}),!0):!1}else return document.querySelectorAll("ui-modal[aberto], ui-modal[open], ui-dialog[aberto], ui-dialog[open]").forEach(r=>{typeof r.fechar=="function"?r.fechar():(r.removeAttribute("aberto"),r.removeAttribute("open"))}),this.emit("modal:fechado-todos"),!0}abrirDrawer(e){if(typeof document>"u")return!1;const t=document.getElementById(e);return t&&typeof t.abrir=="function"?(t.abrir(),this.emit("drawer:aberto",{id:e}),!0):t?(t.setAttribute("aberto",""),this.emit("drawer:aberto",{id:e}),!0):(console.warn(`[UIBus] Drawer com ID "${e}" não encontrado no DOM.`),!1)}fecharDrawer(e){if(typeof document>"u")return!1;if(e){const t=document.getElementById(e);return t&&typeof t.fechar=="function"?(t.fechar(),this.emit("drawer:fechado",{id:e}),!0):t?(t.removeAttribute("aberto"),t.removeAttribute("open"),this.emit("drawer:fechado",{id:e}),!0):!1}else return document.querySelectorAll("ui-drawer[aberto], ui-drawer[open], ui-sheet[aberto], ui-sheet[open]").forEach(r=>{typeof r.fechar=="function"?r.fechar():(r.removeAttribute("aberto"),r.removeAttribute("open"))}),this.emit("drawer:fechado-todos"),!0}notificar(e){const t=this.provedorToast;if(t)try{t(typeof e=="string"?{mensagem:e,tipo:"info"}:e)}catch(r){console.error("Erro ao exibir toast:",r)}}registrarProvedorToast(e){this.provedorToast=e}async copiar(e,t){if(typeof navigator>"u"||!navigator.clipboard)return!1;try{return await navigator.clipboard.writeText(e),t!==void 0&&this.notificar({tipo:"sucesso",mensagem:t||"Copiado para a área de transferência!"}),this.emit("clipboard:copiado",{texto:e}),!0}catch(r){return console.error("[UIBus] Falha ao copiar texto:",r),this.notificar({tipo:"erro",mensagem:"Não foi possível copiar o texto."}),!1}}definirDensidade(e){let t=34;typeof e=="number"?t=Math.max(15,e):e==="compacta"?t=26:e==="relaxada"?t=42:t=34,!(typeof document>"u")&&(document.documentElement.style.setProperty("--ui-altura-minima",`${t}px`),document.documentElement.style.setProperty("--ui-campo-altura",`${t}px`),document.documentElement.setAttribute("data-ui-densidade",typeof e=="string"?e:"custom"),this.emit("densidade:alterada",{densidade:e,alturaPx:t}))}obterTema(){if(typeof document>"u")return"escuro";const e=n(document.documentElement);return e||(m()?"claro":"escuro")}definirTema(e){if(typeof document>"u")return e==="claro"?"claro":"escuro";const t=document.documentElement;if(e==="auto")t.removeAttribute("data-tema"),t.removeAttribute("data-theme"),t.classList.remove("dark","light");else{const i=e||(this.obterTema()==="escuro"?"claro":"escuro");t.setAttribute("data-tema",i),t.classList.toggle("dark",i==="escuro"),t.classList.toggle("light",i==="claro")}const r=this.obterTema();return this.emit("tema:alterado",{tema:r}),r}observarTemaDoSistema(){var e,t;this._observandoSistema||typeof window>"u"||typeof window.matchMedia!="function"||(this._observandoSistema=!0,(t=(e=window.matchMedia("(prefers-color-scheme: light)")).addEventListener)==null||t.call(e,"change",()=>{n(document.documentElement)||this.emit("tema:alterado",{tema:this.obterTema()})}))}}function n(o){const e=o.getAttribute("data-tema")||o.getAttribute("data-theme");return e==="escuro"||e==="dark"?"escuro":e==="claro"||e==="light"?"claro":o.classList.contains("dark")?"escuro":o.classList.contains("light")?"claro":null}function m(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: light)").matches}const d=new f;exports.UIBus=d;
|