summaryrefslogtreecommitdiff
path: root/mdl
diff options
context:
space:
mode:
Diffstat (limited to 'mdl')
-rw-r--r--mdl/classes-1.1.31
-rw-r--r--mdl/lib.urp5
-rw-r--r--mdl/mdl.ur16
-rw-r--r--mdl/mdlFfi.js28
-rw-r--r--mdl/mdlFfi.urs15
5 files changed, 65 insertions, 0 deletions
diff --git a/mdl/classes-1.1.3 b/mdl/classes-1.1.3
index 4f20735..e3ccf7e 100644
--- a/mdl/classes-1.1.3
+++ b/mdl/classes-1.1.3
@@ -783,6 +783,7 @@ mdl-js-radio
mdl-js-ripple-effect
mdl-js-ripple-effect--ignore-events
mdl-js-slider
+mdl-js-snackbar
mdl-js-spinner
mdl-js-switch
mdl-js-tabs
diff --git a/mdl/lib.urp b/mdl/lib.urp
index fabf5a8..9d3f870 100644
--- a/mdl/lib.urp
+++ b/mdl/lib.urp
@@ -1,3 +1,8 @@
+benignEffectful MdlFfi.showSnackbar
+ffi mdlFfi
+file /zoBIS4V6.js mdlFfi.js
+jsFunc MdlFfi.showSnackbar=UrWeb.MdlFfi.showSnackbar
library mdlClasses
+script /zoBIS4V6.js
mdl
diff --git a/mdl/mdl.ur b/mdl/mdl.ur
index f3dec74..7900822 100644
--- a/mdl/mdl.ur
+++ b/mdl/mdl.ur
@@ -13,3 +13,19 @@ CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License. *)
structure Classes = MdlClasses
+open Classes
+
+structure Toast = struct
+ val make : transaction {Placeholder: xbody,
+ Show: string -> transaction unit} =
+ id <- fresh;
+ return {
+ Placeholder = <xml>
+ <div id={id} class="mdl-js-snackbar mdl-snackbar">
+ <div class="mdl-snackbar__text" />
+ <button class="mdl-snackbar__action"></button>
+ </div>
+ </xml>,
+ Show = MdlFfi.showSnackbar (show id)
+ }
+end
diff --git a/mdl/mdlFfi.js b/mdl/mdlFfi.js
new file mode 100644
index 0000000..f961cab
--- /dev/null
+++ b/mdl/mdlFfi.js
@@ -0,0 +1,28 @@
+// Copyright 2015 Google Inc.
+// Copyright 2016 Benjamin Barenblat
+//
+// Licensed under the Apache License, Version 2.0 (the “License”); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an “AS IS” BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+"use strict";
+
+var UrWeb = {
+ MdlFfi: {
+
+ showSnackbar:
+ function(id, text) {
+ document.querySelector('#' + id)
+ .MaterialSnackbar.showSnackbar({message: text});
+ },
+
+ }
+}; // UrWeb.MdlFfi
diff --git a/mdl/mdlFfi.urs b/mdl/mdlFfi.urs
new file mode 100644
index 0000000..74dd636
--- /dev/null
+++ b/mdl/mdlFfi.urs
@@ -0,0 +1,15 @@
+(* Copyright 2015 Google Inc.
+Copyright 2016 Benjamin Barenblat
+
+Licensed under the Apache License, Version 2.0 (the “License”); you may not use
+this file except in compliance with the License. You may obtain a copy of the
+License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software distributed
+under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, either express or implied. See the License for the
+specific language governing permissions and limitations under the License. *)
+
+val showSnackbar : string (* id *) -> string (* text *) -> transaction unit