Skip to content

Commit

Permalink
feat(plugin): support enhanceTrans
Browse files Browse the repository at this point in the history
  • Loading branch information
ilharp committed Nov 9, 2023
1 parent 0835759 commit 8e9fbb5
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion packages/plugin/clients/enhance/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ const enhanceColorCSS = `
`

const enhanceTransCSS = `
.layout-container,
.main-container,
.layout-container .layout-aside,
.layout-status {
background: transparent !important;
}
`

let themeObserver: MutationObserver
let styleSheet: HTMLStyleElement

Expand Down Expand Up @@ -111,6 +121,9 @@ const syncStyleSheet = (config: RemovableRef<Config>) => {
case 'enhance':
styleSheet.innerHTML = baseCSS + enhanceCSS
break
case 'enhanceTrans':
styleSheet.innerHTML = baseCSS + enhanceCSS + enhanceTransCSS
break
}
}

Expand All @@ -126,6 +139,7 @@ const syncTheme = (config: RemovableRef<Config>) => {
)
break
case 'enhance':
case 'enhanceTrans':
send(
window.document.documentElement.classList.contains('dark')
? 'TD'
Expand Down Expand Up @@ -182,7 +196,7 @@ const disposeEnhance = () => {
declare module '@koishijs/client' {
interface Config {
desktop: {
enhance: 'off' | 'enhance' | 'enhanceColor'
enhance: 'off' | 'enhance' | 'enhanceColor' | 'enhanceTrans'
}
}
}
Expand All @@ -204,6 +218,11 @@ export default (ctx: Context) => {
.description('增强色彩')
// @ts-expect-error 【管理员】孤梦星影 1:35:20 看了源码,实际上是可用的 只是没有类型 你可以 @ts-ignore
.disabled(!supports('enhanceColor')),

Schema.const('enhanceTrans')
.description('增强透视')
// @ts-expect-error 【管理员】孤梦星影 1:35:20 看了源码,实际上是可用的 只是没有类型 你可以 @ts-ignore
.disabled(!supports('enhance')),
].filter(Boolean),
)
.default(supports('enhance') ? 'enhance' : 'off')
Expand Down

0 comments on commit 8e9fbb5

Please sign in to comment.