{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE OverloadedStrings #-}
module Miso.Lynx.Element.List.Property
(
ListOptions (..)
, ScrollOrientation (..)
, ListType (..)
, ListItemSnapAlignment (..)
, defaultListOptions
, itemKey_
, key_
, enableScroll_
, enableNestedScroll_
, listMainAxisGap_
, listCrossAxisGap_
, sticky_
, stickyOffset_
, stickyTop_
, stickyBottom_
, bounces_
, initialScrollIndex_
, needVisibleItemInfo_
, upperThresholdItemCount_
, lowerThresholdItemCount_
, scrollEventThrottle_
, itemSnap_
, needLayoutCompleteInfo_
, layoutId_
, preloadBufferCount_
, scrollBarEnable_
, reuseIdentifier_
, fullSpan_
, estimatedMainAxisSizePx_
) where
import Data.Aeson
import Miso.String (MisoString)
import Miso.Types (Attribute)
import Miso.Property
data ListOptions
= ListOptions
{ ListOptions -> ListType
listType_ :: ListType
, ListOptions -> Int
spanCount_ :: Int
, ListOptions -> ScrollOrientation
scrollOrientation_ :: ScrollOrientation
} deriving (Int -> ListOptions -> ShowS
[ListOptions] -> ShowS
ListOptions -> String
(Int -> ListOptions -> ShowS)
-> (ListOptions -> String)
-> ([ListOptions] -> ShowS)
-> Show ListOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListOptions -> ShowS
showsPrec :: Int -> ListOptions -> ShowS
$cshow :: ListOptions -> String
show :: ListOptions -> String
$cshowList :: [ListOptions] -> ShowS
showList :: [ListOptions] -> ShowS
Show, ListOptions -> ListOptions -> Bool
(ListOptions -> ListOptions -> Bool)
-> (ListOptions -> ListOptions -> Bool) -> Eq ListOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListOptions -> ListOptions -> Bool
== :: ListOptions -> ListOptions -> Bool
$c/= :: ListOptions -> ListOptions -> Bool
/= :: ListOptions -> ListOptions -> Bool
Eq)
data ScrollOrientation
= Vertical
| Horizontal
deriving (Int -> ScrollOrientation -> ShowS
[ScrollOrientation] -> ShowS
ScrollOrientation -> String
(Int -> ScrollOrientation -> ShowS)
-> (ScrollOrientation -> String)
-> ([ScrollOrientation] -> ShowS)
-> Show ScrollOrientation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ScrollOrientation -> ShowS
showsPrec :: Int -> ScrollOrientation -> ShowS
$cshow :: ScrollOrientation -> String
show :: ScrollOrientation -> String
$cshowList :: [ScrollOrientation] -> ShowS
showList :: [ScrollOrientation] -> ShowS
Show, ScrollOrientation -> ScrollOrientation -> Bool
(ScrollOrientation -> ScrollOrientation -> Bool)
-> (ScrollOrientation -> ScrollOrientation -> Bool)
-> Eq ScrollOrientation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ScrollOrientation -> ScrollOrientation -> Bool
== :: ScrollOrientation -> ScrollOrientation -> Bool
$c/= :: ScrollOrientation -> ScrollOrientation -> Bool
/= :: ScrollOrientation -> ScrollOrientation -> Bool
Eq)
instance ToJSON ScrollOrientation where
toJSON :: ScrollOrientation -> Value
toJSON ScrollOrientation
Vertical = Value
"vertical"
toJSON ScrollOrientation
Horizontal = Value
"horizontal"
data ListType
= Single
| Flow
| Waterfall
deriving (Int -> ListType -> ShowS
[ListType] -> ShowS
ListType -> String
(Int -> ListType -> ShowS)
-> (ListType -> String) -> ([ListType] -> ShowS) -> Show ListType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListType -> ShowS
showsPrec :: Int -> ListType -> ShowS
$cshow :: ListType -> String
show :: ListType -> String
$cshowList :: [ListType] -> ShowS
showList :: [ListType] -> ShowS
Show, ListType -> ListType -> Bool
(ListType -> ListType -> Bool)
-> (ListType -> ListType -> Bool) -> Eq ListType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListType -> ListType -> Bool
== :: ListType -> ListType -> Bool
$c/= :: ListType -> ListType -> Bool
/= :: ListType -> ListType -> Bool
Eq)
instance ToJSON ListType where
toJSON :: ListType -> Value
toJSON ListType
Single = Value
"single"
toJSON ListType
Flow = Value
"flow"
toJSON ListType
Waterfall = Value
"waterfall"
defaultListOptions :: ListOptions
defaultListOptions :: ListOptions
defaultListOptions
= ListOptions
{ listType_ :: ListType
listType_ = ListType
Single
, spanCount_ :: Int
spanCount_ = Int
0
, scrollOrientation_ :: ScrollOrientation
scrollOrientation_ = ScrollOrientation
Vertical
}
itemKey_ :: MisoString -> Attribute action
itemKey_ :: forall action. MisoString -> Attribute action
itemKey_ = MisoString -> MisoString -> Attribute action
forall action. MisoString -> MisoString -> Attribute action
textProp MisoString
"item-key"
enableScroll_ :: Bool -> Attribute action
enableScroll_ :: forall action. Bool -> Attribute action
enableScroll_ = MisoString -> Bool -> Attribute action
forall action. MisoString -> Bool -> Attribute action
boolProp MisoString
"enable-scroll"
enableNestedScroll_ :: Bool -> Attribute action
enableNestedScroll_ :: forall action. Bool -> Attribute action
enableNestedScroll_ = MisoString -> Bool -> Attribute action
forall action. MisoString -> Bool -> Attribute action
boolProp MisoString
"enable-nested-scroll"
listMainAxisGap_ :: MisoString -> Attribute action
listMainAxisGap_ :: forall action. MisoString -> Attribute action
listMainAxisGap_ = MisoString -> MisoString -> Attribute action
forall action. MisoString -> MisoString -> Attribute action
textProp MisoString
"list-main-axis-gap"
listCrossAxisGap_ :: MisoString -> Attribute action
listCrossAxisGap_ :: forall action. MisoString -> Attribute action
listCrossAxisGap_ = MisoString -> MisoString -> Attribute action
forall action. MisoString -> MisoString -> Attribute action
textProp MisoString
"list-cross-axis-gap"
sticky_ :: Bool -> Attribute action
sticky_ :: forall action. Bool -> Attribute action
sticky_ = MisoString -> Bool -> Attribute action
forall action. MisoString -> Bool -> Attribute action
boolProp MisoString
"sticky"
stickyOffset_ :: Int -> Attribute action
stickyOffset_ :: forall action. Int -> Attribute action
stickyOffset_ = MisoString -> Int -> Attribute action
forall action. MisoString -> Int -> Attribute action
intProp MisoString
"sticky-offset"
stickyTop_ :: Bool -> Attribute action
stickyTop_ :: forall action. Bool -> Attribute action
stickyTop_ = MisoString -> Bool -> Attribute action
forall action. MisoString -> Bool -> Attribute action
boolProp MisoString
"sticky-top"
stickyBottom_ :: Bool -> Attribute action
stickyBottom_ :: forall action. Bool -> Attribute action
stickyBottom_ = MisoString -> Bool -> Attribute action
forall action. MisoString -> Bool -> Attribute action
boolProp MisoString
"sticky-bottom"
bounces_ :: Bool -> Attribute action
bounces_ :: forall action. Bool -> Attribute action
bounces_ = MisoString -> Bool -> Attribute action
forall action. MisoString -> Bool -> Attribute action
boolProp MisoString
"bounces"
initialScrollIndex_ :: Int -> Attribute action
initialScrollIndex_ :: forall action. Int -> Attribute action
initialScrollIndex_ = MisoString -> Int -> Attribute action
forall action. MisoString -> Int -> Attribute action
intProp MisoString
"initial-scroll-index"
needVisibleItemInfo_ :: Bool -> Attribute action
needVisibleItemInfo_ :: forall action. Bool -> Attribute action
needVisibleItemInfo_ = MisoString -> Bool -> Attribute action
forall action. MisoString -> Bool -> Attribute action
boolProp MisoString
"sticky-bottom"
upperThresholdItemCount_ :: Int -> Attribute action
upperThresholdItemCount_ :: forall action. Int -> Attribute action
upperThresholdItemCount_ = MisoString -> Int -> Attribute action
forall action. MisoString -> Int -> Attribute action
intProp MisoString
"upper-threshold-item-count"
lowerThresholdItemCount_ :: Int -> Attribute action
lowerThresholdItemCount_ :: forall action. Int -> Attribute action
lowerThresholdItemCount_ = MisoString -> Int -> Attribute action
forall action. MisoString -> Int -> Attribute action
intProp MisoString
"lower-threshold-item-count"
scrollEventThrottle_ :: Int -> Attribute action
scrollEventThrottle_ :: forall action. Int -> Attribute action
scrollEventThrottle_ = MisoString -> Int -> Attribute action
forall action. MisoString -> Int -> Attribute action
intProp MisoString
"scroll-event-throttle"
data ListItemSnapAlignment
= ListItemSnapAlignment
{ ListItemSnapAlignment -> Int
factor :: Int
, ListItemSnapAlignment -> Int
offset :: Int
} deriving (Int -> ListItemSnapAlignment -> ShowS
[ListItemSnapAlignment] -> ShowS
ListItemSnapAlignment -> String
(Int -> ListItemSnapAlignment -> ShowS)
-> (ListItemSnapAlignment -> String)
-> ([ListItemSnapAlignment] -> ShowS)
-> Show ListItemSnapAlignment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListItemSnapAlignment -> ShowS
showsPrec :: Int -> ListItemSnapAlignment -> ShowS
$cshow :: ListItemSnapAlignment -> String
show :: ListItemSnapAlignment -> String
$cshowList :: [ListItemSnapAlignment] -> ShowS
showList :: [ListItemSnapAlignment] -> ShowS
Show, ListItemSnapAlignment -> ListItemSnapAlignment -> Bool
(ListItemSnapAlignment -> ListItemSnapAlignment -> Bool)
-> (ListItemSnapAlignment -> ListItemSnapAlignment -> Bool)
-> Eq ListItemSnapAlignment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListItemSnapAlignment -> ListItemSnapAlignment -> Bool
== :: ListItemSnapAlignment -> ListItemSnapAlignment -> Bool
$c/= :: ListItemSnapAlignment -> ListItemSnapAlignment -> Bool
/= :: ListItemSnapAlignment -> ListItemSnapAlignment -> Bool
Eq)
instance ToJSON ListItemSnapAlignment where
toJSON :: ListItemSnapAlignment -> Value
toJSON ListItemSnapAlignment {Int
factor :: ListItemSnapAlignment -> Int
offset :: ListItemSnapAlignment -> Int
factor :: Int
offset :: Int
..}
= [Pair] -> Value
object
[ Key
"factor" Key -> Int -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int
factor
, Key
"offset" Key -> Int -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int
offset
]
itemSnap_ :: ListItemSnapAlignment -> Attribute action
itemSnap_ :: forall action. ListItemSnapAlignment -> Attribute action
itemSnap_ = MisoString -> ListItemSnapAlignment -> Attribute action
forall a action. ToJSON a => MisoString -> a -> Attribute action
prop MisoString
"item-snap"
needLayoutCompleteInfo_ :: Bool -> Attribute action
needLayoutCompleteInfo_ :: forall action. Bool -> Attribute action
needLayoutCompleteInfo_ = MisoString -> Bool -> Attribute action
forall a action. ToJSON a => MisoString -> a -> Attribute action
prop MisoString
"need-layout-complete-info"
layoutId_ :: Int -> Attribute action
layoutId_ :: forall action. Int -> Attribute action
layoutId_ = MisoString -> Int -> Attribute action
forall a action. ToJSON a => MisoString -> a -> Attribute action
prop MisoString
"layout-id"
preloadBufferCount_ :: Int -> Attribute action
preloadBufferCount_ :: forall action. Int -> Attribute action
preloadBufferCount_ = MisoString -> Int -> Attribute action
forall action. MisoString -> Int -> Attribute action
intProp MisoString
"preload-buffer-count"
scrollBarEnable_ :: Bool -> Attribute action
scrollBarEnable_ :: forall action. Bool -> Attribute action
scrollBarEnable_ = MisoString -> Bool -> Attribute action
forall action. MisoString -> Bool -> Attribute action
boolProp MisoString
"scroll-bar-enable"
reuseIdentifier_ :: MisoString -> Attribute action
reuseIdentifier_ :: forall action. MisoString -> Attribute action
reuseIdentifier_ = MisoString -> MisoString -> Attribute action
forall action. MisoString -> MisoString -> Attribute action
textProp MisoString
"reuse-identifier"
fullSpan_ :: Bool -> Attribute action
fullSpan_ :: forall action. Bool -> Attribute action
fullSpan_ = MisoString -> Bool -> Attribute action
forall action. MisoString -> Bool -> Attribute action
boolProp MisoString
"full-span"
estimatedMainAxisSizePx_ :: Int -> Attribute action
estimatedMainAxisSizePx_ :: forall action. Int -> Attribute action
estimatedMainAxisSizePx_ = MisoString -> Int -> Attribute action
forall action. MisoString -> Int -> Attribute action
intProp MisoString
"estimated-main-axis-size-px"