chore: v0.1.2 — 全面修复、优化与增强

修复:
- core.js: _resume 计时器 BUG (startedAt 被 _startTimer 覆盖导致暂停恢复失效)
- plugins.js: register 在 install 前展开导致 handler 实例丢失
- locales.js: zh-CN/en-US 大量重复 key 覆盖正确翻译值
- core.js: configure 改为原地更新避免 _config 引用断裂

优化:
- core.js: update() 类型变更时同步更新 DOM 类名和进度条颜色
- animations.js: getActiveCount 返回已注册动画数量
- themes.js: 移除 presetThemes 死代码和重复注册循环
- constants.js: THEMES.auto 从字符串改为规范化对象
- index.js: destroy 添加防重复调用保护

增强:
- core.js: 新增 onError 全局错误回调,钩子异常和定时器错误可被外部捕获
- styles.js: _resume 校准时间基准补偿注释
- 139 tests 全部通过
This commit is contained in:
2026-07-24 14:42:47 +08:00
parent eebd669b7f
commit f7d74d152d
17 changed files with 205 additions and 423 deletions
+21 -277
View File
@@ -1,12 +1,13 @@
/**
* MetonaToast Locales — 国际化翻译数据
* @module locales
* @version 0.1.1
* @description 内置 zh-CN / en-US 完整翻译
* @version 0.1.2
* @description 内置 zh-CN / en-US 完整翻译(已去重优化)
*/
export const LOCALES = {
'zh-CN': {
// === 操作 ===
close: '关闭',
loading: '加载中...',
success: '操作成功',
@@ -87,6 +88,8 @@ export const LOCALES = {
hide: '隐藏',
visible: '可见',
hidden: '隐藏',
// === 状态 ===
enabled: '已启用',
disabled: '已禁用',
active: '活跃',
@@ -95,7 +98,6 @@ export const LOCALES = {
offline: '离线',
connected: '已连接',
disconnected: '已断开',
loading: '加载中',
loaded: '已加载',
saving: '保存中',
saved: '已保存',
@@ -114,12 +116,9 @@ export const LOCALES = {
receiving: '接收中',
received: '已接收',
connecting: '连接中',
error: '错误',
warning: '警告',
info: '信息',
success: '成功',
// === 交互 ===
question: '问题',
help: '帮助',
feedback: '反馈',
report: '报告',
bug: '错误',
@@ -133,7 +132,6 @@ export const LOCALES = {
complete: '完成',
incomplete: '未完成',
pending: '待处理',
processing: '处理中',
failed: '失败',
cancelled: '已取消',
timeout: '超时',
@@ -142,8 +140,6 @@ export const LOCALES = {
valid: '有效',
required: '必填',
optional: '可选',
enabled: '启用',
disabled: '禁用',
allowed: '允许',
denied: '拒绝',
approved: '已批准',
@@ -158,6 +154,8 @@ export const LOCALES = {
unauthenticated: '未认证',
authorized: '已授权',
unauthorized: '未授权',
// === 范围 / 角色 ===
public: '公开',
private: '私有',
protected: '受保护',
@@ -181,6 +179,8 @@ export const LOCALES = {
following: '关注中',
friend: '朋友',
contact: '联系人',
// === 组织 ===
group: '群组',
team: '团队',
organization: '组织',
@@ -190,8 +190,6 @@ export const LOCALES = {
task: '任务',
issue: '问题',
ticket: '工单',
request: '请求',
response: '响应',
message: '消息',
notification: '通知',
alert: '警报',
@@ -199,7 +197,6 @@ export const LOCALES = {
event: '事件',
activity: '活动',
log: '日志',
report: '报告',
analytics: '分析',
statistics: '统计',
metrics: '指标',
@@ -251,134 +248,10 @@ export const LOCALES = {
which: '哪个',
whose: '谁的',
whom: '谁',
myself: '我自己',
yourself: '你自己',
himself: '他自己',
herself: '她自己',
itself: '它自己',
ourselves: '我们自己',
yourselves: '你们自己',
themselves: '他们自己',
mine: '我的',
yours: '你的',
his: '他的',
hers: '她的',
its: '它的',
ours: '我们的',
yours: '你们的',
theirs: '他们的',
me: '我',
you: '你',
him: '他',
her: '她',
it: '它',
us: '我们',
them: '他们',
my: '我的',
your: '你的',
his: '他的',
her: '她的',
its: '它的',
our: '我们的',
your: '你们的',
their: '他们的',
i: '我',
you: '你',
he: '他',
she: '她',
it: '它',
we: '我们',
they: '他们',
am: '是',
is: '是',
are: '是',
was: '是',
were: '是',
be: '是',
been: '是',
being: '是',
have: '有',
has: '有',
had: '有',
having: '有',
do: '做',
does: '做',
did: '做',
doing: '做',
will: '会',
would: '会',
shall: '将',
should: '应该',
may: '可以',
might: '可能',
can: '能',
could: '能',
must: '必须',
need: '需要',
dare: '敢',
ought: '应该',
used: '过去常常',
to: '到',
of: '的',
in: '在',
for: '为了',
on: '在',
with: '和',
at: '在',
by: '通过',
from: '从',
into: '进入',
during: '在...期间',
before: '在...之前',
after: '在...之后',
above: '在...上面',
below: '在...下面',
between: '在...之间',
under: '在...下面',
over: '在...上面',
across: '穿过',
through: '通过',
into: '进入',
towards: '朝向',
upon: '在...上面',
about: '关于',
against: '反对',
among: '在...之中',
along: '沿着',
around: '周围',
beyond: '超出',
but: '但是',
despite: '尽管',
except: '除了',
inside: '里面',
outside: '外面',
since: '自从',
until: '直到',
unless: '除非',
whether: '是否',
while: '当...时候',
although: '虽然',
because: '因为',
if: '如果',
once: '一旦',
since: '自从',
so: '所以',
that: '那个',
though: '虽然',
till: '直到',
unless: '除非',
until: '直到',
when: '当...时候',
whenever: '每当',
where: '哪里',
wherever: '无论哪里',
whereas: '然而',
wherever: '无论哪里',
while: '当...时候',
why: '为什么',
},
'en-US': {
// === Actions ===
close: 'Close',
loading: 'Loading...',
success: 'Success',
@@ -459,6 +332,8 @@ export const LOCALES = {
hide: 'Hide',
visible: 'Visible',
hidden: 'Hidden',
// === Status ===
enabled: 'Enabled',
disabled: 'Disabled',
active: 'Active',
@@ -467,7 +342,6 @@ export const LOCALES = {
offline: 'Offline',
connected: 'Connected',
disconnected: 'Disconnected',
loading: 'Loading',
loaded: 'Loaded',
saving: 'Saving',
saved: 'Saved',
@@ -486,12 +360,9 @@ export const LOCALES = {
receiving: 'Receiving',
received: 'Received',
connecting: 'Connecting',
error: 'Error',
warning: 'Warning',
info: 'Info',
success: 'Success',
// === Interaction ===
question: 'Question',
help: 'Help',
feedback: 'Feedback',
report: 'Report',
bug: 'Bug',
@@ -505,7 +376,6 @@ export const LOCALES = {
complete: 'Complete',
incomplete: 'Incomplete',
pending: 'Pending',
processing: 'Processing',
failed: 'Failed',
cancelled: 'Cancelled',
timeout: 'Timeout',
@@ -514,8 +384,6 @@ export const LOCALES = {
valid: 'Valid',
required: 'Required',
optional: 'Optional',
enabled: 'Enabled',
disabled: 'Disabled',
allowed: 'Allowed',
denied: 'Denied',
approved: 'Approved',
@@ -530,6 +398,8 @@ export const LOCALES = {
unauthenticated: 'Unauthenticated',
authorized: 'Authorized',
unauthorized: 'Unauthorized',
// === Scope / Role ===
public: 'Public',
private: 'Private',
protected: 'Protected',
@@ -553,6 +423,8 @@ export const LOCALES = {
following: 'Following',
friend: 'Friend',
contact: 'Contact',
// === Organization ===
group: 'Group',
team: 'Team',
organization: 'Organization',
@@ -562,8 +434,6 @@ export const LOCALES = {
task: 'Task',
issue: 'Issue',
ticket: 'Ticket',
request: 'Request',
response: 'Response',
message: 'Message',
notification: 'Notification',
alert: 'Alert',
@@ -571,7 +441,6 @@ export const LOCALES = {
event: 'Event',
activity: 'Activity',
log: 'Log',
report: 'Report',
analytics: 'Analytics',
statistics: 'Statistics',
metrics: 'Metrics',
@@ -623,130 +492,5 @@ export const LOCALES = {
which: 'Which',
whose: 'Whose',
whom: 'Whom',
myself: 'Myself',
yourself: 'Yourself',
himself: 'Himself',
herself: 'Herself',
itself: 'Itself',
ourselves: 'Ourselves',
yourselves: 'Yourselves',
themselves: 'Themselves',
mine: 'Mine',
yours: 'Yours',
his: 'His',
hers: 'Hers',
its: 'Its',
ours: 'Ours',
yours: 'Yours',
theirs: 'Theirs',
me: 'Me',
you: 'You',
him: 'Him',
her: 'Her',
it: 'It',
us: 'Us',
them: 'Them',
my: 'My',
your: 'Your',
his: 'His',
her: 'Her',
its: 'Its',
our: 'Our',
your: 'Your',
their: 'Their',
i: 'I',
you: 'You',
he: 'He',
she: 'She',
it: 'It',
we: 'We',
they: 'They',
am: 'Am',
is: 'Is',
are: 'Are',
was: 'Was',
were: 'Were',
be: 'Be',
been: 'Been',
being: 'Being',
have: 'Have',
has: 'Has',
had: 'Had',
having: 'Having',
do: 'Do',
does: 'Does',
did: 'Did',
doing: 'Doing',
will: 'Will',
would: 'Would',
shall: 'Shall',
should: 'Should',
may: 'May',
might: 'Might',
can: 'Can',
could: 'Could',
must: 'Must',
need: 'Need',
dare: 'Dare',
ought: 'Ought',
used: 'Used',
to: 'To',
of: 'Of',
in: 'In',
for: 'For',
on: 'On',
with: 'With',
at: 'At',
by: 'By',
from: 'From',
into: 'Into',
during: 'During',
before: 'Before',
after: 'After',
above: 'Above',
below: 'Below',
between: 'Between',
under: 'Under',
over: 'Over',
across: 'Across',
through: 'Through',
into: 'Into',
towards: 'Towards',
upon: 'Upon',
about: 'About',
against: 'Against',
among: 'Among',
along: 'Along',
around: 'Around',
beyond: 'Beyond',
but: 'But',
despite: 'Despite',
except: 'Except',
inside: 'Inside',
outside: 'Outside',
since: 'Since',
until: 'Until',
unless: 'Unless',
whether: 'Whether',
while: 'While',
although: 'Although',
because: 'Because',
if: 'If',
once: 'Once',
since: 'Since',
so: 'So',
that: 'That',
though: 'Though',
till: 'Till',
unless: 'Unless',
until: 'Until',
when: 'When',
whenever: 'Whenever',
where: 'Where',
wherever: 'Wherever',
whereas: 'Whereas',
wherever: 'Wherever',
while: 'While',
why: 'Why',
},
};