Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/state / src / typings.ts
Size: Mime:
/**
 * @todo fix type
 */
import { ObservableMap } from 'xmobx/mobx'

/**
 * @todo connect to routing too
 *
 * @todo split smaller stores (loading, snackbar, scroll, resize)
 * @see https://mobx.js.org/best/store.html
 * can do focus here too probably & locale
 *
 * @todo can use context here  to show & set popups & modal & snackbar...
 */
export interface ApplicationScreen {
  height: number
  width: number
  availHeight: number
  availWidth: number
  isGrowing?: boolean
  isShrinking?: boolean
}

export interface ApplicationScroll {
  vertical: number
  horizontal: number
  direction: 'up' | 'down' | 'none' | string
}

export interface ApplicationPrev {
  screen: {
    height: number
    width: number
  }
}

export interface ApplicationSnackbar {
  isVisible?: boolean
  message?: string
  meta?: any
}

export interface ApplicationTypes {
  store: ObservableMap
  hasError: boolean
  /**
   * @todo @name snackBar
   */
  snackbar: ApplicationSnackbar
  // router....
  // not observable previous => snapshot
  prev: ApplicationPrev
  screen: ApplicationScreen
  scroll: ApplicationScroll
}

export type CurriedSet<Type = any> = (x: any) =>
  Type & ApplicationTypes