0.6.0 • Published 8 years ago

nhg v0.6.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

Not Mercury Build Status Dependency Status devDependency Status

All of the infinite brilliance of Raynos' Mercury framework, without "mercury".

nhg is basically just mercury but without mercury. If you've ever read the source code for mercury (which you should, it's very short) you can see that it is basically a collection of independant modules and some glue code.

This repository breaks out those modules into their own files for browserify efficiency and uses the modularized versions of the glue code (largely thanks to Ben Drucker). This repository contains no actual code, this is just for npm convenience.

Installation

npm install nhg

Usage

'use strict';

var document = require('nhg/document');
var h = require('nhg/h');
var State = require('nhg/state');
var Value = require('nhg/value');
var Send = require('nhg/send');
var RunApp = require('nhg/app');

function App() {
    return State({
        value: Value(0),
        channels: {
            clicks: incrementCounter
        }
    });
}

function incrementCounter(state) {
    state.value.set(state.value() + 1);
}

App.render = function render(state) {
    return h('div.counter', [
        'The state ', h('code', 'clickCount'),
        ' has value: ' + state.value + '.', h('input.button', {
            type: 'button',
            value: 'Click me!',
            'ev-click': Send(state.channels.clicks)
        })
    ]);
};

RunApp(document.body, App(), App.render);

Modules

nhg/app

Module: main-loop-app

nhg/array

Module: observ-array

nhg/base-event

Module: value-event/base-event

nhg/computed

Module: observ/computed

nhg/create

Module: virtual-dom/create-element

nhg/delegator

Module: dom-delegator

nhg/diff

Module: virtual-dom/diff

nhg/document

Module: global/document

nhg/event

Module: weakmap-event

nhg/h

Module: virtual-dom/h

nhg/main

Module: main-loop

nhg/thunk

Module: vdom-thunk

nhg/patch

Module: virtual-dom/patch

nhg/router

Module: sour

nhg/send-change

Module: value-event/change

nhg/send-click

Module: value-event/click

nhg/send-event

Module: value-event/value

nhg/send-key

Module: value-event/key

nhg/send-submit

Module: value-event/submit

nhg/send

Module: value-event/event

nhg/state

Module: dover

nhg/struct

Module: observ-struct

nhg/svg

Module: virtual-dom/virtual-hyperscript/svg

nhg/value

Module: observ

nhg/varhash

Module: observ-varhash

nhg/watch

Module: observ/watch

nhg/window

Module: global/window

Contributing

Do not contribute code to this repository, create or update modules it depends on and make PR's to update the dependency.

npm run test

License

MIT