diff options
-rw-r--r-- | Makefile | 14 | ||||
-rw-r--r-- | mdl/classes-1.1.3 | 1 | ||||
-rw-r--r-- | mdl/lib.urp | 5 | ||||
-rw-r--r-- | mdl/mdl.ur | 16 | ||||
-rw-r--r-- | mdl/mdlFfi.js | 28 | ||||
-rw-r--r-- | mdl/mdlFfi.urs | 15 |
6 files changed, 74 insertions, 5 deletions
@@ -17,8 +17,14 @@ MDL_GENERATED = mdl/mdlClasses.urp mdl/mdlClasses.ur .PHONY: all all: ugtd ugtd.db -ugtd initialize.sql: ugtd.urp $(MDL_GENERATED) mdl/lib.urp mdl/mdl.ur main.urs \ - main.ur +ugtd initialize.sql: \ + ugtd.urp \ + mdl/lib.urp \ + mdl/mdlFfi.urs mdl/mdlFfi.js \ + mdl/mdlClasses.urp \ + mdl/mdlClasses.ur \ + mdl/mdl.ur \ + main.urs main.ur urweb -ccompiler build_scripts/clang -output ugtd ugtd ugtd.db: initialize.sql prepopulate.sql @@ -26,9 +32,7 @@ ugtd.db: initialize.sql prepopulate.sql sqlite3 $@ <initialize.sql sqlite3 $@ <prepopulate.sql -.PHONY: mdl -mdl: $(MDL_GENERATED) -$(MDL_GENERATED): mdl/classes +mdl/mdlClasses.urp mdl/mdlClasses.ur: mdl/classes build_scripts/generate_mdl <$< .PHONY: clean 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 @@ -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 |