# small-cup

> a small javascript front end framework

Latest version **0.3.3** (published 2023-12-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install small-cup
pnpm add small-cup
yarn add small-cup
bun add small-cup
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.3 |
| Published | 2023-12-06 |
| First published | 2022-08-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 18 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | ailnaf |

## Links

- npm: https://www.npmjs.com/package/small-cup
- Repository: https://github.com/fanlia/small-cup
- Homepage: https://github.com/fanlia/small-cup#readme
- Issues: https://github.com/fanlia/small-cup/issues
- npm.io page: https://npm.io/package/small-cup

## Recent versions

- 0.3.3 (latest) — 2023-12-06
- 0.3.2 — 2023-12-05
- 0.3.1 — 2023-12-05
- 0.3.0 — 2023-12-03
- 0.2.3 — 2023-11-28
- 0.2.2 — 2023-11-27
- 0.2.1 — 2023-11-26
- 0.2.0 — 2023-11-26
- 0.1.12 — 2023-01-01
- 0.1.11 — 2022-11-18
- 0.1.10 — 2022-11-18
- 0.1.9 — 2022-09-29
- 0.1.8 — 2022-09-29
- 0.1.7 — 2022-09-29
- 0.1.6 — 2022-09-27
- … 6 more at https://npm.io/package/small-cup/versions

## README

# small-cup
a small javascript front end framework

## Getting started

```sh
mkdir myapp
cd myapp
npm init small-cup@latest
```

## API

```graphql

enum DOMType { static dynamic }

type DOM {
    node: HTMLNode
    children: [DOM]
    map: {[String]: DOM}
    type: DOMType
    root: Boolean
    update: () => {}
    unload: () => {}
}

type Component {
    template: String
    onload: (el: HTMLNode, ctx: Object, rootDom: DOM) => undefined | Component
    components: {[key: String]: Component}
}

type ElementVNodeData {
    tag: String
    props: Object
    children: undefined | [ChildVNode]
}

type TextVNodeData = String

type VNodeData = ElementVNodeData | TextVNodeData

enum VNodeType { element text }

type VNode {
    type: VNodeType
    data: VNodeData
}

type ChildVNode = String | VNode

```

### render(root: HTMLNode, vnode: VNode, context: Object) => DOM

render vnode to root with context

### mount(root: HTMLNode, vnode: VNode, context: Object)

render vnode to root with context when window.onpopstate triggerd

### h(tag: String | HTMLNode, props: Object, children: undefined | [ChildVNode]) => VNode | HTMLNode

patch or create HTMLNode

## Usage

```html
<script type="module">
import { render, mount, h } from 'https://unpkg.com/small-cup/index.js'
</script>
```

```sh
npm i small-cup
```

## Test

```sh
npm start
```

## License

MIT

---
_Source: https://npm.io/package/small-cup · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
