(* 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 make : int (* radius *) -> transaction {Placeholder : xbody, Trigger : {X : int, Y : int} -> transaction unit} end = struct style ink fun inkStyle radius xy = let fun p a b = value (property a) (atom (show b ^ "px")) val diameter = 2 * radius in oneProperty (oneProperty (oneProperty (oneProperty noStyle (p "width" diameter)) (p "height" diameter)) (p "left" (xy.X - radius))) (p "top" (xy.Y - radius)) end fun inkAnimation radius s = | Some xy => ) } /> fun make radius = center <- source None; return {Placeholder = inkAnimation radius center, Trigger = fn xy => set center (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; ink <- Ripple.make (width / 2); return (inNewStackingContext
{ink.Placeholder} ink.Trigger {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 clickHandler = ink <- Ripple.make (width / 2); return
{ink.Placeholder}
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