<commit_before>module Internal.ImageList.Implementation exposing
    ( Property
    , image
    , imageAspectContainer
    , item
    , label
    , masonry
    , node
    , src
    , supporting
    , view
    , withTextProtection
    )

import Html exposing (Html)
import Html.Attributes as Html
import Internal.ImageList.Model exposing (Config, defaultConfig)
import Internal.Options as Options exposing (cs, styled, when)


cssClasses :
    { masonry : String
    , withTextProtection : String
    }
cssClasses =
    { masonry = "mdc-image-list--masonry"
    , withTextProtection = "mdc-image-list--with-text-protection"
    }



-- VIEW


imageList : List (Property m) -> List (Html m) -> Html m
imageList options =
    let
        ({ config } as summary) =
            Options.collect defaultConfig options
    in
    Options.apply summary
        Html.ul
        [ cs "mdc-image-list"
        , when config.masonry (cs cssClasses.masonry)
        , when config.withTextProtection (cs cssClasses.withTextProtection)
        ]
        []



-- API


type alias Property m =
    Options.Property Config m


view : List (Property m) -> List (Html m) -> Html m
view =
    imageList


item : List (Property m) -> List (Html m) -> Html m
item options =
    styled Html.li (cs "mdc-image-list__item" :: options)


imageAspectContainer : List (Property m) -> List (Html m) -> Html m
imageAspectContainer options =
    let
        ({ config } as summary) =
            Options.collect defaultConfig options
        tag = Maybe.withDefault "div" config.tag
    in
    styled ( Html.node tag ) (cs "mdc-image-list__image-aspect-container" :: options)


supporting : List (Property m) -> List (Html m) -> Html m
supporting options =
    let
        ({ config } as summary) =
            Options.collect defaultConfig options

        tag = Maybe.withDefault "div" config.tag
    in
    styled ( Html.node tag ) (cs "mdc-image-list__supporting" :: options)


label : List (Property m) -> List (Html m) -> Html m
label options =
    let
        ({ config } as summary) =
            Options.collect defaultConfig options

        tag = Maybe.withDefault "span" config.tag
    in
    styled ( Html.node tag ) (cs "mdc-image-list__label" :: options)


withTextProtection : Property m
withTextProtection =
    Options.option (\config -> { config | withTextProtection = True })


masonry : Property m
masonry =
    Options.option (\config -> { config | masonry = True })


node : String -> Property m
node tag =
    Options.option (\config -> { config | tag = Just tag })


image : List (Property m) -> List (Html m) -> Html m
image options =
    styled Html.img (cs "mdc-image-list__image" :: options)


src : String -> Property m
src url =
    Options.attribute (Html.src url)
<commit_msg>Oops, divImage broken, always used the img tag<commit_after>module Internal.ImageList.Implementation exposing
    ( Property
    , image
    , imageAspectContainer
    , item
    , label
    , masonry
    , node
    , src
    , supporting
    , view
    , withTextProtection
    )

import Html exposing (Html)
import Html.Attributes as Html
import Internal.ImageList.Model exposing (Config, defaultConfig)
import Internal.Options as Options exposing (cs, styled, when)


cssClasses :
    { masonry : String
    , withTextProtection : String
    }
cssClasses =
    { masonry = "mdc-image-list--masonry"
    , withTextProtection = "mdc-image-list--with-text-protection"
    }



-- VIEW


imageList : List (Property m) -> List (Html m) -> Html m
imageList options =
    let
        ({ config } as summary) =
            Options.collect defaultConfig options
    in
    Options.apply summary
        Html.ul
        [ cs "mdc-image-list"
        , when config.masonry (cs cssClasses.masonry)
        , when config.withTextProtection (cs cssClasses.withTextProtection)
        ]
        []



-- API


type alias Property m =
    Options.Property Config m


view : List (Property m) -> List (Html m) -> Html m
view =
    imageList


item : List (Property m) -> List (Html m) -> Html m
item options =
    styled Html.li (cs "mdc-image-list__item" :: options)


imageAspectContainer : List (Property m) -> List (Html m) -> Html m
imageAspectContainer options =
    let
        ({ config } as summary) =
            Options.collect defaultConfig options
        tag = Maybe.withDefault "div" config.tag
    in
    styled ( Html.node tag ) (cs "mdc-image-list__image-aspect-container" :: options)


supporting : List (Property m) -> List (Html m) -> Html m
supporting options =
    let
        ({ config } as summary) =
            Options.collect defaultConfig options

        tag = Maybe.withDefault "div" config.tag
    in
    styled ( Html.node tag ) (cs "mdc-image-list__supporting" :: options)


label : List (Property m) -> List (Html m) -> Html m
label options =
    let
        ({ config } as summary) =
            Options.collect defaultConfig options

        tag = Maybe.withDefault "span" config.tag
    in
    styled ( Html.node tag ) (cs "mdc-image-list__label" :: options)


withTextProtection : Property m
withTextProtection =
    Options.option (\config -> { config | withTextProtection = True })


masonry : Property m
masonry =
    Options.option (\config -> { config | masonry = True })


node : String -> Property m
node tag =
    Options.option (\config -> { config | tag = Just tag })


image : List (Property m) -> List (Html m) -> Html m
image options =
    let
        ({ config } as summary) =
            Options.collect defaultConfig options
        tag = Maybe.withDefault "img" config.tag
    in
        styled ( Html.node tag ) (cs "mdc-image-list__image" :: options)


src : String -> Property m
src url =
    Options.attribute (Html.src url)

{'fraction_non_alphanumeric': 0.1035142658315936, 'fraction_numerical': 0.0, 'mean_word_length': 2.4927095990279464, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4542791', 'n_tokens_mistral': 1764, 'n_tokens_neox': 1723, 'n_words': 530}