├── .gitignore ├── LICENSE ├── README.md ├── assets ├── tailwind001.png ├── vimesh001.png ├── vimesh002.jpg └── vimesh003.jpg ├── components ├── combobox.html ├── dialog.html ├── listbox.html ├── menu.html ├── popover.html ├── radio-group.html ├── switch.html └── tabs.html ├── package.json └── playground ├── assets ├── favicon.ico ├── logo.svg ├── prism.css └── prism.js ├── components ├── code-viewer.html ├── header.html ├── key-caster.html ├── m3 │ └── app │ │ ├── float-menu.html │ │ ├── footer.html │ │ ├── on-this-page.html │ │ ├── page-container.html │ │ ├── side-menu.html │ │ ├── tab-list.html │ │ └── topbar.html └── side-menu.html ├── data └── side-menu.json ├── dev.html ├── index.html ├── m3.html ├── m3dev.html └── pages ├── combobox ├── basic.html ├── command-palette-group.html ├── command-palette.html └── multi-select.html ├── dialog ├── basic.html └── slide-over.html ├── home.html ├── listbox ├── basic.html ├── multi-elements.html └── multi-select.html ├── m3 ├── develop │ ├── android │ │ ├── jetpack-compose.html │ │ └── mdc-android.html │ ├── flutter.html │ ├── overview.html │ └── web.html ├── foundations │ ├── accessible-design.html │ └── overview.html ├── get-started.html └── home.html ├── menu ├── basic.html ├── multiple-elements.html ├── with-popper.html ├── with-transition-and-popper.html └── with-transition.html ├── popover └── basic.html ├── radio-group └── basic.html ├── switch └── basic.html └── tabs └── basic.html /.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | .DS_Store 3 | dev/ 4 | ref/ 5 | node_modules/ 6 | yarn.lock 7 | doc 8 | __tests__ 9 | tailwind.config.js -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Vimesh 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Vimesh Headless UI 2 | ## Features 3 | 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: 4 | ### Ultra lightweight 5 | Vimesh Headless UI has much smaller code size 6 | 7 | | Components | Vimesh Headless UI | Tailwind Headless UI for Vue | Tailwind Headless UI for React | 8 | | ----------- | -------------------- | -------- | ----- | 9 | | Listbox | 8k | 34k | 30k | 10 | | Combobox | 9k | 25k | 39k | 11 | | Menu | 7k | 18k | 20k | 12 | | Switch | 0.6k | 5k | 6k | 13 | | Tabs | 4k | 12k | 16k | 14 | | Dialog | 2k | 15k | 17k | 15 | | Popover | 6k | 23k | 28k | 16 | | Radio Group | 1k | 11k | 14k | 17 | 18 | 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). 19 | 20 | * Vimesh (192k) 21 | ![](./assets/vimesh001.png) 22 | * Tailwind (425k) 23 | ![](./assets/tailwind001.png) 24 | 25 | ### Load only used components dynamically 26 | 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. 27 | 28 | ```html 29 | 39 | ``` 40 | 41 | ### No build, no bundle 42 | What you write is what you get. Organize components to html files under meaningful namespaces. You do not need webpack, rollup, vite etc. 43 | 44 | ## Getting Started 45 | ### Development mode 46 | Install development dependencies, including alpinejs, @vimesh/style, @vimesh/ui, universal-router and http-server. 47 | ``` 48 | yarn 49 | ``` 50 | Run static http server 51 | ``` 52 | yarn dev 53 | ``` 54 | Open the url `http://127.0.0.1:8080/playground/dev.html` 55 | 56 | It shows an index page 57 | ![](./assets/vimesh002.jpg) 58 | 59 | There are many examples for different components with relative source code. 60 | 61 | ![](./assets/vimesh003.jpg) 62 | 63 | It uses development version of alpinejs and @vimesh/ui in the node_modules folder. 64 | 65 | ### Production mode 66 | 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. 67 | ``` html 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 85 | ... 86 | 87 | ``` 88 | 89 | [Online Playground](https://unpkg.com/@vimesh/headless/playground/index.html) 90 | 91 | 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. -------------------------------------------------------------------------------- /assets/tailwind001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vimeshjs/vimesh-headless/5a1abed7adee6e704ec02a7b3f4a79b4b6260873/assets/tailwind001.png -------------------------------------------------------------------------------- /assets/vimesh001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vimeshjs/vimesh-headless/5a1abed7adee6e704ec02a7b3f4a79b4b6260873/assets/vimesh001.png -------------------------------------------------------------------------------- /assets/vimesh002.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vimeshjs/vimesh-headless/5a1abed7adee6e704ec02a7b3f4a79b4b6260873/assets/vimesh002.jpg -------------------------------------------------------------------------------- /assets/vimesh003.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vimeshjs/vimesh-headless/5a1abed7adee6e704ec02a7b3f4a79b4b6260873/assets/vimesh003.jpg -------------------------------------------------------------------------------- /components/combobox.html: -------------------------------------------------------------------------------- 1 | 114 | 115 | 123 | 153 | 154 | 173 | 243 | -------------------------------------------------------------------------------- /components/dialog.html: -------------------------------------------------------------------------------- 1 | 35 | 44 | 52 | 60 | -------------------------------------------------------------------------------- /components/listbox.html: -------------------------------------------------------------------------------- 1 | 92 | 93 | 104 | 105 | 140 | 141 | 187 | 188 | -------------------------------------------------------------------------------- /components/menu.html: -------------------------------------------------------------------------------- 1 | 80 | 81 | 116 | 117 | 167 | 168 | -------------------------------------------------------------------------------- /components/popover.html: -------------------------------------------------------------------------------- 1 | 36 | 44 | 90 | 135 | -------------------------------------------------------------------------------- /components/radio-group.html: -------------------------------------------------------------------------------- 1 | 14 | 15 | -------------------------------------------------------------------------------- /components/switch.html: -------------------------------------------------------------------------------- 1 | 4 | 5 | 20 | 21 | 24 | 25 | -------------------------------------------------------------------------------- /components/tabs.html: -------------------------------------------------------------------------------- 1 | 30 | 41 | 73 | 84 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@vimesh/headless", 3 | "version": "0.7.0", 4 | "repository": "https://github.com/vimeshjs/vimesh-headless.git", 5 | "author": "Jacky ZHANG ", 6 | "license": "MIT", 7 | "scripts": { 8 | "dev": "http-server" 9 | }, 10 | "dependencies": {}, 11 | "devDependencies": { 12 | "@alpinejs/persist": "^3.13.0", 13 | "@iconscout/unicons": "^4.0.8", 14 | "@vimesh/style": "^1.1.0", 15 | "@vimesh/ui": "^0.12.4", 16 | "alpinejs": "^3.10.5", 17 | "http-server": "^14.1.1", 18 | "universal-router": "^9.1.0" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /playground/assets/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vimeshjs/vimesh-headless/5a1abed7adee6e704ec02a7b3f4a79b4b6260873/playground/assets/favicon.ico -------------------------------------------------------------------------------- /playground/assets/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 编组 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /playground/assets/prism.css: -------------------------------------------------------------------------------- 1 | /* PrismJS 1.29.0 2 | https://prismjs.com/download.html#themes=prism-tomorrow&languages=markup+css+clike+javascript */ 3 | code[class*=language-],pre[class*=language-]{color:#ccc;background:0 0;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#2d2d2d}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.block-comment,.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#999}.token.punctuation{color:#ccc}.token.attr-name,.token.deleted,.token.namespace,.token.tag{color:#e2777a}.token.function-name{color:#6196cc}.token.boolean,.token.function,.token.number{color:#f08d49}.token.class-name,.token.constant,.token.property,.token.symbol{color:#f8c555}.token.atrule,.token.builtin,.token.important,.token.keyword,.token.selector{color:#cc99cd}.token.attr-value,.token.char,.token.regex,.token.string,.token.variable{color:#7ec699}.token.entity,.token.operator,.token.url{color:#67cdcc}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}.token.inserted{color:green} 4 | -------------------------------------------------------------------------------- /playground/components/code-viewer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /playground/components/header.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /playground/components/key-caster.html: -------------------------------------------------------------------------------- 1 | 56 | -------------------------------------------------------------------------------- /playground/components/m3/app/footer.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /playground/components/m3/app/on-this-page.html: -------------------------------------------------------------------------------- 1 | 29 | -------------------------------------------------------------------------------- /playground/components/m3/app/page-container.html: -------------------------------------------------------------------------------- 1 | 17 | 18 | -------------------------------------------------------------------------------- /playground/components/m3/app/side-menu.html: -------------------------------------------------------------------------------- 1 | 12 | -------------------------------------------------------------------------------- /playground/components/m3/app/tab-list.html: -------------------------------------------------------------------------------- 1 | 39 | -------------------------------------------------------------------------------- /playground/components/m3/app/topbar.html: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /playground/components/side-menu.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /playground/data/side-menu.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/home", 4 | "name": "Home", 5 | "icon": "home", 6 | "color": "neutral", 7 | "children": [] 8 | }, 9 | { 10 | "path": "/get-started", 11 | "name": "Get started", 12 | "icon": "elipsis-double-v-alt", 13 | "color": "blue" 14 | }, 15 | { 16 | "path": "/develop/overview", 17 | "name": "Develop", 18 | "icon": "arrow", 19 | "color": "sky", 20 | "children": [ 21 | { "path": "/develop/overview", "name": "Develop overview" }, 22 | { 23 | "path": "/develop/android", 24 | "name": "Android", 25 | "children": [ 26 | { "path": "/develop/android/mdc-android", "name": "MDC-Android" }, 27 | { 28 | "path": "/develop/android/jetpack-compose", 29 | "name": "Jetpack Compose" 30 | } 31 | ] 32 | }, 33 | { "path": "/develop/flutter", "name": "Flutter" }, 34 | { "path": "/develop/web", "name": "Web" } 35 | ] 36 | }, 37 | { 38 | "path": "/foundations/overview", 39 | "color": "sky", 40 | "name": "Foundations", 41 | "icon": "file-bookmark-alt", 42 | "children": [ 43 | { "path": "/foundations/overview", "name": "Foundations overview" }, 44 | { "path": "/foundations/accessible-design", "name": "Accessibility" }, 45 | { 46 | "path": "", 47 | "name": "Content design", 48 | "children": [ 49 | { "path": "", "name": "Overview" }, 50 | { "path": "", "name": "Style guide" } 51 | ] 52 | }, 53 | { "path": "", "name": "Customizing Material" }, 54 | { "path": "", "name": "Design tokens" }, 55 | { 56 | "path": "", 57 | "name": "Interaction", 58 | "children": [ 59 | { "path": "", "name": "Gestures" }, 60 | { "path": "", "name": "Inputs" }, 61 | { "path": "", "name": "Selection" }, 62 | { "path": "", "name": "States" } 63 | ] 64 | }, 65 | { 66 | "path": "", 67 | "name": "Layout", 68 | "children": [ 69 | { 70 | "path": "", 71 | "name": "Understanding layout" 72 | }, 73 | { 74 | "path": "", 75 | "name": "Applying layout" 76 | }, 77 | { 78 | "path": "", 79 | "name": "Canonical layouts" 80 | } 81 | ] 82 | }, 83 | { 84 | "path": "", 85 | "name": "Material A-Z" 86 | } 87 | ] 88 | }, 89 | { 90 | "path": "/styles", 91 | "color": "sky", 92 | "name": "Styles", 93 | "icon": "palette", 94 | "children": [ 95 | { "path": "", "name": "Style overview" }, 96 | { 97 | "path": "", 98 | "name": "Color", 99 | "children": [ 100 | { "path": "", "name": "Overview" }, 101 | { "path": "", "name": "Color system" }, 102 | { "path": "", "name": "Dynamic color" } 103 | ] 104 | }, 105 | { "path": "", "name": "Elvation" }, 106 | { "path": "", "name": "Icons" }, 107 | { 108 | "path": "", 109 | "name": "Motion", 110 | "children": [ 111 | { "path": "", "name": "Overview" }, 112 | { "path": "", "name": "Easing and duration" }, 113 | { "path": "", "name": "Transitions" } 114 | ] 115 | }, 116 | { 117 | "path": "", 118 | "name": "Shape" 119 | }, 120 | { 121 | "path": "", 122 | "name": "Typography" 123 | } 124 | ] 125 | }, 126 | { 127 | "path": "/components", 128 | "color": "sky", 129 | "name": "Components", 130 | "icon": "plus-circle", 131 | "children": [ 132 | { "path": "", "name": "Components overview" }, 133 | { 134 | "path": "", 135 | "name": "App bars", 136 | "children": [ 137 | { "path": "", "name": "Bottom app bar" }, 138 | { "path": "", "name": "Top app bar" } 139 | ] 140 | }, 141 | { "path": "", "name": "Badges" }, 142 | { 143 | "path": "", 144 | "name": "Buttons", 145 | "children": [ 146 | { "path": "", "name": "All buttons" }, 147 | { "path": "", "name": "Common buttons" }, 148 | { "path": "", "name": "FAB" }, 149 | { "path": "", "name": "Extened FAB" }, 150 | { "path": "", "name": "Icon buttons" }, 151 | { "path": "", "name": "Segmented buttons" } 152 | ] 153 | }, 154 | { "path": "", "name": "Cards" }, 155 | { "path": "", "name": "Carousel" }, 156 | { "path": "", "name": "Checkbox" }, 157 | { "path": "", "name": "Chips" }, 158 | { "path": "", "name": "Date pickers" }, 159 | { "path": "", "name": "Dialogs" }, 160 | { "path": "", "name": "Divider" }, 161 | { "path": "", "name": "Lists" }, 162 | { "path": "", "name": "Menus" }, 163 | { 164 | "path": "", 165 | "name": "Navigation", 166 | "children": [ 167 | { "path": "", "name": "Navigation bar" }, 168 | { "path": "", "name": "Navigation drawer" }, 169 | { "path": "", "name": "Navigation rail" } 170 | ] 171 | }, 172 | { "path": "", "name": "Progress indicators" }, 173 | { "path": "", "name": "Radio button" }, 174 | { "path": "", "name": "Search" }, 175 | { 176 | "path": "", 177 | "name": "Sheets", 178 | "children": [ 179 | { "path": "", "name": "Bottom sheets" }, 180 | { "path": "", "name": "Side sheets" } 181 | ] 182 | }, 183 | { "path": "", "name": "Sliders" }, 184 | { "path": "", "name": "Snackbar" }, 185 | { "path": "", "name": "Switch" }, 186 | { "path": "", "name": "Tabs" }, 187 | { "path": "", "name": "Text fields" }, 188 | { "path": "", "name": "Time pickers" }, 189 | { "path": "", "name": "Tooltips" } 190 | ] 191 | }, 192 | { "path": "blog", "color": "sky", "name": "Blog", "icon": "star" } 193 | ] 194 | -------------------------------------------------------------------------------- /playground/dev.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 45 | 50 | 51 | 52 | 54 | 55 |
56 | 57 |
58 | 59 | 61 |
62 |
63 | 64 | 106 | -------------------------------------------------------------------------------- /playground/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 44 | 49 | 50 | 51 | 53 | 54 |
55 | 56 |
57 | 58 | 60 |
61 |
62 | 63 | 105 | -------------------------------------------------------------------------------- /playground/pages/combobox/basic.html: -------------------------------------------------------------------------------- 1 | 29 | -------------------------------------------------------------------------------- /playground/pages/combobox/command-palette-group.html: -------------------------------------------------------------------------------- 1 | 51 | -------------------------------------------------------------------------------- /playground/pages/combobox/command-palette.html: -------------------------------------------------------------------------------- 1 | 28 | -------------------------------------------------------------------------------- /playground/pages/combobox/multi-select.html: -------------------------------------------------------------------------------- 1 | 39 | -------------------------------------------------------------------------------- /playground/pages/dialog/slide-over.html: -------------------------------------------------------------------------------- 1 | 40 | -------------------------------------------------------------------------------- /playground/pages/listbox/basic.html: -------------------------------------------------------------------------------- 1 | 21 | -------------------------------------------------------------------------------- /playground/pages/listbox/multi-elements.html: -------------------------------------------------------------------------------- 1 | 22 | -------------------------------------------------------------------------------- /playground/pages/listbox/multi-select.html: -------------------------------------------------------------------------------- 1 | 24 | -------------------------------------------------------------------------------- /playground/pages/m3/develop/android/jetpack-compose.html: -------------------------------------------------------------------------------- 1 | 65 | 66 | 92 | 93 | -------------------------------------------------------------------------------- /playground/pages/m3/develop/android/mdc-android.html: -------------------------------------------------------------------------------- 1 | 57 | 58 | 84 | 85 | -------------------------------------------------------------------------------- /playground/pages/m3/develop/flutter.html: -------------------------------------------------------------------------------- 1 | 77 | 78 | 105 | 106 | -------------------------------------------------------------------------------- /playground/pages/m3/develop/overview.html: -------------------------------------------------------------------------------- 1 | 34 | 35 | 56 | 57 | -------------------------------------------------------------------------------- /playground/pages/m3/develop/web.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | -------------------------------------------------------------------------------- /playground/pages/m3/foundations/accessible-design.html: -------------------------------------------------------------------------------- 1 | 84 | 124 | 125 | 135 | 136 | -------------------------------------------------------------------------------- /playground/pages/m3/foundations/overview.html: -------------------------------------------------------------------------------- 1 | 42 | 43 | 64 | 65 | -------------------------------------------------------------------------------- /playground/pages/m3/home.html: -------------------------------------------------------------------------------- 1 | 66 | 67 | 93 | 94 | -------------------------------------------------------------------------------- /playground/pages/menu/basic.html: -------------------------------------------------------------------------------- 1 | 39 | 40 | 53 | -------------------------------------------------------------------------------- /playground/pages/menu/multiple-elements.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /playground/pages/menu/with-popper.html: -------------------------------------------------------------------------------- 1 | 2 | 20 | -------------------------------------------------------------------------------- /playground/pages/menu/with-transition-and-popper.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /playground/pages/menu/with-transition.html: -------------------------------------------------------------------------------- 1 | 43 | 44 | -------------------------------------------------------------------------------- /playground/pages/popover/basic.html: -------------------------------------------------------------------------------- 1 | 2 | 31 | -------------------------------------------------------------------------------- /playground/pages/radio-group/basic.html: -------------------------------------------------------------------------------- 1 | 26 | -------------------------------------------------------------------------------- /playground/pages/switch/basic.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /playground/pages/tabs/basic.html: -------------------------------------------------------------------------------- 1 | 17 | --------------------------------------------------------------------------------