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

99 lines
2.9 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 explicitly:
// 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 ToastComponent 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';
type ToastNamespace = typeof ToastComponent & {
Viewport: typeof Viewport;
Item: typeof Item;
Status: typeof Status;
Main: typeof Main;
Title: typeof Title;
Description: typeof Description;
Action: typeof Action;
Close: typeof Close;
};
const Toast = ToastComponent as ToastNamespace;
Toast.Viewport = Viewport;
Toast.Item = Item;
Toast.Status = Status;
Toast.Main = Main;
Toast.Title = Title;
Toast.Description = Description;
Toast.Action = Action;
Toast.Close = Close;
export { Toast };
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,
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.