release: v0.2.0 — TypeScript 源码重构
CI / test (18.x) (push) Successful in 9m52s
CI / test (22.x) (push) Canceled after 0s
CI / test (24.x) (push) Canceled after 0s
CI / test (20.x) (push) Canceled after 2m49s

### Changed
- 全部源码从 JavaScript 迁移到 TypeScript (strict mode)
- core.js (1244行) 拆分为 toast.ts + api.ts + templates.ts
- 删除手动维护的 types/index.d.ts,类型从源码自动生成
- 构建工具链: Babel → ts-jest, 新增 @rollup/plugin-typescript
- 新增 rollup-plugin-dts 生成合并 .d.ts

### Added
- tsconfig.json (strict: true)
- src/types.ts 核心类型模块 (39 个导出类型)
- .eslintrc.json (@typescript-eslint)
- .gitea/workflows/ci.yml (Node 18/20/22/24 矩阵)
- CHANGELOG.md

### Aligned with metona-starter
- package.json: type:module, engines≥16, prepublishOnly
- rollup.config.js: dts plugin, port 3001
- jest.config.cjs, build.sh, serve.sh, .gitignore (.npmrc)

### Removed
- babel.config.js, types/ 目录, 所有 src/*.js
This commit is contained in:
tianhao
2026-07-25 11:22:07 +08:00
parent ee2b685f64
commit 9a6cd33d90
36 changed files with 3673 additions and 5473 deletions
+496
View File
@@ -0,0 +1,496 @@
/**
* MetonaToast Locales — 国际化翻译数据
* @module locales
* @version 0.2.0
* @description 内置 zh-CN / en-US 完整翻译
*/
export const LOCALES: Record<string, Record<string, string>> = {
'zh-CN': {
// === 操作 ===
close: '关闭',
loading: '加载中...',
success: '操作成功',
error: '操作失败',
warning: '警告',
info: '信息',
confirm: '确认',
cancel: '取消',
yes: '是',
no: '否',
ok: '确定',
retry: '重试',
undo: '撤销',
redo: '重做',
save: '保存',
delete: '删除',
edit: '编辑',
add: '添加',
remove: '移除',
search: '搜索',
filter: '筛选',
sort: '排序',
refresh: '刷新',
sync: '同步',
upload: '上传',
download: '下载',
share: '分享',
copy: '复制',
cut: '剪切',
paste: '粘贴',
print: '打印',
export: '导出',
import: '导入',
settings: '设置',
help: '帮助',
about: '关于',
version: '版本',
language: '语言',
theme: '主题',
dark: '暗色',
light: '亮色',
auto: '自动',
notifications: '通知',
enable: '启用',
disable: '禁用',
on: '开启',
off: '关闭',
max: '最大',
min: '最小',
expand: '展开',
collapse: '折叠',
fullscreen: '全屏',
exitFullscreen: '退出全屏',
zoomIn: '放大',
zoomOut: '缩小',
reset: '重置',
apply: '应用',
submit: '提交',
send: '发送',
receive: '接收',
connect: '连接',
disconnect: '断开',
start: '开始',
stop: '停止',
pause: '暂停',
resume: '继续',
next: '下一个',
previous: '上一个',
first: '第一个',
last: '最后一个',
back: '返回',
forward: '前进',
home: '首页',
menu: '菜单',
more: '更多',
less: '更少',
show: '显示',
hide: '隐藏',
visible: '可见',
hidden: '隐藏',
// === 状态 ===
enabled: '已启用',
disabled: '已禁用',
active: '活跃',
inactive: '非活跃',
online: '在线',
offline: '离线',
connected: '已连接',
disconnected: '已断开',
loaded: '已加载',
saving: '保存中',
saved: '已保存',
deleting: '删除中',
deleted: '已删除',
uploading: '上传中',
uploaded: '已上传',
downloading: '下载中',
downloaded: '已下载',
processing: '处理中',
processed: '已处理',
syncing: '同步中',
synced: '已同步',
sending: '发送中',
sent: '已发送',
receiving: '接收中',
received: '已接收',
connecting: '连接中',
// === 交互 ===
question: '问题',
feedback: '反馈',
report: '报告',
bug: '错误',
feature: '功能',
improvement: '改进',
suggestion: '建议',
request: '请求',
response: '响应',
status: '状态',
progress: '进度',
complete: '完成',
incomplete: '未完成',
pending: '待处理',
failed: '失败',
cancelled: '已取消',
timeout: '超时',
expired: '已过期',
invalid: '无效',
valid: '有效',
required: '必填',
optional: '可选',
allowed: '允许',
denied: '拒绝',
approved: '已批准',
rejected: '已拒绝',
accepted: '已接受',
declined: '已拒绝',
confirmed: '已确认',
unconfirmed: '未确认',
verified: '已验证',
unverified: '未验证',
authenticated: '已认证',
unauthenticated: '未认证',
authorized: '已授权',
unauthorized: '未授权',
// === 范围 / 角色 ===
public: '公开',
private: '私有',
protected: '受保护',
internal: '内部',
external: '外部',
local: '本地',
remote: '远程',
global: '全局',
system: '系统',
user: '用户',
admin: '管理员',
moderator: '版主',
guest: '访客',
member: '成员',
owner: '所有者',
creator: '创建者',
editor: '编辑者',
viewer: '查看者',
subscriber: '订阅者',
follower: '关注者',
following: '关注中',
friend: '朋友',
contact: '联系人',
// === 组织 ===
group: '群组',
team: '团队',
organization: '组织',
company: '公司',
department: '部门',
project: '项目',
task: '任务',
issue: '问题',
ticket: '工单',
message: '消息',
notification: '通知',
alert: '警报',
reminder: '提醒',
event: '事件',
activity: '活动',
log: '日志',
analytics: '分析',
statistics: '统计',
metrics: '指标',
performance: '性能',
security: '安全',
privacy: '隐私',
compliance: '合规',
policy: '政策',
terms: '条款',
conditions: '条件',
agreement: '协议',
contract: '合同',
license: '许可证',
copyright: '版权',
trademark: '商标',
patent: '专利',
tradeSecret: '商业秘密',
confidential: '机密',
sensitive: '敏感',
critical: '关键',
important: '重要',
urgent: '紧急',
high: '高',
medium: '中',
low: '低',
none: '无',
all: '全部',
any: '任何',
some: '一些',
each: '每个',
every: '每个',
both: '两者',
neither: '两者都不',
either: '任一',
other: '其他',
another: '另一个',
this: '这个',
that: '那个',
these: '这些',
those: '那些',
here: '这里',
there: '那里',
where: '哪里',
when: '何时',
why: '为什么',
how: '如何',
what: '什么',
who: '谁',
which: '哪个',
whose: '谁的',
whom: '谁',
},
'en-US': {
// === Actions ===
close: 'Close',
loading: 'Loading...',
success: 'Success',
error: 'Error',
warning: 'Warning',
info: 'Info',
confirm: 'Confirm',
cancel: 'Cancel',
yes: 'Yes',
no: 'No',
ok: 'OK',
retry: 'Retry',
undo: 'Undo',
redo: 'Redo',
save: 'Save',
delete: 'Delete',
edit: 'Edit',
add: 'Add',
remove: 'Remove',
search: 'Search',
filter: 'Filter',
sort: 'Sort',
refresh: 'Refresh',
sync: 'Sync',
upload: 'Upload',
download: 'Download',
share: 'Share',
copy: 'Copy',
cut: 'Cut',
paste: 'Paste',
print: 'Print',
export: 'Export',
import: 'Import',
settings: 'Settings',
help: 'Help',
about: 'About',
version: 'Version',
language: 'Language',
theme: 'Theme',
dark: 'Dark',
light: 'Light',
auto: 'Auto',
notifications: 'Notifications',
enable: 'Enable',
disable: 'Disable',
on: 'On',
off: 'Off',
max: 'Max',
min: 'Min',
expand: 'Expand',
collapse: 'Collapse',
fullscreen: 'Fullscreen',
exitFullscreen: 'Exit Fullscreen',
zoomIn: 'Zoom In',
zoomOut: 'Zoom Out',
reset: 'Reset',
apply: 'Apply',
submit: 'Submit',
send: 'Send',
receive: 'Receive',
connect: 'Connect',
disconnect: 'Disconnect',
start: 'Start',
stop: 'Stop',
pause: 'Pause',
resume: 'Resume',
next: 'Next',
previous: 'Previous',
first: 'First',
last: 'Last',
back: 'Back',
forward: 'Forward',
home: 'Home',
menu: 'Menu',
more: 'More',
less: 'Less',
show: 'Show',
hide: 'Hide',
visible: 'Visible',
hidden: 'Hidden',
// === Status ===
enabled: 'Enabled',
disabled: 'Disabled',
active: 'Active',
inactive: 'Inactive',
online: 'Online',
offline: 'Offline',
connected: 'Connected',
disconnected: 'Disconnected',
loaded: 'Loaded',
saving: 'Saving',
saved: 'Saved',
deleting: 'Deleting',
deleted: 'Deleted',
uploading: 'Uploading',
uploaded: 'Uploaded',
downloading: 'Downloading',
downloaded: 'Downloaded',
processing: 'Processing',
processed: 'Processed',
syncing: 'Syncing',
synced: 'Synced',
sending: 'Sending',
sent: 'Sent',
receiving: 'Receiving',
received: 'Received',
connecting: 'Connecting',
// === Interaction ===
question: 'Question',
feedback: 'Feedback',
report: 'Report',
bug: 'Bug',
feature: 'Feature',
improvement: 'Improvement',
suggestion: 'Suggestion',
request: 'Request',
response: 'Response',
status: 'Status',
progress: 'Progress',
complete: 'Complete',
incomplete: 'Incomplete',
pending: 'Pending',
failed: 'Failed',
cancelled: 'Cancelled',
timeout: 'Timeout',
expired: 'Expired',
invalid: 'Invalid',
valid: 'Valid',
required: 'Required',
optional: 'Optional',
allowed: 'Allowed',
denied: 'Denied',
approved: 'Approved',
rejected: 'Rejected',
accepted: 'Accepted',
declined: 'Declined',
confirmed: 'Confirmed',
unconfirmed: 'Unconfirmed',
verified: 'Verified',
unverified: 'Unverified',
authenticated: 'Authenticated',
unauthenticated: 'Unauthenticated',
authorized: 'Authorized',
unauthorized: 'Unauthorized',
// === Scope / Role ===
public: 'Public',
private: 'Private',
protected: 'Protected',
internal: 'Internal',
external: 'External',
local: 'Local',
remote: 'Remote',
global: 'Global',
system: 'System',
user: 'User',
admin: 'Admin',
moderator: 'Moderator',
guest: 'Guest',
member: 'Member',
owner: 'Owner',
creator: 'Creator',
editor: 'Editor',
viewer: 'Viewer',
subscriber: 'Subscriber',
follower: 'Follower',
following: 'Following',
friend: 'Friend',
contact: 'Contact',
// === Organization ===
group: 'Group',
team: 'Team',
organization: 'Organization',
company: 'Company',
department: 'Department',
project: 'Project',
task: 'Task',
issue: 'Issue',
ticket: 'Ticket',
message: 'Message',
notification: 'Notification',
alert: 'Alert',
reminder: 'Reminder',
event: 'Event',
activity: 'Activity',
log: 'Log',
analytics: 'Analytics',
statistics: 'Statistics',
metrics: 'Metrics',
performance: 'Performance',
security: 'Security',
privacy: 'Privacy',
compliance: 'Compliance',
policy: 'Policy',
terms: 'Terms',
conditions: 'Conditions',
agreement: 'Agreement',
contract: 'Contract',
license: 'License',
copyright: 'Copyright',
trademark: 'Trademark',
patent: 'Patent',
tradeSecret: 'Trade Secret',
confidential: 'Confidential',
sensitive: 'Sensitive',
critical: 'Critical',
important: 'Important',
urgent: 'Urgent',
high: 'High',
medium: 'Medium',
low: 'Low',
none: 'None',
all: 'All',
any: 'Any',
some: 'Some',
each: 'Each',
every: 'Every',
both: 'Both',
neither: 'Neither',
either: 'Either',
other: 'Other',
another: 'Another',
this: 'This',
that: 'That',
these: 'These',
those: 'Those',
here: 'Here',
there: 'There',
where: 'Where',
when: 'When',
why: 'Why',
how: 'How',
what: 'What',
who: 'Who',
which: 'Which',
whose: 'Whose',
whom: 'Whom',
},
};