Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite overflow and overflowWrap using phantom types approach #400

Merged
merged 4 commits into from
Apr 17, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 150 additions & 10 deletions src/Css.elm
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ module Css
, bolder
, borderBox
, boxShadow
, breakWord
, cell
, center
, ch
Expand Down Expand Up @@ -96,6 +97,7 @@ module Css
, hardLight
, help
, hex
, hidden
, historicalLigatures
, hsl
, hsla
Expand Down Expand Up @@ -151,6 +153,10 @@ module Css
, ordinal
, oriya
, outset
, overflow
, overflowWrap
, overflowX
, overflowY
, overlay
, paddingBox
, pc
Expand Down Expand Up @@ -212,6 +218,7 @@ module Css
, url
, verticalText
, vh
, visible
, vmax
, vmin
, vw
Expand Down Expand Up @@ -380,6 +387,15 @@ All CSS properties can have the values `unset`, `initial`, and `inherit`.
Multiple CSS properties use these values.

@docs auto, none
@docs hidden, visible


## Overflow

@docs overflow, overflowX, overflowY

@docs overflowWrap
@docs breakWord

-}

Expand Down Expand Up @@ -569,6 +585,140 @@ none =
Value "none"


{-| The `hidden` value used for properties such as [`visibility`](https://css-tricks.com/almanac/properties/v/visibility/), [`overflow`](https://css-tricks.com/almanac/properties/o/overflow/) and [`border style`](https://developer.mozilla.org/en-US/docs/Web/CSS/border-style).

visibility hidden
overflow hidden
borderStyle hidden

-}
hidden : Value { provides | hidden : Supported }
hidden =
Value "hidden"


{-| The `visible` value used for properties such as [`visibility`](https://css-tricks.com/almanac/properties/v/visibility/), [`overflow`](https://css-tricks.com/almanac/properties/o/overflow/) and [`pointer-events`](https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events).
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the detail on these docs! 😻


visibility visible
overflow visible
pointerEvents visible

-}
visible : Value { provides | visible : Supported }
visible =
Value "visible"


{-| The `scroll` value used for properties such as [`overflow`](https://developer.mozilla.org/en-US/docs/Web/CSS/overflow#Values) and [`background-attachment`](https://developer.mozilla.org/en-US/docs/Web/CSS/background-attachment).

overflow scroll
backgroundAttachment scroll

-}
scroll : Value { provides | scroll : Supported }
scroll =
Value "scroll"



-- OVERFLOW --


{-| Sets [`overflow`](https://css-tricks.com/almanac/properties/o/overflow/).

overflow visible
overflow hidden
overflow scroll
overflow auto

-}
overflow :
Value
{ visible : Supported
, hidden : Supported
, scroll : Supported
, auto : Supported
, inherit : Supported
, initial : Supported
, unset : Supported
}
-> Style
overflow (Value val) =
AppendProperty ("overflow:" ++ val)


{-| Sets [`overflow-x`](https://css-tricks.com/almanac/properties/o/overflow/).

overflowX visible
overflowX hidden
overflowX scroll
overflowX auto

-}
overflowX :
Value
{ visible : Supported
, hidden : Supported
, scroll : Supported
, auto : Supported
, inherit : Supported
, initial : Supported
, unset : Supported
}
-> Style
overflowX (Value val) =
AppendProperty ("overflow-x:" ++ val)


{-| Sets [`overflow-y`](https://css-tricks.com/almanac/properties/o/overflow/).

overflowY visible
overflowY hidden
overflowY scroll
overflowY auto

-}
overflowY :
Value
{ visible : Supported
, hidden : Supported
, scroll : Supported
, auto : Supported
, inherit : Supported
, initial : Supported
, unset : Supported
}
-> Style
overflowY (Value val) =
AppendProperty ("overflow-y:" ++ val)


{-| Sets [`overflow-wrap`](https://css-tricks.com/almanac/properties/o/overflow-wrap/)

overflowWrap breakWord
overflowWrap normal

-}
overflowWrap :
Value
{ breakWord : Supported
, normal : Supported
, inherit : Supported
, initial : Supported
, unset : Supported
}
-> Style
overflowWrap (Value val) =
AppendProperty ("overflow-wrap:" ++ val)


{-| The `break-word` value for the [`overflow-wrap`](https://css-tricks.com/almanac/properties/o/overflow-wrap/) property.
-}
breakWord : Value { provides | breakWord : Supported }
breakWord =
Value "break-word"



-- COLORS --

Expand Down Expand Up @@ -2731,16 +2881,6 @@ fixed =
Value "fixed"


{-| The `scroll` [`background-attachment` value](https://developer.mozilla.org/en-US/docs/Web/CSS/background-attachment#Values)

backgroundAttachment scroll

-}
scroll : Value { provides | scroll : Supported }
scroll =
Value "scroll"


{-| The `local` [`background-attachment` value](https://developer.mozilla.org/en-US/docs/Web/CSS/background-attachment#Values)

backgroundAttachment local
Expand Down