https://github.com/jacob-ebey/dream
What if...
https://github.com/jacob-ebey/dream
Last synced: about 1 year ago
JSON representation
What if...
- Host: GitHub
- URL: https://github.com/jacob-ebey/dream
- Owner: jacob-ebey
- Created: 2024-10-19T02:40:32.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-01T05:31:04.000Z (over 1 year ago)
- Last Synced: 2025-04-15T22:35:28.883Z (about 1 year ago)
- Language: TypeScript
- Size: 298 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Dream
Dream is a set of tools for building web applications with familiar patterns. It's built on native web APIs and is designed with the "use the platform" and "progressive enhancement" philosophies in mind.
## The Pieces
### JSX Runtime
A stateless JSX runtime that renders to either a `ReadableStream` for server rendering, and a `ReadableStream` for use use in the browser.
It supports:
- the `react-jsx` runtime
- the `h()` function from Preact
- sync and async functional components
- sync and async generator components
- there is no event / callback system, therefor
- callbacks such as `onclick` accept strings and render the JS in the attribute
### Browser Runtime
The browser runtime consists of two sides, the declarative API and the programmatic API.
#### Declarative API
Taking after HTMX, attributes are used to build dynamic interfaces.
Supported attributes are:
- hx-target
- hx-swap
- hx-indicator
- hx-disabled-elt
#### Programmatic API
Sometimes the built in declarative API isn't enough to fulfil complex scenarios such as optimistic UI. In these cases we can implement our own declarative APIs with custom elements and utilize the internals of the declarative API.
Supported exports are:
- `swap` - Render JSX into the DOM
- `defineElement` - A small wrapper around `customElements.define` to help with HMR
- `querySelectorExt` - An extended query selector
- `querySelectorAllExt` - An extended query selector all