UNPKG

@dvcol/neo-svelte

Version:

Neomorphic ui library for svelte 5

45 lines (44 loc) 1.2 kB
export const NeoPlacements = { Top: 'top', TopStart: 'top-start', TopEnd: 'top-end', Bottom: 'bottom', BottomStart: 'bottom-start', BottomEnd: 'bottom-end', Left: 'left', LeftStart: 'left-start', LeftEnd: 'left-end', Right: 'right', RightStart: 'right-start', RightEnd: 'right-end', }; export const NeoTooltipPlacements = { ...NeoPlacements, Auto: 'auto', }; export const NeoDialogPlacements = { ...NeoPlacements, Center: 'center', }; export const NeoNotificationPlacements = { Top: 'top', TopStart: 'top-start', TopEnd: 'top-end', Bottom: 'bottom', BottomStart: 'bottom-start', BottomEnd: 'bottom-end', }; export function reversePlacement(placement) { if (placement?.startsWith('right')) return placement?.replace('right', 'left'); if (placement?.startsWith('left')) return placement?.replace('left', 'right'); return placement; } export function invertPlacement(placement) { if (placement?.startsWith('top')) return placement?.replace('top', 'bottom'); if (placement?.startsWith('bottom')) return placement?.replace('bottom', 'top'); return placement; }