From eebd669b7f26d345656e5f56ea364262afe7a209 Mon Sep 17 00:00:00 2001 From: thzxx <1440196015@qq.com> Date: Fri, 24 Jul 2026 14:19:53 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E7=89=88=E6=9C=AC=E5=8F=B7=E9=87=8D?= =?UTF-8?q?=E7=BD=AE=E4=B8=BA=20v0.1.1,=20=E6=9B=B4=E6=96=B0=20site/=20?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E9=A1=B5=E9=9D=A2=E7=A7=BB=E9=99=A4=20v2.0?= =?UTF-8?q?=20=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- site/demo.html | 12 ++++++------ site/docs.html | 20 ++++++++++---------- site/index.html | 2 +- src/animations.js | 2 +- src/constants.js | 2 +- src/core.js | 4 ++-- src/i18n.js | 2 +- src/icons.js | 2 +- src/index.js | 4 ++-- src/locales.js | 2 +- src/plugins.js | 2 +- src/styles.js | 3 ++- src/themes.js | 2 +- src/utils.js | 2 +- tests/index.test.js | 8 ++++---- types/index.d.ts | 2 +- 17 files changed, 37 insertions(+), 36 deletions(-) diff --git a/package.json b/package.json index b947e8e..340c5f1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@metona-team/metona-toast", - "version": "2.0.1", + "version": "0.1.1", "description": "轻量、零依赖、精致美观的Toast通知库。单文件,开箱即用。", "main": "dist/metona-toast.js", "module": "src/index.js", diff --git a/site/demo.html b/site/demo.html index 677e342..84e5203 100644 --- a/site/demo.html +++ b/site/demo.html @@ -136,7 +136,7 @@
-
⚡ Action Toast v2.0
+
⚡ Action Toast
@@ -146,7 +146,7 @@
-
📁 分组管理 v2.0
+
📁 分组管理
@@ -209,9 +209,9 @@
- +
-
🆕 v2.0 新功能 resetTimer · onUpdate · render · notify
+
🔥 高级特性 resetTimer · onUpdate · render · notify
@@ -273,7 +273,7 @@ @@ -351,7 +351,7 @@ MeToast.info('自定义插件已安装(消息后追加计数)'); } - // === v2.0 new features === + // === 高级特性 === function demoResetTimer() { const t=MeToast.info('这条消息不会自动消失(resetTimer)',{duration:3000,resetTimerOnUpdate:true,closeButton:true}); let n=0; const iv=setInterval(()=>{n++;if(n>8){clearInterval(iv);t.close();return;}t.update({message:'重置计时器 #'+n+' — 每次更新重置3秒'});},1000); diff --git a/site/docs.html b/site/docs.html index 55efa52..75e3154 100644 --- a/site/docs.html +++ b/site/docs.html @@ -69,9 +69,9 @@ countdown() queue() stack() - action() NEW + action()
管理方法
- group() NEW + group() dismiss() clear() configure() @@ -87,7 +87,7 @@

API 文档

-

MetonaToast v2.0.1 完整 API 参考。所有基础通知方法(show/success/error/warning/info/loading)支持两种调用形式,均可传入任何 配置项 作为可选第二参数。

+

MetonaToast v0.1.1 完整 API 参考。所有基础通知方法(show/success/error/warning/info/loading)支持两种调用形式,均可传入任何 配置项 作为可选第二参数。

show(message, opts?)

@@ -309,7 +309,7 @@ q.cancel(); // 中途取消 type: 'info', }); -

action(message, actions, opts?) v2.0

+

action(message, actions, opts?)

Action Toast:内嵌操作按钮。默认 duration=0 不自动关闭,closeButton=true。

@@ -331,7 +331,7 @@ q.cancel(); // 中途取消 ]); -

group(name) v2.0

+

group(name)

创建 Toast 分组,返回 GroupAPI 对象。该对象所有方法自动传入 group: name,按组管理。

参数类型默认值说明
@@ -409,7 +409,7 @@ MeToast.use('accessibility');

全部配置项

-

