{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Miso.Event.Types where
import qualified Data.Map as M
import GHC.Generics
import Miso.String
import Data.Aeson (FromJSON)
newtype KeyCode = KeyCode Int
deriving (Show, Eq, Ord, FromJSON)
newtype Checked = Checked Bool
deriving (Show, Eq, Ord, FromJSON)
data Options = Options {
preventDefault :: Bool
, stopPropagation :: Bool
} deriving (Show, Eq, Generic)
defaultOptions :: Options
defaultOptions = Options False False
newtype AllowDrop = AllowDrop Bool
deriving (Show, Eq, FromJSON)
defaultEvents :: M.Map MisoString Bool
defaultEvents = M.fromList [
("blur", True)
, ("change", False)
, ("click", False)
, ("dblclick", False)
, ("focus", False)
, ("input", False)
, ("keydown", False)
, ("keypress", False)
, ("keyup", False)
, ("mouseup", False)
, ("mousedown", False)
, ("mouseenter", False)
, ("mouseleave", False)
, ("mouseover", False)
, ("mouseout", False)
, ("dragstart", False)
, ("dragover", False)
, ("dragend", False)
, ("dragenter", False)
, ("dragleave", False)
, ("drag", False)
, ("drop", False)
, ("submit", False)
]