From 2df8213d7b0e65adf827be09365640694b5be289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Gabriel?= Date: Sat, 22 Aug 2026 14:05:34 -0300 Subject: [PATCH 1/4] =?UTF-8?q?Adiciona=20bot=C3=A3o=20de=20exportar=20no?= =?UTF-8?q?=20html?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/idegua/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/idegua/index.html b/apps/idegua/index.html index e352293..e827c42 100644 --- a/apps/idegua/index.html +++ b/apps/idegua/index.html @@ -28,6 +28,7 @@
+
From fdf69f21aa54725962ad94a3208398ea96c27a40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Gabriel?= Date: Sat, 22 Aug 2026 14:06:17 -0300 Subject: [PATCH 2/4] =?UTF-8?q?Adiciona=20estilos=20ao=20bot=C3=A3o=20de?= =?UTF-8?q?=20exportar.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/idegua/css/style.css | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/apps/idegua/css/style.css b/apps/idegua/css/style.css index f051d81..0b09ab9 100644 --- a/apps/idegua/css/style.css +++ b/apps/idegua/css/style.css @@ -97,6 +97,7 @@ body { * alternativo cinza-suave. */ #runBtn, +#exportBtn, #demoSelector { height: 40px; border: 1px solid transparent; @@ -105,7 +106,7 @@ body { font-family: var(--font-sans); font-size: 14px; cursor: pointer; - transition: background-color 0.25s, color 0.25s; + transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s; } #runBtn { @@ -114,6 +115,30 @@ body { font-weight: 600; } +#exportBtn { + background-color: var(--c-bg); + border-color: var(--c-divider); + color: var(--c-text-1); + font-weight: 600; +} + +#exportBtn:hover { + background-color: var(--c-gray-soft); + border-color: rgba(60, 60, 67, 0.2); +} + +#exportBtn:active { + background-color: var(--c-gray-soft-hover); +} + +#exportBtn:disabled { + background-color: #eeeeF1; + border-color: rgba(60, 60, 67, 0.08); + color: rgba(60, 60, 67, 0.42); + box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45); +} + + #runBtn:hover { background-color: var(--brand-2); } @@ -140,6 +165,7 @@ body { } #runBtn:focus-visible, +#exportBtn:focus-visible, #demoSelector:focus-visible { outline: 2px solid var(--brand-1); outline-offset: 2px; @@ -236,6 +262,7 @@ body { } #runBtn, + #exportBtn, #demoSelector { height: 44px; } From 1554cdffeecf64249fce2b307fa3ece5ef725109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Gabriel?= Date: Sat, 22 Aug 2026 14:06:38 -0300 Subject: [PATCH 3/4] =?UTF-8?q?Adiciona=20fun=C3=A7=C3=A3o=20para=20baixar?= =?UTF-8?q?=20o=20programa=20atual.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/idegua/js/index.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/apps/idegua/js/index.js b/apps/idegua/js/index.js index ed3d15d..3f1c395 100644 --- a/apps/idegua/js/index.js +++ b/apps/idegua/js/index.js @@ -1,6 +1,7 @@ const outputDiv = document.getElementById("output"); const runButton = document.getElementById("runBtn"); const demoSelector = document.getElementById("demoSelector"); +const exportButton = document.getElementById('exportBtn'); String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.slice(1); @@ -34,6 +35,12 @@ const editor = new CodeFlask("#editor", { defaultTheme: false }); +function updateExportButton() { + exportButton.disabled = editor.getCode().trim().length === 0; +} + +editor.onUpdate(updateExportButton); + clearOutput(); const demoKeys = Object.keys(demos); @@ -62,6 +69,8 @@ if (queryCode !== undefined) { loadDemo(demoKeys[0]); } +updateExportButton(); + const runCode = function() { const egua = new Egua.Egua(); @@ -78,3 +87,25 @@ runButton.addEventListener("click", function() { clearOutput(); runCode(); }); + + +function downloadCode() { + const code = editor.getCode(); + + if (code.trim().length === 0) return; + + const blob = new Blob([code], { type: "text/plain;charset=utf-8" }); + const url = URL.createObjectURL(blob); + const link = document.createElement("a"); + + link.href = url; + link.download = "programa.egua"; + document.body.appendChild(link); + link.click(); + link.remove(); + + setTimeout(() => URL.revokeObjectURL(url), 0); +} + +exportButton.addEventListener("click", downloadCode); + From fe4740dba5216ba1f90d8dba4065bc041f4a7039 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Gabriel?= Date: Sat, 22 Aug 2026 14:18:12 -0300 Subject: [PATCH 4/4] =?UTF-8?q?Adiciona=20nome=20edit=C3=A1vel=20ao=20prog?= =?UTF-8?q?rama?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/idegua/css/style.css | 64 ++++++++++++++++++++++++++++++++++++++- apps/idegua/index.html | 8 ++++- apps/idegua/js/index.js | 21 +++++++++++-- 3 files changed, 88 insertions(+), 5 deletions(-) diff --git a/apps/idegua/css/style.css b/apps/idegua/css/style.css index 0b09ab9..c21d0cb 100644 --- a/apps/idegua/css/style.css +++ b/apps/idegua/css/style.css @@ -86,6 +86,53 @@ body { white-space: nowrap; } +.file-name { + min-width: 0; + max-width: 260px; + padding: 2px 6px; + overflow: hidden; + border: 1px solid transparent; + border-radius: 6px; + color: var(--c-text-2); + font-family: var(--font-mono); + font-size: 14px; + font-weight: 500; + line-height: 1.4; + letter-spacing: normal; + text-transform: none; + text-overflow: ellipsis; + white-space: nowrap; + cursor: text; + outline: none; +} + +.file-name-control { + display: inline-flex; + align-items: center; + gap: 5px; + min-width: 0; + padding: 2px 7px; + background-color: var(--c-bg); + border: 1px solid var(--c-divider); + border-radius: 6px; + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03); +} + +.file-name-control:focus-within { + border-color: rgba(60, 60, 67, 0.24); + box-shadow: 0 0 0 2px rgba(255, 75, 85, 0.12); +} + +.file-name:hover { + background-color: transparent; +} + +.file-name:focus { + background-color: var(--c-bg); + border-color: var(--c-divider); + color: var(--c-text-1); +} + .topbar-actions { display: flex; align-items: center; @@ -196,8 +243,13 @@ body { } .panel-head { + display: flex; + align-items: center; + justify-content: flex-start; + gap: 20px; + height: 36px; flex-shrink: 0; - padding: 10px 16px; + padding: 0 16px; background-color: var(--c-bg-alt); border-bottom: 1px solid var(--c-divider); font-size: 12px; @@ -207,6 +259,11 @@ body { color: var(--brand-1); } +.panel-head h2 { + font-size: inherit; + font-weight: inherit; +} + #editor { position: relative; flex: 1; @@ -277,6 +334,11 @@ body { display: none; } + .file-name { + min-width: 0; + max-width: 140px; + } + #demoSelector { padding: 0 32px 0 14px; } diff --git a/apps/idegua/index.html b/apps/idegua/index.html index e827c42..76f4087 100644 --- a/apps/idegua/index.html +++ b/apps/idegua/index.html @@ -34,7 +34,13 @@
-

Editor

+
+

Editor

+ + programa.egua + +
diff --git a/apps/idegua/js/index.js b/apps/idegua/js/index.js index 3f1c395..783f881 100644 --- a/apps/idegua/js/index.js +++ b/apps/idegua/js/index.js @@ -2,6 +2,7 @@ const outputDiv = document.getElementById("output"); const runButton = document.getElementById("runBtn"); const demoSelector = document.getElementById("demoSelector"); const exportButton = document.getElementById('exportBtn'); +const fileName = document.getElementById("fileName"); String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.slice(1); @@ -44,8 +45,9 @@ editor.onUpdate(updateExportButton); clearOutput(); const demoKeys = Object.keys(demos); -function loadDemo(name) { +function loadDemo(name, updateName = true) { editor.updateCode(demos[name]); + if (updateName) fileName.textContent = `${name.toLowerCase()}.egua`; } demoKeys.forEach((demo, index) => { @@ -65,8 +67,9 @@ let queryCode = getQueryVariable("code"); if (queryCode !== undefined) { editor.updateCode(decodeURI(queryCode)); demoSelector.value = "custom"; + fileName.textContent = "programa.egua"; } else { - loadDemo(demoKeys[0]); + loadDemo(demoKeys[0], false); } updateExportButton(); @@ -99,7 +102,8 @@ function downloadCode() { const link = document.createElement("a"); link.href = url; - link.download = "programa.egua"; + const name = fileName.textContent.trim() || "programa.egua"; + link.download = name.endsWith(".egua") ? name : `${name}.egua`; document.body.appendChild(link); link.click(); link.remove(); @@ -109,3 +113,14 @@ function downloadCode() { exportButton.addEventListener("click", downloadCode); +fileName.addEventListener("blur", () => { + const name = fileName.textContent.trim(); + fileName.textContent = name || "programa.egua"; +}); + +fileName.addEventListener("keydown", (event) => { + if (event.key === "Enter") { + event.preventDefault(); + fileName.blur(); + } +});