Compare commits

...

3 Commits

Author SHA1 Message Date
Matthew Griffith
df1b3d004b More visual text input tests 2024-05-25 21:52:01 +01:00
Matthew Griffith
81c67b5ed4 Use Animatior.transition instead of keyframes 2024-05-25 21:51:43 +01:00
Matthew Griffith
e8299d5fe6 Add note to Ui.download 2024-05-25 21:49:47 +01:00
4 changed files with 50 additions and 33 deletions

View File

@ -1,14 +1,11 @@
module Internal.Model2 exposing (..)
import Animator
import Browser.Dom
import Color
import Html
import Html.Attributes as Attr
import Html.Events as Events
import Html.Keyed
import Html.Lazy
import Internal.BitEncodings as Bits
import Internal.BitField as BitField exposing (BitField)
import Internal.Bits.Analyze as AnalyzeBits
import Internal.Bits.Inheritance as Inheritance
@ -722,7 +719,12 @@ link details =
, additionalInheritance = BitField.none
, attrs =
[ Attr.href details.url
, Attr.rel "noopener noreferrer"
, case details.download of
Nothing ->
Attr.rel "noopener noreferrer"
Just _ ->
Attr.class ""
, case details.download of
Nothing ->
if details.newTab then

View File

@ -726,6 +726,9 @@ linkNewTab uri =
{-| A link to download a file.
**Note** This will not work for cross-origin requests unless the server sends the appropriate headers.
-}
download : String -> Attribute msg
download uri =

View File

@ -318,39 +318,18 @@ toAttr trigger incomingCss =
transitionWithTrigger : Trigger -> Duration -> List Animated -> Attribute msg
transitionWithTrigger trigger dur attrs =
Animator.css
(Animator.Timeline.init []
|> Animator.Timeline.to dur attrs
|> Animator.Timeline.update (Time.millisToPosix 1)
)
(\animated ->
( animated, [] )
)
Animator.transition dur attrs
|> Animator.toCss
|> toAttr trigger
addPsuedoClass : String -> Animator.Css -> Animator.Css
addPsuedoClass psuedo css =
{ css
| hash = css.hash ++ psuedo
}
{-| -}
transition : Duration -> List Animated -> Attribute msg
transition dur attrs =
let
css =
Animator.css
(Animator.Timeline.init []
|> Animator.Timeline.to dur attrs
|> Animator.Timeline.update (Time.millisToPosix 1)
)
(\animated ->
( animated, [] )
)
in
Two.styleList css.props
Animator.transition dur attrs
|> Animator.toCss
|> .props
|> Two.styleList
{-| -}

View File

@ -48,14 +48,15 @@ view model =
-- , Ui.background (Ui.rgba 255 0 255 1)
]
[ Theme.h1 "Text"
[ Ui.el [ Ui.download "https://picsum.photos/200/300" ]
(Theme.h1 "Text")
, Ui.Input.text
[ Ui.border 2
, Ui.borderColor (Ui.rgba 0 0 0 1)
, Ui.rounded 10
-- , Ui.height Ui.fill
, Ui.background (Ui.rgba 255 0 255 1)
, Ui.background (Ui.rgba 255 230 255 1)
]
{ onChange = TextUpdated
, text = model.text
@ -63,5 +64,37 @@ view model =
, label =
Ui.Input.labelHidden "Type something here..."
}
, Ui.Input.multiline
[ Ui.border 2
, Ui.borderColor (Ui.rgba 0 0 0 1)
, Ui.rounded 10
-- , Ui.height Ui.fill
, Ui.background (Ui.rgba 255 230 255 1)
]
{ onChange = TextUpdated
, text = model.text
, placeholder = Just "Type something here..."
, spellcheck = False
, label =
Ui.Input.labelHidden "Type something here..."
}
, Ui.Input.multiline
[ Ui.border 2
, Ui.borderColor (Ui.rgba 0 0 0 1)
, Ui.rounded 10
, Ui.heightMax 70
, Ui.scrollable
-- , Ui.height Ui.fill
, Ui.background (Ui.rgba 255 230 255 1)
]
{ onChange = TextUpdated
, text = model.text
, placeholder = Just "Type something here..."
, spellcheck = False
, label =
Ui.Input.labelHidden "Type something here..."
}
]
)