以下配置可用于 configure()init() 或单个 Toast 方法的 opts 参数。带 v2.0 标识的为 v2.0 新增。

+

以下配置可用于 configure()init() 或单个 Toast 方法的 opts 参数。

参数类型说明
@@ -431,9 +431,9 @@ MeToast.use('accessibility'); - - - + + +
配置项类型默认值说明
positionstring'top-right'位置:top-left / top-center / top-right / bottom-left / bottom-center / bottom-right
classNamestring''附加到 Toast 元素上的 CSS 类名
styleobject{}附加到 Toast 元素上的内联样式对象
localestring'zh-CN'语言代码(zh-CN / en-US 等)
resetTimerOnUpdate v2.0booleanfalse调用 update() 时重置 duration 倒计时
notifyWhenHidden v2.0booleanfalse页面不可见时自动通过 Notification API 发送系统通知
render v2.0function自定义渲染函数 (toast) => htmlString,完全接管 DOM 构建
resetTimerOnUpdatebooleanfalse调用 update() 时重置 duration 倒计时
notifyWhenHiddenbooleanfalse页面不可见时自动通过 Notification API 发送系统通知
renderfunction自定义渲染函数 (toast) => htmlString,完全接管 DOM 构建

回调函数

@@ -442,7 +442,7 @@ MeToast.use('accessibility'); onShow(toast: ToastInstance) => voidToast DOM 创建并播放入场动画后 onClose(toast: ToastInstance) => voidToast DOM 被移除后(离场动画完成时) onClick(toast: ToastInstance) => voidToast 被点击时(closeOnClick 为 true 时还会自动关闭) -onUpdate v2.0(toast: ToastInstance) => voidToast 内容通过 update() 更新后 + onUpdate(toast: ToastInstance) => voidToast 内容通过 update() 更新后

动画列表

diff --git a/site/index.html b/site/index.html index cc06394..78abea9 100644 --- a/site/index.html +++ b/site/index.html @@ -237,7 +237,7 @@ orderGroup.dismiss(); // 一键关闭
-

MetonaToast v2.0.1 · MIT License · Gitea

+

MetonaToast v0.1.1 · MIT License · Gitea

