Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- data Content
- data Element = Element {
- name :: Name
- classes :: [[Class]]
- attributes :: Attributes
- children :: [Content]
- type Attributes = Map Name AttValue
- type Attribute = (Name, AttValue)
- type Name = Text
- type AttValue = Text
- type Mod = Element -> Element
- 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
- newtype PxRem = PxRem Int
- newtype Ms = Ms Int
- data Media
- data Sides a
- newtype FlatAttributes = FlatAttributes {}
- newtype Url = Url Text
- class ToColor a where
- colorValue :: a -> HexColor
- colorName :: a -> Text
- newtype HexColor = HexColor Text
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 | |
|
Element Modifiers
type Mod = Element -> Element 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.Style toClassName :: Align -> 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.Style toStyleValue :: Align -> StyleValue Source # | |
ToStyleValue HexColor Source # | |
Defined in Web.View.Types toStyleValue :: HexColor -> 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 Int Source # | |
Defined in Web.View.Types toStyleValue :: Int -> StyleValue Source # |
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
Instances
Num PxRem Source # | |
Show 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 type Rep FlatAttributes :: Type -> Type # 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.2.1.1-inplace" 'True) (C1 ('MetaCons "FlatAttributes" 'PrefixI 'True) (S1 ('MetaSel ('Just "attributes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Attributes))) |
Instances
IsString Url Source # | |
Defined in Web.View.Types fromString :: String -> Url # |
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 # |