Skip to content

Commit e7c9cd7

Browse files
committed
Merge branch 'main' into qr
2 parents 47c45f9 + df91ef6 commit e7c9cd7

File tree

15 files changed

+189
-66
lines changed

15 files changed

+189
-66
lines changed

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,21 @@
2727
"@babel/plugin-transform-modules-commonjs": "^7.24.8",
2828
"@babel/preset-env": "^7.25.4",
2929
"@crowdin/crowdin-api-client": "^1.35.0",
30-
"@types/chrome": "0.0.270",
30+
"@types/chrome": "0.0.271",
3131
"@types/copy-webpack-plugin": "^8.0.1",
3232
"@types/echarts": "^4.9.22",
3333
"@types/generate-json-webpack-plugin": "^0.3.7",
34-
"@types/jest": "^29.5.12",
35-
"@types/node": "^22.5.1",
34+
"@types/jest": "^29.5.13",
35+
"@types/node": "^22.5.5",
3636
"@types/psl": "^1.1.3",
3737
"@types/punycode": "^2.1.4",
3838
"@types/webpack": "^5.28.5",
3939
"@types/webpack-bundle-analyzer": "^4.7.0",
40-
"@vue/babel-plugin-jsx": "^1.2.2",
41-
"babel-loader": "^9.1.3",
40+
"@vue/babel-plugin-jsx": "^1.2.5",
41+
"babel-loader": "^9.2.1",
4242
"copy-webpack-plugin": "^12.0.2",
4343
"css-loader": "^7.1.2",
44-
"eslint": "^9.9.1",
44+
"eslint": "^9.10.0",
4545
"filemanager-webpack-plugin": "^8.0.0",
4646
"generate-json-webpack-plugin": "^2.0.0",
4747
"html-webpack-plugin": "^5.6.0",
@@ -56,23 +56,23 @@
5656
"ts-node": "^10.9.2",
5757
"tsconfig-paths": "^4.2.0",
5858
"tslib": "^2.7.0",
59-
"typescript": "5.5.4",
59+
"typescript": "5.6.2",
6060
"url-loader": "^4.1.1",
6161
"webpack": "^5.94.0",
6262
"webpack-bundle-analyzer": "^4.10.2",
6363
"webpack-cli": "^5.1.4"
6464
},
6565
"dependencies": {
6666
"@element-plus/icons-vue": "^2.3.1",
67-
"@vueuse/core": "^11.0.3",
67+
"@vueuse/core": "^11.1.0",
6868
"countup.js": "^2.8.0",
6969
"echarts": "^5.5.1",
70-
"element-plus": "2.8.1",
70+
"element-plus": "2.8.3",
7171
"js-base64": "^3.7.7",
7272
"punycode": "^2.3.1",
7373
"stream-browserify": "^3.0.0",
74-
"vue": "^3.4.38",
75-
"vue-router": "^4.4.3"
74+
"vue": "^3.5.6",
75+
"vue-router": "^4.4.5"
7676
},
7777
"engines": {
7878
"node": ">=20"

src/app/components/HelpUs/MemberList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*/
77

88
import { getMembers } from "@api/crowdin"
9-
import { useRequest } from "@hooks"
109
import { t } from "@app/locale"
10+
import { useRequest } from "@hooks"
1111
import { ElDivider } from "element-plus"
1212
import { defineComponent } from "vue"
1313

@@ -19,7 +19,7 @@ const _default = defineComponent(() => {
1919
return () => (
2020
<div class="member-container">
2121
<ElDivider>{t(msg => msg.helpUs.contributors)}</ElDivider>
22-
<div>
22+
<div class="list">
2323
{list.value?.map(({ avatarUrl, username }) => (
2424
<a href={`https://crowdin.com/profile/${username}`} target="_blank">
2525
<img src={avatarUrl} alt={username} title={username} />

src/app/components/HelpUs/style.sass

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,21 @@
66
.member-container
77
margin-top: 10px
88
text-align: center
9-
img
10-
width: 60px
11-
height: 60px
12-
border-radius: 30px
13-
a:not(:last-child)
14-
margin-right: 15px
9+
.list
10+
min-height: 60px
11+
display: flex
12+
flex-wrap: wrap
13+
gap: 15px
14+
justify-content: space-around
15+
width: fit-content
16+
margin: 0 auto
17+
padding: 5px 0
18+
a:last-child
19+
margin-right: auto
20+
img
21+
width: 60px
22+
height: 60px
23+
border-radius: 30px
1524
.progress-container
1625
display: grid
1726
padding-left: 30px

src/app/components/Limit/LimitModify/Sop/Step2/UrlInput.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { defineComponent, VNode } from "vue"
2-
import { parseUrl, Protocol, UrlPart } from "../common"
3-
import { useState, useSwitch } from "@hooks"
4-
import { ElButton, ElInput, ElLink, ElMessage, ElOption, ElSelect, ElSwitch, ElTag, ElTooltip } from "element-plus"
51
import { t } from "@app/locale"
62
import { Check, Close, Cpu } from "@element-plus/icons-vue"
3+
import { useState, useSwitch } from "@hooks"
4+
import { ElButton, ElInput, ElLink, ElMessage, ElOption, ElSelect, ElSwitch, ElTag, ElTooltip } from "element-plus"
5+
import { defineComponent, VNode } from "vue"
6+
import { parseUrl, Protocol, UrlPart } from "../common"
77

88
const ALL_PROTOCOLS: Protocol[] = ['http://', 'https://', '*://']
99

@@ -34,7 +34,7 @@ const _default = defineComponent({
3434
}
3535

3636
const handleSave = () => {
37-
const url = protocol.value + parts.value?.map(({ origin, ignored }) => ignored ? '*' : origin)?.join('/') ?? '-'
37+
const url = protocol.value + parts.value?.map(({ origin, ignored }) => ignored ? '*' : origin)?.join('/') || '-'
3838
ctx.emit("save", url)
3939
reset()
4040
}

src/app/components/Option/Tabs.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { t } from "@app/locale"
22
import { Refresh } from "@element-plus/icons-vue"
3+
import { useShadow } from "@hooks/useShadow"
34
import { ElIcon, ElMessage, ElTabPane, ElTabs } from "element-plus"
45
import { defineComponent, h, ref } from "vue"
56
import { useRouter } from "vue-router"
6-
import { changeQuery, OptionCategory, parseQuery } from "./common"
7-
import { useShadow } from "@hooks/useShadow"
87
import ContentContainer from "../common/ContentContainer"
8+
import { changeQuery, OptionCategory, parseQuery } from "./common"
99

1010
const resetButtonName = "reset"
1111

@@ -66,6 +66,12 @@ const _default = defineComponent({
6666
{h(ctx.slots.dailyLimit)}
6767
</ElTabPane>
6868
)}
69+
<ElTabPane
70+
name={"accessibility" satisfies OptionCategory}
71+
label={t(msg => msg.option.accessibility.title)}
72+
>
73+
{h(ctx.slots.accessibility)}
74+
</ElTabPane>
6975
<ElTabPane
7076
name={"backup" satisfies OptionCategory}
7177
label={t(msg => msg.option.backup.title)}

src/app/components/Option/common.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import { Router, useRoute } from "vue-router"
99

10-
export const ALL_CATEGORIES = ["appearance", "statistics", "popup", 'dailyLimit', 'backup'] as const
10+
export const ALL_CATEGORIES = ["appearance", "statistics", "popup", 'dailyLimit', 'accessibility', 'backup'] as const
1111
export type OptionCategory = typeof ALL_CATEGORIES[number]
1212

1313
export type OptionInstance = {
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { t } from "@app/locale"
2+
import optionService from "@service/option-service"
3+
import { defaultAccessibility } from "@util/constant/option"
4+
import { ElSwitch } from "element-plus"
5+
import { defineComponent, reactive, unref, watch } from "vue"
6+
import { OptionInstance } from "../common"
7+
import OptionItem from "./OptionItem"
8+
9+
function copy(target: timer.option.AccessibilityOption, source: timer.option.AccessibilityOption) {
10+
target.chartDecal = source.chartDecal
11+
}
12+
13+
const _default = defineComponent((_, ctx) => {
14+
const option = reactive(defaultAccessibility())
15+
optionService.getAllOption()
16+
.then(currentVal => {
17+
copy(option, currentVal)
18+
watch(option, () => optionService.setAccessibilityOption(unref(option)))
19+
})
20+
ctx.expose({
21+
reset: () => copy(option, defaultAccessibility())
22+
} satisfies OptionInstance)
23+
return () => <>
24+
<OptionItem
25+
label={msg => msg.option.accessibility.chartDecal}
26+
defaultValue={t(msg => msg.option.no)}
27+
hideDivider
28+
v-slots={{
29+
default: () => <ElSwitch
30+
modelValue={option.chartDecal}
31+
onChange={(val: boolean) => option.chartDecal = val}
32+
/>
33+
}}
34+
/>
35+
</>
36+
})
37+
38+
export default _default

src/app/components/Option/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { MediaSize } from "@hooks/useMediaSize"
99
import { defineComponent, ref, type Ref } from "vue"
1010
import { JSX } from "vue/jsx-runtime"
1111
import { OptionCategory, OptionInstance } from "./common"
12+
import AccessibilityOption from "./components/AccessibilityOption"
1213
import AppearanceOption from "./components/AppearanceOption"
1314
import BackupOption from './components/BackupOption'
1415
import LimitOption from './components/LimitOption'
@@ -25,6 +26,7 @@ const _default = defineComponent(() => {
2526
popup: ref(),
2627
backup: ref(),
2728
dailyLimit: ref(),
29+
accessibility: ref(),
2830
}
2931

3032
const mediaSize = useMediaSize()
@@ -34,6 +36,7 @@ const _default = defineComponent(() => {
3436
statistics: () => <StatisticsOption ref={paneRefMap.statistics} />,
3537
popup: () => <PopupOption ref={paneRefMap.popup} />,
3638
dailyLimit: () => <LimitOption ref={paneRefMap.dailyLimit} />,
39+
accessibility: () => <AccessibilityOption ref={paneRefMap.accessibility} />,
3740
backup: () => <BackupOption ref={paneRefMap.backup} />,
3841
}
3942

src/hooks/useEcharts.ts

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,57 @@
88

99
import { ElLoading } from "element-plus"
1010
import { type Ref, onMounted, ref, isRef, watch } from "vue"
11-
import { init, type ECharts } from "echarts"
11+
import { AriaComponentOption, ComposeOption, init, ECharts } from "echarts"
1212
import { useWindowSize } from "@vueuse/core"
13+
import accessibilityHelper from "@service/components/accessibility-helper"
14+
15+
type BaseEchartsOption = ComposeOption<AriaComponentOption>
16+
17+
export const generateAriaOption = async (): Promise<AriaComponentOption> => {
18+
const { chartDecal } = await accessibilityHelper.getOption() || {}
19+
if (!chartDecal) {
20+
return { enabled: false }
21+
}
22+
const color = "rgba(0, 0, 0, 0.2)"
23+
return {
24+
enabled: true,
25+
decal: {
26+
show: true,
27+
decals: [{
28+
color,
29+
dashArrayX: [1, 0],
30+
dashArrayY: [2, 5],
31+
rotation: .5235987755982988,
32+
}, {
33+
color,
34+
symbol: 'circle',
35+
dashArrayX: [[8, 8], [0, 8, 8, 0]],
36+
dashArrayY: [6, 0],
37+
symbolSize: .8,
38+
}, {
39+
color,
40+
dashArrayX: [1, 0],
41+
dashArrayY: [4, 3],
42+
rotation: -.7853981633974483
43+
}, {
44+
color,
45+
dashArrayX: [[6, 6], [0, 6, 6, 0]],
46+
dashArrayY: [6, 0],
47+
}, {
48+
color,
49+
dashArrayX: [[1, 0], [1, 6]],
50+
dashArrayY: [1, 0, 6, 0],
51+
rotation: .7853981633974483,
52+
}, {
53+
color,
54+
symbol: 'triangle',
55+
dashArrayX: [[9, 9], [0, 9, 9, 0]],
56+
dashArrayY: [7, 2],
57+
symbolSize: .75,
58+
}]
59+
}
60+
}
61+
}
1362

1463
export abstract class EchartsWrapper<BizOption, EchartsOption> {
1564
protected instance: ECharts
@@ -32,8 +81,10 @@ export abstract class EchartsWrapper<BizOption, EchartsOption> {
3281

3382
private async innerRender() {
3483
const biz = this.lastBizOption
35-
const option = await this.generateOption(biz)
84+
const option = await this.generateOption(biz) as (EchartsOption & BaseEchartsOption)
3685
if (!option) return
86+
const aria = await generateAriaOption()
87+
option.aria = aria
3788
this.instance.setOption(option, { notMerge: false })
3889
}
3990

src/i18n/message/app/option-resource.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@
121121
"interval": "每 {input} 分钟备份一次"
122122
}
123123
},
124+
"accessibility": {
125+
"title": "无障碍功能",
126+
"chartDecal": "{input} 是否显示图表的贴花图案"
127+
},
124128
"resetButton": "恢复默认",
125129
"resetSuccess": "成功重置为默认值",
126130
"defaultValue": "默认值: {default}"
@@ -369,6 +373,10 @@
369373
"interval": "and run every {input} minutes"
370374
}
371375
},
376+
"accessibility": {
377+
"title": "Accessibility",
378+
"chartDecal": "{input} Whether to display the chart decal"
379+
},
372380
"resetButton": "Reset",
373381
"resetSuccess": "Reset to default successfully!",
374382
"defaultValue": "Default: {default}"

0 commit comments

Comments
 (0)