- 包声明 type:module 时 .js 产物被 Node 按 ESM 解析:Node 16/18 下 require 报 ERR_REQUIRE_ESM,Node 20+ 拿到 namespace 对象(success/version 等属性 undefined) - dist/metona-toast.cjs.js → .cjs,dist/react.cjs.js → .cjs - 主包 CJS footer 将 default 提升为 module.exports:require() 直接返回 MeToast(兼容 .default / .MeToast / .Met / .Toast / .VERSION 所有用法) - 版本 0.5.1(0.5.0 已发布带问题产物) - 真实消费者验证:CJS/ESM/React 子包四路加载全部正常
510 lines
19 KiB
TypeScript
510 lines
19 KiB
TypeScript
/**
|
|
* MetonaToast — 核心类型定义
|
|
* @module types
|
|
* @version 0.5.1
|
|
*/
|
|
/** Toast 通知类型(107种内置图标类型) */
|
|
type ToastType = 'default' | 'success' | 'error' | 'warning' | 'info' | 'loading' | 'check' | 'x' | 'alert' | 'question' | 'star' | 'heart' | 'bell' | 'mail' | 'settings' | 'user' | 'home' | 'search' | 'plus' | 'minus' | 'edit' | 'trash' | 'download' | 'upload' | 'share' | 'link' | 'external' | 'clock' | 'calendar' | 'map' | 'compass' | 'globe' | 'wifi' | 'cloud' | 'sun' | 'moon' | 'zap' | 'activity' | 'cpu' | 'database' | 'server' | 'terminal' | 'code' | 'git' | 'package' | 'layers' | 'grid' | 'list' | 'filter' | 'sort' | 'refresh' | 'sync' | 'power' | 'battery' | 'bluetooth' | 'volume' | 'mic' | 'camera' | 'image' | 'video' | 'music' | 'file' | 'folder' | 'clipboard' | 'save' | 'print' | 'eye' | 'eyeOff' | 'lock' | 'unlock' | 'shield' | 'key' | 'flag' | 'bookmark' | 'tag' | 'gift' | 'award' | 'target' | 'crosshair' | 'move' | 'maximize' | 'minimize' | 'copy' | 'cut' | 'paste' | 'rotateCw' | 'rotateCcw' | 'zoomIn' | 'zoomOut' | 'crop' | 'sliders' | 'toggleLeft' | 'toggleRight' | 'checkCircle' | 'xCircle' | 'alertCircle' | 'infoCircle' | 'helpCircle' | 'alertTriangle' | 'checkSquare' | 'square' | 'circle' | 'triangle' | 'hexagon' | 'octagon' | 'pentagon' | 'diamond';
|
|
/** Toast 显示位置 */
|
|
type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
/** Toast 主题 */
|
|
type ToastTheme = 'light' | 'dark' | 'auto' | 'warm' | (string & {});
|
|
/** Toast 动画类型 */
|
|
type ToastAnimation = 'slide' | 'fade' | 'scale' | 'bounce' | 'flip' | 'rotate' | 'zoom' | 'slideUp' | 'slideDown' | 'slideLeft' | 'slideRight' | (string & {});
|
|
/** 进度条方向 */
|
|
type ToastProgressDirection = 'horizontal' | 'vertical';
|
|
interface TypeColor {
|
|
fg: string;
|
|
bg: string;
|
|
}
|
|
interface ToastConfig {
|
|
position?: ToastPosition;
|
|
duration?: number;
|
|
max?: number;
|
|
gap?: number;
|
|
offset?: number;
|
|
pauseOnHover?: boolean;
|
|
closeOnClick?: boolean;
|
|
draggable?: boolean;
|
|
dragThreshold?: number;
|
|
showProgress?: boolean;
|
|
progressDirection?: ToastProgressDirection;
|
|
icon?: boolean;
|
|
closeButton?: boolean;
|
|
theme?: ToastTheme;
|
|
animation?: ToastAnimation;
|
|
zIndex?: number;
|
|
width?: number | string;
|
|
className?: string;
|
|
style?: Record<string, string>;
|
|
onShow?: ((toast: ToastInstance) => void) | null;
|
|
onBeforeShow?: ((toast: ToastInstance) => boolean | void) | null;
|
|
onClose?: ((toast: ToastInstance) => void) | null;
|
|
onClick?: ((toast: ToastInstance) => void) | null;
|
|
onUpdate?: ((toast: ToastInstance) => void) | null;
|
|
render?: ((toast: ToastInstance) => string) | null;
|
|
resetTimerOnUpdate?: boolean;
|
|
notifyWhenHidden?: boolean;
|
|
onError?: ((errorInfo: ErrorInfo) => void) | null;
|
|
group?: string | null;
|
|
locale?: string;
|
|
plugins?: Array<string | Plugin>;
|
|
}
|
|
interface ErrorInfo {
|
|
hook?: string;
|
|
source?: string;
|
|
error: Error;
|
|
toast?: ToastInstance;
|
|
}
|
|
interface ToastOptions extends Partial<ToastConfig> {
|
|
type?: string;
|
|
title?: string;
|
|
message?: string;
|
|
content?: string;
|
|
html?: string;
|
|
iconHTML?: string;
|
|
id?: string;
|
|
}
|
|
interface ToastInstance {
|
|
id: string;
|
|
type: string;
|
|
title: string;
|
|
message: string;
|
|
html: string;
|
|
iconHTML: string;
|
|
config: ToastConfig;
|
|
el: HTMLElement | null;
|
|
barEl: HTMLElement | null;
|
|
rafId: number | null;
|
|
remaining: number;
|
|
startedAt: number;
|
|
paused: boolean;
|
|
closing: boolean;
|
|
group: string | null;
|
|
_cleanups: Array<() => void>;
|
|
_palette(): {
|
|
theme: string;
|
|
c: TypeColor;
|
|
t: Partial<ThemeConfig>;
|
|
};
|
|
create(): this;
|
|
update(partial: Partial<ToastOptions>): this;
|
|
updatePosition(position: string): this;
|
|
remove(): void;
|
|
close(immediate?: boolean): void;
|
|
_pause(): void;
|
|
_resume(): void;
|
|
_destroy(): void;
|
|
}
|
|
interface LoadingControl {
|
|
id: string;
|
|
success(message?: string, opts?: ToastOptions): ToastInstance | null;
|
|
error(message?: string, opts?: ToastOptions): ToastInstance | null;
|
|
info(message?: string, opts?: ToastOptions): ToastInstance | null;
|
|
warning(message?: string, opts?: ToastOptions): ToastInstance | null;
|
|
update(partial: Partial<ToastOptions>): unknown;
|
|
dismiss(): void;
|
|
}
|
|
interface ProgressControl {
|
|
id: string;
|
|
setProgress(percent: number): void;
|
|
complete(message?: string): void;
|
|
error(message?: string): void;
|
|
dismiss(): void;
|
|
}
|
|
interface CountdownControl {
|
|
id: string;
|
|
cancel(): void;
|
|
pause(): void;
|
|
resume(): void;
|
|
}
|
|
interface ActionControl {
|
|
id: string;
|
|
toast: ToastInstance;
|
|
dismiss(): void;
|
|
}
|
|
interface QueueControl {
|
|
then<TResult1 = void, TResult2 = never>(onfulfilled?: ((value: void) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
catch<TResult = never>(onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null): Promise<void | TResult>;
|
|
cancel(): void;
|
|
}
|
|
interface GroupAPI {
|
|
_group: string;
|
|
show: (...args: unknown[]) => ToastInstance;
|
|
success: (...args: unknown[]) => ToastInstance;
|
|
error: (...args: unknown[]) => ToastInstance;
|
|
warning: (...args: unknown[]) => ToastInstance;
|
|
info: (...args: unknown[]) => ToastInstance;
|
|
loading: (...args: unknown[]) => LoadingControl;
|
|
action: (...args: unknown[]) => ActionControl;
|
|
dismiss(): void;
|
|
count(): number;
|
|
}
|
|
interface ActionButton {
|
|
text: string;
|
|
onClick: (toast: ToastInstance) => void;
|
|
color?: string;
|
|
style?: Record<string, string>;
|
|
close?: boolean;
|
|
}
|
|
interface PromiseOptions extends ToastOptions {
|
|
loading?: string;
|
|
success?: string;
|
|
error?: string;
|
|
}
|
|
interface ConfirmOptions extends ToastOptions {
|
|
confirmText?: string;
|
|
confirmColor?: string;
|
|
cancelText?: string;
|
|
cancelColor?: string;
|
|
}
|
|
interface PromptOptions extends ToastOptions {
|
|
inputType?: string;
|
|
placeholder?: string;
|
|
defaultValue?: string;
|
|
submitText?: string;
|
|
submitColor?: string;
|
|
cancelText?: string;
|
|
cancelColor?: string;
|
|
}
|
|
interface ProgressOptions extends ToastOptions {
|
|
progressColor?: string;
|
|
}
|
|
interface CountdownOptions extends ToastOptions {
|
|
onComplete?: (() => void) | null;
|
|
}
|
|
interface QueueOptions extends ToastOptions {
|
|
delay?: number;
|
|
}
|
|
interface StackOptions extends ToastOptions {
|
|
stagger?: number;
|
|
}
|
|
interface InitOptions {
|
|
config?: Partial<ToastConfig>;
|
|
theme?: ToastTheme;
|
|
locale?: string;
|
|
plugins?: Array<string | Plugin>;
|
|
}
|
|
interface StatusInfo {
|
|
version: string;
|
|
toasts: number;
|
|
theme: string;
|
|
locale: string;
|
|
plugins: string[];
|
|
animations: number;
|
|
}
|
|
interface AnimationConfig {
|
|
enter: Record<string, string | number>;
|
|
leave: Record<string, string | number>;
|
|
duration: number;
|
|
easing: string;
|
|
name?: string;
|
|
delay?: number;
|
|
iterations?: number;
|
|
direction?: 'normal' | 'reverse' | 'alternate' | 'alternate-reverse';
|
|
fillMode?: 'none' | 'forwards' | 'backwards' | 'both';
|
|
}
|
|
interface AnimationUtils {
|
|
register(name: string, config: Partial<AnimationConfig>): void;
|
|
unregister(name: string): void;
|
|
get(name: string): AnimationConfig | null;
|
|
getAnimationNames(): string[];
|
|
getActiveCount(): number;
|
|
cancelAll(): void;
|
|
reset(): void;
|
|
destroy(): void;
|
|
}
|
|
interface ThemeConfig {
|
|
bg: string;
|
|
text: string;
|
|
border: string;
|
|
shadow: string;
|
|
hoverShadow: string;
|
|
progressBg: string;
|
|
closeHoverBg: string;
|
|
backdropFilter?: string;
|
|
}
|
|
interface ThemePreview {
|
|
name: string;
|
|
resolved: string;
|
|
colors: {
|
|
background: string;
|
|
text: string;
|
|
border: string;
|
|
};
|
|
isDark: boolean;
|
|
isLight: boolean;
|
|
isAuto: boolean;
|
|
}
|
|
interface ThemeUtils {
|
|
getSystemTheme(): 'light' | 'dark';
|
|
resolveTheme(theme: string): string;
|
|
getThemeConfig(theme: string): ThemeConfig;
|
|
applyTheme(theme: string): void;
|
|
getCurrentTheme(): string;
|
|
getResolvedTheme(): string;
|
|
switchTheme(theme: string): void;
|
|
toggleTheme(): void;
|
|
resetToAuto(): void;
|
|
initTheme(): void;
|
|
watchSystemTheme(): void;
|
|
unwatchSystemTheme(): void;
|
|
addThemeListener(listener: (theme: string, resolved: string) => void): () => void;
|
|
removeThemeListener(listener: (theme: string, resolved: string) => void): void;
|
|
clearThemeListeners(): void;
|
|
registerTheme(name: string, config: ThemeConfig): void;
|
|
unregisterTheme(name: string): void;
|
|
getAllThemes(): Record<string, ThemeConfig>;
|
|
getThemeNames(): string[];
|
|
hasTheme(name: string): boolean;
|
|
getThemePreview(theme: string): ThemePreview;
|
|
generateThemeCSS(theme: string): string;
|
|
applyThemeCSS(theme: string): void;
|
|
removeThemeCSS(): void;
|
|
saveTheme(theme: string): void;
|
|
loadTheme(): string;
|
|
}
|
|
interface LocaleInfo {
|
|
code: string;
|
|
name: string;
|
|
direction: 'ltr' | 'rtl';
|
|
isSupported: boolean;
|
|
isCurrent: boolean;
|
|
isFallback: boolean;
|
|
}
|
|
interface I18nUtils {
|
|
t(key: string, params?: Record<string, string | number>): string;
|
|
plural(key: string, count: number, params?: Record<string, string | number>): string;
|
|
getCurrentLocale(): string;
|
|
setCurrentLocale(locale: string): void;
|
|
switchLocale(locale: string): void;
|
|
getFallbackLocale(): string;
|
|
setFallbackLocale(locale: string): void;
|
|
hasTranslation(key: string): boolean;
|
|
getTranslations(locale: string): Record<string, unknown>;
|
|
addTranslations(locale: string, translations: Record<string, unknown>): void;
|
|
removeTranslation(locale: string, key: string): void;
|
|
clearTranslations(locale: string): void;
|
|
getSupportedLocales(): string[];
|
|
isLocaleSupported(locale: string): boolean;
|
|
getLocaleName(locale: string): string;
|
|
getLocaleDirection(locale: string): 'ltr' | 'rtl';
|
|
getLocaleInfo(locale: string): LocaleInfo;
|
|
getAllLocaleInfo(): LocaleInfo[];
|
|
formatNumber(number: number, options?: Intl.NumberFormatOptions): string;
|
|
formatCurrency(amount: number, currency?: string, options?: Intl.NumberFormatOptions): string;
|
|
formatPercent(value: number, options?: Intl.NumberFormatOptions): string;
|
|
formatDate(date: Date | number | string, options?: Intl.DateTimeFormatOptions): string;
|
|
formatTime(date: Date | number | string, options?: Intl.DateTimeFormatOptions): string;
|
|
formatRelativeTime(date: Date | number | string, options?: Intl.RelativeTimeFormatOptions): string;
|
|
formatList(list: string[], options?: Record<string, unknown>): string;
|
|
formatPlural(count: number, options?: Intl.PluralRulesOptions): string;
|
|
addLocaleListener(listener: (locale: string) => void): () => void;
|
|
removeLocaleListener(listener: (locale: string) => void): void;
|
|
clearLocaleListeners(): void;
|
|
initI18n(): void;
|
|
saveLocale(locale: string): void;
|
|
loadLocale(): string;
|
|
getDefaultLocale(): string;
|
|
}
|
|
interface Plugin {
|
|
name: string;
|
|
version?: string;
|
|
description?: string;
|
|
hooks?: Record<string, (...args: unknown[]) => void>;
|
|
middleware?: (...args: unknown[]) => unknown;
|
|
install?: (manager: PluginManager) => void | Record<string, unknown> | null;
|
|
uninstall?: (manager: PluginManager) => void;
|
|
init?: (manager: PluginManager) => void;
|
|
destroy?: (manager: PluginManager) => void;
|
|
installed?: boolean;
|
|
enabled?: boolean;
|
|
[key: string]: unknown;
|
|
}
|
|
interface PluginManager {
|
|
register(name: string, plugin: Plugin): PluginManager;
|
|
unregister(name: string): PluginManager;
|
|
get(name: string): Plugin | null;
|
|
has(name: string): boolean;
|
|
getAll(): Plugin[];
|
|
getNames(): string[];
|
|
enable(name: string): PluginManager;
|
|
disable(name: string): PluginManager;
|
|
isEnabled(name: string): boolean;
|
|
destroy(): void;
|
|
}
|
|
interface PluginUtils {
|
|
createManager(): PluginManager;
|
|
register(name: string, plugin: Plugin): PluginManager;
|
|
unregister(name: string): PluginManager;
|
|
get(name: string): Plugin | null;
|
|
has(name: string): boolean;
|
|
getAll(): Plugin[];
|
|
getNames(): string[];
|
|
enable(name: string): PluginManager;
|
|
disable(name: string): PluginManager;
|
|
isEnabled(name: string): boolean;
|
|
getPreset(name: string): Plugin | null;
|
|
getAllPresets(): Record<string, Plugin>;
|
|
createPlugin(config: Partial<Plugin>): Plugin;
|
|
validatePlugin(plugin: Partial<Plugin>): {
|
|
valid: boolean;
|
|
errors: string[];
|
|
};
|
|
}
|
|
interface MeToast {
|
|
version: string;
|
|
_toasts: Map<string, ToastInstance>;
|
|
_config: ToastConfig;
|
|
_destroyed?: boolean;
|
|
_emit(opts: ToastOptions): ToastInstance;
|
|
_remove(id: string): void;
|
|
_resolve(loadingToast: ToastInstance, type: string, message: string, opts: ToastOptions): ToastInstance | null;
|
|
_groupCount(name: string): number;
|
|
configure(opts: Partial<ToastConfig>): MeToast;
|
|
init(options?: InitOptions): MeToast;
|
|
destroy(): void;
|
|
getStatus(): StatusInfo;
|
|
getConfig(): ToastConfig;
|
|
updateConfig(config: Partial<ToastConfig>): MeToast;
|
|
resetConfig(): MeToast;
|
|
show(messageOrOpts: string | ToastOptions, opts?: ToastOptions): ToastInstance;
|
|
success(messageOrOpts: string | ToastOptions, opts?: ToastOptions): ToastInstance;
|
|
error(messageOrOpts: string | ToastOptions, opts?: ToastOptions): ToastInstance;
|
|
warning(messageOrOpts: string | ToastOptions, opts?: ToastOptions): ToastInstance;
|
|
info(messageOrOpts: string | ToastOptions, opts?: ToastOptions): ToastInstance;
|
|
loading(messageOrOpts: string | ToastOptions, opts?: ToastOptions): LoadingControl;
|
|
promise<T>(promise: Promise<T>, opts?: PromiseOptions): Promise<T>;
|
|
confirm(message: string, opts?: ConfirmOptions): Promise<boolean>;
|
|
prompt(message: string, opts?: PromptOptions): Promise<string | null>;
|
|
progress(messageOrOpts: string | ToastOptions, opts?: ProgressOptions): ProgressControl;
|
|
countdown(message: string, seconds?: number, opts?: CountdownOptions): CountdownControl;
|
|
action(messageOrOpts: string | ToastOptions, actions?: ActionButton[], opts?: ToastOptions): ActionControl;
|
|
queue(messages: Array<string | ToastOptions>, opts?: QueueOptions): QueueControl;
|
|
stack(messages: Array<string | ToastOptions>, opts?: StackOptions): void;
|
|
group(name: string): GroupAPI;
|
|
dismissGroup(name: string): void;
|
|
find(id: string): ToastInstance | undefined;
|
|
dismiss(id?: string): void;
|
|
removeToast(id: string): void;
|
|
clear(position?: ToastPosition): void;
|
|
getToasts(): ToastInstance[];
|
|
count(): number;
|
|
hasToasts(): boolean;
|
|
getToast(id: string): ToastInstance | null;
|
|
closeAll(): void;
|
|
clearAll(): void;
|
|
pauseAll(): void;
|
|
resumeAll(): void;
|
|
updateAll(partial: Partial<ToastOptions>): void;
|
|
findToasts(predicate: (toast: ToastInstance) => boolean): ToastInstance[];
|
|
findByType(type: ToastType): ToastInstance[];
|
|
findByPosition(position: ToastPosition): ToastInstance[];
|
|
getAll(): Map<string, ToastInstance>;
|
|
use(plugin: string | Plugin, options?: Record<string, unknown>): MeToast;
|
|
animations: AnimationUtils;
|
|
themes: ThemeUtils;
|
|
i18n: I18nUtils;
|
|
plugins: PluginUtils;
|
|
presetPlugins: Record<string, Plugin>;
|
|
}
|
|
declare global {
|
|
interface Window {
|
|
MeToast: MeToast;
|
|
Met: MeToast;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 增强的 MeToast 对象 — 在 meToast 基础上注入子模块
|
|
*/
|
|
declare const enhancedMeToast: {
|
|
version: string;
|
|
animations: AnimationUtils;
|
|
themes: ThemeUtils;
|
|
i18n: I18nUtils;
|
|
plugins: PluginUtils;
|
|
presetPlugins: Record<string, Plugin>;
|
|
_toasts: Map<string, ToastInstance>;
|
|
_config: ToastConfig;
|
|
_destroyed?: boolean;
|
|
_emit(opts: ToastOptions): ToastInstance;
|
|
_remove(id: string): void;
|
|
_resolve(loadingToast: ToastInstance, type: string, message: string, opts: ToastOptions): ToastInstance | null;
|
|
_groupCount(name: string): number;
|
|
configure(opts: Partial<ToastConfig>): MeToast;
|
|
init(options?: InitOptions): MeToast;
|
|
destroy(): void;
|
|
getStatus(): StatusInfo;
|
|
getConfig(): ToastConfig;
|
|
updateConfig(config: Partial<ToastConfig>): MeToast;
|
|
resetConfig(): MeToast;
|
|
show(messageOrOpts: string | ToastOptions, opts?: ToastOptions): ToastInstance;
|
|
success(messageOrOpts: string | ToastOptions, opts?: ToastOptions): ToastInstance;
|
|
error(messageOrOpts: string | ToastOptions, opts?: ToastOptions): ToastInstance;
|
|
warning(messageOrOpts: string | ToastOptions, opts?: ToastOptions): ToastInstance;
|
|
info(messageOrOpts: string | ToastOptions, opts?: ToastOptions): ToastInstance;
|
|
loading(messageOrOpts: string | ToastOptions, opts?: ToastOptions): LoadingControl;
|
|
promise<T>(promise: Promise<T>, opts?: PromiseOptions): Promise<T>;
|
|
confirm(message: string, opts?: ConfirmOptions): Promise<boolean>;
|
|
prompt(message: string, opts?: PromptOptions): Promise<string | null>;
|
|
progress(messageOrOpts: string | ToastOptions, opts?: ProgressOptions): ProgressControl;
|
|
countdown(message: string, seconds?: number, opts?: CountdownOptions): CountdownControl;
|
|
action(messageOrOpts: string | ToastOptions, actions?: ActionButton[], opts?: ToastOptions): ActionControl;
|
|
queue(messages: Array<string | ToastOptions>, opts?: QueueOptions): QueueControl;
|
|
stack(messages: Array<string | ToastOptions>, opts?: StackOptions): void;
|
|
group(name: string): GroupAPI;
|
|
dismissGroup(name: string): void;
|
|
find(id: string): ToastInstance | undefined;
|
|
dismiss(id?: string): void;
|
|
removeToast(id: string): void;
|
|
clear(position?: ToastPosition): void;
|
|
getToasts(): ToastInstance[];
|
|
count(): number;
|
|
hasToasts(): boolean;
|
|
getToast(id: string): ToastInstance | null;
|
|
closeAll(): void;
|
|
clearAll(): void;
|
|
pauseAll(): void;
|
|
resumeAll(): void;
|
|
updateAll(partial: Partial<ToastOptions>): void;
|
|
findToasts(predicate: (toast: ToastInstance) => boolean): ToastInstance[];
|
|
findByType(type: ToastType): ToastInstance[];
|
|
findByPosition(position: ToastPosition): ToastInstance[];
|
|
getAll(): Map<string, ToastInstance>;
|
|
use(plugin: string | Plugin, options?: Record<string, unknown>): MeToast;
|
|
};
|
|
|
|
/**
|
|
* MetonaToast React — React 适配器
|
|
* @module react
|
|
* @version 0.5.1
|
|
* @description useToast hook + 声明式 <Toast /> 组件。主包保持零依赖,React 为 optional peerDependency
|
|
*/
|
|
|
|
/** 支持声明式渲染的 Toast 类型 */
|
|
type ReactToastType = 'success' | 'error' | 'warning' | 'info' | 'show' | (string & {});
|
|
interface ToastProps extends Omit<ToastOptions, 'message' | 'type'> {
|
|
message: string;
|
|
type?: ReactToastType;
|
|
/** 组件卸载时自动移除该 Toast(默认 true)。设为 false 则 Toast 独立于组件生命周期 */
|
|
autoClose?: boolean;
|
|
}
|
|
/**
|
|
* 创建绑定清理集合的 API — 组件卸载时自动移除本组件创建的 Toast。
|
|
* 纯函数,便于独立测试与扩展。
|
|
*/
|
|
declare const createBoundApi: (cleanup: Set<string>) => Record<string, unknown>;
|
|
/**
|
|
* useToast — 返回 MeToast API,但本组件创建的 Toast 会在组件卸载时自动移除。
|
|
* 适合"通知随组件生命周期"的场景(如表单提交、异步任务页)。
|
|
*/
|
|
declare const useToast: () => Record<string, unknown>;
|
|
/**
|
|
* Toast — 声明式 Toast 组件。props 变化时更新内容(重新创建实例),
|
|
* 组件卸载时自动移除(autoClose 默认 true)。
|
|
*/
|
|
declare const Toast: (props: ToastProps) => null;
|
|
|
|
export { enhancedMeToast as MeToast, ReactToastType, Toast, ToastProps, createBoundApi, useToast };
|