@yakuzaa/jade 0.1.14 → 0.1.15
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/commands/html.js +39 -12
- package/package.json +2 -2
package/commands/html.js
CHANGED
|
@@ -521,8 +521,9 @@ async function mudarTela(nome, telas, db, ui, navItems) {
|
|
|
521
521
|
}
|
|
522
522
|
}
|
|
523
523
|
|
|
524
|
-
//
|
|
525
|
-
resolverAgregacoes
|
|
524
|
+
// NOTA: @soma/@contagem/@media agora são resolvidos reativamente pelo runtime.
|
|
525
|
+
// Mantemos resolverAgregacoes apenas para versões antigas de runtime que não suportam reatividade.
|
|
526
|
+
if (!ui.setDadosEntidade) resolverAgregacoes(tela, dadosMap);
|
|
526
527
|
|
|
527
528
|
ui.renderizarTela(tela, container, dadosMap);
|
|
528
529
|
|
|
@@ -536,7 +537,11 @@ async function mudarTela(nome, telas, db, ui, navItems) {
|
|
|
536
537
|
document.body.classList.add('jade-com-busca');
|
|
537
538
|
buscaInput.value = '';
|
|
538
539
|
signal.set('');
|
|
539
|
-
|
|
540
|
+
let _bt = null;
|
|
541
|
+
buscaInput.oninput = () => {
|
|
542
|
+
clearTimeout(_bt);
|
|
543
|
+
_bt = setTimeout(() => signal.set(buscaInput.value.toLowerCase()), 200);
|
|
544
|
+
};
|
|
540
545
|
} else {
|
|
541
546
|
buscaWrapper.style.display = 'none';
|
|
542
547
|
document.body.classList.remove('jade-com-busca');
|
|
@@ -656,15 +661,37 @@ async function iniciar() {
|
|
|
656
661
|
}
|
|
657
662
|
});
|
|
658
663
|
|
|
659
|
-
// Handler: jade:acao —
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
664
|
+
// Handler: jade:acao — chama função WASM (se existir), atualiza dados reativamente
|
|
665
|
+
window.addEventListener('jade:acao', async (e) => {
|
|
666
|
+
const { acao, tela: nomeTela } = e.detail ?? {};
|
|
667
|
+
if (!acao) return;
|
|
668
|
+
|
|
669
|
+
let chamouWasm = false;
|
|
670
|
+
try {
|
|
671
|
+
// 1. Tenta chamar função WASM exportada com o mesmo nome
|
|
672
|
+
if (typeof runtime?.call === 'function') {
|
|
673
|
+
try {
|
|
674
|
+
runtime.call(acao);
|
|
675
|
+
chamouWasm = true;
|
|
676
|
+
} catch (_) { /* função não exportada ainda — ignora */ }
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// 2. Recarrega dados das entidades ativas e propaga via signals (sem re-render completo)
|
|
680
|
+
const entidades = ui.getEntidadesAtivas?.() ?? [];
|
|
681
|
+
await Promise.all(entidades.map(async (entidade) => {
|
|
682
|
+
const dados = await db.find(entidade).catch(() => []);
|
|
683
|
+
ui.setDadosEntidade?.(entidade, dados);
|
|
684
|
+
}));
|
|
685
|
+
|
|
686
|
+
// 3. Notificação apenas se houve chamada WASM real
|
|
687
|
+
if (chamouWasm) {
|
|
688
|
+
ui.mostrarNotificacao('Ação concluída com sucesso', 'sucesso');
|
|
689
|
+
}
|
|
690
|
+
} catch (err) {
|
|
691
|
+
ui.mostrarNotificacao('Erro ao executar ação: ' + (err?.message ?? err), 'erro');
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
window.dispatchEvent(new CustomEvent('jade:acao:concluido', { detail: { acao } }));
|
|
668
695
|
});
|
|
669
696
|
|
|
670
697
|
// Renderiza primeira tela navegável
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yakuzaa/jade",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "Jade DSL — linguagem empresarial em português compilada para WebAssembly. Instala compilador + runtime + CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@yakuzaa/jade-compiler": "^0.1.15",
|
|
21
|
-
"@yakuzaa/jade-runtime": "^0.1.
|
|
21
|
+
"@yakuzaa/jade-runtime": "^0.1.11"
|
|
22
22
|
},
|
|
23
23
|
"keywords": [
|
|
24
24
|
"jade",
|