muu

DEPRECATED lightweight JS framework
git clone https://git.ce9e.org/muu.git

NameSize
.bowerrc27B
.build/externs.js453B
.build/template.js1396B
.doc/conf.json206B
.doc/styles/jsdoc-default.css1974B
.doc/tutorials/phonecat.md6908B
.gitignore21B
.jshintrc395B
.travis.yml1890B
CHANGES.md3727B
Gruntfile.js3288B
LICENSE18046B
Makefile1706B
README.md4458B
bower.json642B
dist/muu-core.js26748B
dist/muu-core.min.js5406B
dist/muu.js47527B
dist/muu.min.js9769B
examples/example/example.js1901B
examples/example/index.html233B
examples/example/muu-moment.js619B
examples/phonecat/index.html204B
examples/phonecat/phonecat.html353B
examples/phonecat/phonecat.js1364B
examples/phonecat/phones.json6837B
package.json544B
src/directive.js7449B
src/dom-helpers.js4747B
src/index.js444B
src/js-helpers.js4016B
src/location.js3937B
src/registry.js4745B
src/search.js1623B
src/template.js6512B
src/update-dom.js3384B
test/index.html650B
test/run.js1332B
test/test-directive.js13406B
test/test-dom-helpers.js7195B
test/test-js-helpers.js9198B
test/test-registry.js5853B
test/test-search.js1893B
test/test-template.js4109B
test/test-update-dom.js4705B
test/travis.html863B

Deprecated

I have switched to a simpler system based directly on virtual-dom. I still like many of the ideas from this project, it will no longer be maintained.


muu offers angular inspired directives, but with a strong focus on simplicity and modularity rather than performance and completeness.

While this currently is only about directives and data binding, other aspects of angular may be added later on.

For an introduction to the concepts, see the {@tutorial phonecat} tutorial.

Getting started

Muu can be installed with bower:

bower install xi/muu

It can be used either as AMD module or global variable.

See this tutorial for what you can do once muu is loaded.

custom builds

Not all parts of muu are required. This repository contains a minimal build in dist/muu-core.js. It requires lodash and an external templating system, e.g. mustache.js:

var registry = new muu.Registry({
    renderer: Mustache.render
});

In addition, muu.$location is not available.

history

I have worked a bit with angular and found it to be a great set of features. But I always wondered why this set is wrapped in a monolithic framework. Why can't I have $location or $http on their own?

So I started looking around for more modular, more lightweight solutions for things I liked about angular. One such thing is wrapping XMLHttpRequest in native ES6 Promises.

Probably the most important aspect of angular is data binding. It gives you a nice abstraction for all DOM interactions. However, I have some issues with the way angular does this:

So I started an experiment to create a data binding system that was as minimal and close to existing standards as possible.

The initial idea was to have a template that is rendered with the data from my scope. The result is diffed with the existing DOM and a minimal set of changes is applied. This way, I hoped, you could have data binding with any templating engine. As it turns out, it is not that simple.

One big issue was that, once the template had been rendered, I had lost the information about which part of the DOM represented which variable. So having two-way data binding was near impossible.

As explained above, I had not been to keen about two-way data binding anyway, so that was not that much of a problem. I just created a second channel to receive information from the DOM (based on forms) and another one for receiving events.

For several reason, I also wanted to have directives. Now in angular, you can use directives, but you don't have to. In my experience, that is the source of much confusion. So I wrapped all the functionality described above in directives.

misc

Yet another framework?

This is an experiment, not an actual framework for use in production. So the main objective is to learn something from it.

Then again, this whole thing is so little that it is more of a concept or methodology than a software. I guess it is ok to use a framework if it is tiny and does not force you to do everything in a specific way.

Why the name

I started with "modular angular" which was not very catchy and also too long to use it as a prefix in code. I somehow stuck with "muu".

I later learned that there is an old Chinese word "muu" that means "emptiness" which fits quite will with approach of so little framework that it is basically a mere methodology rather than code.

modularity

I started out using lodash for JavaScript helpers, jquery for DOM helpers and mustache as templating system. I later switched to custom code ({@link module:js-helpers}, {@link module:dom-helpers} and {@link module:template}). But switching back to more stable libraries should be fairly simple. In the case of templating, you can even select an engine in the {@link Registry} configuration.