@@ -51,8 +51,6 @@ module Css.Media
5151 , maxMonochrome
5252 , maxResolution
5353 , maxWidth
54- , media
55- , mediaQuery
5654 , minAspectRatio
5755 , minColor
5856 , minColorIndex
@@ -100,7 +98,7 @@ module Css.Media
10098
10199# `@media` rule constructors
102100
103- @docs media, withMedia, mediaQuery , withMediaQuery
101+ @docs withMedia, withMediaQuery
104102
105103
106104# Query constructors
@@ -147,8 +145,8 @@ module Css.Media
147145
148146-}
149147
150- import Css
151- import Css.Preprocess as Preprocess exposing (Style , unwrapSnippet )
148+ import Css exposing ( Style )
149+ import Css.Preprocess as Preprocess exposing (unwrapSnippet )
152150import Css.Structure as Structure exposing (..)
153151
154152
@@ -209,94 +207,6 @@ type alias Value compatible =
209207{- -Rule constructors--}
210208
211209
212- {- | Combines media queries into a `@media` rule.
213-
214- (stylesheet << namespace "homepage")
215- [ media [ only screen [ Media.minWidth (px 300) ] ]
216- [ footer [ Css.maxWidth (px 300) ] ]
217- ]
218-
219- The above code translates into the following CSS.
220-
221- ```css
222- @media screen and (min-width: 300px) {
223- footer {
224- max-width: 300px;
225- }
226- }
227- ```
228-
229- -}
230- media :
231- List MediaQuery
232- -> List Css . Snippet
233- -> Css . Snippet
234- media queries snippets =
235- let
236- snippetDeclarations : List Preprocess . SnippetDeclaration
237- snippetDeclarations =
238- List . concatMap unwrapSnippet snippets
239-
240- extractStyleBlocks : List Preprocess . SnippetDeclaration -> List Preprocess . StyleBlock
241- extractStyleBlocks declarations =
242- case declarations of
243- [] ->
244- []
245-
246- ( Preprocess . StyleBlockDeclaration styleBlock) :: rest ->
247- styleBlock :: extractStyleBlocks rest
248-
249- first :: rest ->
250- extractStyleBlocks rest
251-
252- mediaRuleFromStyleBlocks : Preprocess . SnippetDeclaration
253- mediaRuleFromStyleBlocks =
254- Preprocess . MediaRule queries
255- ( extractStyleBlocks snippetDeclarations)
256-
257- nestedMediaRules : List Preprocess . SnippetDeclaration -> List Preprocess . SnippetDeclaration
258- nestedMediaRules declarations =
259- case declarations of
260- [] ->
261- []
262-
263- ( Preprocess . StyleBlockDeclaration _) :: rest ->
264- -- These will already have been handled previously, with appropriate
265- -- bundling, so don't create duplicates here.
266- nestedMediaRules rest
267-
268- ( Preprocess . MediaRule nestedMediaQueries styleBlocks) :: rest ->
269- -- nest the media queries
270- Preprocess . MediaRule ( List . append queries nestedMediaQueries) styleBlocks
271- :: nestedMediaRules rest
272-
273- first :: rest ->
274- first :: nestedMediaRules rest
275- in
276- Preprocess . Snippet ( mediaRuleFromStyleBlocks :: nestedMediaRules snippetDeclarations)
277-
278-
279- {- | Manually specify a `@media` rule using a List of strings.
280-
281- mediaQuery [ "screen and (min-width: 320px)", "screen and (max-height: 400px)" ]
282- [ body [ fontSize (px 14)] ]
283-
284- The above code translates into the following CSS.
285-
286- ```css
287- @media screen and (min-width: 320px), screen and (max-height: 400px) {
288- body {
289- font-size: 14px;
290- }
291- }
292- ```
293-
294- -}
295- mediaQuery : List String -> List Css .Snippet -> Css .Snippet
296- mediaQuery stringQueries snippets =
297- media ( List . map Structure . CustomQuery stringQueries) snippets
298-
299-
300210{- | Combines media queries that are nested under selectors into a `@media` rule.
301211
302212 (stylesheet << namespace "homepage")
@@ -316,7 +226,7 @@ The above code translates into the following CSS.
316226```
317227
318228-}
319- withMedia : List MediaQuery -> List Css . Style -> Css . Style
229+ withMedia : List MediaQuery -> List Style -> Style
320230withMedia queries =
321231 Preprocess . WithMedia queries
322232
@@ -340,7 +250,7 @@ The above code translates into the following CSS.
340250```
341251
342252-}
343- withMediaQuery : List String -> List Css . Style -> Css . Style
253+ withMediaQuery : List String -> List Style -> Style
344254withMediaQuery queries =
345255 queries
346256 |> List . map Structure . CustomQuery
0 commit comments