-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Lays out boxes according to the CSS Box Model. -- -- Computes where to place e.g. images, paragraphs, containers, tables, -- etc onscreen given desired amounts of whitespace. @package cattrap @version 0.5.0.0 -- | (Unused) Parses & evaluates calc() expressions. Implemented using -- The Shunting Yard Algorithm. module Graphics.Layout.Arithmetic -- | Parsed calc() expression. As a postfix arithmatic expression. data Opcode n Seq :: Opcode n Add :: Opcode n Subtract :: Opcode n Multiply :: Opcode n Divide :: Opcode n Func :: Text -> Opcode n Num :: n -> Opcode n -- | Parse a calc() expression. parseCalc :: [Token] -> [Opcode (Float, String)] -> [Opcode (Float, String)] -- | Verify that a parsed math expression can be properly evaluated. verifyCalc :: [Opcode (Float, String)] -> [Bool] -> Bool -- | Evaluate a parsed calc() expression. evalCalc :: [Opcode Float] -> [Float] -> Float -- | Convert all numbers in an expression via the given callback. mapCalc :: (a -> b) -> [Opcode a] -> [Opcode b] instance GHC.Show.Show n => GHC.Show.Show (Graphics.Layout.Arithmetic.Opcode n) -- | Datastructures representing the CSS box model, & utilities for -- operating on them. module Graphics.Layout.Box -- | Amount of space surrounding the box. data Border m n Border :: m -> m -> n -> n -> Border m n [top] :: Border m n -> m [bottom] :: Border m n -> m [left] :: Border m n -> n [right] :: Border m n -> n -- | Convert horizontal spacing via given callback. mapX :: (n -> nn) -> Border m n -> Border m nn -- | Convert vertical spacing via given callback. mapY :: (m -> mm) -> Border m n -> Border mm n -- | 2D size of a box. Typically inline is width & block is height. -- This may change as support for vertical layout is added. data Size m n Size :: n -> m -> Size m n [inline] :: Size m n -> n [block] :: Size m n -> m -- | Convert block size via given callback mapSizeX :: (n -> nn) -> Size m n -> Size m nn -- | Convert inline size via given callback mapSizeY :: (m -> mm) -> Size m n -> Size mm n -- | A box with min & max bounds & surrounding borders. The CSS Box -- Model. data PaddedBox m n PaddedBox :: Size m n -> Size m n -> Size Double Double -> Size m n -> Border m n -> Border m n -> Border m n -> PaddedBox m n -- | The minimum amount of pixels this box should take. [min] :: PaddedBox m n -> Size m n -- | The maximum amount of pixels this box should take. [max] :: PaddedBox m n -> Size m n -- | The ideal number of pixels this box should take. [nat] :: PaddedBox m n -> Size Double Double -- | The amount of pixels this box should take. [size] :: PaddedBox m n -> Size m n -- | The amount of space between the box & the border. [padding] :: PaddedBox m n -> Border m n -- | The amount of space for the border. [border] :: PaddedBox m n -> Border m n -- | The amount of space between the border & anything else. [margin] :: PaddedBox m n -> Border m n -- | An empty box, takes up nospace onscreen. zeroBox :: PaddedBox Double Double -- | A box which takes up all available space with no borders. lengthBox :: PaddedBox Length Length -- | Convert all sizes along the inline axis via given callback. mapX' :: (n -> nn) -> PaddedBox m n -> PaddedBox m nn -- | Convert all sizes along the block axis via given callback. mapY' :: (m -> mm) -> PaddedBox m n -> PaddedBox mm n -- | The total size along the inline axis including borders, etc. width :: Num a => PaddedBox m a -> a -- | The total size along the block axis, including borders, etc. height :: Num a => PaddedBox a n -> a -- | The total minimum size along the inline axis. minWidth :: Num a => PaddedBox m a -> a -- | The total minimum size along the block axis. minHeight :: Num a => PaddedBox a n -> a -- | The total maximum size along the inline axis. maxWidth :: Num a => PaddedBox m a -> a -- | The total maximum size along the block axis. maxHeight :: Num a => PaddedBox a n -> a -- | Amount of whitespace to the left, summing margins, borders, & -- padding. leftSpace :: Num a => PaddedBox m a -> a -- | Amount of whitespace to the right, summing margins, borders, & -- padding. rightSpace :: Num a => PaddedBox m a -> a -- | Amount of whitespace to the top, summing margins, borders, & -- padding. topSpace :: Num a => PaddedBox a n -> a -- | Amount of whitespace to the bottom, summing margins, borders, & -- padding. bottomSpace :: Num a => PaddedBox a n -> a -- | Amount of whitespace along the x axis, summing margins, borders, & -- padding. hSpace :: Num a => PaddedBox m a -> a -- | Amount of whitespace along the y axis, summing margins, borders, & -- padding. vSpace :: Num a => PaddedBox a n -> a -- | A partially-computed length value. data Length -- | Absolute number of device pixels. Pixels :: Double -> Length -- | Multiplier by container width. Percent :: Double -> Length -- | Use normal layout computations. Auto :: Length -- | Use computed preferred width. Preferred :: Length -- | Use minimum legible width. Min :: Length -- | Replace keywords with a given number of pixels. Useful for avoiding -- messing up percentage calculations in later processing. mapAuto :: Double -> Length -> Length -- | Convert a length given the container's width. Filling in 0 for -- keywords. If you wish for keywords to be handled differently, callers -- need to compute that themselves. lowerLength :: Double -> Length -> Double -- | Typeclass for zeroing out fields, so layout primitives can be more -- reusable. class Zero a -- | Return the empty (or zero) value for a CatTrap geometric type. zero :: Zero a => a -- | Typeclass for converting between doubles & layout types, -- approximately if needs be. So layout primitives can be more reusable. class CastDouble a -- | Convert a double to a double or length. fromDouble :: CastDouble a => Double -> a -- | Convert a double or length to a double. toDouble :: CastDouble a => a -> Double toDoubleWithin :: CastDouble a => Double -> a -> Double toDoubleWithinAuto :: CastDouble a => Double -> Double -> a -> Double instance GHC.Generics.Generic (Graphics.Layout.Box.Border m n) instance (GHC.Show.Show m, GHC.Show.Show n) => GHC.Show.Show (Graphics.Layout.Box.Border m n) instance (GHC.Read.Read m, GHC.Read.Read n) => GHC.Read.Read (Graphics.Layout.Box.Border m n) instance (GHC.Classes.Eq m, GHC.Classes.Eq n) => GHC.Classes.Eq (Graphics.Layout.Box.Border m n) instance GHC.Generics.Generic (Graphics.Layout.Box.Size m n) instance (GHC.Read.Read n, GHC.Read.Read m) => GHC.Read.Read (Graphics.Layout.Box.Size m n) instance (GHC.Show.Show n, GHC.Show.Show m) => GHC.Show.Show (Graphics.Layout.Box.Size m n) instance (GHC.Classes.Eq n, GHC.Classes.Eq m) => GHC.Classes.Eq (Graphics.Layout.Box.Size m n) instance GHC.Generics.Generic (Graphics.Layout.Box.PaddedBox m n) instance (GHC.Show.Show n, GHC.Show.Show m) => GHC.Show.Show (Graphics.Layout.Box.PaddedBox m n) instance (GHC.Read.Read n, GHC.Read.Read m) => GHC.Read.Read (Graphics.Layout.Box.PaddedBox m n) instance (GHC.Classes.Eq n, GHC.Classes.Eq m) => GHC.Classes.Eq (Graphics.Layout.Box.PaddedBox m n) instance GHC.Generics.Generic Graphics.Layout.Box.Length instance GHC.Show.Show Graphics.Layout.Box.Length instance GHC.Read.Read Graphics.Layout.Box.Length instance GHC.Classes.Eq Graphics.Layout.Box.Length instance Graphics.Layout.Box.CastDouble GHC.Types.Double instance Graphics.Layout.Box.CastDouble Graphics.Layout.Box.Length instance Graphics.Layout.Box.Zero GHC.Types.Double instance Graphics.Layout.Box.Zero Graphics.Layout.Box.Length instance (Graphics.Layout.Box.Zero m, Graphics.Layout.Box.Zero n) => Graphics.Layout.Box.Zero (Graphics.Layout.Box.PaddedBox m n) instance (Graphics.Layout.Box.Zero m, Graphics.Layout.Box.Zero n) => Graphics.Layout.Box.Zero (Graphics.Layout.Box.Border m n) instance Control.DeepSeq.NFData Graphics.Layout.Box.Length instance (Control.DeepSeq.NFData m, Control.DeepSeq.NFData n) => Control.DeepSeq.NFData (Graphics.Layout.Box.PaddedBox m n) instance (Control.DeepSeq.NFData m, Control.DeepSeq.NFData n) => Control.DeepSeq.NFData (Graphics.Layout.Box.Size m n) instance (Control.DeepSeq.NFData m, Control.DeepSeq.NFData n) => Control.DeepSeq.NFData (Graphics.Layout.Box.Border m n) -- | Infrastructure for parsing & desugaring length units & -- keywords, in reference to the selected font. module Graphics.Layout.CSS.Length -- | A number+unit, prior to resolving side units. The unit may alternately -- represent a keyword, in which case the number is ignored & -- typically set to 0. type Unitted = (Double, Text) -- | The CSS auto keyword. auto :: Unitted -- | Parse a pre-tokenized CSS length value. parseLength :: [Token] -> Maybe Unitted -- | Variant of parseLength which supports min-content & -- max-content keywords. parseLength' :: [Token] -> Maybe (Double, Text) -- | Supported length units. units :: [Text] -- | Convert a lexed number to a Double. n2f :: (Fractional x, RealFloat x) => NumericValue -> x -- | Resolve a parsed length according to the sizing parameters in a given -- Font`. finalizeLength :: Unitted -> Font' -> Length -- | Convert any length-units in the given CSS tokens to device pixels finalizeLengths :: Font' -> [Token] -> [Token] -- | Convert from a computed length to the "pt" unit. px2pt :: Font' -> Double -> Double -- | A Harfbuzz font with sizing parameters. data Font' Font' :: Font -> Pattern -> (Char -> Double) -> (Char -> Double) -> Double -> Double -> Double -> Double -> Double -> Double -> Double -> Double -> Double -> Font' -- | The Harfbuzz font used to shape text & query character-size -- information. [hbFont] :: Font' -> Font -- | The FontConfig query result. Useful to incorporate into output -- rendering. [pattern] :: Font' -> Pattern -- | Query the height of a character. Used for cap, ex, or ic units. [fontHeight] :: Font' -> Char -> Double -- | Query the width of a character, used for ch unit. [fontAdvance] :: Font' -> Char -> Double -- | The desired font-size, used for em unit. [fontSize] :: Font' -> Double -- | The root font's size, used for rem unit. [rootEm] :: Font' -> Double -- | The desired line-height, used for lh unit. [lineheight] :: Font' -> Double -- | The root font's line-height, used for rlh unit. [rlh] :: Font' -> Double -- | Scale-factor for vh unit. [vh] :: Font' -> Double -- | Scale-factor for vw unit. [vw] :: Font' -> Double -- | Scale-factor for vmax unit. [vmax] :: Font' -> Double -- | Scale-factor for vmin unit. [vmin] :: Font' -> Double -- | How many device pixels in a CSS px? [scale] :: Font' -> Double instance GHC.Classes.Eq Graphics.Layout.CSS.Length.Font' instance GHC.Show.Show Graphics.Layout.CSS.Length.Font' instance Graphics.Layout.Box.Zero Graphics.Layout.CSS.Length.Unitted -- | Infrastructure for parsing & desugaring CSS properties related to -- fonts. module Graphics.Layout.CSS.Font -- | A Harfbuzz font with sizing parameters. data Font' Font' :: Font -> Pattern -> (Char -> Double) -> (Char -> Double) -> Double -> Double -> Double -> Double -> Double -> Double -> Double -> Double -> Double -> Font' -- | The Harfbuzz font used to shape text & query character-size -- information. [hbFont] :: Font' -> Font -- | The FontConfig query result. Useful to incorporate into output -- rendering. [pattern] :: Font' -> Pattern -- | Query the height of a character. Used for cap, ex, or ic units. [fontHeight] :: Font' -> Char -> Double -- | Query the width of a character, used for ch unit. [fontAdvance] :: Font' -> Char -> Double -- | The desired font-size, used for em unit. [fontSize] :: Font' -> Double -- | The root font's size, used for rem unit. [rootEm] :: Font' -> Double -- | The desired line-height, used for lh unit. [lineheight] :: Font' -> Double -- | The root font's line-height, used for rlh unit. [rlh] :: Font' -> Double -- | Scale-factor for vh unit. [vh] :: Font' -> Double -- | Scale-factor for vw unit. [vw] :: Font' -> Double -- | Scale-factor for vmax unit. [vmax] :: Font' -> Double -- | Scale-factor for vmin unit. [vmin] :: Font' -> Double -- | How many device pixels in a CSS px? [scale] :: Font' -> Double -- | zero'd Font` to serve as the root's parent in a font heirarchy. placeholderFont :: Font' -- | Scale-factor for text-shaping APIs. hbUnit :: Double -- | Convert from FontConfig query result to a Harfbuzz font. pattern2hbfont :: Pattern -> Int -> [Variation] -> Font -- | Convert Parsed CSS to a Font`. Includes sizing parameters -- derived from a root & parent Font`. pattern2font :: Pattern -> CSSFont -> Font' -> Font' -> Font' -- | Parsed CSS font properties, excluding the FontConfig query. data CSSFont CSSFont :: Unitted -> Unitted -> [Variation] -> Variation -> Variation -> Variation -> Bool -> CSSFont -- | Parsed CSS font-size. [cssFontSize] :: CSSFont -> Unitted -- | Parsed CSS line-height. [cssLineheight] :: CSSFont -> Unitted -- | Parsed CSS font-variation-settings. [variations] :: CSSFont -> [Variation] -- | Parsed CSS font-weight. [weightVariation] :: CSSFont -> Variation -- | Parsed CSS font-stretch. [widthVariation] :: CSSFont -> Variation -- | Parsed CSS font-style. [slantVariation] :: CSSFont -> Variation -- | Parsed CSS font-optical-sizing. [opticalSize] :: CSSFont -> Bool -- | All font-variations from the parsed CSS properties. | Requires the -- resolved font-size in case font-optical-sizing is set. variations' :: Double -> CSSFont -> [Variation] instance Stylist.PropertyParser Graphics.Layout.CSS.Font.CSSFont -- | Layout formula positioning children horizontally or vertically, with -- or without wrapping. module Graphics.Layout.Flex -- | Parameters to flexbox layout data Flex a b Flex :: Direction -> Bool -> FlexWrapping -> Justification -> Maybe Justification -> b -> b -> [[FlexChild a b]] -> Double -> Flex a b -- | On which axis to position children [direction] :: Flex a b -> Direction -- | Whether to reverse each row [reverseRows] :: Flex a b -> Bool -- | Whether to wrap children to multiple lines [wrap] :: Flex a b -> FlexWrapping -- | How to justify children within lines [justify] :: Flex a b -> Justification -- | How to justify lines within the flexbox. Nothing is CSS "stretch". [alignLines] :: Flex a b -> Maybe Justification -- | Gap between children [baseGap] :: Flex a b -> b -- | Gap between lines [crossGap] :: Flex a b -> b -- | The children to layout, 2D list so as to store lines once split. [children] :: Flex a b -> [[FlexChild a b]] -- | How wide to consider the page when paginating. [pageWidth] :: Flex a b -> Double -- | Properties for positioning a child of a flexbox data FlexChild a b FlexChild :: Double -> Double -> b -> Alignment -> a -> FlexChild a b [grow] :: FlexChild a b -> Double [shrink] :: FlexChild a b -> Double [basis] :: FlexChild a b -> b [alignment] :: FlexChild a b -> Alignment [flexInner] :: FlexChild a b -> a -- | Which axis to position children along data Direction Row :: Direction Column :: Direction -- | Whether to wrap or reverse the wrapped lines data FlexWrapping NoWrap :: FlexWrapping Wrap :: FlexWrapping WrapReverse :: FlexWrapping -- | How to position lines within a flexbox, or children within a line data Justification JStart :: Justification JEnd :: Justification JCenter :: Justification JSpaceBetween :: Justification JSpaceAround :: Justification JSpaceEvenly :: Justification -- | How to align children along the cross-axis (opposite axis from which -- they're laid out) data Alignment AlStretch :: Alignment AlStart :: Alignment AlEnd :: Alignment AlCenter :: Alignment AlBaseline :: Alignment -- | Apply an operation to every child flexMap :: (a -> b) -> Flex a c -> Flex b c -- | Resolve lengths in the flexbox to doubles. flexResolve :: CastDouble b => (a -> Direction -> Double) -> Double -> Flex a b -> Flex a Double -- | The minimum size of the flexbox along direction, i.e. maximum -- size of a child. flexMaxBasis :: Flex a Double -> Double -- | The maximum width of each row of the flexbox. flexSumBasis :: Flex a Double -> Double -- | Wrap all lines to a given size reassigning overflow or underflow -- space. NOTE: shrink propery may yield negative sizes. Caller will want -- to enforce min-sizes. flexWrap :: CastDouble b => Flex a b -> Double -> Flex a b -- | The cross (opposite from direction axis) size of a row. flexRowSize :: (a -> Double) -> [FlexChild a b] -> Double -- | The cross (opposite from direction axis) size of all rows. flexRowsSize :: (a -> Double) -> Flex a Double -> Double -- | How far right to shift some elements to achieve desired justification. justifyOffset :: Double -> [Double] -> Double -> Justification -> Double -- | How much space to add between elements. justifySpacing :: Double -> [Double] -> Double -> Justification -> Double -- | Position new positions for the given items according to the given -- justification. flexJustify :: (a -> Double) -> Double -> [a] -> Double -> Justification -> [(Double, a)] -- | How far right to shift some elements to achieve desired alignment. alignOffset :: Double -> Double -> Alignment -> Double outerMinMain :: Num m => PaddedBox m m -> Direction -> m outerMain :: Num m => PaddedBox m m -> Direction -> m outerMaxMain :: Num m => PaddedBox m m -> Direction -> m outerMinCross :: Num m => PaddedBox m m -> Direction -> m outerCross :: Num m => PaddedBox m m -> Direction -> m outerMaxCross :: Num m => PaddedBox m m -> Direction -> m innerMinMain :: Num m => PaddedBox m m -> Direction -> m innerMain :: Num m => PaddedBox m m -> Direction -> m innerMaxMain :: Num m => PaddedBox m m -> Direction -> m innerMinCross :: Num m => PaddedBox m m -> Direction -> m innerCross :: Num m => PaddedBox m m -> Direction -> m innerMaxCross :: Num m => PaddedBox m m -> Direction -> m -- | Compute the size bounds of a flexbox. flexGetBox :: (Zero m, CastDouble m, Zero n, CastDouble n) => (a -> PaddedBox Double Double) -> Flex a m -> PaddedBox m n -- | Split a flexbox over multiple pages. flexSplit :: (a -> Size Double Double) -> Double -> Double -> Flex a Double -> (Flex a Double, Flex a Double) -- | Compute final position of a flexbox's children. flexPosition :: ((Double, Double) -> a -> b) -> (a -> Size Double Double) -> (Double, Double) -> Size Double Double -> Flex a Double -> Flex b Double instance GHC.Read.Read Graphics.Layout.Flex.Direction instance GHC.Show.Show Graphics.Layout.Flex.Direction instance GHC.Classes.Eq Graphics.Layout.Flex.Direction instance GHC.Read.Read Graphics.Layout.Flex.FlexWrapping instance GHC.Show.Show Graphics.Layout.Flex.FlexWrapping instance GHC.Classes.Eq Graphics.Layout.Flex.FlexWrapping instance GHC.Read.Read Graphics.Layout.Flex.Justification instance GHC.Show.Show Graphics.Layout.Flex.Justification instance GHC.Classes.Eq Graphics.Layout.Flex.Justification instance GHC.Read.Read Graphics.Layout.Flex.Alignment instance GHC.Show.Show Graphics.Layout.Flex.Alignment instance GHC.Classes.Eq Graphics.Layout.Flex.Alignment instance (GHC.Read.Read b, GHC.Read.Read a) => GHC.Read.Read (Graphics.Layout.Flex.FlexChild a b) instance (GHC.Show.Show b, GHC.Show.Show a) => GHC.Show.Show (Graphics.Layout.Flex.FlexChild a b) instance (GHC.Classes.Eq b, GHC.Classes.Eq a) => GHC.Classes.Eq (Graphics.Layout.Flex.FlexChild a b) instance (GHC.Read.Read b, GHC.Read.Read a) => GHC.Read.Read (Graphics.Layout.Flex.Flex a b) instance (GHC.Show.Show b, GHC.Show.Show a) => GHC.Show.Show (Graphics.Layout.Flex.Flex a b) instance (GHC.Classes.Eq b, GHC.Classes.Eq a) => GHC.Classes.Eq (Graphics.Layout.Flex.Flex a b) -- | Parse FlexBox-related CSS properties module Graphics.Layout.Flex.CSS -- | Parsed FlexBox-related CSS properties. data CSSFlex CSSFlex :: Direction -> Bool -> FlexWrapping -> Maybe Justification -> Alignment -> Maybe Justification -> Unitted -> Unitted -> Integer -> Double -> Double -> Unitted -> Alignment -> Bool -> CSSFlex -- | Parsed CSS flex-direction, axis component. [directionCSS] :: CSSFlex -> Direction -- | Parsed CSS flex-direction, reversed flag [reverseRowsCSS] :: CSSFlex -> Bool -- | Parsed CSS flex-wrap [wrapCSS] :: CSSFlex -> FlexWrapping -- | Parsed CSS justify-content [justifyCSS] :: CSSFlex -> Maybe Justification -- | Parsed CSS align-items [alignItemsCSS] :: CSSFlex -> Alignment -- | Parsed CSS align-content, Nothing is "stretch" [alignLinesCSS] :: CSSFlex -> Maybe Justification -- | Parsed CSS row-gap [rowGapCSS] :: CSSFlex -> Unitted -- | Parsed CSS column-gap [columnGapCSS] :: CSSFlex -> Unitted -- | Parsed CSS order [orderCSS] :: CSSFlex -> Integer -- | Parsed CSS flex-grow [growCSS] :: CSSFlex -> Double -- | Parsed CSS flex-shrink [shrinkCSS] :: CSSFlex -> Double -- | Parsed CSS flex-basis [basisCSS] :: CSSFlex -> Unitted -- | Parsed CSS align-self [alignSelfCSS] :: CSSFlex -> Alignment -- | Whether justification or alignment properties should be parsed as -- right-to-left or left-to-right. [textRTL] :: CSSFlex -> Bool -- | Lower the Flexbox styling tree to the Layout tree. lowerFlex :: CSSFlex -> Font' -> [CSSFlex] -> [a] -> [Font'] -> Flex a Length instance Stylist.PropertyParser Graphics.Layout.Flex.CSS.CSSFlex -- | Sizes a block element & positions their children. Taking into -- account size bounds. module Graphics.Layout.Flow -- | Compute the minimum width of a block element with children of the -- given sizes. flowMinWidth :: Double -> PaddedBox a Length -> [PaddedBox b Double] -> Double -- | Compute the natural width of a block element with children of the -- given sizes. flowNatWidth :: Double -> PaddedBox a Length -> [PaddedBox b Double] -> Double -- | Compute the maximum width of a block element inside the given parent -- size. flowMaxWidth :: PaddedBox a Double -> PaddedBox b Length -> Double -- | Compute final block element width based on cached width computations -- & parent size. flowWidth :: PaddedBox a Double -> PaddedBox b Length -> Double -- | Compute natural block element height at cached width. flowNatHeight :: Double -> PaddedBox Length Double -> [PaddedBox Double Double] -> Double -- | Compute minimum block height at cached width. flowMinHeight :: Double -> PaddedBox Length Double -> Double -- | Compute maximum block height at cached width. flowMaxHeight :: Double -> PaddedBox Length Double -> Double -- | Compute final block height at cached width. flowHeight :: PaddedBox Double Double -> PaddedBox Length Double -> Double -- | Compute position of all children relative to this block element. positionFlow :: [PaddedBox Double Double] -> [Size Double Double] -- | Compute size given block element in given parent, & position of -- given children. layoutFlow :: PaddedBox Double Double -> PaddedBox Length Length -> [PaddedBox Length Double] -> (PaddedBox Double Double, [(Size Double Double, PaddedBox Double Double)]) -- | Sizes grid cells & positions elements to them. module Graphics.Layout.Grid -- | An element which positions it's children within a grid. type Grid m n = Size (Track m) (Track n) -- | The sizes to which children are alonged on a single axis. data Track x Track :: [Either x Double] -> [Double] -> [Double] -> x -> Track x -- | The desired size of each cell. If Left specifies ratio of excess space -- to use. [cells] :: Track x -> [Either x Double] -- | The minimum amount of space each cell should take. [trackMins] :: Track x -> [Double] -- | The ideal amount of space each cell should take. [trackNats] :: Track x -> [Double] -- | How much space to add between cells. [gap] :: Track x -> x -- | Which cells a child should be aligned to. type GridItem = Size GridItem' GridItem' -- | How a grid child should be aligned per-axis. data GridItem' GridItem :: Int -> Int -> Alignment -> Double -> Double -> GridItem' -- | On which cell should this child start. [cellStart] :: GridItem' -> Int -- | Before which cell should this child end. [cellEnd] :: GridItem' -> Int -- | How to redistribute excess space. [alignment] :: GridItem' -> Alignment -- | The minimum amount of space to allocate to this child. [minSize] :: GridItem' -> Double -- | The maximum aount of space to allocate to this child. [natSize] :: GridItem' -> Double -- | How to redistribute excess space. data Alignment Start :: Alignment Mid :: Alignment End :: Alignment -- | Constructs a track with default (to-be-computed) values & given -- cell sizes. buildTrack :: CastDouble x => [Either x Double] -> Track x -- | Constructs a grid with default (to-be-computed) values & given -- cell sizes. buildGrid :: (CastDouble m, CastDouble n) => [Either m Double] -> [Either n Double] -> Grid m n -- | Sets minimum & natural sizes from the given padded box. setCellBox :: (CastDouble m, CastDouble n) => GridItem -> PaddedBox m n -> GridItem -- | Utility for associate an index with each item in a list. enumerate :: [b] -> [(Int, b)] -- | Compute the maximum size as a PaddedBox of a child, for it to be sized -- to. gridItemBox :: (CastDouble x, CastDouble y) => Grid y x -> GridItem -> PaddedBox Double Double -- | Compute the maximum size along an axis of a child, for it to be sized -- to. cellSize :: CastDouble x => Track x -> GridItem' -> Double -- | Compute the minimum size for the track given cell sizes. Refers to -- computed min sizes if cached. trackMin :: (n -> Double) -> Track n -> Double -- | Compute the natural size for the track given cell sizes. Refers to -- compute natural sizes if cached. trackNat :: (n -> Double) -> Track n -> Double -- | Estimate grid width to inform proper width calculation. gridEstWidth :: Grid y Length -> [GridItem] -> Double -- | Calculate minimum sizes for all cells in the track. Sized to fit given -- children. sizeTrackMins :: Double -> Track Length -> [GridItem'] -> [Double] -- | Compute natural sizes for all cells in the track. Sized to fit given -- children. sizeTrackNats :: Double -> Track Length -> [GridItem'] -> [Double] -- | Compute maximum sizes for all cells in the track, sized to the parent -- element. sizeTrackMaxs :: Double -> Track Length -> [Double] -- | Compute the position of all children within the grid. trackPosition :: Track Double -> [GridItem'] -> [Double] -- | Compute the position of all children in a grid. gridPosition :: Grid Double Double -> [GridItem] -> [(Double, Double)] -- | Compute the track sizes & child positions along a single axis. trackLayout :: Double -> Double -> Track Length -> [GridItem'] -> (Track Double, [(Double, GridItem')]) -- | Compute the track sizes & child positions along both axes. gridLayout :: Size Double Double -> Grid Length Length -> [GridItem] -> (Grid Double Double, [((Double, Double), GridItem)]) instance GHC.Classes.Ord x => GHC.Classes.Ord (Graphics.Layout.Grid.Track x) instance GHC.Classes.Eq x => GHC.Classes.Eq (Graphics.Layout.Grid.Track x) instance GHC.Read.Read x => GHC.Read.Read (Graphics.Layout.Grid.Track x) instance GHC.Show.Show x => GHC.Show.Show (Graphics.Layout.Grid.Track x) instance GHC.Generics.Generic Graphics.Layout.Grid.Alignment instance GHC.Classes.Eq Graphics.Layout.Grid.Alignment instance GHC.Classes.Ord Graphics.Layout.Grid.Alignment instance GHC.Enum.Enum Graphics.Layout.Grid.Alignment instance GHC.Show.Show Graphics.Layout.Grid.Alignment instance GHC.Read.Read Graphics.Layout.Grid.Alignment instance GHC.Generics.Generic Graphics.Layout.Grid.GridItem' instance GHC.Classes.Eq Graphics.Layout.Grid.GridItem' instance GHC.Classes.Ord Graphics.Layout.Grid.GridItem' instance GHC.Show.Show Graphics.Layout.Grid.GridItem' instance GHC.Read.Read Graphics.Layout.Grid.GridItem' instance Control.DeepSeq.NFData Graphics.Layout.Grid.GridItem' instance Control.DeepSeq.NFData Graphics.Layout.Grid.Alignment -- | Datastructures for parsing table styling properties, & for -- positioning cells into Grid layout regions. module Graphics.Layout.Grid.Table -- | Tracks rowspan attributes so later rows can dodge it. type Overflowed = [Int] -- | A row with no cells overflowing into it. emptyRow :: Overflowed -- | Decrement all rowspans being overflowed, removing 0'd ones. commitRow :: Overflowed -> Overflowed -- | Find the next column which a previous multi-row cell hasn't called -- "dibs" on. allocCol :: Int -> Overflowed -> Int -- | Splice a newly-allocated cell covernig colspan (2nd arg) & -- rowspan (3rd arg) from "ix" (from 1st arg) into the final arg. insertCell :: Int -> Int -> Int -> Overflowed -> Overflowed -- | Parsed CSS properties & HTML attributes for laying out "table" -- elements. To parse HTML attributes, expects the following useragent -- stylesheet rules: -- --