Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(share): give the tree the app's pane color and raised current note
Elian Dorancd6d6f7bdbb3
diff --git a/packages/share-theme/src/base.css b/packages/share-theme/src/base.cssindex 0cf281a4ab..6be88c60a8 100644--- a/packages/share-theme/src/base.css+++ b/packages/share-theme/src/base.css@@ -30,9 +30,11 @@ html.theme-light {--link-hover-background: #3c7fa017;--link-focus-outline-color: #00000063;--text-menu-active: var(--background-secondary);- --tree-item-hover-background: rgba(0, 0, 0, 0.04);- --tree-item-active-background: rgba(0, 0, 0, 0.075);+ /* The tree item colors of `theme-next-light.css`. */+ --tree-item-hover-background: rgba(0, 0, 0, 0.032);+ --tree-item-active-background: #FFFFFF;--tree-item-active-color: #000000;+ --tree-item-active-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);--mermaid-theme: default;color-scheme: light;}@@ -54,6 +56,7 @@ html.theme-dark {--tree-item-hover-background: #ffffff0d;--tree-item-active-background: #ffffff25;--tree-item-active-color: #dfdfdf;+ --tree-item-active-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);--mermaid-theme: dark;color-scheme: dark;}diff --git a/packages/share-theme/src/page/layout.css b/packages/share-theme/src/page/layout.cssindex 461ae68a1e..6c8f4b9a1a 100644--- a/packages/share-theme/src/page/layout.css+++ b/packages/share-theme/src/page/layout.css@@ -20,6 +20,7 @@ html {width: min(18rem, 25vw);height: 100vh;border-inline-end: 1px solid var(--background-highlight);+ background: var(--background-secondary);justify-content: flex-start;position: sticky;top: 0;@@ -27,6 +28,19 @@ html {flex-shrink: 0;}+/* Extends the pane's background to the edge of the window when the layout is narrower than it. */+@media not all and (max-width: 48em) {+ #left-pane {+ box-shadow: -100vw 0 0 100vw var(--background-secondary);+ clip-path: inset(0 0 0 -100vw);+ }++ #left-pane:dir(rtl) {+ box-shadow: 100vw 0 0 100vw var(--background-secondary);+ clip-path: inset(0 -100vw 0 0);+ }+}+#right-pane {flex: 1;min-width: 0;@@ -88,7 +102,6 @@ html {width: 80%;max-width: 300px;height: auto;- background: var(--background-secondary);transform: translateX(-100%);transition: transform 200ms ease;z-index: 2;diff --git a/packages/share-theme/src/page/navigation.css b/packages/share-theme/src/page/navigation.cssindex 1caf5fb278..e2f70aa90c 100644--- a/packages/share-theme/src/page/navigation.css+++ b/packages/share-theme/src/page/navigation.css@@ -18,13 +18,11 @@}#menu > ul {- overflow-y: auto;list-style: none;padding-inline-start: 0 !important;}#menu ul {- overflow-y: hidden;position: relative;display: flex;flex-direction: column;@@ -56,7 +54,7 @@flex: 1;align-items: center;gap: 6px;- padding: 4px 8px;+ padding: 7px 8px;border-radius: 6px;color: var(--text-menu);font-weight: 400;@@ -65,7 +63,7 @@}#menu li.item > a {- padding-inline-start: 32px;+ padding-inline-start: 38px;}#menu a:hover {@@ -79,6 +77,7 @@#menu a.active {background: var(--tree-item-active-background);+ box-shadow: var(--tree-item-active-shadow);color: var(--tree-item-active-color);}@@ -98,7 +97,7 @@flex-shrink: 0;align-items: center;justify-content: center;- width: 18px;+ width: 24px;padding: 0;border: 0;background: transparent;@@ -123,7 +122,7 @@}.collapse-button .tn-icon {- font-size: 18px;+ font-size: 24px;}@media (prefers-reduced-motion: reduce) {diff --git a/packages/share-theme/src/page/navigation.spec.ts b/packages/share-theme/src/page/navigation.spec.tsindex 3daf0e5f87..8ee52ea027 100644--- a/packages/share-theme/src/page/navigation.spec.ts+++ b/packages/share-theme/src/page/navigation.spec.ts@@ -35,8 +35,10 @@ describe("setupExpanders", () => {expect(click.defaultPrevented).toBe(true);expect(item.classList.contains("expanded")).toBe(true);expect(subtree.style.height).toBe("40px");+ expect(subtree.style.overflow).toBe("hidden");vi.advanceTimersByTime(200);expect(subtree.style.height).toBe("");+ expect(subtree.style.overflow).toBe("");expander.click();expect(item.classList.contains("expanded")).toBe(false);diff --git a/packages/share-theme/src/page/navigation.ts b/packages/share-theme/src/page/navigation.tsindex 1066c3e4ba..3a1ec4f999 100644--- a/packages/share-theme/src/page/navigation.ts+++ b/packages/share-theme/src/page/navigation.ts@@ -18,6 +18,8 @@ export default function setupExpanders() {}const isExpanded = li.classList.contains("expanded");+ // Only a moving subtree is clipped, so the current note's shadow shows otherwise.+ ul.style.overflow = "hidden";if (isExpanded) {// Collapsing@@ -39,6 +41,7 @@ export default function setupExpanders() {setTimeout(() => {ul.style.height = "";+ ul.style.overflow = "";}, 200);});}