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

96 lines
2.0 KiB
TypeScript

import { router, useLinkTo, type LinkProps as OneLinkProps } from 'one'
import type { ButtonProps, ViewProps } from '@hanzo/gui'
import { Button, Paragraph, Text } from '@hanzo/gui'
export type LinkProps = ViewProps &
OneLinkProps<any> & {
// for animating/doing something right before nav
delayNavigate?: boolean
}
export const Link = ({ href, replace, asChild, delayNavigate, ...props }: LinkProps) => {
const linkProps = useLinkTo({ href: href as any, replace: !!replace })
return (
<Text
render="a"
// always except-style
asChild={asChild ? 'except-style' : false}
className="t_Link"
cursor="pointer"
{...props}
{...linkProps}
{...(delayNavigate && {
onPress(e) {
e.preventDefault()
setTimeout(() => {
router.navigate(href)
}, 100)
props.onPress?.(e)
},
})}
/>
)
}
export const ParagraphLink = ({
href = '' as any,
replace,
delayNavigate,
onPress,
children,
...props
}: LinkProps) => {
const linkProps = useLinkTo({ href: href as string, replace: !!replace })
return (
<Paragraph
render="a"
cursor="pointer"
color="$color"
hoverStyle={{ color: '$color', outlineColor: 'red' }}
{...props}
{...(linkProps as any)}
{...(delayNavigate && {
onPress(e) {
e.preventDefault()
setTimeout(() => {
router.navigate(href)
}, 16)
onPress?.(e)
},
})}
>
{children}
</Paragraph>
)
}
export type ButtonLinkProps = Pick<LinkProps, 'href' | 'replace' | 'target' | 'rel'> &
ButtonProps
export const ButtonLink = ({
href = '' as any,
rel,
target,
replace = false,
children,
...props
}: ButtonLinkProps) => {
return (
<Link
asChild
{...{
href,
rel,
target,
replace,
}}
>
<Button render="a" {...props}>
{children}
</Button>
</Link>
)
}