File tree 3 files changed +34
-3
lines changed
3 files changed +34
-3
lines changed Original file line number Diff line number Diff line change 18
18
"dependencies" : {
19
19
"purescript-media-types" : " ^4.0.0" ,
20
20
"purescript-prelude" : " ^4.0.0" ,
21
- "purescript-web-clipboard" : " ^1 .0.0" ,
22
- "purescript-web-touchevents" : " ^1 .0.0"
21
+ "purescript-web-clipboard" : " ^2 .0.0" ,
22
+ "purescript-web-touchevents" : " ^2 .0.0"
23
23
}
24
24
}
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import DOM.HTML.Indexed.ButtonType (ButtonType)
4
4
import DOM.HTML.Indexed.CrossOriginValue (CrossOriginValue )
5
5
import DOM.HTML.Indexed.DirValue (DirValue )
6
6
import DOM.HTML.Indexed.FormMethod (FormMethod )
7
+ import DOM.HTML.Indexed.InputAcceptType (InputAcceptType )
7
8
import DOM.HTML.Indexed.InputType (InputType )
8
9
import DOM.HTML.Indexed.KindValue (KindValue )
9
10
import DOM.HTML.Indexed.MenuType (MenuType )
@@ -338,7 +339,7 @@ type HTMLimg = Interactive
338
339
)
339
340
340
341
type HTMLinput = Interactive
341
- ( accept :: MediaType
342
+ ( accept :: InputAcceptType
342
343
, autocomplete :: OnOff
343
344
, autofocus :: Boolean
344
345
, checked :: Boolean
Original file line number Diff line number Diff line change
1
+ module DOM.HTML.Indexed.InputAcceptType where
2
+
3
+ import Prelude
4
+
5
+ import Data.MediaType (MediaType (..))
6
+ import Data.String as String
7
+
8
+ newtype InputAcceptType = InputAcceptType (Array InputAcceptTypeAtom )
9
+
10
+ instance semigroupInputAcceptType :: Semigroup InputAcceptType where
11
+ append (InputAcceptType a) (InputAcceptType b) = InputAcceptType (a <> b)
12
+
13
+ mediaType :: MediaType -> InputAcceptType
14
+ mediaType mt = InputAcceptType [AcceptMediaType mt]
15
+
16
+ extension :: String -> InputAcceptType
17
+ extension ext = InputAcceptType [AcceptFileExtension ext]
18
+
19
+ data InputAcceptTypeAtom
20
+ = AcceptMediaType MediaType
21
+ | AcceptFileExtension String
22
+
23
+ renderInputAcceptType :: InputAcceptType -> String
24
+ renderInputAcceptType (InputAcceptType atoms) =
25
+ String .joinWith " ," (map renderInputAcceptTypeAtom atoms)
26
+
27
+ renderInputAcceptTypeAtom :: InputAcceptTypeAtom -> String
28
+ renderInputAcceptTypeAtom = case _ of
29
+ AcceptMediaType (MediaType mt) -> mt
30
+ AcceptFileExtension ext -> ext
You can’t perform that action at this time.
0 commit comments