You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte-kit-vice/src/uix/eidos/components/toast/index.ts

87 lines
2.5 KiB

// Toast — eidos compound API, disciplined option C.
//
// Two distinct roots, NOT one wrapping the other:
//
// - `<Toast>` — manual compound. Wraps Soma's Provider; consumer
// iterates `toaster.toasts` themselves. Children attached via
// Object.assign: Viewport, Item, Status, Main, Title, Description,
// Action, Close.
//
// - `<Toaster />` — imperative auto-mount. Renders the entire
// Provider+Viewport+Item loop with a default card template. Pass a
// `toaster` from `createToaster()`. Lives at the same import level
// as `Toast`, exported separately because it's a competing root —
// not a child of `Toast`.
//
// import { Toast, Toaster, createToaster } from '$uix/eidos/components/toast';
//
// const t = createToaster();
//
// // Imperative form:
// <Toaster toaster={t} />
//
// // Manual compound form:
// <Toast toaster={t}>
// <Toast.Viewport>
// {#each t.toasts as toast}
// <Toast.Item {toast}>
// <Toast.Status />
// <Toast.Main>
// <Toast.Title>{toast.title}</Toast.Title>
// <Toast.Description>{toast.description}</Toast.Description>
// </Toast.Main>
// <Toast.Close />
// </Toast.Item>
// {/each}
// </Toast.Viewport>
// </Toast>
import ToastRoot from './toast.svelte';
import Viewport from './toast-viewport.svelte';
import Item from './toast-item.svelte';
import Status from './toast-status.svelte';
import Main from './toast-main.svelte';
import Title from './toast-title.svelte';
import Description from './toast-description.svelte';
import Action from './toast-action.svelte';
import Close from './toast-close.svelte';
export const Toast = Object.assign(ToastRoot, {
Viewport,
Item,
Status,
Main,
Title,
Description,
Action,
Close
});
export default Toast;
// Imperative auto-mount (separate root — not attached to Toast).
export { default as Toaster } from './toaster.svelte';
// Re-export Soma's imperative API so consumers don't reach into headless directly.
export {
createToaster,
type ToastData,
type CreateToastOpts,
type PromiseToastOpts,
type ToasterConfig,
type SwipeDirection
} from '$soma/components/toast';
export type {
ToasterProps,
ToastProviderProps as ToastProps,
ToastViewportProps as ViewportProps,
ToastItemProps as ItemProps,
ToastStatusProps as StatusProps,
ToastMainProps as MainProps,
ToastTitleProps as TitleProps,
ToastDescriptionProps as DescriptionProps,
ToastActionProps as ActionProps,
ToastCloseProps as CloseProps,
ToastPosition
} from './types';

Powered by TurnKey Linux.