mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-12 23:36:15 -08:00
27 lines
747 B
TypeScript
27 lines
747 B
TypeScript
import type { ControlFactory, ControlOption } from './types'
|
|
import { appendElement } from '../component/dom'
|
|
import { tooltip } from '../utils'
|
|
import { controlEvents } from './resources'
|
|
|
|
export default function setting(option: ControlOption): ControlFactory {
|
|
return art => ({
|
|
...option,
|
|
tooltip: art.i18n.get('Show Setting'),
|
|
mounted: ($control) => {
|
|
const { on, proxy } = controlEvents(art, $control)
|
|
const { icons, i18n } = art
|
|
|
|
appendElement($control, icons.setting)
|
|
|
|
proxy($control, 'click', () => {
|
|
art.setting.toggle()
|
|
art.setting.resize()
|
|
})
|
|
|
|
on('setting', (value) => {
|
|
tooltip($control, i18n.get(value ? 'Hide Setting' : 'Show Setting'))
|
|
})
|
|
},
|
|
})
|
|
}
|