Compare commits

...

2 commits

Author SHA1 Message Date
13ad78853d mod] [popover 2025-11-01 22:53:55 +00:00
13871be80b [mod] css 2025-11-01 16:31:29 +00:00
8 changed files with 122 additions and 79 deletions

35
package-lock.json generated
View file

@ -16,6 +16,7 @@
"@codemirror/search": "^6.5.11",
"@codemirror/theme-one-dark": "^6.1.3",
"@codemirror/view": "^6.38.6",
"@quietui/quiet-browser": "^1.6.1",
"@replit/codemirror-minimap": "^0.5.2",
"@zenfs/core": "^2.4.2",
"@zenfs/dom": "^1.2.5",
@ -696,6 +697,16 @@
"integrity": "sha512-0FCeqG6WvK4/Cc06F/xXMd/pv4FeisI0c1tUpBbfhA2n9Y8eZEv4Karjbmf2ZqQCPUWMrGp8A571tCjizxoTiQ==",
"license": "Apache-2.0"
},
"node_modules/@quietui/quiet-browser": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/@quietui/quiet-browser/-/quiet-browser-1.6.1.tgz",
"integrity": "sha512-t398SI83bVmIuM6rQZTfQkMop8lMGdPmcSPhd6AUg2tpBVorQXUNTTQnFotevAHKU5kXch9amTKNnW44GBcUaw==",
"license": "MIT",
"funding": {
"type": "individual",
"url": "https://github.com/sponsors/quietui"
}
},
"node_modules/@replit/codemirror-minimap": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/@replit/codemirror-minimap/-/codemirror-minimap-0.5.2.tgz",
@ -1104,9 +1115,9 @@
"license": "MIT"
},
"node_modules/@types/node": {
"version": "24.9.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.9.1.tgz",
"integrity": "sha512-QoiaXANRkSXK6p0Duvt56W208du4P9Uye9hWLWgGMDTEoKPhuenzNcC4vGUmrNkiOKTlIrBoyNQYNpSwfEZXSg==",
"version": "24.9.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.9.2.tgz",
"integrity": "sha512-uWN8YqxXxqFMX2RqGOrumsKeti4LlmIMIyV0lgut4jx7KQBcBiW6vkDtIBvHnHIquwNfJhk8v2OtmO8zXWHfPA==",
"license": "MIT",
"dependencies": {
"undici-types": "~7.16.0"
@ -1549,9 +1560,9 @@
"license": "MIT"
},
"node_modules/kerium": {
"version": "1.3.7",
"resolved": "https://registry.npmjs.org/kerium/-/kerium-1.3.7.tgz",
"integrity": "sha512-3pFGohBrDeGkxBvRJ1FKrkN6HpiLAvHRZ4rk5zZUExzslgDZm/iijDRKXTHHJpyHQaBlOFxVnpqYp76u5qmQSg==",
"version": "1.3.8",
"resolved": "https://registry.npmjs.org/kerium/-/kerium-1.3.8.tgz",
"integrity": "sha512-tOtOOsTZ85Wt4h8TwV4ItgTi6paj2U1buOC/v9Rdon0ndtqASm5fn/rBRfEsif1czW4+u73T7XPbQAIBUF4tzg==",
"license": "MIT",
"dependencies": {
"utilium": "^2.0.0"
@ -1622,9 +1633,9 @@
}
},
"node_modules/memium": {
"version": "0.3.10",
"resolved": "https://registry.npmjs.org/memium/-/memium-0.3.10.tgz",
"integrity": "sha512-7LdicWe1tGBLrstNXdcH1Wh2iiAC4u8eU/iGuBvoVAkG20qU2d8bQk3/y40FIrM6mk5N+hpiqFI7PmOlR1hNOg==",
"version": "0.3.11",
"resolved": "https://registry.npmjs.org/memium/-/memium-0.3.11.tgz",
"integrity": "sha512-CwmIpLVSG7UToDj2sYAZFDkpco30OPsXpaCnt+7Z7JQaulCjH5UvwJIctTIHmgQdFqk8pliBsPLnH5OZcDLZyQ==",
"license": "LGPL-3.0-or-later",
"dependencies": {
"kerium": "^1.3.2",
@ -2047,9 +2058,9 @@
"license": "MIT"
},
"node_modules/utilium": {
"version": "2.5.7",
"resolved": "https://registry.npmjs.org/utilium/-/utilium-2.5.7.tgz",
"integrity": "sha512-8F/HW+6g4v6k3yYR1bhSG+OVnoxjbuZeelLa4IyyNdwFaqGj8HpxKdOQf07xmB2jWIuUs1sq2wXcsqiERRWvEA==",
"version": "2.5.8",
"resolved": "https://registry.npmjs.org/utilium/-/utilium-2.5.8.tgz",
"integrity": "sha512-RNXAYoYH7hefayCW/2LU3SYCwDGQlDc8f4gPCRbMO6dJsYGGlzAhyHqYQGp73ox41JtPKjdqzddAbDhWQ9MrXQ==",
"license": "LGPL-3.0-or-later",
"dependencies": {
"eventemitter3": "^5.0.1"

View file

@ -11,6 +11,7 @@
"@codemirror/search": "^6.5.11",
"@codemirror/theme-one-dark": "^6.1.3",
"@codemirror/view": "^6.38.6",
"@quietui/quiet-browser": "^1.6.1",
"@replit/codemirror-minimap": "^0.5.2",
"@zenfs/core": "^2.4.2",
"@zenfs/dom": "^1.2.5",

View file

@ -3,18 +3,18 @@ import module namespace ast="lsp/ast" at "../webapp/lsp/ast/ast.xqm";
(: declare variable $file:="sample.docs/pdfbox.xqm"; :)
declare variable $file:="sample.docs/simple.xq";
declare variable $A:=doc("sample.docs/parse-pdfbox.xml");
declare variable $A:="sample.docs/pdfbox.xqm";
unparsed-text($file)
unparsed-text($A)
=>ast:build()
=>ast:build({"flatten":true(),"position":true()})
update{
(: update{
for $e in descendant-or-self::element()
let $len:=string-length($e)
let $before:=$e/preceding-sibling::node()/string-length()=>sum()
return (insert node attribute len { $len } into $e,
insert node attribute before { $before } into $e
)
}
} :)

View file

@ -4,3 +4,4 @@ declare variable $parse:=doc($src)/*;
syms:list($parse,string($parse ))

View file

@ -4,6 +4,7 @@
color-scheme: light dark;
--quiet-primary-seed: #e98d61;
--quiet-content-spacing: 0.75rem;
--quiet-form-control-height-md:0.9rem;
}
* {
@ -29,7 +30,7 @@ form header {
.page-wrap {
background: white;
height: calc(100vh - 10px);
box-shadow: 0 0 3px rgba(black, 0.33);
display: grid;
grid-template-columns: minmax(10px, 1fr) minmax(10px, 4fr);
@ -97,6 +98,7 @@ form header {
grid-column: 1 / -1;
display: flex;
justify-content: space-between;
background: #ffecb3;
}
.page-sidebar {

View file

@ -33,41 +33,52 @@
<quiet-icon slot="checked" name="network" family="outline"></quiet-icon>
</quiet-toggle-icon>
<quiet-toolbar label="Links">
<quiet-button href="#" variant="primary" aria-current="page" size="sm">
Editor
<quiet-button-group>
<quiet-button id="bnNew" title="New file">
<quiet-icon slot="start" name="file"></quiet-icon>New
</quiet-button>
<quiet-button href="/app/home" target="lsp" rel="noreferrer noopener" size="sm">
LSP Manager <quiet-icon name="external-link"></quiet-icon>
</quiet-button>
<quiet-button href="/dba/logs" target="dba" rel="noreferrer noopener" size="sm">
Dba <quiet-icon name="external-link"></quiet-icon>
</quiet-button>
</quiet-toolbar>
<quiet-select id="load" style="width:20em;">
<option selected value="">load..</option>
<optgroup label="XQuery3">
<option
value="https://raw.githubusercontent.com/expkg-zone58/pdfbox/refs/heads/main/src/Pdfbox3.xqm">
Pdfbox3.xqm</option>
<option
value="https://raw.githubusercontent.com/Quodatum/xqdoca/refs/heads/master/src/main/lib/model.xqm">
model.xqm</option>
</optgroup>
<optgroup label="XQuery4">
<option
value="https://git.quodatum.duckdns.org/quodatum/basex-lsp/raw/branch/main/webapp/lsp/lsp-text.xqm">
lsp-text.xqm</option>
<option value="../../../lsp/lsp-text.xqm">
lsp-text.xqm</option>
</optgroup>
<optgroup label="xpath">
<option
value="https://raw.githubusercontent.com/dnovatchev/Articles/refs/heads/main/Generators/Code/generator.xq">
generator.xquery</option>
</optgroup>
</quiet-select>
<quiet-button id="bnRead" title="Open local file">
<quiet-icon slot="start" name="folder-open"></quiet-icon>Open
</quiet-button>
<input type="file" id="fileElem" multiple accept="*/*" style="display: none;" />
<quiet-button id="bnUrl" title="Open web file">
<quiet-icon slot="start" name="link"></quiet-icon>Web
</quiet-button>
<quiet-button id="popover__url">URL</quiet-button>
<quiet-select id="load" style="width:16em;">
<option selected value="">load..</option>
<optgroup label="XQuery3">
<option
value="https://raw.githubusercontent.com/expkg-zone58/pdfbox/refs/heads/main/src/Pdfbox3.xqm">
Pdfbox3.xqm</option>
<option
value="https://raw.githubusercontent.com/Quodatum/xqdoca/refs/heads/master/src/main/lib/model.xqm">
model.xqm</option>
</optgroup>
<optgroup label="XQuery4">
<option
value="https://git.quodatum.duckdns.org/quodatum/basex-lsp/raw/branch/main/webapp/lsp/lsp-text.xqm">
lsp-text.xqm</option>
<option value="../../../lsp/lsp-text.xqm">
lsp-text.xqm</option>
</optgroup>
<optgroup label="xpath">
<option
value="https://raw.githubusercontent.com/dnovatchev/Articles/refs/heads/main/Generators/Code/generator.xq">
generator.xquery</option>
</optgroup>
</quiet-select>
</quiet-button-group>
<a href="/app/home" target="lsp" rel="noreferrer noopener">
LSP Manager <quiet-icon name="external-link"></quiet-icon>
</a>
<a href="/dba/logs" target="dba" rel="noreferrer noopener" size="sm">
Dba <quiet-icon name="external-link"></quiet-icon>
</a>
<button popovertarget="popAbout" type="button">
<i class="codicon codicon-info"></i>
@ -80,47 +91,41 @@
<quiet-button-group>
<button id="search" title="Search" type="button" class="btn btn-light"><i
class="codicon codicon-search"></i></button>
<button id="search" title="Search" type="button"><i class="codicon codicon-search"></i></button>
<button id="lint" title="Display diagnostics" type="button" class="btn btn-light"><i
<button id="lint" title="Display diagnostics" type="button"><i
class="codicon codicon-report"></i></button>
<button id="symbols2" type="button" class="btn btn-light" title="symbols">
<button id="symbols2" type="button" title="symbols">
<i class="codicon codicon-symbol-misc"></i></button>
<button id="format" type="button" class="btn btn-light" title="Format (Shift-Alt-f)"><i
<button id="format" type="button" title="Format (Shift-Alt-f)"><i
class="codicon codicon-list-flat"></i></button>
<button id="sync" title="Sync changes to server" type="button" class="btn btn-light">
<button id="sync" title="Sync changes to server" type="button">
<i class="codicon codicon-sync"></i>
</button>
<button id="cmdList" type="button" class="btn btn-light" title="Command and key mapping help">
<button id="cmdList" type="button" title="Command and key mapping help">
<i class="codicon codicon-record-keys"></i>
</button>
<button type="button" class="btn btn-light" popovertarget="popSettings" title="Settings">
<button type="button" popovertarget="popSettings" title="Settings">
<i class="codicon codicon-settings"></i></button>
</quiet-button-group>
<quiet-button-group>
<button id="fullscreen" title="Full screen editor" type="button" class="btn btn-light">
<button id="fullscreen" title="Full screen editor" type="button">
<i class="codicon codicon-screen-full"></i>
</button>
<button id="bnNew" type="button" class="btn btn-light" title="New file"><i
class="codicon codicon-new-file"></i></button>
<button id="bnRead" type="button" class="btn btn-light" title="LOad local file"><i
class="codicon codicon-cloud-upload"></i></button>
<input type="file" id="fileElem" multiple accept="*/*" style="display: none;" />
<button id="bnSave" type="button" class="btn btn-light" title="save view">
<button id="bnSave" type="button" title="save view">
<i class="codicon codicon-git-stash"></i></button>
<button id="bnLoad" type="button" class="btn btn-light" title="load view">
<button id="bnLoad" type="button" title="load view">
<i class="codicon codicon-git-stash-pop"></i></button>
<button id="bnWordAt" type="button" class="btn btn-light" title="word at">
<button id="bnWordAt" type="button" title="word at">
<i class="codicon codicon-whole-word"></i></button>
</quiet-button-group>
@ -199,9 +204,28 @@
</footer>
</div>
<!-- dialogs -->
<quiet-popover for="popover__url">
<form action="about:blank" target="_blank">
<quiet-text-field type="url" name="url" label="URL to fetch" placeholder="http://..."
with-clear required style="width: 20em;">
<datalist>
<option value="https://raw.githubusercontent.com/expkg-zone58/pdfbox/refs/heads/main/src/Pdfbox3.xqm"></option>
<option value="Other"></option>
</datalist>
</quiet-text-field>
<quiet-button type="submit" variant="primary">Fetch</quiet-button>
<quiet-button data-popover="close" variant="neutral">Cancel</quiet-button>
</form>
</quiet-popover>
<!-- Popovers -->
<dialog id="popConnect" popover>
<form>
<header>Connect to LSP

View file

@ -39,9 +39,13 @@ window.addEventListener('beforeunload', () => {
$("connect").onclick = e => { e.preventDefault(); connect() };
$("symTrigger").onclick = e => { e.preventDefault(); };
$("symOptions").onclick = e => { e.preventDefault(); };
$("bnNew").onclick = e => { alert("TODO"); };
$("symTrigger").onclick = e => { e.preventDefault(); };
$("symOptions").onclick = e => { e.preventDefault(); };
$("bnNew").onclick = e => {
let name = prompt("New file name?");
if (name === null) return;
alert("TODO")
};
$("search").onclick = e => lsp.openSearchPanel(view);
@ -76,13 +80,13 @@ $("cmdList").onclick = e => {
};
$("symList").addEventListener("itemSelected", e => {
const plugin=lsp.LSPPlugin.get(view)
if(!plugin) return;
const plugin = lsp.LSPPlugin.get(view)
if (!plugin) return;
const sel = e.detail.range // or selectionRange;
console.log("SYM selection range", sel);
const an = plugin.fromPosition(sel.start)
const hd = plugin.fromPosition(sel.end)
view.dispatch({ selection: { anchor: an, head: hd}, scrollIntoView: true });
view.dispatch({ selection: { anchor: an, head: hd }, scrollIntoView: true });
});
$("lint").onclick = async e => {
@ -129,7 +133,7 @@ $("load").onchange = e => {
$("tConnect").addEventListener('quiet-change', e => {
e.preventDefault();
$("popConnect").showPopover()
});
});
$("msgIcon").onclick = e => {
e.preventDefault();
alert("NOT YET")
@ -158,13 +162,13 @@ function connect() {
const file = $("iFile").value;
lsp.simpleWebSocketTransport(server)
.then(transport => {
transport.socket.onclose = (event) => $("tConnect").checked=false;
transport.socket.onclose = (event) => $("tConnect").checked = false;
transport.socket.oneror = (event) => $("msg").innerText = "sock error!";
transport.subscribe(incoming);
client = new lsp.LSPClient({ extensions: lsp.languageServerExtensions() });
client.connect(transport);
$("popConnect").hidePopover();
$("tConnect").checked=true;
$("tConnect").checked = true;
const extLsp = client.plugin(file, "xquery");
view.dispatch({
@ -175,7 +179,7 @@ function connect() {
})
.catch(e => {
console.log(e);
$("tConnect").checked=false;
$("tConnect").checked = false;
alert("connection failed: " + server)
});

View file

@ -183,7 +183,7 @@ class PanelComponent extends HTMLElement {
style.textContent = `
@import url("../codicon@0.0.40/codicon.css");
ul { list-style-type: none; padding:0;margin:0;
background-color: #f8f9fa;font-size: 80%;}
background-color: #e3e4e4ff;font-size: 80%; scrollbar-color: #000077 #bada55;}
li { padding: 0 0 0 2px; border-bottom: 1px solid #ccc; cursor: pointer; width:100%; }
li:not(.selected) :hover { background-color: #ccc; }
.selected { background-color: #0d6efd;color: #ffff;}