(* Copyright 2015 Google Inc. Copyright 2016, 2017 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. *) style materialIcon style stackingContext fun icon s = {[s]} fun inNewStackingContext x =
{x}
structure Ripple : sig val inkAnimation : int -> int -> source (option {X : int, Y : int}) -> xbody end = struct style ink fun inkStyle width height xy = let fun p a b = value (property a) (atom (show b ^ "px")) in oneProperty (oneProperty (oneProperty (oneProperty noStyle (p "width" width)) (p "height" height)) (p "left" (xy.X - width / 2))) (p "top" (xy.Y - height / 2)) end fun inkAnimation width height s = | Some xy => ) } /> end (* TODO(bbaren): Support attributes in the arguments. *) fun page p = (* Disable tap highlight on IE. *) (* Color the status bar on mobile devices. *) {p.Head} {p.Body} structure AppBar = struct style bar style title fun make t =

{[t]}

end structure Checkbox = struct style checkbox style checked style container (* Pixel dimensions of the checkbox. If you update these, you must also update the CSS file. *) val width = 24 val height = 24 val make c onChange = s <- source c; inkCenter <- source None; return (inNewStackingContext
{Ripple.inkAnimation width height inkCenter} set inkCenter (Some {X = click.ClientX, Y = click.ClientY}); c <- get s; let val c' = not c in set s c'; onChange c' end } >
) end structure FloatingActionButton = struct style container style element (* Pixel dimensions of the button. If you update these, you must also update the CSS file. *) val width = 56 val height = 56 fun make s = inkCenter <- source None; return
{Ripple.inkAnimation width height inkCenter}
end structure List = struct structure SingleLine = struct style element style icon style list fun make es = fun item i =
  • {i.Icon} {i.Content}
  • end end