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, because you should think about NOT using it.
|
||||
Um, because you should think about, um, NOT using it.
|
||||
|
||||
## Features
|
||||
- No Virtual Dom
|
||||
|
@ -15,7 +15,7 @@ Um, because you should think about NOT using it.
|
|||
|
||||
## 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})
|
||||
|
||||
|
@ -28,17 +28,19 @@ The `app()` is the builder function and takes an `opts` object:
|
|||
| `state` | `{}` | initial data state |
|
||||
| `actions` | `{}` | function object passed to view |
|
||||
| `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:
|
||||
|
||||
> WARNING: May change in future
|
||||
|
||||
| Property | Description |
|
||||
| --------------- | --------------------------------------------- |
|
||||
| `state([data])` | state function to get or update internal data |
|
||||
|
||||
### 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
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
/**
|
||||
* App Builder
|
||||
*
|
||||
* Composes data, views, actions together as
|
||||
* Composes state, actions, view together as
|
||||
* 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 {Function} opts.view function that returns dom. state and actions are passed in
|
||||
* @param {Object} opts.actions object functions includes and return state
|
||||
* @param {String} opts.mount querySelector value
|
||||
* @returns
|
||||
*
|
||||
* @returns {Object} state proxy object
|
||||
*/
|
||||
export default function app(opts) {
|
||||
// initial setup
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/**
|
||||
* 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 {*} args - attributes and/or child tag elements
|
||||
* @param {string} tag - tag name
|
||||
* @param {any} args - attributes, text or array of child elements
|
||||
*
|
||||
* @returns {HTMLElement} The created DOM element(s)
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue