Files
zeekayandHanzo Dev 751ef5c778 rename the framework to @hanzo/gui and the loader to @hanzogui/loader
Both old names are owned by a different npm account (artemis-prime), so
publishing them returns 403 — which is how this surfaced: the 8.0.0 run
shipped @hanzogui/logo and @hanzogui/demos depending on [email protected], a
version that cannot be published and therefore does not exist. Those two
were uninstallable.

@hanzo/gui and @hanzogui/* are ours, so the framework now carries the name
it is imported by everywhere downstream, and the loader moves under the
scope we control.

The rewrite is limited to package references. `DEBUG?.startsWith('hanzogui')`
is a log-namespace filter and join(dir, 'hanzogui') is a path — rewriting
either would change behaviour, so both are untouched.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-30 20:23:18 -07:00

64 lines
1.6 KiB
TypeScript

import {
Toast,
ToastProvider as ToastProviderOG,
ToastViewport,
useToastController,
useToastState,
type ToastProps,
} from '@hanzogui/toast'
import { Theme, YStack } from '@hanzo/gui'
export let toastController: ReturnType<typeof useToastController>
// this feels weird but it works... TODO: might want to add some variation of this to @hanzogui/toast cause useToastController can be a bit cumbersome to use outside react
const ToastImportHandler = () => {
toastController = useToastController()
return null
}
export const ToastProvider = ({ children }: { children: React.ReactNode }) => {
return (
<ToastProviderOG swipeDirection="vertical" swipeThreshold={80}>
<ToastHandler />
{children}
<ToastImportHandler />
<ToastViewport m="$0.5" left="50%" x="-50%" bottom={0} />
</ToastProviderOG>
)
}
const ToastHandler = () => {
const toast = useToastState()
// avoid rendering the toast if it's a demo toast
if (!toast || toast?.demo) return null
return (
<Theme name="accent">
<Toast
key={toast.title + toast.message}
duration={toast.duration ?? 3000}
transition="200ms"
enterStyle={{ opacity: 0, y: 50 }}
exitStyle={{ opacity: 0, y: 50 }}
y={-20}
b={0}
opacity={1}
gap={0}
elevation="$4"
{...toast.customData}
>
<YStack gap={0}>
<Toast.Title>{toast.title}</Toast.Title>
<Toast.Description>{toast.message}</Toast.Description>
</YStack>
</Toast>
</Theme>
)
}
declare module '@hanzogui/toast' {
interface CustomData extends ToastProps {}
}