Small UI changes

This commit is contained in:
Magnus Åhall 2026-06-04 08:42:54 +02:00
parent 44ee1ac94b
commit 12f8c019f0
5 changed files with 47 additions and 35 deletions

View file

@ -199,6 +199,10 @@ html {
#main-page { #main-page {
display: contents; display: contents;
&:focus-within {
background-color: #faf;
}
&.node { &.node {
#page-node { #page-node {
display: contents; display: contents;

View file

@ -8,7 +8,7 @@
version="1.1" version="1.1"
id="svg1" id="svg1"
sodipodi:docname="leaf.svg" sodipodi:docname="leaf.svg"
inkscape:version="1.4.2 (ebf0e94, 2025-05-08)" inkscape:version="1.4.4 (dcaf3e7d9e, 2026-05-05)"
xml:space="preserve" xml:space="preserve"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
@ -23,13 +23,13 @@
inkscape:pagecheckerboard="0" inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1" inkscape:deskcolor="#d1d1d1"
inkscape:document-units="px" inkscape:document-units="px"
inkscape:zoom="11.17754" inkscape:zoom="31.614857"
inkscape:cx="8.0965937" inkscape:cx="5.0609117"
inkscape:cy="22.903072" inkscape:cy="9.5524708"
inkscape:window-width="1916" inkscape:window-width="2190"
inkscape:window-height="1161" inkscape:window-height="1401"
inkscape:window-x="0" inkscape:window-x="1463"
inkscape:window-y="18" inkscape:window-y="0"
inkscape:window-maximized="1" inkscape:window-maximized="1"
inkscape:current-layer="layer1" inkscape:current-layer="layer1"
showgrid="false" /><defs showgrid="false" /><defs
@ -42,6 +42,10 @@
id="title1-1">folder-open-outline</title><title id="title1-1">folder-open-outline</title><title
id="title1-5">notebook-outline</title><title id="title1-5">notebook-outline</title><title
id="title1-8">text-box-outline</title><path id="title1-8">text-box-outline</title><path
style="fill:#ffffff;stroke-width:0.264583"
d="m 108.3015,148.56838 h 3.95851 v 3.96688 h -3.95851 z"
id="path3"
sodipodi:nodetypes="ccccc" /><path
d="m 108.47917,148.16667 c -0.29369,0 -0.52917,0.23548 -0.52917,0.52917 V 152.4 c 0,0.29369 0.23548,0.52917 0.52917,0.52917 h 3.70416 c 0.29369,0 0.52917,-0.23548 0.52917,-0.52917 v -3.70416 c 0,-0.29369 -0.23548,-0.52917 -0.52917,-0.52917 h -3.70416 m 0,0.52917 h 3.70416 V 152.4 h -3.70416 v -3.70416" d="m 108.47917,148.16667 c -0.29369,0 -0.52917,0.23548 -0.52917,0.52917 V 152.4 c 0,0.29369 0.23548,0.52917 0.52917,0.52917 h 3.70416 c 0.29369,0 0.52917,-0.23548 0.52917,-0.52917 v -3.70416 c 0,-0.29369 -0.23548,-0.52917 -0.52917,-0.52917 h -3.70416 m 0,0.52917 h 3.70416 V 152.4 h -3.70416 v -3.70416"
id="path1" id="path1"
style="fill:#ababab;fill-opacity:1;stroke-width:0.264583" style="fill:#ababab;fill-opacity:1;stroke-width:0.264583"

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Before After
Before After

View file

@ -66,7 +66,6 @@ export class App {
switch (event.key.toUpperCase()) { switch (event.key.toUpperCase()) {
case 'T': case 'T':
if (document.activeElement.id === 'tree-nodes') { if (document.activeElement.id === 'tree-nodes') {
console.log('take focus')
this.nodeUI.takeFocus() this.nodeUI.takeFocus()
} else { } else {
this.tree.focus() this.tree.focus()

View file

@ -106,9 +106,9 @@ export class N2PageNodeUI extends CustomHTMLElement {
}// }}} }// }}}
takeFocus() {// {{{ takeFocus() {// {{{
if (this.showMarkdown()) { if (this.showMarkdown()) {
this.elNodeMarkdown.focus() this.elNodeMarkdown.focus({ preventScroll: true })
} else } else
this.elNodeContent.focus() this.elNodeContent.focus({ preventScroll: true })
}// }}} }// }}}
contentChanged(event) {//{{{ contentChanged(event) {//{{{

View file

@ -64,8 +64,6 @@ export class N2Tree extends CustomHTMLElement {
this.tmpl.innerHTML = ` this.tmpl.innerHTML = `
<style> <style>
n2-tree { n2-tree {
anchor-name: --tree;
#logo { #logo {
display: grid; display: grid;
grid-template-columns: 1fr min-content; grid-template-columns: 1fr min-content;
@ -97,27 +95,8 @@ export class N2Tree extends CustomHTMLElement {
cursor: pointer; cursor: pointer;
margin-left: 16px; margin-left: 16px;
} }
.focusline {
position: fixed;
background-color: #a00;
top: 0px;
left: anchor(--tree left);
right: anchor(--tree right);
height: 2px;
opacity: 0;
}
&:focus-within {
.focusline {
opacity: 1;
background-color: #fff;
transition: background-color 150ms;
}
}
} }
</style> </style>
<div class="focusline"></div>
<div id="logo"> <div id="logo">
<img data-el="logo" src="/images/${_VERSION}/logo.svg" /> <img data-el="logo" src="/images/${_VERSION}/logo.svg" />
<div data-el="hide-tree">&lt;</div> <div data-el="hide-tree">&lt;</div>
@ -492,10 +471,35 @@ export class N2TreeNode extends CustomHTMLElement {
static {// {{{ static {// {{{
this.tmpl = document.createElement('template') this.tmpl = document.createElement('template')
this.tmpl.innerHTML = ` this.tmpl.innerHTML = `
<style>
n2-tree:focus-within {
.el-name {
&.selected {
span {
position:relative;
}
span:before {
position: absolute;
content: '';
top: -8px;
left: -36px;
right: -8px;
bottom: -4px;
z-index: -1;
background-color: #f8f8f8;
border: 1px solid #ddd;
border-radius: 4px;
}
}
}
}
</style>
<div data-el="expand-toggle" class="expand-toggle"> <div data-el="expand-toggle" class="expand-toggle">
<img data-el="expand"> <img data-el="expand">
</div> </div>
<div data-el="name" class="name"></div> <div data-el="name" class="name"><span></span></div>
<div data-el="children" class="children"></div> <div data-el="children" class="children"></div>
` `
}// }}} }// }}}
@ -541,7 +545,8 @@ export class N2TreeNode extends CustomHTMLElement {
} }
// Update the name and selected status // Update the name and selected status
this.elName.innerText = this.node.get('Name') this.elName.querySelector('span').innerText = this.node.get('Name')
if (this.tree.isSelected(this.node)) if (this.tree.isSelected(this.node))
this.elName.classList.add('selected') this.elName.classList.add('selected')
else else