Skip to content

Commit

Permalink
Merge branch 'preview-features' into preview
Browse files Browse the repository at this point in the history
  • Loading branch information
the1812 committed Sep 8, 2024
2 parents 334026b + b512fc6 commit 3d56cf2
Show file tree
Hide file tree
Showing 62 changed files with 1,488 additions and 465 deletions.
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,43 @@
<!-- spell-checker: disable -->
# 更新日志

## v2.9.2-preview
`2024-09-08`

包含 [v2.9.2](https://github.com/the1812/Bilibili-Evolved/releases/tag/v2.9.2) 的所有更新内容.

✨新增
- `弹幕转义` 支持对正斜杠的换行 (`/n`) 进行转义. (#4865)
- `自定义顶栏` 支持直接在功能中打开布局设置. (#2666)
- `高分辨率图片` 支持处理没有指定高度的图片, 支持在专栏页面中请求原图. (#2868)
- `直播间网页全屏自适应` 样式适配较低的宽度值. (#4895)

☕开发者相关
- 外部资源接入 Subresource Integrity. (#4896)

## v2.9.2
`2024-09-08`

✨新增
- `网址参数清理` 支持清理 `is_room_feed`. (PR #4886 by [dreammu](https://github.com/dreammu))

🐛修复
- 新版评论区相关功能修复: (#4843)
- 修复 `快速收起评论` 按钮错位. (#4890)
- 恢复功能: `禁用评论区搜索词`, `评论区IP属地显示`, `复制动态链接`.
- `简化评论区` 支持 Firefox.
- 样式实现使用 [Container style queries](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_containment/Container_size_and_style_queries#container_style_queries_2) 替代 [:host-context](https://developer.mozilla.org/en-US/docs/Web/CSS/:host-context), 虽然 Firefox 还是不支持, 但是能稍微标准化一点.
- 夜间模式适配

☕开发者相关
- Shadow DOM API (`./src/core/shadow-dom`) 更名为 Shadow Root API (`./src/core/shadow-root`), 模块内的功能导出单例:
- `shadowDomObserver`: 持续观测页面上的所有 Shadow DOM.
- `shadowRootStyles`: 支持将样式注入到 Shadow DOM 内部.
- Comments API 增加 `CommentAreaV3` 实现, 支持基于 Shadow DOM 的新版评论区. (#4843)
- 增加 `isContainerStyleQuerySupported` 来检测当前浏览器对 [Container style queries](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_containment/Container_size_and_style_queries#container_style_queries_2) 的支持.
- 组件样式支持在 `ComponentMetadata.instantStyles` 中声明 `shadowDom: true` 来插入到 Shadow DOM 中.


## v2.9.1-preview
`2024-08-15`

Expand Down
4 changes: 4 additions & 0 deletions doc/donate.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ https://afdian.net/@the1812?tab=sponsor

| 时间 | 用户名 | 单号后4位 | 金额 |
| ------------------- | --------------------- | --------- | ------- |
| 2024.09.06 16:05:23 | 匿名 | 0752 | ¥5.00 |
| 2024.09.03 23:08:43 | *| 3956 | ¥20.00 |
| 2024.08.25 16:55:07 | 匿名 | 6595 | ¥10.00 |
| 2024.08.16 11:01:03 | 匿名 | 7648 | ¥30.00 |
| 2024.08.15 10:18:07 | *9 | 1653 | ¥10.00 |
| 2024.07.30 13:40:22 | Z*n | 2215 | ¥5.00 |
| 2024.07.24 09:38:46 | H*g | 7776 | ¥5.00 |
Expand Down
2 changes: 1 addition & 1 deletion doc/features/features.json
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@
"type": "component",
"name": "unescapeDanmaku",
"displayName": "弹幕转义",
"description": "将弹幕中的 `\\n` 替换为真实的换行, 注意这可能导致原先不重叠的弹幕发生重叠.\r\n",
"description": "将弹幕中的 `\\n` 或 `/n` 替换为真实的换行, 注意这可能导致原先不重叠的弹幕发生重叠.\r\n",
"fullRelativePath": "../../registry/dist/components/video/danmaku/unescape.js",
"fullAbsolutePath": "registry/dist/components/video/danmaku/unescape.js"
},
Expand Down
2 changes: 1 addition & 1 deletion doc/features/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ by [@kdxcxs](https://github.com/kdxcxs)

**GitHub:** [`Stable`](https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/registry/dist/components/video/danmaku/unescape.js) / [`Preview`](https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/registry/dist/components/video/danmaku/unescape.js)

将弹幕中的 `\n` 替换为真实的换行, 注意这可能导致原先不重叠的弹幕发生重叠.
将弹幕中的 `\n` `/n` 替换为真实的换行, 注意这可能导致原先不重叠的弹幕发生重叠.

### [视频页默认定位](../../registry/dist/components/video/default-location.js)
`videoDefaultLocation`
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
:host(bili-comments) {
#end .bottombar {
padding-bottom: 8px !important;
}
}
20 changes: 15 additions & 5 deletions registry/lib/components/feeds/fold-comments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { select } from '@/core/spin-query'
import { childListSubtree } from '@/core/observer'

const entry = async () => {
const { shadowRootStyles } = await import('@/core/shadow-root')
const { forEachFeedsCard } = await import('@/components/feeds/api')
const { childList } = await import('@/core/observer')
const commentSelector = '.bb-comment, .bili-comment-container'
Expand All @@ -30,20 +31,23 @@ const entry = async () => {
commentBox.insertAdjacentElement('beforeend', button)
}
if (feedsCardsManager.managerType === 'v2') {
const existingComment = dq(card, commentSelector) as HTMLElement
const getExistingComment = () => dq(card, commentSelector) as HTMLElement
const isCommentAreaReady = () => {
const existingComment = getExistingComment()
return existingComment !== null && dq(existingComment, 'bili-comments')
}
const handler = () => {
const button = dq(card, '.bili-dyn-action.comment') as HTMLElement
button?.click()
}
if (!existingComment) {
if (!isCommentAreaReady()) {
childListSubtree(card, () => {
const panel = dq(card, commentSelector)
if (panel) {
if (isCommentAreaReady()) {
injectToComment(card, handler)
}
})
} else {
injectToComment(existingComment, handler)
injectToComment(getExistingComment(), handler)
}
return
}
Expand Down Expand Up @@ -75,6 +79,12 @@ const entry = async () => {
forEachFeedsCard({
added: c => injectButton(c.element),
})

const style = await import('./fold-comment-shadow.scss').then(m => m.default)
shadowRootStyles.addStyle({
id: 'foldComments',
style,
})
}

export const component = defineComponentMetadata({
Expand Down
20 changes: 20 additions & 0 deletions registry/lib/components/live/chat-panel-fit/chat-panel-fit.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
.player-full-win:not(.hide-aside-area) {
.live-room-app {
.aside-area {
container-name: aside-area;
container-type: size;
width: var(--live-chat-panel-width, 302px) !important;
}
.player-section {
width: calc(100% - var(--live-chat-panel-width, 302px)) !important;
}
@container aside-area (max-width: 290px) {
.control-panel-icon-row-new .icon-left-part-new {
.super-chat,
.like-btn {
width: 32px;
&-icon {
margin-right: 0 !important;
}
&-text {
display: none !important;
}
}
}
.chat-input-ctnr-new .medal-section {
min-width: 0 !important;
max-width: 0 !important;
}
}
}
}
3 changes: 3 additions & 0 deletions registry/lib/components/style/custom-navbar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ export const component = defineComponentMetadata({
// const { addImportantStyle } = await import('@/core/style')
// addImportantStyle(style, styleID)
},
widget: {
component: () => import('./settings/Widget.vue').then(m => m.default),
},
extraOptions: () => import('./settings/ExtraOptions.vue').then(m => m.default),
plugin: {
displayName: '自定义顶栏 - 功能扩展',
Expand Down
24 changes: 24 additions & 0 deletions registry/lib/components/style/custom-navbar/settings/Widget.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<template>
<DefaultWidget
name="顶栏布局设置"
icon="mdi-sort"
@mouseover="loadNavbarSettings()"
@click="toggleNavbarSettings()"
/>
</template>
<script lang="ts">
import { DefaultWidget } from '@/ui'
import { loadNavbarSettings, toggleNavbarSettings } from './vm'
export default Vue.extend({
components: {
DefaultWidget,
},
methods: {
async loadNavbarSettings() {
await loadNavbarSettings()
},
toggleNavbarSettings,
},
})
</script>
77 changes: 77 additions & 0 deletions registry/lib/components/style/dark-mode/dark-shadow-dom.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
@import './dark-definitions';

:host(bili-comment-action-buttons-renderer) {
@include color('a');
button {
@include color('a');
&:hover {
@include theme-color();
}
}
bili-icon[style*='var(--brand_blue)'] ~ #count {
@include theme-color();
}
}
:host(bili-comment-replies-renderer) {
#view-more {
@include color('a');
}
}
:host(bili-comment-user-info) {
#user-name {
@include color('e');
}
}
:host(bili-comments) {
.bottombar {
@include color('e');
&.clickable:hover {
@include theme-color();
}
}
}
:host(bili-comment-menu) {
#options li:hover {
@include background-color('3');
}
}
:host(bili-rich-text) {
#contents {
a {
@include theme-color();
}
img,
a i {
@include to-theme('blue');
}
}
}
:host(bili-comment-box) {
#pub button {
@include theme-background-color();
@include foreground-color();
&:hover,
&.active {
@include theme-background-color('80');
}
}
}
:host(bili-comments-header-renderer) {
#title #count {
@include color('a');
}
bili-text-button {
@include set-color('--_label-text-color', 'e');
&:hover {
@include set-theme-color('--_label-text-color-hover');
}
}
#sort-actions.hot bili-text-button:first-child,
#sort-actions.time bili-text-button:last-child {
@include set-theme-color('--_label-text-color');
}
.bili-comments-bottom-fixed-wrapper > div {
@include background-color('2');
@include border-color('3');
}
}
27 changes: 27 additions & 0 deletions registry/lib/components/style/dark-mode/dark-slice-16.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,28 @@
.bili-dyn-publishing {
@include dyn-container-skeleton();
@include background-color('4');
&__title {
&__input {
@include background-color();
@include color('e');
&::placeholder {
@include color('a');
}
}
&__indicator {
@include color('a');
}
&__close {
@include background-color('6');
}
}
&__tools {
&__item {
@include color('e');
&.active,
&:hover {
@include theme-color();
}
// 这里用 filter 会导致弹窗内容也被影响, 暂时先去掉了
// &.active,
// &:hover {
Expand All @@ -79,6 +99,13 @@
}
}
}
&__settings__btn {
@include color('e');
&.active,
&:hover {
@include theme-color();
}
}
.bili-rich-textarea__inner {
@include background-color();
@include color('e');
Expand Down
23 changes: 14 additions & 9 deletions registry/lib/components/style/dark-mode/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineComponentMetadata } from '@/components/define'
import { darkExcludes } from './dark-urls'

const name = 'darkMode'
const changeDelay = 200
const darkMetaColor = '#111'
const add = async () => {
Expand Down Expand Up @@ -40,16 +41,15 @@ const remove = async () => {
colorSchemeMeta.content = 'light'
}
}
const entry = async () => {
setTimeout(add, changeDelay)
}

export const component = defineComponentMetadata({
name: 'darkMode',
name,
displayName: '夜间模式',
entry: () => {
setTimeout(add, changeDelay)
},
reload: () => {
setTimeout(add, changeDelay)
},
entry,
reload: entry,
unload: () => {
setTimeout(remove, changeDelay)
},
Expand All @@ -66,6 +66,11 @@ export const component = defineComponentMetadata({
style: () => import('./dark-mode.important.scss'),
important: true,
},
{
name: 'dark-shadow-dom',
style: () => import('./dark-shadow-dom.scss'),
shadowDom: true,
},
],
plugin: {
displayName: '夜间模式 - 提前注入',
Expand All @@ -76,8 +81,8 @@ export const component = defineComponentMetadata({
const { contentLoaded } = await import('@/core/life-cycle')
const { isComponentEnabled } = await import('@/core/settings')
contentLoaded(() => {
// 提前添加dark的class, 防止颜色抖动
if (isComponentEnabled('darkMode')) {
// 提前添加 dark 的 class, 防止颜色抖动
if (isComponentEnabled(name)) {
document.body.classList.add('dark')
}
})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
:host(bili-rich-text) {
#contents img,
#contents a i {
max-width: 1.4em;
max-height: 1.4em;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
:host(bili-comment-renderer) {
bili-comment-user-sailing-card {
display: none;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
:host(bili-comments-header-renderer) {
bili-comments-notice {
display: none;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
:host(bili-comment-user-info) {
bili-comment-user-medal {
display: none;
}
}
Loading

0 comments on commit 3d56cf2

Please sign in to comment.