mirror of https://github.com/n2geoff/um
doc tweaks
This commit is contained in:
parent
e9b736dec3
commit
071f3c962c
10
README.md
10
README.md
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
Um, is an experimental composable UI builder that takes ideas from early [hyperapp](https://github.com/jorgebucaran/hyperapp) design, but does not stick to strict Elm Architecture.
|
Um, is an experimental composable UI builder that takes ideas from early [hyperapp](https://github.com/jorgebucaran/hyperapp) design, but does not stick to strict Elm Architecture.
|
||||||
|
|
||||||
Um, because you should think about NOT using it.
|
Um, because you should think about, um, NOT using it.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
- No Virtual Dom
|
- No Virtual Dom
|
||||||
|
@ -15,7 +15,7 @@ Um, because you should think about NOT using it.
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
The library only has 2 functions, `app()` and `h()`, and the later is optional.
|
**Um** only has 2 exported functions, `app()` and `h()`, and the later is optional.
|
||||||
|
|
||||||
### app({opts})
|
### app({opts})
|
||||||
|
|
||||||
|
@ -28,17 +28,19 @@ The `app()` is the builder function and takes an `opts` object:
|
||||||
| `state` | `{}` | initial data state |
|
| `state` | `{}` | initial data state |
|
||||||
| `actions` | `{}` | function object passed to view |
|
| `actions` | `{}` | function object passed to view |
|
||||||
| `view` | `(state, actions) => null` | function that takes state and actions and returns valid dom |
|
| `view` | `(state, actions) => null` | function that takes state and actions and returns valid dom |
|
||||||
| `mount` | "body" | valid query selector as mounting point |
|
| `mount` | `body` | valid query selector as mounting point |
|
||||||
|
|
||||||
#### Output:
|
#### Output:
|
||||||
|
|
||||||
|
> WARNING: May change in future
|
||||||
|
|
||||||
| Property | Description |
|
| Property | Description |
|
||||||
| --------------- | --------------------------------------------- |
|
| --------------- | --------------------------------------------- |
|
||||||
| `state([data])` | state function to get or update internal data |
|
| `state([data])` | state function to get or update internal data |
|
||||||
|
|
||||||
### h(tag, [...args])
|
### h(tag, [...args])
|
||||||
|
|
||||||
The `h()` is an **optional** hypertext build utility that weighs in around **~250b** and is provided as *a* way to build out your view markdown, but you can build your view using any method you like as long as it returns valid dom.
|
The `h()` is an **optional** hypertext build utility that weighs in around **~250b** and is provided as *a* way to build out your `view` DOM, but you can build your `view` using any method you like as long as it returns valid DOM.
|
||||||
|
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
/**
|
/**
|
||||||
* App Builder
|
* App Builder
|
||||||
*
|
*
|
||||||
* Composes data, views, actions together as
|
* Composes state, actions, view together as
|
||||||
* mountable ui
|
* mountable ui
|
||||||
*
|
*
|
||||||
* @param {Object} opts options
|
* @param {Object} opts options bag of state, view, actions, and mount
|
||||||
* @param {Object} opts.state initial app object state
|
* @param {Object} opts.state initial app object state
|
||||||
* @param {Function} opts.view function that returns dom. state and actions are passed in
|
* @param {Function} opts.view function that returns dom. state and actions are passed in
|
||||||
* @param {Object} opts.actions object functions includes and return state
|
* @param {Object} opts.actions object functions includes and return state
|
||||||
* @param {String} opts.mount querySelector value
|
* @param {String} opts.mount querySelector value
|
||||||
* @returns
|
*
|
||||||
|
* @returns {Object} state proxy object
|
||||||
*/
|
*/
|
||||||
export default function app(opts) {
|
export default function app(opts) {
|
||||||
// initial setup
|
// initial setup
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/**
|
/**
|
||||||
* HTML Tag Scripting Function
|
* HTML Tag Scripting Function
|
||||||
*
|
*
|
||||||
* creates new DOM element(s) from tag name(s) and attributes
|
* Generates new DOM element(s) from a tag, attributes
|
||||||
*
|
*
|
||||||
* @param {String} tag - tag to create
|
* @param {string} tag - tag name
|
||||||
* @param {*} args - attributes and/or child tag elements
|
* @param {any} args - attributes, text or array of child elements
|
||||||
*
|
*
|
||||||
* @returns {HTMLElement} The created DOM element(s)
|
* @returns {HTMLElement} The created DOM element(s)
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue