Mercurial > urweb
comparison lib/ur/basis.urs @ 1047:609ab3947a08
Add 'id' attributes and <label>
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Wed, 25 Nov 2009 09:30:44 -0500 |
parents | e46227efcbba |
children | 93315ac00394 |
comparison
equal
deleted
inserted
replaced
1046:a5eb8f87bc17 | 1047:609ab3947a08 |
---|---|
544 val dyn : ctx ::: {Unit} -> use ::: {Type} -> bind ::: {Type} -> [ctx ~ body] => unit | 544 val dyn : ctx ::: {Unit} -> use ::: {Type} -> bind ::: {Type} -> [ctx ~ body] => unit |
545 -> tag [Signal = signal (xml (body ++ ctx) use bind)] (body ++ ctx) [] use bind | 545 -> tag [Signal = signal (xml (body ++ ctx) use bind)] (body ++ ctx) [] use bind |
546 | 546 |
547 val head : unit -> tag [] html head [] [] | 547 val head : unit -> tag [] html head [] [] |
548 val title : unit -> tag [] head [] [] [] | 548 val title : unit -> tag [] head [] [] [] |
549 val link : unit -> tag [Rel = string, Typ = string, Href = url, Media = string] head [] [] [] | 549 val link : unit -> tag [Id = string, Rel = string, Typ = string, Href = url, Media = string] head [] [] [] |
550 | 550 |
551 val body : unit -> tag [Onload = transaction unit, Onresize = transaction unit, Onunload = transaction unit] | 551 val body : unit -> tag [Onload = transaction unit, Onresize = transaction unit, Onunload = transaction unit] |
552 html body [] [] | 552 html body [] [] |
553 con bodyTag = fn (attrs :: {Type}) => | 553 con bodyTag = fn (attrs :: {Type}) => |
554 ctx ::: {Unit} -> | 554 ctx ::: {Unit} -> |
557 con bodyTagStandalone = fn (attrs :: {Type}) => | 557 con bodyTagStandalone = fn (attrs :: {Type}) => |
558 ctx ::: {Unit} | 558 ctx ::: {Unit} |
559 -> [[Body] ~ ctx] => | 559 -> [[Body] ~ ctx] => |
560 unit -> tag attrs ([Body] ++ ctx) [] [] [] | 560 unit -> tag attrs ([Body] ++ ctx) [] [] [] |
561 | 561 |
562 val br : bodyTagStandalone [] | 562 val br : bodyTagStandalone [Id = int] |
563 | 563 |
564 con focusEvents = [Onblur = transaction unit, Onfocus = transaction unit] | 564 con focusEvents = [Onblur = transaction unit, Onfocus = transaction unit] |
565 con mouseEvents = [Onclick = transaction unit, Ondblclick = transaction unit, | 565 con mouseEvents = [Onclick = transaction unit, Ondblclick = transaction unit, |
566 Onmousedown = transaction unit, Onmousemove = transaction unit, | 566 Onmousedown = transaction unit, Onmousemove = transaction unit, |
567 Onmouseout = transaction unit, Onmouseover = transaction unit, | 567 Onmouseout = transaction unit, Onmouseover = transaction unit, |
572 con resizeEvents = [Onresize = transaction unit] | 572 con resizeEvents = [Onresize = transaction unit] |
573 | 573 |
574 con boxEvents = focusEvents ++ mouseEvents ++ keyEvents ++ resizeEvents | 574 con boxEvents = focusEvents ++ mouseEvents ++ keyEvents ++ resizeEvents |
575 con tableEvents = focusEvents ++ mouseEvents ++ keyEvents | 575 con tableEvents = focusEvents ++ mouseEvents ++ keyEvents |
576 | 576 |
577 val span : bodyTag boxEvents | 577 con boxAttrs = [Id = string] ++ boxEvents |
578 val div : bodyTag boxEvents | 578 con tableAttrs = [Id = string] ++ tableEvents |
579 | 579 |
580 val p : bodyTag boxEvents | 580 val span : bodyTag boxAttrs |
581 val b : bodyTag boxEvents | 581 val div : bodyTag boxAttrs |
582 val i : bodyTag boxEvents | 582 |
583 val tt : bodyTag boxEvents | 583 val p : bodyTag boxAttrs |
584 | 584 val b : bodyTag boxAttrs |
585 val h1 : bodyTag boxEvents | 585 val i : bodyTag boxAttrs |
586 val h2 : bodyTag boxEvents | 586 val tt : bodyTag boxAttrs |
587 val h3 : bodyTag boxEvents | 587 |
588 val h4 : bodyTag boxEvents | 588 val h1 : bodyTag boxAttrs |
589 val h5 : bodyTag boxEvents | 589 val h2 : bodyTag boxAttrs |
590 val h6 : bodyTag boxEvents | 590 val h3 : bodyTag boxAttrs |
591 | 591 val h4 : bodyTag boxAttrs |
592 val li : bodyTag boxEvents | 592 val h5 : bodyTag boxAttrs |
593 val ol : bodyTag boxEvents | 593 val h6 : bodyTag boxAttrs |
594 val ul : bodyTag boxEvents | 594 |
595 | 595 val li : bodyTag boxAttrs |
596 val hr : bodyTag boxEvents | 596 val ol : bodyTag boxAttrs |
597 | 597 val ul : bodyTag boxAttrs |
598 val a : bodyTag ([Link = transaction page, Href = url] ++ boxEvents) | 598 |
599 val hr : bodyTag boxAttrs | |
600 | |
601 val a : bodyTag ([Link = transaction page, Href = url] ++ boxAttrs) | |
599 | 602 |
600 val img : bodyTag ([Src = url, Onabort = transaction unit, Onerror = transaction unit, | 603 val img : bodyTag ([Src = url, Onabort = transaction unit, Onerror = transaction unit, |
601 Onload = transaction unit] ++ boxEvents) | 604 Onload = transaction unit] ++ boxAttrs) |
602 | 605 |
603 val form : ctx ::: {Unit} -> bind ::: {Type} | 606 val form : ctx ::: {Unit} -> bind ::: {Type} |
604 -> [[Body, Form] ~ ctx] => | 607 -> [[Body, Form] ~ ctx] => |
605 xml ([Body, Form] ++ ctx) [] bind | 608 xml ([Body, Form] ++ ctx) [] bind |
606 -> xml ([Body] ++ ctx) [] [] | 609 -> xml ([Body] ++ ctx) [] [] |
625 con formTag = fn (ty :: Type) (inner :: {Unit}) (attrs :: {Type}) => | 628 con formTag = fn (ty :: Type) (inner :: {Unit}) (attrs :: {Type}) => |
626 ctx ::: {Unit} | 629 ctx ::: {Unit} |
627 -> [[Form] ~ ctx] => | 630 -> [[Form] ~ ctx] => |
628 nm :: Name -> unit | 631 nm :: Name -> unit |
629 -> tag attrs ([Form] ++ ctx) inner [] [nm = ty] | 632 -> tag attrs ([Form] ++ ctx) inner [] [nm = ty] |
630 val hidden : formTag string [] [Value = string] | 633 val hidden : formTag string [] [Id = string, Value = string] |
631 val textbox : formTag string [] ([Value = string, Size = int, Source = source string, Onchange = transaction unit, | 634 val textbox : formTag string [] ([Value = string, Size = int, Source = source string, Onchange = transaction unit, |
632 Ontext = transaction unit] ++ boxEvents) | 635 Ontext = transaction unit] ++ boxAttrs) |
633 val password : formTag string [] ([Value = string, Size = int] ++ boxEvents) | 636 val password : formTag string [] ([Value = string, Size = int] ++ boxAttrs) |
634 val textarea : formTag string [] ([Rows = int, Cols = int, Onchange = transaction unit, | 637 val textarea : formTag string [] ([Rows = int, Cols = int, Onchange = transaction unit, |
635 Ontext = transaction unit] ++ boxEvents) | 638 Ontext = transaction unit] ++ boxAttrs) |
636 | 639 |
637 val checkbox : formTag bool [] ([Checked = bool] ++ boxEvents) | 640 val checkbox : formTag bool [] ([Checked = bool] ++ boxAttrs) |
638 | 641 |
639 type file | 642 type file |
640 val fileName : file -> option string | 643 val fileName : file -> option string |
641 val fileMimeType : file -> string | 644 val fileMimeType : file -> string |
642 val fileData : file -> blob | 645 val fileData : file -> blob |
643 | 646 |
644 val upload : formTag file [] ([Value = string, Size = int] ++ boxEvents) | 647 val upload : formTag file [] ([Value = string, Size = int] ++ boxAttrs) |
645 | 648 |
646 type mimeType | 649 type mimeType |
647 val blessMime : string -> mimeType | 650 val blessMime : string -> mimeType |
648 val checkMime : string -> option mimeType | 651 val checkMime : string -> option mimeType |
649 val returnBlob : t ::: Type -> blob -> mimeType -> transaction t | 652 val returnBlob : t ::: Type -> blob -> mimeType -> transaction t |
650 val blobSize : blob -> int | 653 val blobSize : blob -> int |
651 | 654 |
652 con radio = [Body, Radio] | 655 con radio = [Body, Radio] |
653 val radio : formTag string radio [] | 656 val radio : formTag string radio [Id = string] |
654 val radioOption : unit -> tag ([Value = string] ++ boxEvents) radio [] [] [] | 657 val radioOption : unit -> tag ([Value = string] ++ boxAttrs) radio [] [] [] |
655 | 658 |
656 con select = [Select] | 659 con select = [Select] |
657 val select : formTag string select ([Onchange = transaction unit] ++ boxEvents) | 660 val select : formTag string select ([Onchange = transaction unit] ++ boxAttrs) |
658 val option : unit -> tag [Value = string, Selected = bool] select [] [] [] | 661 val option : unit -> tag [Value = string, Selected = bool] select [] [] [] |
659 | 662 |
660 val submit : ctx ::: {Unit} -> use ::: {Type} | 663 val submit : ctx ::: {Unit} -> use ::: {Type} |
661 -> [[Form] ~ ctx] => | 664 -> [[Form] ~ ctx] => |
662 unit | 665 unit |
663 -> tag ([Value = string, Action = $use -> transaction page] ++ boxEvents) | 666 -> tag ([Value = string, Action = $use -> transaction page] ++ boxAttrs) |
664 ([Form] ++ ctx) ([Form] ++ ctx) use [] | 667 ([Form] ++ ctx) ([Form] ++ ctx) use [] |
668 | |
669 val label : bodyTag ([For = string, Accesskey = string] ++ tableAttrs) | |
670 | |
665 | 671 |
666 (*** AJAX-oriented widgets *) | 672 (*** AJAX-oriented widgets *) |
667 | 673 |
668 con cformTag = fn (attrs :: {Type}) (inner :: {Unit}) => | 674 con cformTag = fn (attrs :: {Type}) (inner :: {Unit}) => |
669 ctx ::: {Unit} | 675 ctx ::: {Unit} |
670 -> [[Body] ~ ctx] => | 676 -> [[Body] ~ ctx] => |
671 unit -> tag attrs ([Body] ++ ctx) inner [] [] | 677 unit -> tag attrs ([Body] ++ ctx) inner [] [] |
672 | 678 |
673 val ctextbox : cformTag ([Value = string, Size = int, Source = source string, Onchange = transaction unit, | 679 val ctextbox : cformTag ([Value = string, Size = int, Source = source string, Onchange = transaction unit, |
674 Ontext = transaction unit] ++ boxEvents) [] | 680 Ontext = transaction unit] ++ boxAttrs) [] |
675 val button : cformTag ([Value = string] ++ boxEvents) [] | 681 val button : cformTag ([Value = string] ++ boxAttrs) [] |
676 | 682 |
677 val ccheckbox : cformTag ([Value = bool, Size = int, Source = source bool] ++ boxEvents) [] | 683 val ccheckbox : cformTag ([Value = bool, Size = int, Source = source bool] ++ boxAttrs) [] |
678 | 684 |
679 con cselect = [Cselect] | 685 con cselect = [Cselect] |
680 val cselect : cformTag ([Source = source string, Onchange = transaction unit] ++ boxEvents) cselect | 686 val cselect : cformTag ([Source = source string, Onchange = transaction unit] ++ boxAttrs) cselect |
681 val coption : unit -> tag [Value = string, Selected = bool] cselect [] [] [] | 687 val coption : unit -> tag [Value = string, Selected = bool] cselect [] [] [] |
682 | 688 |
683 (*** Tables *) | 689 (*** Tables *) |
684 | 690 |
685 val tabl : other ::: {Unit} -> [other ~ [Body, Table]] => unit | 691 val tabl : other ::: {Unit} -> [other ~ [Body, Table]] => unit |
686 -> tag ([Border = int] ++ boxEvents) | 692 -> tag ([Border = int] ++ boxAttrs) |
687 ([Body] ++ other) ([Body, Table] ++ other) [] [] | 693 ([Body] ++ other) ([Body, Table] ++ other) [] [] |
688 val tr : other ::: {Unit} -> [other ~ [Body, Table, Tr]] => unit | 694 val tr : other ::: {Unit} -> [other ~ [Body, Table, Tr]] => unit |
689 -> tag tableEvents | 695 -> tag tableAttrs |
690 ([Body, Table] ++ other) ([Body, Tr] ++ other) [] [] | 696 ([Body, Table] ++ other) ([Body, Tr] ++ other) [] [] |
691 val th : other ::: {Unit} -> [other ~ [Body, Tr]] => unit | 697 val th : other ::: {Unit} -> [other ~ [Body, Tr]] => unit |
692 -> tag ([Colspan = int] ++ tableEvents) | 698 -> tag ([Colspan = int] ++ tableAttrs) |
693 ([Body, Tr] ++ other) ([Body] ++ other) [] [] | 699 ([Body, Tr] ++ other) ([Body] ++ other) [] [] |
694 val td : other ::: {Unit} -> [other ~ [Body, Tr]] => unit | 700 val td : other ::: {Unit} -> [other ~ [Body, Tr]] => unit |
695 -> tag ([Colspan = int] ++ tableEvents) | 701 -> tag ([Colspan = int] ++ tableAttrs) |
696 ([Body, Tr] ++ other) ([Body] ++ other) [] [] | 702 ([Body, Tr] ++ other) ([Body] ++ other) [] [] |
697 | 703 |
698 | 704 |
699 (** Aborting *) | 705 (** Aborting *) |
700 | 706 |