From 61d177d6b14da7297d74a6a19687695a2e22f51f Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sat, 14 Feb 2015 08:27:50 -0500 Subject: Return to working version mode --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 1991c463..3dd849ee 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([urweb], [20150214]) -WORKING_VERSION=0 +WORKING_VERSION=1 AC_USE_SYSTEM_EXTENSIONS # automake 1.12 requires this, but automake 1.11 doesn't recognize it -- cgit v1.2.3 From ef750aab36ed77ad0eb53b7143de40a64765bf43 Mon Sep 17 00:00:00 2001 From: Sergey Mironov Date: Sun, 26 Oct 2014 14:07:07 +0000 Subject: Add 'download' attribute to , part of HTML5 --- lib/ur/basis.urs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs index 326563d6..b8e52582 100644 --- a/lib/ur/basis.urs +++ b/lib/ur/basis.urs @@ -914,7 +914,7 @@ val time : bodyTag boxAttrs val wbr : bodyTag boxAttrs val bdi : bodyTag boxAttrs -val a : bodyTag ([Link = transaction page, Href = url, Target = string, Rel = string] ++ boxAttrs) +val a : bodyTag ([Link = transaction page, Href = url, Target = string, Rel = string, Download = string] ++ boxAttrs) val img : bodyTag ([Alt = string, Src = url, Width = int, Height = int, Onabort = transaction unit, Onerror = transaction unit, -- cgit v1.2.3 From e998c88f705a7e4a731d8a4135d59717bd0331a4 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Mon, 16 Feb 2015 14:52:56 -0500 Subject: Evaluate minus and times in MonoOpt --- src/mono_opt.sml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mono_opt.sml b/src/mono_opt.sml index 2d40e0f0..04ef7f50 100644 --- a/src/mono_opt.sml +++ b/src/mono_opt.sml @@ -630,7 +630,9 @@ fun exp e = EFfiApp ("Basis", "writec", [e]) | EBinop (_, "+", (EPrim (Prim.Int n1), _), (EPrim (Prim.Int n2), _)) => EPrim (Prim.Int (Int64.+ (n1, n2))) - + | EBinop (_, "-", (EPrim (Prim.Int n1), _), (EPrim (Prim.Int n2), _)) => EPrim (Prim.Int (Int64.- (n1, n2))) + | EBinop (_, "*", (EPrim (Prim.Int n1), _), (EPrim (Prim.Int n2), _)) => EPrim (Prim.Int (Int64.* (n1, n2))) + | _ => e and optExp e = #1 (U.Exp.map {typ = typ, exp = exp} e) -- cgit v1.2.3 From 30e24b7ca8513d5df727a258e0d9ccc16e16e184 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Tue, 3 Mar 2015 15:55:00 -0500 Subject: Support 'dynClass' and 'dynStyle' for --- lib/js/urweb.js | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- src/monoize.sml | 44 ++++++++++++++++++++++++++++++++++++-------- tests/dynClassB.ur | 17 +++++++++++++++++ tests/dynClassB.urp | 5 +++++ tests/style.css | 7 +++++++ 5 files changed, 116 insertions(+), 9 deletions(-) create mode 100644 tests/dynClassB.ur create mode 100644 tests/dynClassB.urp create mode 100644 tests/style.css diff --git a/lib/js/urweb.js b/lib/js/urweb.js index 3bf21dd2..bd5109c3 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -1200,7 +1200,7 @@ function dynClass(pnode, html, s_class, s_style) { x.dead = false; x.signal = s_class; x.sources = null; - x.closures = htmlCls; + x.closures = null; x.recreate = function(v) { for (var ls = x.closures; ls != htmlCls; ls = ls.next) @@ -1237,6 +1237,56 @@ function dynClass(pnode, html, s_class, s_style) { } } +function bodyDynClass(s_class, s_style) { + if (suspendScripts) + return; + + var htmlCls = null; + + if (s_class) { + var x = document.createElement("script"); + x.dead = false; + x.signal = s_class; + x.sources = null; + x.closures = htmlCls; + + x.recreate = function(v) { + for (var ls = x.closures; ls != htmlCls; ls = ls.next) + freeClosure(ls.data); + + var cls = {v : null}; + document.body.className = flatten(cls, v); + console.log("className to + " + document.body.className); + x.closures = concat(cls.v, htmlCls); + } + + document.body.appendChild(x); + populate(x); + } + + if (s_style) { + var htmlCls2 = s_class ? null : htmlCls; + var y = document.createElement("script"); + y.dead = false; + y.signal = s_style; + y.sources = null; + y.closures = htmlCls2; + + y.recreate = function(v) { + for (var ls = y.closures; ls != htmlCls2; ls = ls.next) + freeClosure(ls.data); + + var cls = {v : null}; + document.body.style.cssText = flatten(cls, v); + console.log("style to + " + document.body.style.cssText); + y.closures = concat(cls.v, htmlCls2); + } + + document.body.appendChild(y); + populate(y); + } +} + function addOnChange(x, f) { var old = x.onchange; if (old == null) diff --git a/src/monoize.sml b/src/monoize.sml index 5727d997..59c5d2ea 100644 --- a/src/monoize.sml +++ b/src/monoize.sml @@ -3267,6 +3267,11 @@ fun monoExp (env, st, fm) (all as (e, loc)) = else (NONE, NONE, attrs) + val (class, fm) = monoExp (env, st, fm) class + val (dynClass, fm) = monoExp (env, st, fm) dynClass + val (style, fm) = monoExp (env, st, fm) style + val (dynStyle, fm) = monoExp (env, st, fm) dynStyle + (* Special case for