Skip to content

Commit

Permalink
The first complete readme
Browse files Browse the repository at this point in the history
  • Loading branch information
xinjie-zhang committed Jan 8, 2023
1 parent 1477717 commit a7ee4fe
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 10 deletions.
66 changes: 57 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Vimesh Headless UI
This is Alpine.js implementation of [Tailwind Headless UI](https://headlessui.com/). Built with [Vimesh UI](https://github.com/vimeshjs/vimesh-ui) framework, Vimesh Headless UI has some unique features:
## Ultra lightweight
Vimesh Headless UI has much less code size
## Features
This is Alpine.js implementation of [Tailwind Headless UI](https://headlessui.com/). Built with [Vimesh UI](https://github.com/vimeshjs/vimesh-ui) framework, Vimesh Headless UI has some nice features:
### Ultra lightweight
Vimesh Headless UI has much smaller code size

| Component | Vimesh Headless UI | Tailwind Headless UI for Vue | Tailwind Headless UI for React |
| Components | Vimesh Headless UI | Tailwind Headless UI for Vue | Tailwind Headless UI for React |
| ----------- | -------------------- | -------- | ----- |
| Listbox | 8k | 34k | 30k |
| Combobox | 9k | 25k | 39k |
Expand All @@ -14,15 +15,15 @@ Vimesh Headless UI has much less code size
| Popover | 6k | 23k | 28k |
| Radio Group | 1k | 11k | 14k |

Comparing the production version of Vimesh and Tailwind headless dialog example page size, Vimesh is much smaller with more features and less bugs (check the menu display in the popup dialog).
Comparing the production version of Vimesh and Tailwind headless dialog example page size, Vimesh is much smaller with more features and less bugs (check the menu display in the tailwind popup dialog).

| Vimesh | Tailwind |
| ---- | ---- |
| ![](./assets/vimesh001.png) | ![](./assets/tailwind001.png) |
| 192k | 425k |

## Load only used components dynamically
Components are plain html files, which could be hosted anywhere, normally at CDN. They could be shared cross different projects without extra tree shaking magic. For example, the dialog basic example uses two components `hui-dialog` and `hui-menu`. Just load them asynchronously with `x-import`, [Vimesh UI](https://github.com/vimeshjs/vimesh-ui) registers native custom elements and initialize them.
### Load only used components dynamically
Components are plain html files, which could be hosted anywhere, normally at CDN. They could be shared cross different projects without extra tree shaking magic. For example, the dialog basic example uses two components `hui-dialog` and `hui-menu`. Just load them asynchronously with `x-import`. Vimesh UI registers corresponding native custom elements and initialize them.

```html
<template x-component:page="dialog-basic" x-import="hui:dialog,menu" x-data="setupDialogBasicData()"
Expand All @@ -37,7 +38,54 @@ Components are plain html files, which could be hosted anywhere, normally at CDN
</template>
```

## No build, no bundle
### No build, no bundle
What you write is what you get. Organize components to html files under meaningful namespaces. You do not need webpack, rollup, vite etc.

## Easy to debug
## Getting Started
### Development mode
Install development dependencies, including alpinejs, @vimesh/style, @vimesh/ui, universal-router and http-server.
```
yarn
```
Run static http server
```
yarn dev
```
Open the url `http:https://127.0.0.1:8080/playground/dev.html`

It shows an index page
![](./assets/vimesh002.jpg)

There are many examples for different components with relative source code.

![](./assets/vimesh003.jpg)

It uses development version of alpinejs and @vimesh/ui in the node_modules folder.

### Production mode
Please check `playground/index.html`, which use the latest alpinejs and @vimesh/ui at `unpkg.com`. In fact it is also what you would do if you use Vimesh Headless UI in your real projects.
``` html
<head>
<link rel="icon" type="image/x-icon" href="./assets/favicon.ico">

<script src="https://unpkg.com/@vimesh/style"></script>
<script src="https://unpkg.com/@vimesh/ui"></script>
<script src="https://unpkg.com/alpinejs" defer></script>
<script src="https://unpkg.com/universal-router/universal-router.min.js"></script>

<script>
const DEBUG = false
$vui.config.debug = DEBUG
$vui.config.importMap = {
"hui": '../components/${component}.html' + (DEBUG ? '?v=' + new Date().valueOf() : '?v=0.1'),
"app": './components/${path}${component}.html' + (DEBUG ? '?v=' + new Date().valueOf() : '?v=0.1'),
"page": './pages/${path}${component}.html' + (DEBUG ? '?v=' + new Date().valueOf() : '?v=0.1'),
}
</script>
...
</head>
```

[Online Playground](https://unpkg.com/@vimesh/headless/playground/index.html)

Yes, the online playground are 100% plain html hosted at `unpkg.com`. It is very old school style, right? Let's make frondend development back to what it should be.
Binary file added assets/vimesh002.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/vimesh003.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vimesh/headless",
"version": "0.6.0",
"version": "0.7.0",
"repository": "https://github.com/vimeshjs/vimesh-headless.git",
"author": "Jacky ZHANG <[email protected]>",
"license": "MIT",
Expand Down

0 comments on commit a7ee4fe

Please sign in to comment.