Skip to content

Commit

Permalink
v2.1.6: adjust v-block-ref, pdf side panel, doc history side list; up…
Browse files Browse the repository at this point in the history
…date info
  • Loading branch information
mustakshif committed Feb 20, 2024
1 parent 178f79e commit ed7fef6
Show file tree
Hide file tree
Showing 9 changed files with 129 additions and 93 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
### v2.1.6

* 适配切换主题不重载
* 优化 `虚拟引用` 元素样式
* 调整 `pdf 阅读器` 侧栏和顶部工具栏样式
* 调整 `文件历史` 面板侧栏上下内边距,修复侧栏宽度频繁变动的问题
* 修复 Mac 端带图标的 `页签` 上下被裁切的问题
* 适配 `思源笔记增强` 插件,避免被状态栏遮挡

<br />

* Adapted switch-theme-without-reloading feature.
* Optimized the style of the `virtual reference` element.
* Adjusted the side panel and top toolbar styles of the `PDF reader`.
* Adjusted the top and bottom padding of the sidebar in the `document history` panel, and fixed the issue of frequent changes in sidebar width.
* Fixed the issue where `tabs` with icon were cropped on the top and bottom on Mac.
* Adapted the `sy-plugin-enhance` plugin to avoid being obscured by the status bar.

---

### v2.1.5

* 去除 `数据库` 表头和选择框右边框
Expand Down
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ An ultra-modern theme for [SiYuan Note](https://github.com/siyuan-note/siyuan),

## Latest Updates

### v2.1.5

* Removed the right border of the `database` header and selection box
* Enlarged the responsive area for the resizing control of iframes in full-width display
* Vertically aligned the icon and text of the `tab` on Mac
* Fixed the issue of icon misalignment in the `top bar` in extremely narrow width
* Adapted the tab bar for the `Background Cover` plugin
### v2.1.6

* Adapted switch-theme-without-reloading feature.
* Optimized the style of the `virtual reference` element.
* Adjusted the side panel and top toolbar styles of the `PDF reader`.
* Adjusted the top and bottom padding of the sidebar in the `document history` panel, and fixed the issue of frequent changes in sidebar width.
* Fixed the issue where `tabs` with icon were cropped on the top and bottom on Mac.
* Adapted the `sy-plugin-enhance` plugin to avoid being obscured by the status bar.

Check all updates [here](./CHANGELOG.md).

Expand Down
15 changes: 8 additions & 7 deletions README_zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ Asri 是一款极富现代感的[思源笔记](https://github.com/siyuan-note/si

## 最近更新

### v2.1.5

* 去除 `数据库` 表头和选择框右边框
* 扩大全宽显示 iframe 的大小调节控件响应区域
* 垂直方向上对齐 Mac 端 `页签` 图标和文本
* 修复极窄宽度下 `顶栏` 图标错位的问题
* 页签栏适配 `替换图片背景` 插件
### v2.1.6

* 适配切换主题不重载
* 优化 `虚拟引用` 元素样式
* 调整 `pdf 阅读器` 侧栏和顶部工具栏样式
* 调整 `文件历史` 面板侧栏上下内边距,修复侧栏宽度频繁变动的问题
* 修复 Mac 端带图标的 `页签` 上下被裁切的问题
* 适配 `思源笔记增强` 插件,避免被状态栏遮挡

点击[这里](./CHANGELOG.md)查看全部更新日志。

Expand Down
5 changes: 3 additions & 2 deletions style/components/dialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,9 @@

&>.b3-list,
&>.history__diff {
width: min(256px, 30%);
min-width: fit-content;
// width: min(256px, 30%);
// min-width: fit-content; // 导致宽度根据条目长度频繁变动
padding: 8px 0;
background-color: var(--b3-theme-surface);
}
}
Expand Down
2 changes: 1 addition & 1 deletion style/components/menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
padding: 5px;

.b3-menu__item {
padding: 0 8px;
// padding: 0 8px; //用默认主题的声明
background-color: transparent;
line-height: 24px;
border-radius: 5px;
Expand Down
27 changes: 20 additions & 7 deletions style/layout/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
color: inherit;
text-decoration: underline dashed;
text-decoration-color: var(--b3-theme-primary);
text-decoration-thickness: 0.1em;
text-decoration-thickness: .1em;
background: linear-gradient(90deg, var(--bg-clr) 100%, transparent 0%) center right;
background-size: 0;
background-repeat: no-repeat;
Expand All @@ -122,18 +122,20 @@
[data-node-id] span[data-type=virtual-block-ref] {
border-bottom: none;
text-decoration: underline;
text-decoration-thickness: 0.1em;
text-decoration-thickness: .1em;
text-decoration-color: var(--b3-theme-on-surface-light);
text-decoration-style: dashed;
background: linear-gradient(90deg, var(--b3-border-color) 100%, transparent 0%) center right;
background-size: 0;
background-repeat: no-repeat;
transition: background-size 0.2s;
transition: background-size .2s;

&:hover {
background-position: center left;
text-decoration-style: solid !important;
border: none;
background-size: 100% !important;
transition-delay: .125s;
}
}
}
Expand Down Expand Up @@ -423,6 +425,14 @@
// 标签 ——————————————————————————————————————
@include tag;

[data-node-id] span[data-type~="tag"] {
&[data-type~="block-ref"] {
box-shadow: none;
border: .08em solid var(--b3-theme-primary);
text-decoration: none;
}
}

// 行级代码 ————————————————————————————————————
@include inline-code;

Expand Down Expand Up @@ -614,7 +624,7 @@
margin: 0.2em 0;
}

