Safe Haskell | None |
---|---|
Language | GHC2021 |
Synopsis
- data Content
- data Element = Element {
- inline :: Bool
- name :: Name
- attributes :: Attributes
- children :: [Content]
- element :: Name -> Attributes -> [Content] -> Element
- data Attributes = Attributes {}
- type Attribute = (Name, AttValue)
- type Name = Text
- type AttValue = Text
- type Mod = Attributes -> Attributes
- type CSS = Map Selector Class
- data Class = Class {
- selector :: Selector
- properties :: Styles
- type Styles = Map Name StyleValue
- data Selector = Selector {}
- selector :: ClassName -> Selector
- newtype ClassName = ClassName {}
- class ToClassName a where
- toClassName :: a -> Text
- data Pseudo
- newtype StyleValue = StyleValue String
- class ToStyleValue a where
- toStyleValue :: a -> StyleValue
- data Length
- newtype PxRem = PxRem' Int
- newtype Ms = Ms Int
- data Media
- data Sides a
- newtype FlatAttributes = FlatAttributes {}
- class ToColor a where
- colorValue :: a -> HexColor
- colorName :: a -> Text
- newtype HexColor = HexColor Text
- data Align = Center
Documentation
A single HTML tag. Note that the class attribute is stored separately from the rest of the attributes to make adding styles easier
Element | |
|
data Attributes Source #
Instances
Monoid Attributes Source # | |
Defined in Web.View.Types mempty :: Attributes # mappend :: Attributes -> Attributes -> Attributes # mconcat :: [Attributes] -> Attributes # | |
Semigroup Attributes Source # | |
Defined in Web.View.Types (<>) :: Attributes -> Attributes -> Attributes # sconcat :: NonEmpty Attributes -> Attributes # stimes :: Integral b => b -> Attributes -> Attributes # | |
Show Attributes Source # | |
Defined in Web.View.Types showsPrec :: Int -> Attributes -> ShowS # show :: Attributes -> String # showList :: [Attributes] -> ShowS # |
Attribute Modifiers
type Mod = Attributes -> Attributes Source #
Element functions expect a Mod function as their first argument that adds attributes and classes.
userEmail :: User -> View c () userEmail user = input (fontSize 16 . active) (text user.email) where active = isActive user then bold else id
Atomic CSS
Atomic classes include a selector and the corresponding styles
Class | |
|
The selector to use for the given atomic Class
A class name
class ToClassName a where Source #
Convert a type into a className segment to generate unique compound style names based on the value
Nothing
toClassName :: a -> Text Source #
default toClassName :: Show a => a -> Text Source #
Instances
ToClassName Text Source # | |
Defined in Web.View.Types toClassName :: Text -> Text Source # | |
ToClassName Align Source # | |
Defined in Web.View.Types toClassName :: Align -> Text Source # | |
ToClassName Length Source # | |
Defined in Web.View.Types toClassName :: Length -> Text Source # | |
ToClassName Ms Source # | |
Defined in Web.View.Types toClassName :: Ms -> Text Source # | |
ToClassName PxRem Source # | |
Defined in Web.View.Types toClassName :: PxRem -> Text Source # | |
ToClassName Float Source # | |
Defined in Web.View.Types toClassName :: Float -> Text Source # | |
ToClassName Int Source # | |
Defined in Web.View.Types toClassName :: Int -> Text Source # |
Psuedos allow for specifying styles that only apply in certain conditions. See hover
etc
el (color Primary . hover (color White)) "hello"
newtype StyleValue Source #
The value of a css style property
Instances
IsString StyleValue Source # | |
Defined in Web.View.Types fromString :: String -> StyleValue # | |
Show StyleValue Source # | |
Defined in Web.View.Types showsPrec :: Int -> StyleValue -> ShowS # show :: StyleValue -> String # showList :: [StyleValue] -> ShowS # |
class ToStyleValue a where Source #
Use a type as a css style property value
Nothing
toStyleValue :: a -> StyleValue Source #
default toStyleValue :: Show a => a -> StyleValue Source #
Instances
ToStyleValue Text Source # | |
Defined in Web.View.Types toStyleValue :: Text -> StyleValue Source # | |
ToStyleValue Align Source # | |
Defined in Web.View.Types toStyleValue :: Align -> StyleValue Source # | |
ToStyleValue HexColor Source # | |
Defined in Web.View.Types toStyleValue :: HexColor -> StyleValue Source # | |
ToStyleValue Length Source # | |
Defined in Web.View.Types toStyleValue :: Length -> StyleValue Source # | |
ToStyleValue Ms Source # | |
Defined in Web.View.Types toStyleValue :: Ms -> StyleValue Source # | |
ToStyleValue PxRem Source # | |
Defined in Web.View.Types toStyleValue :: PxRem -> StyleValue Source # | |
ToStyleValue String Source # | |
Defined in Web.View.Types toStyleValue :: String -> StyleValue Source # | |
ToStyleValue Float Source # | |
Defined in Web.View.Types toStyleValue :: Float -> StyleValue Source # | |
ToStyleValue Int Source # | |
Defined in Web.View.Types toStyleValue :: Int -> StyleValue Source # |
PxRem PxRem | Px, converted to Rem. Allows for the user to change the document font size and have the app scale accordingly. But allows the programmer to code in pixels to match a design |
Pct Float |
Instances
Num Length Source # | |
Show Length Source # | |
ToClassName Length Source # | |
Defined in Web.View.Types toClassName :: Length -> Text Source # | |
ToStyleValue Length Source # | |
Defined in Web.View.Types toStyleValue :: Length -> StyleValue Source # |
Instances
Enum PxRem Source # | |
Num PxRem Source # | |
Integral PxRem Source # | |
Real PxRem Source # | |
Defined in Web.View.Types toRational :: PxRem -> Rational # | |
Show PxRem Source # | |
Eq PxRem Source # | |
Ord PxRem Source # | |
ToClassName PxRem Source # | |
Defined in Web.View.Types toClassName :: PxRem -> Text Source # | |
ToStyleValue PxRem Source # | |
Defined in Web.View.Types toStyleValue :: PxRem -> StyleValue Source # |
Milliseconds, used for transitions
Instances
Num Ms Source # | |
Show Ms Source # | |
ToClassName Ms Source # | |
Defined in Web.View.Types toClassName :: Ms -> Text Source # | |
ToStyleValue Ms Source # | |
Defined in Web.View.Types toStyleValue :: Ms -> StyleValue Source # |
Media allows for responsive designs that change based on characteristics of the window. See Layout Example
Options for styles that support specifying various sides. This has a "fake" Num instance to support literals
border 5 border (X 2) border (TRBL 0 5 0 0)
Instances
newtype FlatAttributes Source #
Element's attributes do not include class, which is separated. FlatAttributes generate the class attribute and include it
Instances
Generic FlatAttributes Source # | |||||
Defined in Web.View.Types
from :: FlatAttributes -> Rep FlatAttributes x # to :: Rep FlatAttributes x -> FlatAttributes # | |||||
type Rep FlatAttributes Source # | |||||
Defined in Web.View.Types type Rep FlatAttributes = D1 ('MetaData "FlatAttributes" "Web.View.Types" "web-view-0.5.0-inplace" 'True) (C1 ('MetaCons "FlatAttributes" 'PrefixI 'True) (S1 ('MetaSel ('Just "attributes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Name AttValue)))) |
Colors
class ToColor a where Source #
ToColor allows you to create a type containing your application's colors:
data AppColor = White | Primary | Dark instance ToColor AppColor where colorValue White = "#FFF" colorValue Dark = "#333" colorValue Primary = "#00F" hello :: View c () hello = el (bg Primary . color White) "Hello"
colorValue :: a -> HexColor Source #
Hexidecimal Color. Can be specified with or without the leading #
. Recommended to use an AppColor type instead of manually using hex colors. See ToColor
Instances
IsString HexColor Source # | |
Defined in Web.View.Types fromString :: String -> HexColor # | |
ToColor HexColor Source # | |
ToStyleValue HexColor Source # | |
Defined in Web.View.Types toStyleValue :: HexColor -> StyleValue Source # |
Instances
Show Align Source # | |
ToClassName Align Source # | |
Defined in Web.View.Types toClassName :: Align -> Text Source # | |
ToStyleValue Align Source # | |
Defined in Web.View.Types toStyleValue :: Align -> StyleValue Source # |