An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Refine settings dialog drag area and frosted glass transition https://github.com/siyuan-note/siyuan/issues/19141
Vanessab227e30ab556
diff --git a/app/src/assets/scss/business/_config.scss b/app/src/assets/scss/business/_config.scssindex 2dfc7cb31a..76254d0ac0 100644--- a/app/src/assets/scss/business/_config.scss+++ b/app/src/assets/scss/business/_config.scss@@ -15,8 +15,50 @@position: absolute;top: 0;left: 0;+ right: 0;z-index: 1;+ height: 24px;touch-action: none;++ &::before {+ content: "";+ position: absolute;+ inset: 0;+ pointer-events: none;+ background-color: color-mix(in srgb, var(--b3-theme-background) 80%, transparent);+ backdrop-filter: blur(10px);+ -webkit-backdrop-filter: blur(10px);+ mask-image: linear-gradient(to bottom, #000 0%, #000 30%, transparent 100%);+ }++ &--tabs {+ height: 16px;+ }+ }++ &__tab-wrap > .config__tab-container:not([data-name="bazaar"]):not([data-name="assets"]) {+ margin: 0 24px;+ padding: 24px 0;+ scroll-padding-block: 24px;+ height: 100%;+ flex-shrink: 0;++ > .config-group {+ margin-left: 0;+ margin-right: 0;+ }++ > .config-group--first {+ margin-top: 0;++ > .config-title {+ margin-top: 0;+ }+ }++ > .config-group--last {+ margin-bottom: 0;+ }}&__tab-container {diff --git a/app/src/config/setting/drag.ts b/app/src/config/setting/drag.tsindex a2c6317d16..2553ea3625 100644--- a/app/src/config/setting/drag.ts+++ b/app/src/config/setting/drag.ts@@ -1,6 +1,6 @@import {scrollSettingContent} from "./dragScroll";-// 拖拽层仅覆盖首组标题及现有留白,随滚动和面板切换更新,避开控件及滚动条。+// 顶部渐变毛玻璃固定覆盖边距,内容从其后方滚动,同时支持拖拽。export const initSettingDrag = (dialog: HTMLElement) => {const wrap = dialog.querySelector<HTMLElement>(".config__tab-wrap");const handle = document.createElement("div");@@ -25,40 +25,27 @@ export const initSettingDrag = (dialog: HTMLElement) => {frame = 0;const panel = Array.from(wrap.querySelectorAll<HTMLElement>(":scope > .config__tab-container")).find(element => element.getClientRects().length > 0);- let height = 0;- let width = 0;- if (panel) {- const top = wrap.getBoundingClientRect().top;- width = panel.clientWidth;- let first = Array.from(panel.children).find(element => element.getClientRects().length > 0);- // 穿过纯布局容器,找到实际首项;嵌套页面的工具栏也在此处形成边界。- while (first && !first.matches(".config-group, .layout-tab-bar, .b3-label, .b3-dialog__header")) {- const child = Array.from(first.children).find(element => element.getClientRects().length > 0);- if (!child) {- break;+ const className = `config__drag resize__move${panel ?+ (["bazaar", "assets"].includes(panel.dataset.name) ? " config__drag--tabs" : "") : " fn__none"}`;+ if (handle.className !== className) {+ handle.className = className;+ }+ if (panel && !["bazaar", "assets"].includes(panel.dataset.name)) {+ // 搜索过滤后也只移除首尾可见分组的外侧间距,避免与固定留白叠加。+ const visible = Array.from(panel.children).filter(element => element.getClientRects().length > 0);+ const first = visible[0];+ const last = visible[visible.length - 1];+ panel.querySelectorAll(":scope > .config-group").forEach(group => {+ const isFirst = group === first;+ if (group.classList.contains("config-group--first") !== isFirst) {+ group.classList.toggle("config-group--first", isFirst);}- first = child;- }- if (first) {- height = Math.min(24, first.getBoundingClientRect().top - top);- if (first.matches(".layout-tab-bar")) {- // 使用页签实际顶边识别内边距及外边距,热区不覆盖可点击的页签。- const items = Array.from(first.children).filter(element => element.getClientRects().length > 0);- if (items.length > 0) {- height = Math.min(24, ...items.map(element => element.getBoundingClientRect().top - top));- }- } else if (first.matches(".config-group")) {- const title = first.querySelector<HTMLElement>(":scope > .config-title");- const items = first.querySelector<HTMLElement>(":scope > .config-items");- if (title?.getClientRects().length && items &&- !title.querySelector("button, input, select, textarea, a, label, [contenteditable], [role], [tabindex], [data-type], [data-action], .block__icon")) {- height = items.getBoundingClientRect().top - top;- }+ const isLast = group === last;+ if (group.classList.contains("config-group--last") !== isLast) {+ group.classList.toggle("config-group--last", isLast);}- }+ });}- handle.style.width = `${width}px`;- handle.style.height = `${Math.max(0, height)}px`;};const schedule = () => {if (!frame) {@@ -67,17 +54,10 @@ export const initSettingDrag = (dialog: HTMLElement) => {};const observer = new MutationObserver(schedule);observer.observe(wrap, {childList: true, subtree: true, attributes: true, attributeFilter: ["class"]});- const resizeObserver = new ResizeObserver(schedule);- resizeObserver.observe(wrap);- wrap.addEventListener("scroll", update, true);- dialog.addEventListener("transitionend", schedule);schedule();return () => {handle.removeEventListener("wheel", onWheel);cancelAnimationFrame(frame);observer.disconnect();- resizeObserver.disconnect();- wrap.removeEventListener("scroll", update, true);- dialog.removeEventListener("transitionend", schedule);};};