0.7.0 • Published 1 year ago

@vimesh/headless v0.7.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Vimesh Headless UI

Features

This is Alpine.js implementation of Tailwind Headless UI. Built with Vimesh UI framework, Vimesh Headless UI has some nice features:

Ultra lightweight

Vimesh Headless UI has much smaller code size

ComponentsVimesh Headless UITailwind Headless UI for VueTailwind Headless UI for React
Listbox8k34k30k
Combobox9k25k39k
Menu7k18k20k
Switch0.6k5k6k
Tabs4k12k16k
Dialog2k15k17k
Popover6k23k28k
Radio Group1k11k14k

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).

VimeshTailwind
npm.ionpm.io
192k425k

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.

<template x-component:page="dialog-basic" x-import="hui:dialog,menu" x-data="setupDialogBasicData()"
    class="overflow-y-auto">
    ...
    <hui-dialog :open="isOpen" @close="setIsOpen(false)">
        ...
        <hui-menu>
        </hui-menu>
    </hui-dialog>
    ...
</template>

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.

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://127.0.0.1:8080/playground/dev.html

It shows an index page npm.io

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

npm.io

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.

<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

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.

0.7.0

1 year ago

0.6.0

1 year ago

0.5.0

1 year ago

0.4.1

1 year ago

0.4.0

1 year ago

0.3.1

1 year ago

0.3.0

1 year ago

0.1.0

1 year ago