import type { PageActionSchema } from './page-action.js'; import type { RefSchema } from './ref.js'; /** Display a toast notification. React: toast/message UI. Mini-program: wx.showToast. */ export interface ToastAction extends PageActionSchema { type: 'toast'; message: string | RefSchema; icon?: 'success' | 'error' | 'loading' | 'none'; } /** Display an alert dialog. React: modal. Mini-program: wx.showModal. */ export interface AlertAction extends PageActionSchema { type: 'alert'; title: string | RefSchema; content: string | RefSchema; } export const popup = { toast(message: string | RefSchema, icon?: 'success' | 'error' | 'loading' | 'none'): ToastAction { return { name: 'toast', type: 'toast', message, icon }; }, alert(title: string | RefSchema, content: string | RefSchema): AlertAction { return { name: 'alert', type: 'alert', title, content }; }, };