matken11235/html-styled-extra/1.0.0

NOTE: the latest version is 1.0.2

Renamed to ken-matsui/html-styled-extra. It is published under that name, and new versions come out there.

Versions published as matken11235/html-styled-extra still install under that name. 2 versions of 3 come from the new location (see their notes). 1 version could not be recovered and cannot be installed.

Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/ken-matsui/html-styled-extra.

What we checked: The repo moved to github.com/ken-matsui/html-styled-extra. Rebuilt with git archive from commit 24da6cf8c6a2 of https://github.com/ken-matsui/html-styled-extra (zip prefix matken11235-html-styled-extra-24da6cf/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 c591713a5f08be2e49c9056829d292eef6b4953e.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/matken11235/html-styled-extra/zipball/1.0.0/

Html.Styled.Attributes.Extra

Additional attributes for html

Embedding static attributes

static : Attribute Never -> Attribute msg

Embedding static attributes.

Works alike to Html.Styled.Extra.static.

Conditional attribute handling

empty : Attribute msg

A no-op attribute.

Allows for patterns like:

Html.Styled.div
    [ someAttr
    , if someCondition then
        empty


      else
        someAttr2
    ]
    [ someHtml ]

instead of

Html.Styled.div
    (someAttr
        :: (if someCondition then
                []


            else
                [ someAttr2 ]
           )
    )
    [ someHtml ]

This is useful eg. for conditional event handlers.


The only effect it can have on the resulting DOM is adding a class attribute, or adding an extra trailing space in the class attribute if added after Html.Styled.Attribute.class or Html.Styled.Attribute.classList:

-- side effect 1:
-- <div class="" />
Html.Styled.div [ empty ] []


-- side effect 2:
-- <div class="x " />
Html.Styled.div [ class "x", empty ] []


-- no side effect:
-- <div class="x" />
Html.Styled.div [ empty, class "x" ] []


-- side effect 2:
-- <div class="x " />
Html.Styled.div [ classList [ ( "x", True ) ], empty ] []


-- no side effect:
-- <div class="x" />
Html.Styled.div [ empty, classList [ ( "x", True ) ] ] []
attributeIf : Bool -> Attribute msg -> Attribute msg

A function to only render a HTML attribute under a certain condition

attributeMaybe : (a -> Attribute msg) -> Maybe a -> Attribute msg

Renders empty attribute in case of Nothing, uses the provided function in case of Just.

Inputs

valueAsFloat : Float -> Attribute msg

Uses valueAsNumber to update an input with a floating-point value. This should only be used on <input> of type number, range, or date. It differs from value in that a floating point value will not necessarily overwrite the contents on an input element.

valueAsFloat 2.5 -- e.g. will not change the displayed value for input showing "2.5000"


valueAsFloat 0.4 -- e.g. will not change the displayed value for input showing ".4"
valueAsInt : Int -> Attribute msg

Uses valueAsNumber to update an input with an integer value. This should only be used on <input> of type number, range, or date. It differs from value in that an integer value will not necessarily overwrite the contents on an input element.

valueAsInt 18 -- e.g. will not change the displayed value for input showing "00018"
autocomplete : Completion -> Attribute msg

Render one of the possible Completion types into an Attribute.

Semantic web

role : String -> Attribute msg

Used to annotate markup languages with machine-extractable semantic information about the purpose of an element. See the official specs.

Meter element

low : String -> Attribute msg

The upper numeric bound of the low end of the measured range, used with the meter element.

high : String -> Attribute msg

The lower numeric bound of the high end of the measured range, used with the meter element.

optimum : String -> Attribute msg

This attribute indicates the optimal numeric value, used with the meter element.

Media element

volume : Float -> Attribute msg

Audio volume, starting from 0.0 (silent) up to 1.0 (loudest).

Custom Attributes

stringProperty : String -> String -> Attribute msg

Create arbitrary string properties.

boolProperty : String -> Bool -> Attribute msg

Create arbitrary bool properties.

floatProperty : String -> Float -> Attribute msg

Create arbitrary floating-point properties.

intProperty : String -> Int -> Attribute msg

Create arbitrary integer properties.