diff --git a/src/animations.js b/src/animations.js index b1388f3..8fb101a 100644 --- a/src/animations.js +++ b/src/animations.js @@ -1,5 +1,5 @@ /** - * MetonaToast Animations - 动画管理(精简版 v2.0.1) + * MetonaToast Animations - 动画管理 v0.1.1 * @module animations * @description 动画注册与管理,移除未使用的 Web Animations API dead code */ diff --git a/src/constants.js b/src/constants.js index 0e0750c..3e13a20 100644 --- a/src/constants.js +++ b/src/constants.js @@ -1,7 +1,7 @@ /** * MetonaToast Constants - 常量定义 * @module constants - * @version 2.0.1 + * @version 0.1.1 * @description 默认配置、颜色、动画、主题等常量 */ diff --git a/src/core.js b/src/core.js index 1f1bbe7..4155d15 100644 --- a/src/core.js +++ b/src/core.js @@ -1,7 +1,7 @@ /** * MetonaToast Core - 核心Toast逻辑 * @module core - * @version 2.0.1 + * @version 0.1.1 * @description 重构后的核心模块,包含Toast类的优化实现 */ @@ -621,7 +621,7 @@ const _actionHTML = (actions) => { const meToast = { _toasts: new Map(), _config: { ...DEFAULTS }, - version: '2.0.1', + version: '0.1.1', configure(opts) { if (!opts || typeof opts !== 'object') return this; diff --git a/src/i18n.js b/src/i18n.js index 0005b9a..fcd408c 100644 --- a/src/i18n.js +++ b/src/i18n.js @@ -1,7 +1,7 @@ /** * MetonaToast i18n - 国际化管理 * @module i18n - * @version 2.0.1 + * @version 0.1.1 * @description 多语言支持、语言切换和翻译管理 */ diff --git a/src/icons.js b/src/icons.js index fe472ff..70be2c1 100644 --- a/src/icons.js +++ b/src/icons.js @@ -1,7 +1,7 @@ /** * MetonaToast Icons — 图标SVG定义 * @module icons - * @version 2.0.1 + * @version 0.1.1 * @description 80+ 内置SVG图标 */ diff --git a/src/index.js b/src/index.js index 66c20da..e645c88 100644 --- a/src/index.js +++ b/src/index.js @@ -1,7 +1,7 @@ /** * MetonaToast - 轻量级Toast通知库 * @module metona-toast - * @version 2.0.1 + * @version 0.1.1 * @author thzxx * @description 轻量、零依赖、精致美观的Toast通知库。单文件,开箱即用。 * @license MIT @@ -15,7 +15,7 @@ import { pluginUtils, presetPlugins } from './plugins.js'; import { DEFAULTS } from './constants.js'; // 版本信息 -const VERSION = '2.0.1'; +const VERSION = '0.1.1'; /** * 主对象增强 diff --git a/src/locales.js b/src/locales.js index df7d4df..2cd98cf 100644 --- a/src/locales.js +++ b/src/locales.js @@ -1,7 +1,7 @@ /** * MetonaToast Locales — 国际化翻译数据 * @module locales - * @version 2.0.1 + * @version 0.1.1 * @description 内置 zh-CN / en-US 完整翻译 */ diff --git a/src/plugins.js b/src/plugins.js index c7febf5..8aa1ec0 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -1,7 +1,7 @@ /** * MetonaToast Plugins - 插件系统 * @module plugins - * @version 2.0.1 + * @version 0.1.1 * @description 插件管理器 + 3 款预设插件 (keyboard / persistence / accessibility) */ diff --git a/src/styles.js b/src/styles.js index 0d9be1b..e506285 100644 --- a/src/styles.js +++ b/src/styles.js @@ -1,6 +1,7 @@ /** - * MetonaToast Styles - 样式管理(精简版 v2.0.1) + * MetonaToast Styles - 样式管理(精简版 v0.1.1) * @module styles + * @version 0.1.1 * @description 样式注入与主题管理,移除未使用的组件样式 */ diff --git a/src/themes.js b/src/themes.js index 7932bbe..0545950 100644 --- a/src/themes.js +++ b/src/themes.js @@ -1,7 +1,7 @@ /** * MetonaToast Themes - 主题管理 * @module themes - * @version 2.0.1 + * @version 0.1.1 * @description 主题系统、自定义主题和主题切换 */ diff --git a/src/utils.js b/src/utils.js index 869b137..767484d 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1,7 +1,7 @@ /** * MetonaToast Utils - 精简工具函数 * @module utils - * @version 2.0.1 + * @version 0.1.1 * @description 仅保留核心模块实际使用的工具函数 */ diff --git a/tests/index.test.js b/tests/index.test.js index 5f232d8..6c2cda1 100644 --- a/tests/index.test.js +++ b/tests/index.test.js @@ -1,7 +1,7 @@ /** * MetonaToast 单元测试 * @module tests - * @version 2.0.1 + * @version 0.1.1 */ import MeToast, { Toast, VERSION } from '../src/index.js'; @@ -121,8 +121,8 @@ describe('MetonaToast', () => { describe('版本信息', () => { test('应该有正确的版本号', () => { - expect(VERSION).toBe('2.0.1'); - expect(MeToast.version).toBe('2.0.1'); + expect(VERSION).toBe('0.1.1'); + expect(MeToast.version).toBe('0.1.1'); }); }); @@ -583,7 +583,7 @@ describe('MetonaToast', () => { MeToast.success('消息'); const status = MeToast.getStatus(); - expect(status.version).toBe('2.0.1'); + expect(status.version).toBe('0.1.1'); expect(status.toasts).toBeGreaterThanOrEqual(0); expect(status.theme).toBeDefined(); expect(status.locale).toBeDefined(); diff --git a/types/index.d.ts b/types/index.d.ts index 4cffbdf..a28695c 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,6 +1,6 @@ /** * MetonaToast TypeScript 类型定义 - * @version 2.0.1 + * @version 0.1.1 */ // 基础类型