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

82 lines
2.1 KiB
TypeScript

import { Unspaced, XStack, YStack } from '@hanzo/gui'
// TODO: rendering these is very expensive, converting to svg might help
export const Ruler = ({
size,
max = size,
orientation = 'horizontal',
disableColorDiff = false,
rotate = false,
}: {
size: number
max?: number
orientation?: 'horizontal' | 'vertical'
disableColorDiff?: boolean
rotate?: boolean
}) => {
const applied = Math.floor(size / 10)
const Stack = orientation === 'horizontal' ? XStack : YStack
return (
<Stack items={rotate ? 'flex-end' : undefined} gap={9}>
<Unspaced>
<YStack
position="absolute"
width={orientation === 'horizontal' ? max : undefined}
height={orientation === 'vertical' ? max : undefined}
borderColor="$color6"
borderBottomWidth={orientation === 'horizontal' ? 1 : undefined}
borderLeftWidth={orientation === 'vertical' ? 1 : undefined}
/>
<YStack
position="absolute"
width={orientation === 'horizontal' ? size : undefined}
height={orientation === 'vertical' ? size : undefined}
/>
</Unspaced>
{Array.from(Array(Math.floor(max / 10) + 1).keys()).map((_, idx) => {
const currentPx = idx * 10
const prominent = currentPx % 100 === 0
const active = currentPx < applied * 10
return (
<RulerLine
key={idx}
orientation={orientation}
active={active}
disableColorDiff={disableColorDiff}
prominent={prominent}
/>
)
})}
</Stack>
)
}
export const RulerLine = ({
prominent,
active,
orientation,
disableColorDiff = false,
}: {
prominent?: boolean
active?: boolean
orientation: 'horizontal' | 'vertical'
disableColorDiff?: boolean
}) => {
const size = prominent ? 12 : 5
return (
<YStack
bg={
disableColorDiff
? '$color6'
: active
? prominent
? '$color11'
: '$color10'
: '$color6'
}
width={orientation === 'horizontal' ? 1 : size}
height={orientation === 'vertical' ? 1 : size}
/>
)
}