doc tweaks

This commit is contained in:
Geoff Doty 2024-05-22 12:34:59 -04:00
parent e9b736dec3
commit 071f3c962c
3 changed files with 13 additions and 10 deletions

View File

@ -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

View File

@ -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

View File

@ -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)
*/ */