{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE QuasiQuotes #-}
{-# OPTIONS_GHC -fno-warn-missing-fields #-}
module Text.Lucius
    ( -- * Parsing
      lucius
    , luciusFile
    , luciusFileDebug
    , luciusFileReload
      -- ** Mixins
    , luciusMixin
    , Mixin
      -- ** Runtime
    , luciusRT
    , luciusRT'
    , luciusRTMinified
      -- *** Mixin
    , luciusRTMixin
    , RTValue (..)
    , -- * Datatypes
      Css
    , CssUrl
      -- * Type class
    , ToCss (..)
      -- * Rendering
    , renderCss
    , renderCssUrl
      -- * ToCss instances
      -- ** Color
    , Color (..)
    , colorRed
    , colorBlack
      -- ** Size
    , mkSize
    , AbsoluteUnit (..)
    , AbsoluteSize (..)
    , absoluteSize
    , EmSize (..)
    , ExSize (..)
    , PercentageSize (..)
    , percentageSize
    , PixelSize (..)
      -- * Internal
    , parseTopLevels
    , luciusUsedIdentifiers
    ) where

import Text.Internal.CssCommon
import Text.Internal.Lucius
import Language.Haskell.TH.Quote (QuasiQuoter (..))
import Language.Haskell.TH.Syntax
import Data.Text (Text)
import qualified Data.Text.Lazy as TL
import Text.Internal.Css

-- |
--
-- >>> renderCss ([lucius|foo{bar:baz}|] undefined)
-- "foo{bar:baz}"
lucius :: QuasiQuoter
lucius :: QuasiQuoter
lucius = Order -> QuasiQuoter
luciusWithOrder Order
Unordered

luciusFile :: FilePath -> Q Exp
luciusFile :: FilePath -> Q Exp
luciusFile = Order -> FilePath -> Q Exp
luciusFileWithOrd Order
Unordered

luciusFileDebug :: FilePath -> Q Exp
luciusFileDebug :: FilePath -> Q Exp
luciusFileDebug = Order -> FilePath -> Q Exp
luciusFileDebugWithOrder Order
Unordered

luciusFileReload :: FilePath -> Q Exp
luciusFileReload :: FilePath -> Q Exp
luciusFileReload = FilePath -> Q Exp
luciusFileDebug


luciusRT' :: TL.Text
          -> Either String ([(Text, Text)] -> Either String [TopLevel 'Resolved])
luciusRT' :: Text
-> Either
     FilePath ([(Text, Text)] -> Either FilePath [TopLevel 'Resolved])
luciusRT' = Order
-> Text
-> Either
     FilePath ([(Text, Text)] -> Either FilePath [TopLevel 'Resolved])
luciusRTWithOrder' Order
Unordered

luciusRT :: TL.Text -> [(Text, Text)] -> Either String TL.Text
luciusRT :: Text -> [(Text, Text)] -> Either FilePath Text
luciusRT = Order -> Text -> [(Text, Text)] -> Either FilePath Text
luciusRTWithOrder Order
Unordered


-- | Runtime Lucius with mixin support.
--
-- Since 1.0.6
luciusRTMixin :: TL.Text -- ^ template
              -> Bool -- ^ minify?
              -> [(Text, RTValue)] -- ^ scope
              -> Either String TL.Text
luciusRTMixin :: Text -> Bool -> [(Text, RTValue)] -> Either FilePath Text
luciusRTMixin = Order -> Text -> Bool -> [(Text, RTValue)] -> Either FilePath Text
luciusRTMixinWithOrder Order
Unordered

-- | Same as 'luciusRT', but output has no added whitespace.
--
-- Since 1.0.3
luciusRTMinified :: TL.Text -> [(Text, Text)] -> Either String TL.Text
luciusRTMinified :: Text -> [(Text, Text)] -> Either FilePath Text
luciusRTMinified = Order -> Text -> [(Text, Text)] -> Either FilePath Text
luciusRTMinifiedWithOrder Order
Unordered

luciusMixin :: QuasiQuoter
luciusMixin :: QuasiQuoter
luciusMixin = Order -> QuasiQuoter
luciusMixinWithOrder Order
Unordered