[fix] connected indictor

This commit is contained in:
Andy Bunce 2025-12-09 11:47:59 +00:00
parent 566831c73d
commit 7d0414a43f
4 changed files with 43 additions and 76 deletions

View file

@ -103,7 +103,6 @@ form header {
.page-nav {
grid-column: 2 / 3;
background: red;
}

View file

@ -133,7 +133,7 @@ $("popUrl").onsubmit = e => {
$("bnDebug").onclick = e => { debugger; };
$("tConnect").addEventListener('quiet-change', e => {
$("bConnect").addEventListener('click', e => {
e.preventDefault();
$("popConnect").showPopover()
});
@ -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;

View file

@ -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;
}

View file

@ -37,14 +37,11 @@
<div>
<span class="h4">XQuery 4.0 LSP client</span>
<quiet-toggle-icon id="tConnect" label="Connection status" size="lg"
style="--checked-color: green;--unchecked-color: red;">
<wa-icon slot="unchecked" library="tabler" name="network-off" family="outline"></wa-icon>
<wa-icon slot="checked" library="tabler" name="network" family="outline"></wa-icon>
</quiet-toggle-icon>
<wa-tooltip id="tipConnect" for="tConnect">I'm a tooltip</wa-tooltip>
<wa-button id="bConnect" variant="danger">
<wa-icon library="tabler" name="network-off"></wa-icon>
</wa-button>
<wa-tooltip id="tipConnect" for="bConnect">Not connected</wa-tooltip>
</div>
@ -137,9 +134,11 @@
<summary class='bg-info'>WORKSPACE
<wa-icon library="codicon" name="kebab-vertical" style="float:right"></wa-icon>
</summary>
<div style="overflow: scroll;">
<wa-tree id="workspace" selection="single">
<wa-tree-item>file:///some/file.xqm</wa-tree-item>
</wa-tree>
</div>
</details>
@ -187,12 +186,7 @@
<option value="xquery">xquery</option>
<option value="xml">xml</option>
</select>
<wa-button>
aaaaa
</wa-button>
<button>
ddddd
</button>
</footer>
</div>
@ -233,8 +227,8 @@
<wa-tree-item>
XQuery 3.1
<wa-tree-item
data-href="https://raw.githubusercontent.com/expkg-zone58/pdfbox/refs/heads/main/src/Pdfbox3.xqm"
>Pdfbox3.xqm (expkg-zone58/pdfbox)</wa-tree-item>
data-href="https://raw.githubusercontent.com/expkg-zone58/pdfbox/refs/heads/main/src/Pdfbox3.xqm">Pdfbox3.xqm
(expkg-zone58/pdfbox)</wa-tree-item>
<wa-tree-item
data-href="https://raw.githubusercontent.com/Quodatum/xqdoca/refs/heads/master/src/main/lib/model.xqm">
model.xqm (Quodatum/xqdoca)</option></wa-tree-item>