Mercurial > urweb
comparison lib/ur/basis.urs @ 2008:93ff76058825
HTML5 data-* attributes
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Fri, 02 May 2014 15:32:10 -0400 |
parents | d3a0f2b8af28 |
children | fee1f660139c |
comparison
equal
deleted
inserted
replaced
2007:d3a0f2b8af28 | 2008:93ff76058825 |
---|---|
794 -> tag [Code = transaction xbody] body [] [] [] | 794 -> tag [Code = transaction xbody] body [] [] [] |
795 | 795 |
796 val script : unit | 796 val script : unit |
797 -> tag [Code = transaction unit] head [] [] [] | 797 -> tag [Code = transaction unit] head [] [] [] |
798 | 798 |
799 val head : unit -> tag [] html head [] [] | 799 (* Type for HTML5 "data-*" attributes. *) |
800 val title : unit -> tag [] head [] [] [] | 800 type data_attr |
801 val link : unit -> tag [Id = id, Rel = string, Typ = string, Href = url, Media = string] head [] [] [] | 801 val data_attr : string (* Key *) -> string (* Value *) -> data_attr |
802 | 802 (* This function will fail if the key doesn't meet HTML's lexical rules! *) |
803 val body : unit -> tag [Onload = transaction unit, Onresize = transaction unit, Onunload = transaction unit, Onhashchange = transaction unit] | 803 val data_attrs : data_attr -> data_attr -> data_attr |
804 | |
805 val head : unit -> tag [Data = data_attr] html head [] [] | |
806 val title : unit -> tag [Data = data_attr] head [] [] [] | |
807 val link : unit -> tag [Data = data_attr, Id = id, Rel = string, Typ = string, Href = url, Media = string] head [] [] [] | |
808 | |
809 val body : unit -> tag [Data = data_attr, Onload = transaction unit, Onresize = transaction unit, Onunload = transaction unit, Onhashchange = transaction unit] | |
804 html body [] [] | 810 html body [] [] |
805 con bodyTag = fn (attrs :: {Type}) => | 811 con bodyTag = fn (attrs :: {Type}) => |
806 ctx ::: {Unit} -> | 812 ctx ::: {Unit} -> |
807 [[Body] ~ ctx] => | 813 [[Body] ~ ctx] => |
808 unit -> tag attrs ([Body] ++ ctx) ([Body] ++ ctx) [] [] | 814 unit -> tag attrs ([Body] ++ ctx) ([Body] ++ ctx) [] [] |
809 con bodyTagStandalone = fn (attrs :: {Type}) => | 815 con bodyTagStandalone = fn (attrs :: {Type}) => |
810 ctx ::: {Unit} | 816 ctx ::: {Unit} |
811 -> [[Body] ~ ctx] => | 817 -> [[Body] ~ ctx] => |
812 unit -> tag attrs ([Body] ++ ctx) [] [] [] | 818 unit -> tag attrs ([Body] ++ ctx) [] [] [] |
813 | 819 |
814 val br : bodyTagStandalone [Id = id] | 820 val br : bodyTagStandalone [Data = data_attr, Id = id] |
815 | 821 |
816 con focusEvents = [Onblur = transaction unit, Onfocus = transaction unit] | 822 con focusEvents = [Onblur = transaction unit, Onfocus = transaction unit] |
817 | 823 |
818 datatype mouseButton = Left | Right | Middle | 824 datatype mouseButton = Left | Right | Middle |
819 | 825 |
835 con scrollEvents = [Onscroll = transaction unit] | 841 con scrollEvents = [Onscroll = transaction unit] |
836 | 842 |
837 con boxEvents = focusEvents ++ mouseEvents ++ keyEvents ++ resizeEvents ++ scrollEvents | 843 con boxEvents = focusEvents ++ mouseEvents ++ keyEvents ++ resizeEvents ++ scrollEvents |
838 con tableEvents = focusEvents ++ mouseEvents ++ keyEvents | 844 con tableEvents = focusEvents ++ mouseEvents ++ keyEvents |
839 | 845 |
840 con boxAttrs = [Id = id, Title = string] ++ boxEvents | 846 con boxAttrs = [Data = data_attr, Id = id, Title = string] ++ boxEvents |
841 con tableAttrs = [Id = id, Title = string] ++ tableEvents | 847 con tableAttrs = [Data = data_attr, Id = id, Title = string] ++ tableEvents |
842 | 848 |
843 val span : bodyTag boxAttrs | 849 val span : bodyTag boxAttrs |
844 val div : bodyTag boxAttrs | 850 val div : bodyTag boxAttrs |
845 | 851 |
846 val p : bodyTag boxAttrs | 852 val p : bodyTag boxAttrs |
899 con formTag = fn (ty :: Type) (inner :: {Unit}) (attrs :: {Type}) => | 905 con formTag = fn (ty :: Type) (inner :: {Unit}) (attrs :: {Type}) => |
900 ctx ::: {Unit} | 906 ctx ::: {Unit} |
901 -> [[Form] ~ ctx] => | 907 -> [[Form] ~ ctx] => |
902 nm :: Name -> unit | 908 nm :: Name -> unit |
903 -> tag attrs ([Form] ++ ctx) inner [] [nm = ty] | 909 -> tag attrs ([Form] ++ ctx) inner [] [nm = ty] |
904 val hidden : formTag string [] [Id = string, Value = string] | 910 val hidden : formTag string [] [Data = data_attr, Id = string, Value = string] |
905 val textbox : formTag string [] ([Value = string, Size = int, Placeholder = string, Source = source string, Onchange = transaction unit, | 911 val textbox : formTag string [] ([Value = string, Size = int, Placeholder = string, Source = source string, Onchange = transaction unit, |
906 Ontext = transaction unit] ++ boxAttrs) | 912 Ontext = transaction unit] ++ boxAttrs) |
907 val password : formTag string [] ([Value = string, Size = int, Placeholder = string] ++ boxAttrs) | 913 val password : formTag string [] ([Value = string, Size = int, Placeholder = string] ++ boxAttrs) |
908 val textarea : formTag string [] ([Rows = int, Cols = int, Onchange = transaction unit, | 914 val textarea : formTag string [] ([Rows = int, Cols = int, Onchange = transaction unit, |
909 Ontext = transaction unit] ++ boxAttrs) | 915 Ontext = transaction unit] ++ boxAttrs) |
933 val fieldName : postField -> string | 939 val fieldName : postField -> string |
934 val fieldValue : postField -> string | 940 val fieldValue : postField -> string |
935 val remainingFields : postField -> string | 941 val remainingFields : postField -> string |
936 | 942 |
937 con radio = [Body, Radio] | 943 con radio = [Body, Radio] |
938 val radio : formTag (option string) radio [Id = id] | 944 val radio : formTag (option string) radio [Data = data_attr, Id = id] |
939 val radioOption : unit -> tag ([Value = string, Checked = bool] ++ boxAttrs) radio [] [] [] | 945 val radioOption : unit -> tag ([Value = string, Checked = bool] ++ boxAttrs) radio [] [] [] |
940 | 946 |
941 con select = [Select] | 947 con select = [Select] |
942 val select : formTag string select ([Onchange = transaction unit] ++ boxAttrs) | 948 val select : formTag string select ([Onchange = transaction unit] ++ boxAttrs) |
943 val option : unit -> tag [Value = string, Selected = bool] select [] [] [] | 949 val option : unit -> tag [Data = data_attr, Value = string, Selected = bool] select [] [] [] |
944 | 950 |
945 val submit : ctx ::: {Unit} -> use ::: {Type} | 951 val submit : ctx ::: {Unit} -> use ::: {Type} |
946 -> [[Form] ~ ctx] => | 952 -> [[Form] ~ ctx] => |
947 unit | 953 unit |
948 -> tag ([Value = string, Action = $use -> transaction page] ++ boxAttrs) | 954 -> tag ([Value = string, Action = $use -> transaction page] ++ boxAttrs) |
1004 | 1010 |
1005 (** Definition lists *) | 1011 (** Definition lists *) |
1006 | 1012 |
1007 val dl : other ::: {Unit} -> [other ~ [Body,Dl]] | 1013 val dl : other ::: {Unit} -> [other ~ [Body,Dl]] |
1008 => unit | 1014 => unit |
1009 -> tag [] ([Body] ++ other) ([Dl] ++ other) [] [] | 1015 -> tag [Data = data_attr] ([Body] ++ other) ([Dl] ++ other) [] [] |
1010 | 1016 |
1011 val dt : other ::: {Unit} -> [other ~ [Body,Dl]] | 1017 val dt : other ::: {Unit} -> [other ~ [Body,Dl]] |
1012 => unit | 1018 => unit |
1013 -> tag [] ([Dl] ++ other) ([Body] ++ other) [] [] | 1019 -> tag [Data = data_attr] ([Dl] ++ other) ([Body] ++ other) [] [] |
1014 | 1020 |
1015 val dd : other ::: {Unit} -> [other ~ [Body,Dl]] | 1021 val dd : other ::: {Unit} -> [other ~ [Body,Dl]] |
1016 => unit | 1022 => unit |
1017 -> tag [] ([Dl] ++ other) ([Body] ++ other) [] [] | 1023 -> tag [Data = data_attr] ([Dl] ++ other) ([Body] ++ other) [] [] |
1024 | |
1018 | 1025 |
1019 (** Aborting *) | 1026 (** Aborting *) |
1020 | 1027 |
1021 val error : t ::: Type -> xbody -> t | 1028 val error : t ::: Type -> xbody -> t |
1022 | 1029 |