An open API service indexing awesome lists of open source software.

https://github.com/cloudspeech/sig-html

A micro framework featuring signals + lit-html template syntax
https://github.com/cloudspeech/sig-html

Last synced: about 1 month ago
JSON representation

A micro framework featuring signals + lit-html template syntax

Awesome Lists containing this project

README

        

# sig-html
sig-html is a micro framework for web apps based on plain or computed signals + lit-html template syntax.

How micro? **943** bytes, when maximally Brotli-compressed!

## Status
This is alpha-quality software and as such not ready for production.

## Counter Example

```js


Counter Example in sig-html





import {html, render, Signal} from './index.js';
const container = document.querySelector('.app');
const counter = new Signal(0);
const app = html `<h1 title="${counter}">${document.title}</h1>
<div class="container">
<button @click="${e => counter.value++}">+</button>
<span class="value">${counter}</span>
<button @click="${e => counter.value--}">-</button>
</div>`;
render(container, app);

```

## Supported lit-html syntax

```html

alert(e)}">${5}

```
This is a subset of the [full lit-html syntax](https://lit.dev/docs/templates/expressions/).

## Known restrictions:
- Signals are the only mechanism provided for reactivity
- any template literal variables must span the _entire_ attribute value or text content in which it occurs, i.e. no `some ${aTemplateVariable} followed by other text or template variable` is allowed (for now)
- no HTML validation or sanitizing whatsoever
- no careful memory or performance optimizations (yet)

## How to try it out

1. Install [bun](https://bun.sh)
2. bun install
3. bun start
4. Point your browser to http://localhost:8080/index.html **or** http://localhost:8080/counter.html **or** http://localhost:8080/spreadsheet.html **or** http://localhost:8080/eventlog.html