.sb[data-sb-layout=row] > :where(.bq, .sb, blockquote) + :where(.bq, blockquote) {
.sb[data-sb-layout=row]> :where(.bq, .sb, blockquote)+ :where(.bq, blockquote) {
margin-top: $sb-gap;
}

Expand Down Expand Up @@ -932,7 +942,7 @@
transition-delay: 1s;
pointer-events: none;

> * {
>* {
pointer-events: all;
}

Expand Down Expand Up @@ -985,7 +995,7 @@
}

.b3-typography {
font-feature-settings: "ss06" on;
font-feature-settings: "ss06" on;
font-variant-ligatures: normal;
// font-variant-emoji: emoji; // 不受支持

Expand Down Expand Up @@ -1034,6 +1044,8 @@
#sidebarContainer {
top: 42px;
z-index: 1;
background-color: var(--b3-theme-background);
border-right: 1px solid var(--b3-border-color-trans);

#sidebarResizer {
right: -3px;
Expand All @@ -1060,6 +1072,7 @@
#toolbarViewer {
height: 42px;
align-items: center;
border-bottom: 1px solid var(--b3-border-color-trans);

.dropdownToolbarButton {
margin: 4px 8px 4px 0;
Expand Down Expand Up @@ -1228,7 +1241,7 @@
// 数据库主体
&__scroll {
font-variant-numeric: tabular-nums;

.av__row--header {
color: var(--b3-theme-on-surface);
font-weight: 500;
Expand Down
2 changes: 1 addition & 1 deletion theme.css

Large diffs are not rendered by default.

134 changes: 67 additions & 67 deletions theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -1019,81 +1019,81 @@

window.addEventListener('dblclick', handleDblClick);

// window.destroyTheme = () => {
window.destroyTheme = () => {

// let htmlElement = document.documentElement;
// let themeMode = htmlElement.getAttribute('data-theme-mode');
// let lightTheme = htmlElement.getAttribute('data-light-theme');
// let darkTheme = htmlElement.getAttribute('data-dark-theme');
let htmlElement = document.documentElement;
let themeMode = htmlElement.getAttribute('data-theme-mode');
let lightTheme = htmlElement.getAttribute('data-light-theme');
let darkTheme = htmlElement.getAttribute('data-dark-theme');

// // let switchBetweenAsriThemes = (themeMode === 'light' && (darkTheme === 'Asri-for-SiYuan' || darkTheme === 'Asri')) || (themeMode === 'dark' && (lightTheme === "Asri-for-SiYuan" || lightTheme === 'Asri'));
// let switchBetweenAsriThemes = (themeMode === 'light' && (darkTheme === 'Asri-for-SiYuan' || darkTheme === 'Asri')) || (themeMode === 'dark' && (lightTheme === "Asri-for-SiYuan" || lightTheme === 'Asri'));

// // let toDiffTheme = (themeMode === 'light' && (darkTheme !== "Asri-for-SiYuan" || darkTheme !== 'Asri')) || (themeMode === 'dark' && (lightTheme !== "Asri-for-SiYuan" || lightTheme !== 'Asri'));
// let toDiffTheme = (themeMode === 'light' && (darkTheme !== "Asri-for-SiYuan" || darkTheme !== 'Asri')) || (themeMode === 'dark' && (lightTheme !== "Asri-for-SiYuan" || lightTheme !== 'Asri'));

// // 取消事件监听
// window.removeEventListener('dblclick', handleDblClick);
// window.removeEventListener('resize', handleWinResize);
// 取消事件监听
window.removeEventListener('dblclick', handleDblClick);
window.removeEventListener('resize', handleWinResize);

// // 取消所有变动观察
// AsriObservers.forEach(observer => observer.disconnect());
// 取消所有变动观察
AsriObservers.forEach(observer => observer.disconnect());

// // 恢复 traffic light 位置
// if (isMacOS && !isInBrowser) setTrafficLightPosition(8);
// if (isMacOS && isMiniWindow) setTrafficLightPosition(8, 13);
// 恢复 traffic light 位置
if (isMacOS && !isInBrowser) setTrafficLightPosition(8);
if (isMacOS && isMiniWindow) setTrafficLightPosition(8, 13);

// // 删除添加的类名和元素
// AsriClassNames.forEach(className => {
// document.querySelectorAll(className).forEach(el => el.classList.remove(className.slice(1)));
// })
// document.querySelector('#AsriTopbarLeftSpacing')?.remove();
// document.querySelector('#AsriTopbarRightSpacing')?.remove();
// document.querySelector('#AsriPluginsIconsDivider')?.remove();

// // 移除 js 样式属性
// document.body.style.removeProperty('--mouseX');
// document.body.style.removeProperty('--mouseY');
// asriDoms.topbar?.style.removeProperty('--topbar-left-spacing');
// asriDoms.topbar?.style.removeProperty('--topbar-right-spacing');
// asriDoms.topbar?.style.removeProperty('--avoid-topbar');
// asriDoms.status?.style.removeProperty('max-width');
// asriDoms.status?.style.removeProperty('transform');
// asriDoms.status?.style.removeProperty('--status-height');

// let wndElements = asriDoms.layouts?.querySelectorAll('[data-type="wnd"]');
// wndElements.forEach(wnd => {
// let tabbarContainer = wnd.querySelector('.fn__flex-column[data-type="wnd"] > .fn__flex:first-child');
// let protyles = wnd.querySelectorAll('.protyle-wysiwyg');

// tabbarContainer.style.removeProperty('padding-left');
// tabbarContainer.style.removeProperty('padding-right');
// protyles.forEach(protyle => {
// protyle.style.removeProperty('--protyle-spacing');
// protyle.dataset.prevPadding = undefined;
// });
// })
// 删除添加的类名和元素
AsriClassNames.forEach(className => {
document.querySelectorAll(className).forEach(el => el.classList.remove(className.slice(1)));
})
document.querySelector('#AsriTopbarLeftSpacing')?.remove();
document.querySelector('#AsriTopbarRightSpacing')?.remove();
document.querySelector('#AsriPluginsIconsDivider')?.remove();

// 移除 js 样式属性
document.body.style.removeProperty('--mouseX');
document.body.style.removeProperty('--mouseY');
asriDoms.topbar?.style.removeProperty('--topbar-left-spacing');
asriDoms.topbar?.style.removeProperty('--topbar-right-spacing');
asriDoms.topbar?.style.removeProperty('--avoid-topbar');
asriDoms.status?.style.removeProperty('max-width');
asriDoms.status?.style.removeProperty('transform');
asriDoms.status?.style.removeProperty('--status-height');

let wndElements = asriDoms.layouts?.querySelectorAll('[data-type="wnd"]');
wndElements.forEach(wnd => {
let tabbarContainer = wnd.querySelector('.fn__flex-column[data-type="wnd"] > .fn__flex:first-child');
let protyles = wnd.querySelectorAll('.protyle-wysiwyg');

tabbarContainer.style.removeProperty('padding-left');
tabbarContainer.style.removeProperty('padding-right');
protyles.forEach(protyle => {
protyle.style.removeProperty('--protyle-spacing');
protyle.dataset.prevPadding = undefined;
});
})

// let layoutTabContainers = asriDoms.layouts?.querySelectorAll('.layout__center .layout-tab-container');
// layoutTabContainers.forEach(tabContainer => {
// tabContainer.style.removeProperty('padding-bottom');
// })
let layoutTabContainers = asriDoms.layouts?.querySelectorAll('.layout__center .layout-tab-container');
layoutTabContainers.forEach(tabContainer => {
tabContainer.style.removeProperty('padding-bottom');
})

// document.getElementById('searchList')?.style.removeProperty('padding-bottom');
// document.getElementById('searchPreview')?.style.removeProperty('padding-bottom');
// document.getElementById('viewerContainer')?.style.removeProperty('padding-bottom');
// asriDoms.layouts.querySelectorAll('.card__main').forEach(card => {
// card.style.removeProperty('padding-bottom');
// })
// document.querySelectorAll('.dock').forEach(dock => {
// dock.style.removeProperty('--border-clr');
// })
document.getElementById('searchList')?.style.removeProperty('padding-bottom');
document.getElementById('searchPreview')?.style.removeProperty('padding-bottom');
document.getElementById('viewerContainer')?.style.removeProperty('padding-bottom');
asriDoms.layouts.querySelectorAll('.card__main').forEach(card => {
card.style.removeProperty('padding-bottom');
})
document.querySelectorAll('.dock').forEach(dock => {
dock.style.removeProperty('--border-clr');
})

// // 还原被删除的规则
// if (AsriDeletedRules) {
// for (let i = 0; i < AsriDeletedRules.length; i++) {
// let rule = AsriDeletedRules[i];
// rule.styleSheet.insertRule(rule.rule, rule.styleSheet.cssRules.length);
// }
// }
// // console.log('Asri theme destroyed!');
// }
// 还原被删除的规则
if (AsriDeletedRules) {
for (let i = 0; i < AsriDeletedRules.length; i++) {
let rule = AsriDeletedRules[i];
rule.styleSheet.insertRule(rule.rule, rule.styleSheet.cssRules.length);
}
}
// console.log('Asri theme destroyed!');
}
})();
2 changes: 1 addition & 1 deletion theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Asri",
"author": "MUSTAKSHIF",
"url": "https://github.com/mustakshif/Asri",
"version": "2.1.5",
"version": "2.1.6",
"displayName": {
"default": "Asri",
"zh_CN": "Asri",
Expand Down

0 comments on commit ed7fef6

Please sign in to comment.