webwire-0.1.0: Functional reactive web framework

MaintainerErtugrul Soeylemez <es@ertes.de>

WebWire.Widget

Contents

Description

HTML widgets, inspired by Yesod.

Synopsis

Widget type

data Widget Source

A widget is essentially a full HTML page splitted into the actual HTML markup and its dependencies like CSS and JavaScript.

Constructors

Widget 

Fields

wgtBody :: Html

HTML body.

wgtHeadCSS :: [Text]

CSS source code to add.

wgtHeadJS :: [Text]

JavaScript source code to add.

wgtLinkCSS :: [Text]

CSS links to add.

wgtLinkJS :: [Text]

JavaScript links to add.

wgtTitle :: [Text]

Page title parts.

Instances

Monoid Widget

The empty widget is an HTML page with an empty body and no dependencies. The sum of two widgets is the concatenation of the individual HTML markups and the union of their dependencies, such that external stylesheets or JavaScript files are only included once.

ToHtml Widget

A widget can be converted into HTML with a default page template. This should suffice for simple websites.

Renderable Widget

Widgets render to HTML in the way specified in WebWire.Widget.

Adding content

bodyW :: Html -> WidgetSource

Widget with an HTML body fragment.

hamletW :: HtmlUrl a -> WidgetSource

Widget with an HTML body fragment from Hamlet.

titleW :: Text -> WidgetSource

Widget with a title segment.

Stylesheets

cassiusW :: CssUrl a -> WidgetSource

Widget with an inline CSS stylesheet rendered by Cassius or Lucius.

cssLinkW :: Text -> WidgetSource

Widget with an external CSS link.

cssW :: Text -> WidgetSource

Widget with an inline CSS stylesheet.

JavaScript

jsLinkW :: Text -> WidgetSource

Widget with an external JavaScript link.

jsW :: Text -> WidgetSource

Widget with inline JavaScript.

juliusW :: JavascriptUrl a -> WidgetSource

Widget with inline JavaScript rendered by Julius.