diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b25c15b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*~ diff --git a/mithril.scm b/mithril.scm new file mode 100644 index 0000000..21abfc7 --- /dev/null +++ b/mithril.scm @@ -0,0 +1,31 @@ +(define (mithril:init) + "(mithril:init) + +Loads Mithril into the document head and sets the +pragma->sxml function." + (get-resource ) + (pragma->sxml m)) + +(define-macro (mithril:comp view . args) + "(mithril:comp view . args) + +Creates a Mithril component object, where VIEW is +a function body used to display the component, and +ARGS is a list of keyword-value pairs that specify +additional values on the component object. + +For example, the following code creates a stateful +heading component: +``` +(define Heading + (component + (sxml + (h1 ~vnode.state.title)) + :title \"Title Text\")) +```" + (when (= (remainder (length args) 2 1)) + (error "Component macro expects even length args list.")) + `(object + :view + (lambda (vnode) (,@view)) + ,@args)) diff --git a/nitinol.scm b/nitinol.scm new file mode 100644 index 0000000..8d7dda7 --- /dev/null +++ b/nitinol.scm @@ -0,0 +1 @@ +(include "mithril.scm")