fix(#9,#16,#17): 移除未使用import; 合并重复CSS @media print; accessibility从i18n读取类型名
This commit is contained in:
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
* @description 重构后的核心模块,包含Toast类的优化实现
|
* @description 重构后的核心模块,包含Toast类的优化实现
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { generateId, escapeHTML, prefersDark } from './utils.js';
|
import { generateId, escapeHTML } from './utils.js';
|
||||||
import { DEFAULTS, ICONS, TYPE_COLORS, THEMES } from './constants.js';
|
import { DEFAULTS, ICONS, TYPE_COLORS, THEMES } from './constants.js';
|
||||||
import { injectStyles } from './styles.js';
|
import { injectStyles } from './styles.js';
|
||||||
import { getTheme, applyTheme } from './themes.js';
|
import { getTheme, applyTheme } from './themes.js';
|
||||||
|
|||||||
+4
-2
@@ -5,6 +5,8 @@
|
|||||||
* @description 插件管理器 + 3 款预设插件 (keyboard / persistence / accessibility)
|
* @description 插件管理器 + 3 款预设插件 (keyboard / persistence / accessibility)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { t } from './i18n.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 插件管理器
|
* 插件管理器
|
||||||
*/
|
*/
|
||||||
@@ -154,8 +156,8 @@ const presetPlugins = {
|
|||||||
el.setAttribute('aria-live', 'assertive');
|
el.setAttribute('aria-live', 'assertive');
|
||||||
el.setAttribute('aria-atomic', 'true');
|
el.setAttribute('aria-atomic', 'true');
|
||||||
el.style.cssText = 'position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;';
|
el.style.cssText = 'position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;';
|
||||||
const typeNames = { success:'成功', error:'错误', warning:'警告', info:'信息', loading:'加载中', default:'通知' };
|
const typeName = t(toast.type) || toast.type;
|
||||||
el.textContent = `${typeNames[toast.type] || '通知'}: ${toast.title || ''} ${toast.message || ''}`;
|
el.textContent = `${typeName}: ${toast.title || ''} ${toast.message || ''}`;
|
||||||
document.body.appendChild(el);
|
document.body.appendChild(el);
|
||||||
setTimeout(() => { if (el.parentNode) el.parentNode.removeChild(el); }, 3000);
|
setTimeout(() => { if (el.parentNode) el.parentNode.removeChild(el); }, 3000);
|
||||||
},
|
},
|
||||||
|
|||||||
+3
-7
@@ -446,6 +446,9 @@ const generateCSS = (theme) => {
|
|||||||
.met-container {
|
.met-container {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
.met-toast {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 高对比度模式 */
|
/* 高对比度模式 */
|
||||||
@@ -663,13 +666,6 @@ const generateCSS = (theme) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 打印时隐藏 */
|
|
||||||
@media print {
|
|
||||||
.met-toast {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 滚动时固定位置 */
|
/* 滚动时固定位置 */
|
||||||
.met-container {
|
.met-container {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
|||||||
Reference in New Issue
Block a user