dev-environment-widget 0.0.0-stage → 1.2.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/README.md CHANGED
@@ -1,3 +1,84 @@
1
- # Temporary Holding Version
1
+ # DevEnvironmentWidget
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Componente flutuante e barra de ambiente para Vue 3 no padrão canônico do CRC (PUC Minas).
4
+
5
+ Permite alternância controlada entre os ambientes **Produção** e **Canary**, simulação em tempo real de **Roles** na store do Pinia (sem tocar no Keycloak) e **limpeza atômica de caches do PWA / Service Worker** antes do reload.
6
+
7
+ ---
8
+
9
+ ## 1. Instalação
10
+
11
+ Adicione como dependência do projeto:
12
+
13
+ ```bash
14
+ npm install dev-environment-widget
15
+ ```
16
+
17
+ Ou no monorepo/submódulo local:
18
+ ```json
19
+ "dependencies": {
20
+ "dev-environment-widget": "file:../dev-environment-widget"
21
+ }
22
+ ```
23
+
24
+ ---
25
+
26
+ ## 2. Como Usar
27
+
28
+ ### 2.1. Registro Global (Plugin)
29
+ Em `main.ts`:
30
+
31
+ ```typescript
32
+ import { createApp } from 'vue'
33
+ import App from './App.vue'
34
+ import { DevEnvironmentWidgetPlugin } from 'dev-environment-widget'
35
+ import 'dev-environment-widget/dist/style.css'
36
+
37
+ const app = createApp(App)
38
+ app.use(DevEnvironmentWidgetPlugin)
39
+ app.mount('#app')
40
+ ```
41
+
42
+ ### 2.2. Inclusão no Layout Raiz (`App.vue`)
43
+ Em `App.vue`:
44
+
45
+ ```vue
46
+ <script setup lang="ts">
47
+ import { DevEnvironmentWidget } from 'dev-environment-widget'
48
+ import 'dev-environment-widget/dist/style.css'
49
+ import { APP_VERSION } from '@/config/version'
50
+ </script>
51
+
52
+ <template>
53
+ <router-view />
54
+
55
+ <!-- Renderizado via Teleport no body exclusivamente para desenvolvedores -->
56
+ <DevEnvironmentWidget
57
+ nome-sistema="sistec"
58
+ :versao-app="APP_VERSION"
59
+ :roles-disponiveis="['SISTEC_DEV', 'SISTEC_ADMIN', 'SISTEC_TECNICO', 'CANARY']"
60
+ />
61
+ </template>
62
+ ```
63
+
64
+ ---
65
+
66
+ ## 3. Propriedades (Props)
67
+
68
+ | Propriedade | Tipo | Padrão | Descrição |
69
+ | :--- | :--- | :--- | :--- |
70
+ | `nomeSistema` | `string` | `'sistema'` | Slug do sistema (ex.: `sistec`, `labblock`, `sgl`). Usado para o cookie canary `<sistema>_canary`. |
71
+ | `versaoApp` | `string` | `'dev'` | Versão atual da aplicação exibida no cabeçalho do widget. |
72
+ | `roleDev` | `string` | `'DEV'` | Role que concede visibilidade ao widget em produção. |
73
+ | `nomeCookieCanary` | `string` | `<nomeSistema>_canary` | Nome do cookie inspecionado pelo APISIX para roteamento canary. |
74
+ | `rolesDisponiveis` | `string[]` | `['DEV', 'ADMIN', ...]` | Lista de roles sugeridas para simulação rápida no Pinia. |
75
+ | `habilitado` | `boolean` | `undefined` | Força a exibição ou ocultação do widget independente de roles. |
76
+
77
+ ---
78
+
79
+ ## 4. Recursos e Padrões Atendidos
80
+
81
+ - **Linha Roxa Fixa no Topo (3px):** Sinaliza visualmente no topo da viewport a ativação do modo de desenvolvimento. Em ambiente Canary, transiciona para tons âmbar/vermelho.
82
+ - **Roteamento Canary via Cookie e Role:** Alterna instantaneamente o cookie institucional `<sistema>_canary`, disparando a limpeza de caches para garantir a visualização da versão correta servida pelo APISIX.
83
+ - **Simulador de Roles no Pinia:** Modifica a store `keycloakStore` (de `v-keycloak-store`) em memória, permitindo testar telas, botões protegidos e permissões sem precisar alterar os grupos do usuário no Keycloak.
84
+ - **Limpeza Atômica de Cache:** Desregistra os Service Workers ativos, limpa a API `caches` do navegador e o `sessionStorage`, e executa o reload da página.
@@ -0,0 +1 @@
1
+ .dev-linha-vermelha-topo[data-v-8af06332]{position:fixed;top:0;left:0;right:0;height:3px;background:#b22222;box-shadow:0 1px 4px #b2222273;z-index:2147483647;pointer-events:none}.dev-widget-flutuante[data-v-8af06332]{position:fixed;z-index:2147483646;-webkit-user-select:none;user-select:none}.dev-botao-gatilho[data-v-8af06332]{display:inline-flex;align-items:center;gap:6px;background:#202020;color:#ffffffd9;border:1px solid rgba(255,255,255,.12);border-radius:20px;padding:4px 10px;box-shadow:0 4px 16px #00000073;cursor:grab;font-family:ui-sans-serif,-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif;font-size:11px;font-weight:500;transition:all .15s ease}.dev-botao-gatilho[data-v-8af06332]:hover{background:#282828;border-color:#fff3;color:#fff;box-shadow:0 6px 20px #0000008c}.dev-icone-engrenagem-svg[data-v-8af06332]{width:13px;height:13px;opacity:.75;display:block}.dev-icone-svg[data-v-8af06332]{width:14px;height:14px;display:block}.dev-icone-svg-sm[data-v-8af06332]{width:12px;height:12px;display:block}.dev-alca-icone-svg[data-v-8af06332]{width:11px;height:11px;display:block;opacity:.45}.dev-icone-btn-svg[data-v-8af06332]{width:13px;height:13px;display:inline-block;vertical-align:middle;flex-shrink:0}.dev-badge-ambiente[data-v-8af06332]{background:#ffffff14;color:#ffffffb3;border:1px solid rgba(255,255,255,.1);padding:1px 5px;border-radius:4px;font-size:9px;font-weight:600;letter-spacing:.4px}.dev-badge-ambiente.is-dev[data-v-8af06332]{background:#9d72ff2e;color:#c4a7ff;border-color:#9d72ff59}.dev-painel-flutuante[data-v-8af06332]{position:absolute;bottom:38px;right:0;min-width:260px;max-width:min(92vw,650px);min-height:230px;max-height:min(85vh,750px);background:#191919;color:#ffffffe6;border:1px solid rgba(255,255,255,.1);border-radius:10px;box-shadow:0 16px 38px #000000a6,0 0 0 1px #ffffff0d;padding:14px;font-family:ui-sans-serif,-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif;font-size:12px;display:flex;flex-direction:column;overflow:hidden;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.2) transparent}.dev-painel-flutuante.abrir-para-direita[data-v-8af06332]{right:auto;left:0}.dev-painel-flutuante.abrir-para-direita .dev-alca-redimensionar[data-v-8af06332]{left:auto;right:3px}.dev-cabecalho-acoes[data-v-8af06332]{display:flex;align-items:center;gap:4px}.dev-botao-ima[data-v-8af06332]{background:transparent;border:none;font-size:11px;cursor:pointer;padding:2px 4px;border-radius:4px;opacity:.55;transition:all .15s ease;line-height:1}.dev-botao-ima[data-v-8af06332]:hover{opacity:1;background:#ffffff14}.dev-botao-ima.ativo[data-v-8af06332]{opacity:.95}.dev-alca-redimensionar[data-v-8af06332]{position:absolute;top:3px;left:3px;width:14px;height:14px;cursor:nwse-resize;display:flex;align-items:center;justify-content:center;color:#ffffff40;font-size:11px;-webkit-user-select:none;user-select:none;transition:color .15s ease;z-index:10}.dev-alca-redimensionar[data-v-8af06332]:hover{color:#c4a7ff}.dev-alca-icone[data-v-8af06332]{transform:rotate(90deg);display:inline-block;line-height:1}.dev-cabecalho[data-v-8af06332]{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid rgba(255,255,255,.07);padding-bottom:9px;margin-bottom:12px}.dev-titulo-container[data-v-8af06332]{display:flex;align-items:center;gap:7px;padding-left:10px}.dev-titulo-texto[data-v-8af06332]{font-weight:600;font-size:12px;color:#fffffff2;letter-spacing:.3px}.dev-versao-tag[data-v-8af06332]{background:#ffffff0f;color:#ffffff80;border:1px solid rgba(255,255,255,.08);padding:1px 6px;border-radius:4px;font-size:10px}.dev-botao-fechar[data-v-8af06332]{background:transparent;border:none;color:#fff6;cursor:pointer;font-size:13px;padding:2px 6px;line-height:1;border-radius:4px;transition:all .15s ease}.dev-botao-fechar[data-v-8af06332]:hover{background:#ffffff14;color:#ffffffe6}.dev-secao[data-v-8af06332]{margin-bottom:11px}.dev-rotulo[data-v-8af06332]{display:block;font-size:11px;font-weight:500;color:#ffffff73;margin-bottom:6px}.dev-grupo-botoes[data-v-8af06332]{display:flex;gap:6px}.dev-opcao-ambiente[data-v-8af06332]{flex:1;padding:6px 10px;background:#232323;color:#ffffffa6;border:1px solid rgba(255,255,255,.07);border-radius:6px;font-size:11px;font-weight:500;cursor:pointer;transition:all .15s ease}.dev-opcao-ambiente[data-v-8af06332]:hover{background:#2a2a2a;color:#ffffffe6}.dev-opcao-ambiente.ativo[data-v-8af06332]{background:#2eaadc26;border-color:#2eaadc59;color:#56c2ea;font-weight:600}.dev-opcao-ambiente.dev.ativo[data-v-8af06332]{background:#9d72ff2e;border-color:#9d72ff66;color:#c4a7ff;font-weight:600}.dev-linha-flex[data-v-8af06332]{display:flex;align-items:center;justify-content:space-between;margin-bottom:6px}.dev-toggle-simulacao[data-v-8af06332]{background:#232323;color:#ffffff80;border:1px solid rgba(255,255,255,.08);border-radius:4px;padding:2px 8px;font-size:10px;font-weight:500;cursor:pointer;transition:all .15s ease}.dev-toggle-simulacao[data-v-8af06332]:hover{background:#2a2a2a;color:#ffffffd9}.dev-toggle-simulacao.ativa[data-v-8af06332]{background:#4dab9a2e;border-color:#4dab9a59;color:#6dd3be;font-weight:600}.dev-lista-roles[data-v-8af06332]{display:grid;grid-template-columns:repeat(2,1fr);gap:5px;flex:1;min-height:70px;max-height:180px;overflow-y:auto;background:#202020;padding:7px;border:1px solid rgba(255,255,255,.06);border-radius:6px;margin-bottom:7px}.dev-item-role[data-v-8af06332]{display:flex;align-items:center;gap:6px;font-size:10px;color:#ffffffbf;cursor:pointer;-webkit-user-select:none;user-select:none;padding:2px 4px;border-radius:4px;transition:background .1s ease}.dev-item-role[data-v-8af06332]:hover{background:#ffffff0a}.dev-checkbox-role[data-v-8af06332]{accent-color:#9d72ff;cursor:pointer}.dev-adicionar-role-container[data-v-8af06332]{display:flex;gap:5px}.dev-campo-role[data-v-8af06332]{flex:1;background:#202020;border:1px solid rgba(255,255,255,.1);color:#ffffffe6;padding:4px 8px;border-radius:4px;font-size:11px;transition:border-color .15s ease}.dev-campo-role[data-v-8af06332]:focus{outline:none;border-color:#9d72ff}.dev-botao-adicionar[data-v-8af06332]{background:#ffffff14;color:#ffffffd9;border:1px solid rgba(255,255,255,.1);padding:3px 9px;border-radius:4px;cursor:pointer;font-weight:600;transition:all .15s ease}.dev-botao-adicionar[data-v-8af06332]:hover{background:#ffffff24;color:#fff}.dev-secao-rodape[data-v-8af06332]{display:flex;gap:8px;align-items:center;border-top:1px solid rgba(255,255,255,.07);padding-top:9px;margin-top:auto}.dev-botao-simular-rodape[data-v-8af06332]{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;gap:5px;background:#232323;color:#ffffffb3;border:1px solid rgba(255,255,255,.12);border-radius:6px;padding:6px 12px;font-size:11px;font-weight:500;cursor:pointer;transition:all .15s ease;white-space:nowrap}.dev-botao-simular-rodape[data-v-8af06332]:hover{background:#2a2a2a;color:#fff;border-color:#fff3}.dev-botao-simular-rodape.ativa[data-v-8af06332]{background:#4dab9a2e;border-color:#4dab9a59;color:#6dd3be;font-weight:600}.dev-botao-limpeza[data-v-8af06332]{flex:1;display:inline-flex;align-items:center;justify-content:center;gap:6px;background:#eb57571f;color:#ff7878;border:1px solid rgba(235,87,87,.25);padding:6px 10px;border-radius:6px;font-size:11px;font-weight:500;cursor:pointer;transition:all .15s ease;white-space:nowrap;text-align:center}.dev-botao-limpeza[data-v-8af06332]:hover{background:#eb575738;border-color:#eb575766;color:#ff9494}
@@ -0,0 +1,657 @@
1
+ import { computed as W, ref as w, onMounted as re, onUnmounted as ue, defineComponent as de, openBlock as x, createBlock as ve, Teleport as me, unref as c, createElementBlock as D, Fragment as K, createElementVNode as t, normalizeStyle as ne, withModifiers as z, normalizeClass as N, toDisplayString as q, renderList as pe, withDirectives as fe, withKeys as ge, isRef as he, vModelText as we, createCommentVNode as ie } from "vue";
2
+ import { getActivePinia as ye } from "pinia";
3
+ function ce() {
4
+ const a = [""];
5
+ try {
6
+ const u = window.location.hostname;
7
+ if (u.includes(".")) {
8
+ const d = u.split(".");
9
+ d.length >= 3 && a.push(`.${d.slice(-3).join(".")}`), d.length >= 2 && a.push(`.${d.slice(-2).join(".")}`);
10
+ }
11
+ } catch {
12
+ }
13
+ return Array.from(new Set(a));
14
+ }
15
+ async function ae() {
16
+ try {
17
+ if ("serviceWorker" in navigator) {
18
+ const a = await navigator.serviceWorker.getRegistrations();
19
+ for (const u of a)
20
+ await u.unregister();
21
+ }
22
+ if ("caches" in window) {
23
+ const a = await caches.keys();
24
+ for (const u of a)
25
+ await caches.delete(u);
26
+ }
27
+ sessionStorage.clear();
28
+ } catch (a) {
29
+ console.error("Falha ao limpar caches:", a);
30
+ } finally {
31
+ window.location.reload();
32
+ }
33
+ }
34
+ function ke(a) {
35
+ const u = document.cookie.match(new RegExp(`(^|;\\s*)(${a})=([^;]*)`));
36
+ return u ? decodeURIComponent(u[3]) : null;
37
+ }
38
+ function se(a, u, d = 30) {
39
+ const v = /* @__PURE__ */ new Date();
40
+ v.setTime(v.getTime() + d * 24 * 60 * 60 * 1e3);
41
+ const _ = v.toUTCString(), C = ce();
42
+ for (const b of C) {
43
+ const T = b ? `; domain=${b}` : "";
44
+ document.cookie = `${a}=${encodeURIComponent(u)}; expires=${_}; path=/${T}; SameSite=Lax`;
45
+ }
46
+ }
47
+ function le(a) {
48
+ const u = ce();
49
+ for (const d of u) {
50
+ const v = d ? `; domain=${d}` : "";
51
+ document.cookie = `${a}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/${v}; SameSite=Lax`, document.cookie = `${a}=; max-age=0; path=/${v}; SameSite=Lax`;
52
+ }
53
+ }
54
+ const ee = "dev_widget_simulacao_ativa", oe = "dev_widget_roles_simuladas", te = "dev_widget_roles_originais";
55
+ function Se(a = {}) {
56
+ const u = a.nomeSistema || "app", d = a.nomeCookieCanary || `${u}_canary`, v = W(() => a.roleDev ? Array.isArray(a.roleDev) ? a.roleDev.map((e) => String(e).toUpperCase()) : [String(a.roleDev).toUpperCase()] : ["DEV"]), _ = w(!1), C = w(window.innerWidth - 70), b = w(window.innerHeight - 80), T = w(!1), p = w(!1), y = w([]), f = w([]), Y = w("");
57
+ try {
58
+ if (sessionStorage.getItem(ee) === "true") {
59
+ p.value = !0;
60
+ const l = sessionStorage.getItem(oe);
61
+ l && (f.value = JSON.parse(l));
62
+ const i = sessionStorage.getItem(te);
63
+ i && (y.value = JSON.parse(i));
64
+ }
65
+ } catch {
66
+ }
67
+ const j = w(!1);
68
+ function Q() {
69
+ const e = ke(d);
70
+ return e === "true" || e === "1";
71
+ }
72
+ const Z = W(() => j.value ? "canary" : "producao");
73
+ function O(e) {
74
+ e === "canary" ? (se(d, "true"), se("canary", "true")) : (le(d), le("canary")), ae();
75
+ }
76
+ const $ = w(null), A = w(null);
77
+ function g() {
78
+ try {
79
+ const e = ye() || window.__pinia || window[Symbol.for("pinia")];
80
+ if (e && e._s) {
81
+ if (e._s.has("keycloakStore")) return e._s.get("keycloakStore");
82
+ if (e._s.has("keycloak")) return e._s.get("keycloak");
83
+ const i = Array.from(e._s.values()).find((r) => r.$id && r.$id.toLowerCase().includes("keycloak"));
84
+ if (i) return i;
85
+ }
86
+ } catch {
87
+ }
88
+ return null;
89
+ }
90
+ let E = null;
91
+ function P(e) {
92
+ e && typeof e.$subscribe == "function" && !E && (E = e.$subscribe(
93
+ () => {
94
+ if (p.value) {
95
+ const l = e.roles || [];
96
+ (l.length !== f.value.length || !f.value.every((r) => l.includes(r))) && S();
97
+ }
98
+ },
99
+ { detached: !0 }
100
+ ));
101
+ }
102
+ function H() {
103
+ var l, i, r, h;
104
+ const e = g();
105
+ if (e) {
106
+ if ($.value === null && "is_superuser" in e && ($.value = e.is_superuser), A.value === null && "is_staff" in e && (A.value = e.is_staff), y.value.length === 0) {
107
+ const m = e.roles || e.groups || [];
108
+ let R = Array.isArray(m) ? [...m].map((n) => String(n).replace(/^\//, "")) : [];
109
+ const k = e.keycloakInstance;
110
+ if (k != null && k.tokenParsed) {
111
+ const n = ((i = (l = k.tokenParsed) == null ? void 0 : l.realm_access) == null ? void 0 : i.roles) || [], o = ((r = k.tokenParsed) == null ? void 0 : r.groups) || [], s = ((h = k.tokenParsed) == null ? void 0 : h.roles) || [], U = [...R, ...n, ...o, ...s];
112
+ R = Array.from(new Set(U)).map((B) => String(B).replace(/^\//, ""));
113
+ }
114
+ if (R.length > 0) {
115
+ y.value = R;
116
+ try {
117
+ sessionStorage.setItem(te, JSON.stringify(y.value));
118
+ } catch {
119
+ }
120
+ }
121
+ }
122
+ p.value ? S() : f.value = [...y.value], P(e);
123
+ }
124
+ }
125
+ function L() {
126
+ p.value = !0, S();
127
+ }
128
+ function I() {
129
+ p.value = !1, f.value = [...y.value], S();
130
+ }
131
+ function X() {
132
+ I();
133
+ }
134
+ function G(e) {
135
+ const l = f.value.indexOf(e);
136
+ l >= 0 ? f.value.splice(l, 1) : f.value.push(e), p.value = !0, S();
137
+ }
138
+ function J() {
139
+ const e = Y.value.trim().toUpperCase();
140
+ e && !f.value.includes(e) && (f.value.push(e), Y.value = "", p.value = !0, S());
141
+ }
142
+ function S() {
143
+ const e = g();
144
+ if (e) {
145
+ const l = p.value ? [...f.value] : [...y.value];
146
+ e.simulandoRoles = p.value, "roles" in e && (e.roles = [...l]), "groups" in e && (e.groups = [...l]);
147
+ const i = e.keycloakInstance;
148
+ if (i)
149
+ if (!i._originalHasRealmRole && typeof i.hasRealmRole == "function" && (i._originalHasRealmRole = i.hasRealmRole), !i._originalHasResourceRole && typeof i.hasResourceRole == "function" && (i._originalHasResourceRole = i.hasResourceRole), p.value) {
150
+ const r = l.map((h) => String(h).replace(/^\/+|\/+$/g, "").trim().toUpperCase());
151
+ i.hasRealmRole = (h) => {
152
+ const m = String(h).replace(/^\/+|\/+$/g, "").trim().toUpperCase();
153
+ return r.includes(m);
154
+ }, i.hasResourceRole = (h) => {
155
+ const m = String(h).replace(/^\/+|\/+$/g, "").trim().toUpperCase();
156
+ return r.includes(m);
157
+ };
158
+ } else
159
+ i._originalHasRealmRole && (i.hasRealmRole = i._originalHasRealmRole), i._originalHasResourceRole && (i.hasResourceRole = i._originalHasResourceRole);
160
+ if (p.value) {
161
+ const r = l.some((h) => {
162
+ const m = String(h).toUpperCase();
163
+ return m === "DEV" || m.includes("_DEV") || m === "ADMIN" || m.includes("_ADMIN");
164
+ });
165
+ "is_superuser" in e && (e.is_superuser = r), "is_staff" in e && (e.is_staff = r);
166
+ try {
167
+ sessionStorage.setItem(ee, "true"), sessionStorage.setItem(oe, JSON.stringify(f.value)), y.value.length > 0 && sessionStorage.setItem(te, JSON.stringify(y.value));
168
+ } catch {
169
+ }
170
+ } else {
171
+ "is_superuser" in e && $.value !== null && (e.is_superuser = $.value), "is_staff" in e && A.value !== null && (e.is_staff = A.value);
172
+ try {
173
+ sessionStorage.removeItem(ee), sessionStorage.removeItem(oe);
174
+ } catch {
175
+ }
176
+ }
177
+ }
178
+ }
179
+ const F = W(() => {
180
+ var h, m, R;
181
+ if (a.habilitado !== void 0)
182
+ return a.habilitado;
183
+ const e = g();
184
+ if (!e)
185
+ return !1;
186
+ const l = y.value.length > 0 ? [...y.value] : [...e.roles || [], ...e.groups || []], i = e.keycloakInstance;
187
+ if (i != null && i.tokenParsed) {
188
+ const k = ((m = (h = i.tokenParsed) == null ? void 0 : h.realm_access) == null ? void 0 : m.roles) || [], n = ((R = i.tokenParsed) == null ? void 0 : R.groups) || [];
189
+ l.push(...k, ...n);
190
+ }
191
+ const r = l.map(
192
+ (k) => String(k).replace(/^\//, "").toUpperCase()
193
+ );
194
+ return v.value.some((k) => r.includes(k)) || r.includes(`${u.toUpperCase()}_DEV`) || r.includes(`${u.toUpperCase()}2_DEV`) || r.includes("SISTEC_DEV") || r.includes("DEV");
195
+ });
196
+ let M = null;
197
+ const V = () => {
198
+ p.value && S();
199
+ };
200
+ return re(() => {
201
+ j.value = Q(), H(), window.addEventListener("popstate", V), M = setInterval(() => {
202
+ const e = g();
203
+ if (e) {
204
+ if (E || P(e), y.value.length === 0)
205
+ H();
206
+ else if (p.value) {
207
+ const l = e.roles || [];
208
+ (l.length !== f.value.length || !f.value.every((r) => l.includes(r))) && S();
209
+ }
210
+ }
211
+ }, 1e3);
212
+ }), ue(() => {
213
+ window.removeEventListener("popstate", V), M && (clearInterval(M), M = null), E && (E(), E = null);
214
+ }), {
215
+ painelAberto: _,
216
+ posicaoX: C,
217
+ posicaoY: b,
218
+ arrastando: T,
219
+ ambienteAtual: Z,
220
+ ehCanaryCookie: j,
221
+ simulacaoAtiva: p,
222
+ rolesOriginais: y,
223
+ rolesSimuladas: f,
224
+ novaRoleInput: Y,
225
+ usuarioTemPermissaoDev: F,
226
+ alternarAmbiente: O,
227
+ ativarSimulacaoRoles: L,
228
+ desativarSimulacaoRoles: I,
229
+ resetarSimulacaoRoles: X,
230
+ alternarRole: G,
231
+ adicionarRolePersonalizada: J,
232
+ executarLimpezaAtomicaCaches: ae
233
+ };
234
+ }
235
+ const Re = ["title"], _e = { class: "dev-cabecalho" }, be = { class: "dev-titulo-container" }, xe = { class: "dev-titulo-texto" }, Ce = { class: "dev-versao-tag" }, Ae = { class: "dev-cabecalho-acoes" }, Ee = ["title"], Ie = {
236
+ key: 0,
237
+ class: "dev-icone-svg",
238
+ viewBox: "0 0 24 24",
239
+ fill: "none",
240
+ stroke: "currentColor",
241
+ "stroke-width": "2",
242
+ "stroke-linecap": "round",
243
+ "stroke-linejoin": "round"
244
+ }, De = {
245
+ key: 1,
246
+ class: "dev-icone-svg",
247
+ viewBox: "0 0 24 24",
248
+ fill: "none",
249
+ stroke: "currentColor",
250
+ "stroke-width": "2",
251
+ "stroke-linecap": "round",
252
+ "stroke-linejoin": "round"
253
+ }, $e = { class: "dev-secao" }, Le = { class: "dev-grupo-botoes" }, Me = { class: "dev-secao" }, Ve = { class: "dev-lista-roles" }, Oe = ["checked", "onChange"], Pe = { class: "dev-adicionar-role-container" }, Ue = { class: "dev-secao-rodape" }, Ne = ["title"], Te = /* @__PURE__ */ de({
254
+ __name: "DevEnvironmentWidget",
255
+ props: {
256
+ versaoApp: { default: "dev" },
257
+ nomeSistema: { default: "sistema" },
258
+ roleDev: { default: "DEV" },
259
+ nomeCookieCanary: { default: void 0 },
260
+ habilitado: { type: Boolean, default: void 0 },
261
+ rolesDisponiveis: { default: () => ["DEV", "ADMIN", "TECNICO", "USUARIO", "CANARY"] }
262
+ },
263
+ setup(a) {
264
+ const u = a, {
265
+ painelAberto: d,
266
+ posicaoX: v,
267
+ posicaoY: _,
268
+ ambienteAtual: C,
269
+ simulacaoAtiva: b,
270
+ rolesSimuladas: T,
271
+ novaRoleInput: p,
272
+ usuarioTemPermissaoDev: y,
273
+ alternarAmbiente: f,
274
+ ativarSimulacaoRoles: Y,
275
+ desativarSimulacaoRoles: j,
276
+ resetarSimulacaoRoles: Q,
277
+ alternarRole: Z,
278
+ adicionarRolePersonalizada: O,
279
+ executarLimpezaAtomicaCaches: $
280
+ } = Se(u), A = W(() => C.value === "producao" ? "PROD" : "DEV"), g = w(!0);
281
+ function E() {
282
+ g.value = !g.value;
283
+ try {
284
+ localStorage.setItem("dev_widget_ima", String(g.value));
285
+ } catch {
286
+ }
287
+ g.value && P();
288
+ }
289
+ function P() {
290
+ if (!g.value) return;
291
+ const n = 86, o = 10, s = window.innerWidth / 2;
292
+ v.value + n / 2 < s ? v.value = o : v.value = Math.max(o, window.innerWidth - n - o);
293
+ try {
294
+ localStorage.setItem("dev_widget_x", String(v.value)), localStorage.setItem("dev_widget_y", String(_.value));
295
+ } catch {
296
+ }
297
+ }
298
+ const H = W(() => v.value < 220), L = w(300), I = w(360), X = w(!1);
299
+ let G = 300, J = 360, S = 0, F = 0;
300
+ function M(n) {
301
+ X.value = !0;
302
+ const o = "touches" in n ? n.touches[0].clientX : n.clientX, s = "touches" in n ? n.touches[0].clientY : n.clientY;
303
+ S = o, F = s, G = L.value, J = I.value, window.addEventListener("mousemove", V), window.addEventListener("mouseup", e), window.addEventListener("touchmove", V), window.addEventListener("touchend", e);
304
+ }
305
+ function V(n) {
306
+ if (!X.value) return;
307
+ const o = "touches" in n ? n.touches[0].clientX : n.clientX, s = "touches" in n ? n.touches[0].clientY : n.clientY, U = H.value ? o - S : S - o, B = F - s;
308
+ L.value = Math.max(260, Math.min(window.innerWidth - 30, G + U)), I.value = Math.max(220, Math.min(window.innerHeight - 60, J + B));
309
+ }
310
+ function e() {
311
+ X.value = !1, window.removeEventListener("mousemove", V), window.removeEventListener("mouseup", e), window.removeEventListener("touchmove", V), window.removeEventListener("touchend", e);
312
+ try {
313
+ localStorage.setItem("dev_widget_w", String(L.value)), localStorage.setItem("dev_widget_h", String(I.value));
314
+ } catch {
315
+ }
316
+ }
317
+ re(() => {
318
+ try {
319
+ const n = localStorage.getItem("dev_widget_ima");
320
+ n !== null && (g.value = n !== "false");
321
+ const o = localStorage.getItem("dev_widget_w"), s = localStorage.getItem("dev_widget_h");
322
+ o && (L.value = Math.max(260, Math.min(window.innerWidth - 30, parseInt(o, 10)))), s && (I.value = Math.max(220, Math.min(window.innerHeight - 60, parseInt(s, 10))));
323
+ } catch {
324
+ }
325
+ g.value && P();
326
+ });
327
+ const l = w(!1);
328
+ let i = 0, r = 0;
329
+ function h(n) {
330
+ l.value = !0;
331
+ const o = "touches" in n ? n.touches[0].clientX : n.clientX, s = "touches" in n ? n.touches[0].clientY : n.clientY;
332
+ i = o - v.value, r = s - _.value, window.addEventListener("mousemove", m), window.addEventListener("mouseup", R), window.addEventListener("touchmove", m), window.addEventListener("touchend", R);
333
+ }
334
+ function m(n) {
335
+ if (!l.value) return;
336
+ const o = "touches" in n ? n.touches[0].clientX : n.clientX, s = "touches" in n ? n.touches[0].clientY : n.clientY, U = Math.max(10, Math.min(window.innerWidth - 60, o - i)), B = Math.max(10, Math.min(window.innerHeight - 60, s - r));
337
+ v.value = U, _.value = B;
338
+ }
339
+ function R() {
340
+ if (l.value = !1, window.removeEventListener("mousemove", m), window.removeEventListener("mouseup", R), window.removeEventListener("touchmove", m), window.removeEventListener("touchend", R), g.value)
341
+ P();
342
+ else
343
+ try {
344
+ localStorage.setItem("dev_widget_x", String(v.value)), localStorage.setItem("dev_widget_y", String(_.value));
345
+ } catch {
346
+ }
347
+ }
348
+ function k() {
349
+ d.value = !d.value;
350
+ }
351
+ return (n, o) => (x(), ve(me, { to: "body" }, [
352
+ c(y) ? (x(), D(K, { key: 0 }, [
353
+ o[22] || (o[22] = t("div", { class: "dev-linha-vermelha-topo" }, null, -1)),
354
+ t("div", {
355
+ class: "dev-widget-flutuante",
356
+ style: ne({ left: `${c(v)}px`, top: `${c(_)}px` }),
357
+ onMousedown: h,
358
+ onTouchstartPassive: h
359
+ }, [
360
+ t("button", {
361
+ type: "button",
362
+ class: "dev-botao-gatilho",
363
+ title: `Ambiente: ${A.value} | v${a.versaoApp}${g.value ? " (Ímã ativo)" : ""}`,
364
+ onClick: z(k, ["stop"])
365
+ }, [
366
+ o[10] || (o[10] = t("svg", {
367
+ class: "dev-icone-engrenagem-svg",
368
+ viewBox: "0 0 24 24",
369
+ fill: "none",
370
+ stroke: "currentColor",
371
+ "stroke-width": "2",
372
+ "stroke-linecap": "round",
373
+ "stroke-linejoin": "round"
374
+ }, [
375
+ t("circle", {
376
+ cx: "12",
377
+ cy: "12",
378
+ r: "3"
379
+ }),
380
+ t("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z" })
381
+ ], -1)),
382
+ t("span", {
383
+ class: N(["dev-badge-ambiente", { "is-dev": A.value === "DEV" }])
384
+ }, q(A.value), 3)
385
+ ], 8, Re),
386
+ c(d) ? (x(), D("div", {
387
+ key: 0,
388
+ class: N(["dev-painel-flutuante", { "abrir-para-direita": H.value }]),
389
+ style: ne({ width: `${L.value}px`, height: `${I.value}px` }),
390
+ onMousedown: o[8] || (o[8] = z(() => {
391
+ }, ["stop"])),
392
+ onTouchstart: o[9] || (o[9] = z(() => {
393
+ }, ["stop"]))
394
+ }, [
395
+ t("div", {
396
+ class: "dev-alca-redimensionar",
397
+ title: "Arraste para redimensionar",
398
+ onMousedown: z(M, ["stop", "prevent"]),
399
+ onTouchstartPassive: z(M, ["stop"])
400
+ }, [...o[11] || (o[11] = [
401
+ t("svg", {
402
+ class: "dev-alca-icone-svg",
403
+ viewBox: "0 0 16 16",
404
+ fill: "currentColor"
405
+ }, [
406
+ t("circle", {
407
+ cx: "4",
408
+ cy: "12",
409
+ r: "1.5"
410
+ }),
411
+ t("circle", {
412
+ cx: "8",
413
+ cy: "12",
414
+ r: "1.5"
415
+ }),
416
+ t("circle", {
417
+ cx: "12",
418
+ cy: "12",
419
+ r: "1.5"
420
+ }),
421
+ t("circle", {
422
+ cx: "8",
423
+ cy: "8",
424
+ r: "1.5"
425
+ }),
426
+ t("circle", {
427
+ cx: "12",
428
+ cy: "8",
429
+ r: "1.5"
430
+ }),
431
+ t("circle", {
432
+ cx: "12",
433
+ cy: "4",
434
+ r: "1.5"
435
+ })
436
+ ], -1)
437
+ ])], 32),
438
+ t("div", _e, [
439
+ t("div", be, [
440
+ t("span", xe, q(a.nomeSistema.toUpperCase()), 1),
441
+ t("span", Ce, "v" + q(a.versaoApp), 1)
442
+ ]),
443
+ t("div", Ae, [
444
+ t("button", {
445
+ type: "button",
446
+ class: N(["dev-botao-ima", { ativo: g.value }]),
447
+ title: g.value ? "Ímã na borda ativo (clique para soltar)" : "Ímã desativado (clique para prender na borda)",
448
+ onClick: E
449
+ }, [
450
+ g.value ? (x(), D("svg", Ie, [...o[12] || (o[12] = [
451
+ t("path", { d: "M6 3v7a6 6 0 0 0 12 0V3" }, null, -1),
452
+ t("line", {
453
+ x1: "4",
454
+ y1: "3",
455
+ x2: "8",
456
+ y2: "3"
457
+ }, null, -1),
458
+ t("line", {
459
+ x1: "16",
460
+ y1: "3",
461
+ x2: "20",
462
+ y2: "3"
463
+ }, null, -1),
464
+ t("line", {
465
+ x1: "4",
466
+ y1: "8",
467
+ x2: "8",
468
+ y2: "8"
469
+ }, null, -1),
470
+ t("line", {
471
+ x1: "16",
472
+ y1: "8",
473
+ x2: "20",
474
+ y2: "8"
475
+ }, null, -1)
476
+ ])])) : (x(), D("svg", De, [...o[13] || (o[13] = [
477
+ t("rect", {
478
+ x: "3",
479
+ y: "11",
480
+ width: "18",
481
+ height: "11",
482
+ rx: "2",
483
+ ry: "2"
484
+ }, null, -1),
485
+ t("path", { d: "M7 11V7a5 5 0 0 1 9.9-1" }, null, -1)
486
+ ])]))
487
+ ], 10, Ee),
488
+ t("button", {
489
+ type: "button",
490
+ class: "dev-botao-fechar",
491
+ title: "Fechar painel",
492
+ onClick: o[0] || (o[0] = (s) => d.value = !1)
493
+ }, [...o[14] || (o[14] = [
494
+ t("svg", {
495
+ class: "dev-icone-svg-sm",
496
+ viewBox: "0 0 24 24",
497
+ fill: "none",
498
+ stroke: "currentColor",
499
+ "stroke-width": "2",
500
+ "stroke-linecap": "round",
501
+ "stroke-linejoin": "round"
502
+ }, [
503
+ t("line", {
504
+ x1: "18",
505
+ y1: "6",
506
+ x2: "6",
507
+ y2: "18"
508
+ }),
509
+ t("line", {
510
+ x1: "6",
511
+ y1: "6",
512
+ x2: "18",
513
+ y2: "18"
514
+ })
515
+ ], -1)
516
+ ])])
517
+ ])
518
+ ]),
519
+ t("div", $e, [
520
+ o[15] || (o[15] = t("label", { class: "dev-rotulo" }, "Ambiente Ativo:", -1)),
521
+ t("div", Le, [
522
+ t("button", {
523
+ type: "button",
524
+ class: N(["dev-opcao-ambiente", { ativo: c(C) === "producao" }]),
525
+ onClick: o[1] || (o[1] = (s) => c(f)("producao"))
526
+ }, " Produção ", 2),
527
+ t("button", {
528
+ type: "button",
529
+ class: N(["dev-opcao-ambiente dev", { ativo: c(C) === "canary" || c(C) === "desenvolvimento" }]),
530
+ onClick: o[2] || (o[2] = (s) => c(f)("canary"))
531
+ }, " DEV ", 2)
532
+ ])
533
+ ]),
534
+ t("div", Me, [
535
+ o[16] || (o[16] = t("div", { class: "dev-linha-flex" }, [
536
+ t("label", { class: "dev-rotulo" }, "Simulação de Roles:")
537
+ ], -1)),
538
+ t("div", Ve, [
539
+ (x(!0), D(K, null, pe(a.rolesDisponiveis, (s) => (x(), D("label", {
540
+ key: s,
541
+ class: "dev-item-role"
542
+ }, [
543
+ t("input", {
544
+ type: "checkbox",
545
+ class: "dev-checkbox-role",
546
+ checked: c(T).includes(s),
547
+ onChange: (U) => c(Z)(s)
548
+ }, null, 40, Oe),
549
+ t("span", null, q(s), 1)
550
+ ]))), 128))
551
+ ]),
552
+ t("div", Pe, [
553
+ fe(t("input", {
554
+ "onUpdate:modelValue": o[3] || (o[3] = (s) => he(p) ? p.value = s : null),
555
+ type: "text",
556
+ placeholder: "NOVA_ROLE",
557
+ class: "dev-campo-role",
558
+ onKeyup: o[4] || (o[4] = ge(
559
+ //@ts-ignore
560
+ (...s) => c(O) && c(O)(...s),
561
+ ["enter"]
562
+ ))
563
+ }, null, 544), [
564
+ [we, c(p)]
565
+ ]),
566
+ t("button", {
567
+ type: "button",
568
+ class: "dev-botao-adicionar",
569
+ title: "Adicionar Role",
570
+ onClick: o[5] || (o[5] = //@ts-ignore
571
+ (...s) => c(O) && c(O)(...s))
572
+ }, " + ")
573
+ ])
574
+ ]),
575
+ t("div", Ue, [
576
+ t("button", {
577
+ type: "button",
578
+ class: N(["dev-botao-simular-rodape", { ativa: c(b) }]),
579
+ title: c(b) ? "Restaurar roles originais do token" : "Ativar simulação de roles",
580
+ onClick: o[6] || (o[6] = (s) => c(b) ? c(Q)() : c(Y)())
581
+ }, [
582
+ c(b) ? (x(), D(K, { key: 0 }, [
583
+ o[17] || (o[17] = t("svg", {
584
+ class: "dev-icone-btn-svg",
585
+ viewBox: "0 0 24 24",
586
+ fill: "none",
587
+ stroke: "currentColor",
588
+ "stroke-width": "2",
589
+ "stroke-linecap": "round",
590
+ "stroke-linejoin": "round"
591
+ }, [
592
+ t("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }),
593
+ t("path", { d: "M3 3v5h5" })
594
+ ], -1)),
595
+ o[18] || (o[18] = t("span", null, "Resetar", -1))
596
+ ], 64)) : (x(), D(K, { key: 1 }, [
597
+ o[19] || (o[19] = t("svg", {
598
+ class: "dev-icone-btn-svg",
599
+ viewBox: "0 0 24 24",
600
+ fill: "none",
601
+ stroke: "currentColor",
602
+ "stroke-width": "2",
603
+ "stroke-linecap": "round",
604
+ "stroke-linejoin": "round"
605
+ }, [
606
+ t("polygon", { points: "5 3 19 12 5 21 5 3" })
607
+ ], -1)),
608
+ o[20] || (o[20] = t("span", null, "Simular", -1))
609
+ ], 64))
610
+ ], 10, Ne),
611
+ t("button", {
612
+ type: "button",
613
+ class: "dev-botao-limpeza",
614
+ onClick: o[7] || (o[7] = //@ts-ignore
615
+ (...s) => c($) && c($)(...s))
616
+ }, [...o[21] || (o[21] = [
617
+ t("svg", {
618
+ class: "dev-icone-btn-svg",
619
+ viewBox: "0 0 24 24",
620
+ fill: "none",
621
+ stroke: "currentColor",
622
+ "stroke-width": "2",
623
+ "stroke-linecap": "round",
624
+ "stroke-linejoin": "round"
625
+ }, [
626
+ t("polyline", { points: "23 4 23 10 17 10" }),
627
+ t("polyline", { points: "1 20 1 14 7 14" }),
628
+ t("path", { d: "M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15" })
629
+ ], -1),
630
+ t("span", null, "Limpar Caches & Recarregar", -1)
631
+ ])])
632
+ ])
633
+ ], 38)) : ie("", !0)
634
+ ], 36)
635
+ ], 64)) : ie("", !0)
636
+ ]));
637
+ }
638
+ }), Ye = (a, u) => {
639
+ const d = a.__vccOpts || a;
640
+ for (const [v, _] of u)
641
+ d[v] = _;
642
+ return d;
643
+ }, He = /* @__PURE__ */ Ye(Te, [["__scopeId", "data-v-8af06332"]]), ze = {
644
+ install(a) {
645
+ a.component("DevEnvironmentWidget", He);
646
+ }
647
+ };
648
+ export {
649
+ He as DevEnvironmentWidget,
650
+ ze as DevEnvironmentWidgetPlugin,
651
+ He as default,
652
+ se as definirCookie,
653
+ ae as executarLimpezaAtomicaCaches,
654
+ ke as obterCookie,
655
+ le as removerCookie,
656
+ Se as useDevEnvironment
657
+ };
@@ -0,0 +1 @@
1
+ (function(h,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("pinia")):typeof define=="function"&&define.amd?define(["exports","vue","pinia"],e):(h=typeof globalThis<"u"?globalThis:h||self,e(h.DevEnvironmentWidget={},h.Vue,h.Pinia))})(this,(function(h,e,oe){"use strict";function Z(){const i=[""];try{const c=window.location.hostname;if(c.includes(".")){const d=c.split(".");d.length>=3&&i.push(`.${d.slice(-3).join(".")}`),d.length>=2&&i.push(`.${d.slice(-2).join(".")}`)}}catch{}return Array.from(new Set(i))}async function X(){try{if("serviceWorker"in navigator){const i=await navigator.serviceWorker.getRegistrations();for(const c of i)await c.unregister()}if("caches"in window){const i=await caches.keys();for(const c of i)await caches.delete(c)}sessionStorage.clear()}catch(i){console.error("Falha ao limpar caches:",i)}finally{window.location.reload()}}function ee(i){const c=document.cookie.match(new RegExp(`(^|;\\s*)(${i})=([^;]*)`));return c?decodeURIComponent(c[3]):null}function W(i,c,d=30){const m=new Date;m.setTime(m.getTime()+d*24*60*60*1e3);const S=m.toUTCString(),N=Z();for(const V of N){const L=V?`; domain=${V}`:"";document.cookie=`${i}=${encodeURIComponent(c)}; expires=${S}; path=/${L}; SameSite=Lax`}}function j(i){const c=Z();for(const d of c){const m=d?`; domain=${d}`:"";document.cookie=`${i}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/${m}; SameSite=Lax`,document.cookie=`${i}=; max-age=0; path=/${m}; SameSite=Lax`}}const F="dev_widget_simulacao_ativa",G="dev_widget_roles_simuladas",J="dev_widget_roles_originais";function te(i={}){const c=i.nomeSistema||"app",d=i.nomeCookieCanary||`${c}_canary`,m=e.computed(()=>i.roleDev?Array.isArray(i.roleDev)?i.roleDev.map(t=>String(t).toUpperCase()):[String(i.roleDev).toUpperCase()]:["DEV"]),S=e.ref(!1),N=e.ref(window.innerWidth-70),V=e.ref(window.innerHeight-80),L=e.ref(!1),f=e.ref(!1),E=e.ref([]),p=e.ref([]),B=e.ref("");try{if(sessionStorage.getItem(F)==="true"){f.value=!0;const r=sessionStorage.getItem(G);r&&(p.value=JSON.parse(r));const a=sessionStorage.getItem(J);a&&(E.value=JSON.parse(a))}}catch{}const U=e.ref(!1);function K(){const t=ee(d);return t==="true"||t==="1"}const Q=e.computed(()=>U.value?"canary":"producao");function I(t){t==="canary"?(W(d,"true"),W("canary","true")):(j(d),j("canary")),X()}const b=e.ref(null),R=e.ref(null);function g(){try{const t=oe.getActivePinia()||window.__pinia||window[Symbol.for("pinia")];if(t&&t._s){if(t._s.has("keycloakStore"))return t._s.get("keycloakStore");if(t._s.has("keycloak"))return t._s.get("keycloak");const a=Array.from(t._s.values()).find(l=>l.$id&&l.$id.toLowerCase().includes("keycloak"));if(a)return a}}catch{}return null}let C=null;function M(t){t&&typeof t.$subscribe=="function"&&!C&&(C=t.$subscribe(()=>{if(f.value){const r=t.roles||[];(r.length!==p.value.length||!p.value.every(l=>r.includes(l)))&&y()}},{detached:!0}))}function P(){var r,a,l,v;const t=g();if(t){if(b.value===null&&"is_superuser"in t&&(b.value=t.is_superuser),R.value===null&&"is_staff"in t&&(R.value=t.is_staff),E.value.length===0){const u=t.roles||t.groups||[];let k=Array.isArray(u)?[...u].map(n=>String(n).replace(/^\//,"")):[];const w=t.keycloakInstance;if(w!=null&&w.tokenParsed){const n=((a=(r=w.tokenParsed)==null?void 0:r.realm_access)==null?void 0:a.roles)||[],o=((l=w.tokenParsed)==null?void 0:l.groups)||[],s=((v=w.tokenParsed)==null?void 0:v.roles)||[],$=[...k,...n,...o,...s];k=Array.from(new Set($)).map(T=>String(T).replace(/^\//,""))}if(k.length>0){E.value=k;try{sessionStorage.setItem(J,JSON.stringify(E.value))}catch{}}}f.value?y():p.value=[...E.value],M(t)}}function x(){f.value=!0,y()}function _(){f.value=!1,p.value=[...E.value],y()}function O(){_()}function z(t){const r=p.value.indexOf(t);r>=0?p.value.splice(r,1):p.value.push(t),f.value=!0,y()}function Y(){const t=B.value.trim().toUpperCase();t&&!p.value.includes(t)&&(p.value.push(t),B.value="",f.value=!0,y())}function y(){const t=g();if(t){const r=f.value?[...p.value]:[...E.value];t.simulandoRoles=f.value,"roles"in t&&(t.roles=[...r]),"groups"in t&&(t.groups=[...r]);const a=t.keycloakInstance;if(a)if(!a._originalHasRealmRole&&typeof a.hasRealmRole=="function"&&(a._originalHasRealmRole=a.hasRealmRole),!a._originalHasResourceRole&&typeof a.hasResourceRole=="function"&&(a._originalHasResourceRole=a.hasResourceRole),f.value){const l=r.map(v=>String(v).replace(/^\/+|\/+$/g,"").trim().toUpperCase());a.hasRealmRole=v=>{const u=String(v).replace(/^\/+|\/+$/g,"").trim().toUpperCase();return l.includes(u)},a.hasResourceRole=v=>{const u=String(v).replace(/^\/+|\/+$/g,"").trim().toUpperCase();return l.includes(u)}}else a._originalHasRealmRole&&(a.hasRealmRole=a._originalHasRealmRole),a._originalHasResourceRole&&(a.hasResourceRole=a._originalHasResourceRole);if(f.value){const l=r.some(v=>{const u=String(v).toUpperCase();return u==="DEV"||u.includes("_DEV")||u==="ADMIN"||u.includes("_ADMIN")});"is_superuser"in t&&(t.is_superuser=l),"is_staff"in t&&(t.is_staff=l);try{sessionStorage.setItem(F,"true"),sessionStorage.setItem(G,JSON.stringify(p.value)),E.value.length>0&&sessionStorage.setItem(J,JSON.stringify(E.value))}catch{}}else{"is_superuser"in t&&b.value!==null&&(t.is_superuser=b.value),"is_staff"in t&&R.value!==null&&(t.is_staff=R.value);try{sessionStorage.removeItem(F),sessionStorage.removeItem(G)}catch{}}}}const H=e.computed(()=>{var v,u,k;if(i.habilitado!==void 0)return i.habilitado;const t=g();if(!t)return!1;const r=E.value.length>0?[...E.value]:[...t.roles||[],...t.groups||[]],a=t.keycloakInstance;if(a!=null&&a.tokenParsed){const w=((u=(v=a.tokenParsed)==null?void 0:v.realm_access)==null?void 0:u.roles)||[],n=((k=a.tokenParsed)==null?void 0:k.groups)||[];r.push(...w,...n)}const l=r.map(w=>String(w).replace(/^\//,"").toUpperCase());return m.value.some(w=>l.includes(w))||l.includes(`${c.toUpperCase()}_DEV`)||l.includes(`${c.toUpperCase()}2_DEV`)||l.includes("SISTEC_DEV")||l.includes("DEV")});let A=null;const D=()=>{f.value&&y()};return e.onMounted(()=>{U.value=K(),P(),window.addEventListener("popstate",D),A=setInterval(()=>{const t=g();if(t){if(C||M(t),E.value.length===0)P();else if(f.value){const r=t.roles||[];(r.length!==p.value.length||!p.value.every(l=>r.includes(l)))&&y()}}},1e3)}),e.onUnmounted(()=>{window.removeEventListener("popstate",D),A&&(clearInterval(A),A=null),C&&(C(),C=null)}),{painelAberto:S,posicaoX:N,posicaoY:V,arrastando:L,ambienteAtual:Q,ehCanaryCookie:U,simulacaoAtiva:f,rolesOriginais:E,rolesSimuladas:p,novaRoleInput:B,usuarioTemPermissaoDev:H,alternarAmbiente:I,ativarSimulacaoRoles:x,desativarSimulacaoRoles:_,resetarSimulacaoRoles:O,alternarRole:z,adicionarRolePersonalizada:Y,executarLimpezaAtomicaCaches:X}}const ne=["title"],ae={class:"dev-cabecalho"},ie={class:"dev-titulo-container"},se={class:"dev-titulo-texto"},re={class:"dev-versao-tag"},le={class:"dev-cabecalho-acoes"},ce=["title"],de={key:0,class:"dev-icone-svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},me={key:1,class:"dev-icone-svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},ue={class:"dev-secao"},fe={class:"dev-grupo-botoes"},pe={class:"dev-secao"},ge={class:"dev-lista-roles"},ve=["checked","onChange"],he={class:"dev-adicionar-role-container"},Ee={class:"dev-secao-rodape"},we=["title"],q=((i,c)=>{const d=i.__vccOpts||i;for(const[m,S]of c)d[m]=S;return d})(e.defineComponent({__name:"DevEnvironmentWidget",props:{versaoApp:{default:"dev"},nomeSistema:{default:"sistema"},roleDev:{default:"DEV"},nomeCookieCanary:{default:void 0},habilitado:{type:Boolean,default:void 0},rolesDisponiveis:{default:()=>["DEV","ADMIN","TECNICO","USUARIO","CANARY"]}},setup(i){const c=i,{painelAberto:d,posicaoX:m,posicaoY:S,ambienteAtual:N,simulacaoAtiva:V,rolesSimuladas:L,novaRoleInput:f,usuarioTemPermissaoDev:E,alternarAmbiente:p,ativarSimulacaoRoles:B,desativarSimulacaoRoles:U,resetarSimulacaoRoles:K,alternarRole:Q,adicionarRolePersonalizada:I,executarLimpezaAtomicaCaches:b}=te(c),R=e.computed(()=>N.value==="producao"?"PROD":"DEV"),g=e.ref(!0);function C(){g.value=!g.value;try{localStorage.setItem("dev_widget_ima",String(g.value))}catch{}g.value&&M()}function M(){if(!g.value)return;const n=86,o=10,s=window.innerWidth/2;m.value+n/2<s?m.value=o:m.value=Math.max(o,window.innerWidth-n-o);try{localStorage.setItem("dev_widget_x",String(m.value)),localStorage.setItem("dev_widget_y",String(S.value))}catch{}}const P=e.computed(()=>m.value<220),x=e.ref(300),_=e.ref(360),O=e.ref(!1);let z=300,Y=360,y=0,H=0;function A(n){O.value=!0;const o="touches"in n?n.touches[0].clientX:n.clientX,s="touches"in n?n.touches[0].clientY:n.clientY;y=o,H=s,z=x.value,Y=_.value,window.addEventListener("mousemove",D),window.addEventListener("mouseup",t),window.addEventListener("touchmove",D),window.addEventListener("touchend",t)}function D(n){if(!O.value)return;const o="touches"in n?n.touches[0].clientX:n.clientX,s="touches"in n?n.touches[0].clientY:n.clientY,$=P.value?o-y:y-o,T=H-s;x.value=Math.max(260,Math.min(window.innerWidth-30,z+$)),_.value=Math.max(220,Math.min(window.innerHeight-60,Y+T))}function t(){O.value=!1,window.removeEventListener("mousemove",D),window.removeEventListener("mouseup",t),window.removeEventListener("touchmove",D),window.removeEventListener("touchend",t);try{localStorage.setItem("dev_widget_w",String(x.value)),localStorage.setItem("dev_widget_h",String(_.value))}catch{}}e.onMounted(()=>{try{const n=localStorage.getItem("dev_widget_ima");n!==null&&(g.value=n!=="false");const o=localStorage.getItem("dev_widget_w"),s=localStorage.getItem("dev_widget_h");o&&(x.value=Math.max(260,Math.min(window.innerWidth-30,parseInt(o,10)))),s&&(_.value=Math.max(220,Math.min(window.innerHeight-60,parseInt(s,10))))}catch{}g.value&&M()});const r=e.ref(!1);let a=0,l=0;function v(n){r.value=!0;const o="touches"in n?n.touches[0].clientX:n.clientX,s="touches"in n?n.touches[0].clientY:n.clientY;a=o-m.value,l=s-S.value,window.addEventListener("mousemove",u),window.addEventListener("mouseup",k),window.addEventListener("touchmove",u),window.addEventListener("touchend",k)}function u(n){if(!r.value)return;const o="touches"in n?n.touches[0].clientX:n.clientX,s="touches"in n?n.touches[0].clientY:n.clientY,$=Math.max(10,Math.min(window.innerWidth-60,o-a)),T=Math.max(10,Math.min(window.innerHeight-60,s-l));m.value=$,S.value=T}function k(){if(r.value=!1,window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",k),window.removeEventListener("touchmove",u),window.removeEventListener("touchend",k),g.value)M();else try{localStorage.setItem("dev_widget_x",String(m.value)),localStorage.setItem("dev_widget_y",String(S.value))}catch{}}function w(){d.value=!d.value}return(n,o)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.unref(E)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[o[22]||(o[22]=e.createElementVNode("div",{class:"dev-linha-vermelha-topo"},null,-1)),e.createElementVNode("div",{class:"dev-widget-flutuante",style:e.normalizeStyle({left:`${e.unref(m)}px`,top:`${e.unref(S)}px`}),onMousedown:v,onTouchstartPassive:v},[e.createElementVNode("button",{type:"button",class:"dev-botao-gatilho",title:`Ambiente: ${R.value} | v${i.versaoApp}${g.value?" (Ímã ativo)":""}`,onClick:e.withModifiers(w,["stop"])},[o[10]||(o[10]=e.createElementVNode("svg",{class:"dev-icone-engrenagem-svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("circle",{cx:"12",cy:"12",r:"3"}),e.createElementVNode("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})],-1)),e.createElementVNode("span",{class:e.normalizeClass(["dev-badge-ambiente",{"is-dev":R.value==="DEV"}])},e.toDisplayString(R.value),3)],8,ne),e.unref(d)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["dev-painel-flutuante",{"abrir-para-direita":P.value}]),style:e.normalizeStyle({width:`${x.value}px`,height:`${_.value}px`}),onMousedown:o[8]||(o[8]=e.withModifiers(()=>{},["stop"])),onTouchstart:o[9]||(o[9]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:"dev-alca-redimensionar",title:"Arraste para redimensionar",onMousedown:e.withModifiers(A,["stop","prevent"]),onTouchstartPassive:e.withModifiers(A,["stop"])},[...o[11]||(o[11]=[e.createElementVNode("svg",{class:"dev-alca-icone-svg",viewBox:"0 0 16 16",fill:"currentColor"},[e.createElementVNode("circle",{cx:"4",cy:"12",r:"1.5"}),e.createElementVNode("circle",{cx:"8",cy:"12",r:"1.5"}),e.createElementVNode("circle",{cx:"12",cy:"12",r:"1.5"}),e.createElementVNode("circle",{cx:"8",cy:"8",r:"1.5"}),e.createElementVNode("circle",{cx:"12",cy:"8",r:"1.5"}),e.createElementVNode("circle",{cx:"12",cy:"4",r:"1.5"})],-1)])],32),e.createElementVNode("div",ae,[e.createElementVNode("div",ie,[e.createElementVNode("span",se,e.toDisplayString(i.nomeSistema.toUpperCase()),1),e.createElementVNode("span",re,"v"+e.toDisplayString(i.versaoApp),1)]),e.createElementVNode("div",le,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["dev-botao-ima",{ativo:g.value}]),title:g.value?"Ímã na borda ativo (clique para soltar)":"Ímã desativado (clique para prender na borda)",onClick:C},[g.value?(e.openBlock(),e.createElementBlock("svg",de,[...o[12]||(o[12]=[e.createElementVNode("path",{d:"M6 3v7a6 6 0 0 0 12 0V3"},null,-1),e.createElementVNode("line",{x1:"4",y1:"3",x2:"8",y2:"3"},null,-1),e.createElementVNode("line",{x1:"16",y1:"3",x2:"20",y2:"3"},null,-1),e.createElementVNode("line",{x1:"4",y1:"8",x2:"8",y2:"8"},null,-1),e.createElementVNode("line",{x1:"16",y1:"8",x2:"20",y2:"8"},null,-1)])])):(e.openBlock(),e.createElementBlock("svg",me,[...o[13]||(o[13]=[e.createElementVNode("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"},null,-1),e.createElementVNode("path",{d:"M7 11V7a5 5 0 0 1 9.9-1"},null,-1)])]))],10,ce),e.createElementVNode("button",{type:"button",class:"dev-botao-fechar",title:"Fechar painel",onClick:o[0]||(o[0]=s=>d.value=!1)},[...o[14]||(o[14]=[e.createElementVNode("svg",{class:"dev-icone-svg-sm",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])])]),e.createElementVNode("div",ue,[o[15]||(o[15]=e.createElementVNode("label",{class:"dev-rotulo"},"Ambiente Ativo:",-1)),e.createElementVNode("div",fe,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["dev-opcao-ambiente",{ativo:e.unref(N)==="producao"}]),onClick:o[1]||(o[1]=s=>e.unref(p)("producao"))}," Produção ",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["dev-opcao-ambiente dev",{ativo:e.unref(N)==="canary"||e.unref(N)==="desenvolvimento"}]),onClick:o[2]||(o[2]=s=>e.unref(p)("canary"))}," DEV ",2)])]),e.createElementVNode("div",pe,[o[16]||(o[16]=e.createElementVNode("div",{class:"dev-linha-flex"},[e.createElementVNode("label",{class:"dev-rotulo"},"Simulação de Roles:")],-1)),e.createElementVNode("div",ge,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.rolesDisponiveis,s=>(e.openBlock(),e.createElementBlock("label",{key:s,class:"dev-item-role"},[e.createElementVNode("input",{type:"checkbox",class:"dev-checkbox-role",checked:e.unref(L).includes(s),onChange:$=>e.unref(Q)(s)},null,40,ve),e.createElementVNode("span",null,e.toDisplayString(s),1)]))),128))]),e.createElementVNode("div",he,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":o[3]||(o[3]=s=>e.isRef(f)?f.value=s:null),type:"text",placeholder:"NOVA_ROLE",class:"dev-campo-role",onKeyup:o[4]||(o[4]=e.withKeys((...s)=>e.unref(I)&&e.unref(I)(...s),["enter"]))},null,544),[[e.vModelText,e.unref(f)]]),e.createElementVNode("button",{type:"button",class:"dev-botao-adicionar",title:"Adicionar Role",onClick:o[5]||(o[5]=(...s)=>e.unref(I)&&e.unref(I)(...s))}," + ")])]),e.createElementVNode("div",Ee,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["dev-botao-simular-rodape",{ativa:e.unref(V)}]),title:e.unref(V)?"Restaurar roles originais do token":"Ativar simulação de roles",onClick:o[6]||(o[6]=s=>e.unref(V)?e.unref(K)():e.unref(B)())},[e.unref(V)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[o[17]||(o[17]=e.createElementVNode("svg",{class:"dev-icone-btn-svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),e.createElementVNode("path",{d:"M3 3v5h5"})],-1)),o[18]||(o[18]=e.createElementVNode("span",null,"Resetar",-1))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[o[19]||(o[19]=e.createElementVNode("svg",{class:"dev-icone-btn-svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("polygon",{points:"5 3 19 12 5 21 5 3"})],-1)),o[20]||(o[20]=e.createElementVNode("span",null,"Simular",-1))],64))],10,we),e.createElementVNode("button",{type:"button",class:"dev-botao-limpeza",onClick:o[7]||(o[7]=(...s)=>e.unref(b)&&e.unref(b)(...s))},[...o[21]||(o[21]=[e.createElementVNode("svg",{class:"dev-icone-btn-svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("polyline",{points:"23 4 23 10 17 10"}),e.createElementVNode("polyline",{points:"1 20 1 14 7 14"}),e.createElementVNode("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})],-1),e.createElementVNode("span",null,"Limpar Caches & Recarregar",-1)])])])],38)):e.createCommentVNode("",!0)],36)],64)):e.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-8af06332"]]),ye={install(i){i.component("DevEnvironmentWidget",q)}};h.DevEnvironmentWidget=q,h.DevEnvironmentWidgetPlugin=ye,h.default=q,h.definirCookie=W,h.executarLimpezaAtomicaCaches=X,h.obterCookie=ee,h.removerCookie=j,h.useDevEnvironment=te,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
@@ -0,0 +1,83 @@
1
+ import { ComponentOptionsMixin } from 'vue';
2
+ import { ComponentProvideOptions } from 'vue';
3
+ import { ComputedRef } from 'vue';
4
+ import { DefineComponent } from 'vue';
5
+ import { Plugin as Plugin_2 } from 'vue';
6
+ import { PublicProps } from 'vue';
7
+ import { Ref } from 'vue';
8
+
9
+ export declare type AmbienteTipo = 'producao' | 'canary' | 'desenvolvimento';
10
+
11
+ declare const _default: DefineComponent<PropriedadesWidget, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<PropriedadesWidget> & Readonly<{}>, {
12
+ versaoApp: string;
13
+ nomeSistema: string;
14
+ roleDev: string | string[];
15
+ nomeCookieCanary: string;
16
+ habilitado: boolean;
17
+ rolesDisponiveis: string[];
18
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
19
+ export { _default as DevEnvironmentWidget }
20
+ export default _default;
21
+
22
+ /**
23
+ * Define um cookie no host atual e nos domínios corporativos base.
24
+ */
25
+ export declare function definirCookie(nome: string, valor: string, dias?: number): void;
26
+
27
+ export declare const DevEnvironmentWidgetPlugin: Plugin_2;
28
+
29
+ export declare interface EstadoDevEnvironment {
30
+ ativo: boolean;
31
+ ambiente: AmbienteTipo;
32
+ emulandoRoles: boolean;
33
+ rolesOriginais: string[];
34
+ rolesSimuladas: string[];
35
+ }
36
+
37
+ /**
38
+ * Executa a limpeza atômica de caches do navegador, Service Workers e dados de sessão,
39
+ * recarregando a página imediatamente para garantir a carga do código mais recente.
40
+ */
41
+ export declare function executarLimpezaAtomicaCaches(): Promise<void>;
42
+
43
+ /**
44
+ * Lê o valor de um cookie pelo nome.
45
+ */
46
+ export declare function obterCookie(nome: string): string | null;
47
+
48
+ export declare interface PropriedadesWidget {
49
+ versaoApp?: string;
50
+ nomeSistema?: string;
51
+ roleDev?: string | string[];
52
+ nomeCookieCanary?: string;
53
+ habilitado?: boolean;
54
+ rolesDisponiveis?: string[];
55
+ }
56
+
57
+ /**
58
+ * Remove um cookie pelo nome em todos os domínios aplicáveis.
59
+ */
60
+ export declare function removerCookie(nome: string): void;
61
+
62
+ export declare function useDevEnvironment(propriedades?: PropriedadesWidget): {
63
+ painelAberto: Ref<boolean, boolean>;
64
+ posicaoX: Ref<number, number>;
65
+ posicaoY: Ref<number, number>;
66
+ arrastando: Ref<boolean, boolean>;
67
+ ambienteAtual: ComputedRef<AmbienteTipo>;
68
+ ehCanaryCookie: Ref<boolean, boolean>;
69
+ simulacaoAtiva: Ref<boolean, boolean>;
70
+ rolesOriginais: Ref<string[], string[]>;
71
+ rolesSimuladas: Ref<string[], string[]>;
72
+ novaRoleInput: Ref<string, string>;
73
+ usuarioTemPermissaoDev: ComputedRef<boolean>;
74
+ alternarAmbiente: (ambienteDesejado: AmbienteTipo) => void;
75
+ ativarSimulacaoRoles: () => void;
76
+ desativarSimulacaoRoles: () => void;
77
+ resetarSimulacaoRoles: () => void;
78
+ alternarRole: (role: string) => void;
79
+ adicionarRolePersonalizada: () => void;
80
+ executarLimpezaAtomicaCaches: typeof executarLimpezaAtomicaCaches;
81
+ };
82
+
83
+ export { }
package/package.json CHANGED
@@ -1,6 +1,53 @@
1
1
  {
2
2
  "name": "dev-environment-widget",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.2.0",
4
+ "type": "module",
5
+ "main": "./dist/dev-environment-widget.umd.cjs",
6
+ "module": "./dist/dev-environment-widget.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/dev-environment-widget.js",
12
+ "require": "./dist/dev-environment-widget.umd.cjs"
13
+ },
14
+ "./style.css": "./dist/dev-environment-widget.css",
15
+ "./dist/style.css": "./dist/dev-environment-widget.css",
16
+ "./dist/dev-environment-widget.css": "./dist/dev-environment-widget.css"
17
+ },
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "scripts": {
22
+ "dev": "vite",
23
+ "build": "vite build",
24
+ "typecheck": "vue-tsc --noEmit",
25
+ "test": "vue-tsc --noEmit",
26
+ "prepublishOnly": "npm run build",
27
+ "release": "release-it",
28
+ "release:beta": "release-it --preRelease=beta",
29
+ "release:canary": "release-it --preRelease=canary"
30
+ },
31
+ "peerDependencies": {
32
+ "vue": "^3.4.0",
33
+ "pinia": ">=2.1.0"
34
+ },
35
+ "devDependencies": {
36
+ "@release-it/conventional-changelog": "^10.0.6",
37
+ "@types/node": "^22.10.1",
38
+ "@vitejs/plugin-vue": "^5.2.1",
39
+ "pinia": "^2.3.0",
40
+ "release-it": "^19.2.4",
41
+ "typescript": "^5.7.2",
42
+ "vite": "^6.0.1",
43
+ "vite-plugin-dts": "^4.3.0",
44
+ "vue": "^3.5.13",
45
+ "vue-tsc": "^2.1.10"
46
+ },
47
+ "publishConfig": {
48
+ "access": "public"
49
+ },
50
+ "author": "Jansem Wallemberg Torquetti Maia <jansem@pucminas.br>",
51
+ "license": "ISC",
52
+ "description": "Componente flutuante e barra roxa superior para alternância entre Produção/Canary, simulação de roles no Pinia e limpeza de caches PWA no padrão CRC."
53
+ }