All files / core/domain viewport.ts

100% Statements 8/8
100% Branches 4/4
100% Functions 2/2
100% Lines 8/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18      8x       8x     8x 8x   8x 2x 8x 2x  
import { Schema } from 'effect'
 
/** Compact turns the readout into a sheet of cards over the map. */
export const Layout = Schema.Literals(['Wide', 'Compact'])
export type Layout = typeof Layout.Type
 
/** Touch screens cannot hover, so there is no cursor position to report. */
export const Pointer = Schema.Literals(['Hover', 'Touch'])
export type Pointer = typeof Pointer.Type
 
export const COMPACT_QUERY = '(max-width: 767px)'
export const HOVER_QUERY = '(hover: hover)'
 
export const toLayout = (isCompact: boolean): Layout =>
  isCompact ? 'Compact' : 'Wide'
export const toPointer = (canHover: boolean): Pointer =>
  canHover ? 'Hover' : 'Touch'