eddyystop / mithril-components

Components, mixins, patterns and sample code for mithril (lhorie/mithril.js)
MIT License
114 stars 3 forks source link

[mithril-components] (https://github.com/eddyystop/mithril-components)

Components, mixins, patterns and code for [mithril] (https://github.com/lhorie/mithril.js).

Installation

bower install git://github.com/eddyystop/mithril-components

Running examples

Many examples may be run without the server. Just run the HTML file.

Others require the node.js server. You can install it from http://nodejs.org/. Then load the this repo's dependencies with npm install.

Start the server with node app.js and point your browser to http://localhost:3000/public/FormMixin.html for example.

Components

You may extract the files you need with a build tool, or you may use the front-end packaging tool [component] (https://github.com/component/component).

UI Components

Occlusion components

Occlusion implementations helps you implement efficient components that render only what is visible on the screen. They are useful for large tables, large lists, infinite scrolling, deferring rendering of below-the-fold content, and parallax sites.

Mixins

Mixin ValidationMixin resides in mixins/ValidationMixins/. Docs are in the readme. A working example, if any, is located at public/ValidationMixin.html.

Patterns

Pattern seo-by-cleanup resides in patterns/seo-by-cleanup.js . A working example, if any, is located at public/seo-by-cleanup.html

Basic

Services - just throwing things inline for now

var Thing = {
  list: function(options) {
    return m.request({method: "GET", url: "/thing", config: function(xhr) { xhr.onprogress = options.progress }})
  }
}
Thing.list({progress: function(e) { console.log("progress: ", e) }})

More obscure

SEO / server rendered first page

Code

First page loading

License

Copyright (c) 2014 John Szwaronek (johnsz9999@gmail.com). Distributed under the MIT license. See LICENSE.md for details.