From 7d0414a43f6aec693ec27a765937acabba91b821 Mon Sep 17 00:00:00 2001 From: Andy Bunce Date: Tue, 9 Dec 2025 11:47:59 +0000 Subject: [PATCH] [fix] connected indictor --- webapp/static/clients/codemirror/grail.css | 1 - webapp/static/clients/codemirror/script.js | 26 ++++++---- webapp/static/clients/codemirror/wa.css | 32 ------------ webapp/static/clients/codemirror/wa.html | 60 ++++++++++------------ 4 files changed, 43 insertions(+), 76 deletions(-) diff --git a/webapp/static/clients/codemirror/grail.css b/webapp/static/clients/codemirror/grail.css index 697f367..cd36601 100644 --- a/webapp/static/clients/codemirror/grail.css +++ b/webapp/static/clients/codemirror/grail.css @@ -103,7 +103,6 @@ form header { .page-nav { grid-column: 2 / 3; - background: red; } diff --git a/webapp/static/clients/codemirror/script.js b/webapp/static/clients/codemirror/script.js index 04332e8..1bb975e 100644 --- a/webapp/static/clients/codemirror/script.js +++ b/webapp/static/clients/codemirror/script.js @@ -133,7 +133,7 @@ $("popUrl").onsubmit = e => { $("bnDebug").onclick = e => { debugger; }; -$("tConnect").addEventListener('quiet-change', e => { +$("bConnect").addEventListener('click', e => { e.preventDefault(); $("popConnect").showPopover() }); @@ -142,10 +142,10 @@ $("msgIcon").onclick = e => { alert("NOT YET") }; $("samples").addEventListener('wa-selection-change', e => { - const sel=e.detail.selection; - const href=sel[0].getAttribute("data-href") - if(!href) return; - $("popUrl").querySelector('wa-input[name="url"]').value=href; + const sel = e.detail.selection; + const href = sel[0].getAttribute("data-href") + if (!href) return; + $("popUrl").querySelector('wa-input[name="url"]').value = href; }); function updateSettings(event) { @@ -176,8 +176,7 @@ function connect() { client = new lsp.LSPClient({ extensions: lsp.languageServerExtensions() }); client.connect(transport); $("popConnect").hidePopover(); - $("tConnect").checked = true; - $("tipConnect").innerText = server; + connectState(server, true) const extLsp = client.plugin(file, "xquery"); view.dispatch({ @@ -188,12 +187,19 @@ function connect() { }) .catch(e => { console.log(e); - $("tConnect").checked = false; + connectState(server, false) alert("connection failed: " + server) }); }; +// set ui state for connection +function connectState(server, bConn) { + $("bConnect").setAttribute("variant", bConn ? "success" : "danger") + $("tipConnect").innerText = bConn ? server : "Not connected"; + $("bConnect").querySelector('wa-icon').setAttribute("name", bConn ? "network" : "network-off"); +}; + // change active doc function docSwitch(text, urlNew) { const urlOld = $("iFile").value; @@ -214,8 +220,8 @@ function treeAdd(tree, txt) { const treeItem = document.createElement('wa-tree-item'); treeItem.innerText = txt; tree.querySelectorAll('wa-tree-item').forEach(item => (item.selected = false)); - tree.insertBefore(treeItem,tree.firstChild); - treeItem.selected=true; + tree.insertBefore(treeItem, tree.firstChild); + treeItem.selected = true; }; function incoming(msg) { const rpc = JSON.parse(msg); diff --git a/webapp/static/clients/codemirror/wa.css b/webapp/static/clients/codemirror/wa.css index 4d04d32..ef0e2a5 100644 --- a/webapp/static/clients/codemirror/wa.css +++ b/webapp/static/clients/codemirror/wa.css @@ -83,7 +83,6 @@ details[open]::details-content { grid-column: 1 / -1; display: flex; justify-content: space-between; - background: red; } .page-sidebar { @@ -118,34 +117,3 @@ details[open]::details-content { justify-content: space-between; padding: 2px; } - -wa-button.pink::part(base) { - border-radius: 6px; - border: solid 2px; - background: #ff1493; - border-top-color: #ff7ac1; - border-left-color: #ff7ac1; - border-bottom-color: #ad005c; - border-right-color: #ad005c; - color: white; - font-size: 1.125rem; - box-shadow: 0 2px 10px #0002; - transition: all var(--wa-transition-slow) var(--wa-transition-easing); -} - -wa-button.pink::part(base):hover { - transform: scale(1.05); -} - -wa-button.pink::part(base):active { - border-top-color: #ad005c; - border-right-color: #ff7ac1; - border-bottom-color: #ff7ac1; - border-left-color: #ad005c; - transform: translateY(1px); -} - -wa-button.pink::part(base):focus-visible { - outline: dashed 2px deeppink; - outline-offset: 4px; -} \ No newline at end of file diff --git a/webapp/static/clients/codemirror/wa.html b/webapp/static/clients/codemirror/wa.html index c966de3..883763f 100644 --- a/webapp/static/clients/codemirror/wa.html +++ b/webapp/static/clients/codemirror/wa.html @@ -37,14 +37,11 @@
XQuery 4.0 LSP client - - - - - I'm a tooltip - - + + + + + Not connected
@@ -99,7 +96,7 @@ - + @@ -137,9 +134,11 @@ WORKSPACE - - file:///some/file.xqm - +
+ + file:///some/file.xqm + +
@@ -187,12 +186,7 @@ - - aaaaa - - + @@ -202,16 +196,16 @@
Load a document from the web
- +
- + - + @@ -227,15 +221,15 @@ generator.xquery - Fetch -
+ Fetch +
XQuery 3.1 - Pdfbox3.xqm (expkg-zone58/pdfbox) - Pdfbox3.xqm + (expkg-zone58/pdfbox) + model.xqm (Quodatum/xqdoca) Item X @@ -249,7 +243,7 @@ Item 3 - +
@@ -327,11 +321,11 @@ - - - - - + + + + +