UNPKG

doz

Version:

A JavaScript framework for building UI, almost like writing in VanillaJS.

130 lines (106 loc) • 3.84 kB
<div align="center"> <br/><br/> <img src="https://raw.githubusercontent.com/dozjs/doz/master/extra/doz-header.png" title="doz"/> <br/><br/> <br/><br/> Almost like writing in VanillaJS. For modern browser. <br/><br/> <a href="https://travis-ci.org/dozjs/doz" target="_blank"><img src="https://travis-ci.org/dozjs/doz.svg?branch=master" title="Build Status"/></a> <a href="https://opensource.org/licenses/MIT" target="_blank"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" title="License: MIT"/></a> <img src="https://img.shields.io/badge/Node.js-%3E%3D10.x.x-green.svg" title="Node.js version"/> <br/><br/> <a href="https://github.com/dozjs/doz/blob/master/documentation/index.md">Documentation</a> | <a href="https://github.com/dozjs/doz/blob/master/documentation/api.md">API</a> | <a href="https://dozjs.github.io/doz/example/">Demo</a> | <a href="https://github.com/dozjs/doz/tree/master/example">Browse example code</a> <br/><br/> šŸ‘‰ <a href="https://play.xdevel.com/2">SEE A PROJECT BUILT WITH DOZ</a> šŸ‘ˆ <br/><br/> <img src="https://raw.githubusercontent.com/dozjs/doz/master/extra/login-form-example.gif" title="A login form built with Doz"/> <br> <a href="https://codepen.io/fabioricali/pen/poveXwo">Look at the code on Codepen</a> <br/><br/> </div> ## Why - šŸŽ¼ Works with tagged template literals - šŸŽ³ Component based - 🧩 WebComponent ready - šŸŖ Global stores - šŸ˜† Global components - šŸ”« Fast performance - šŸ’… Scoped style - šŸ“” Uses ES6 proxy to observe changes - 😁 Simple and familiar API - šŸ˜±ā€ No extra syntax like JSX - šŸ’£ No confusion with props and state - ā› Extensible through: plugins, mixin, components - šŸ“½ CSS animation support ## Get started ``` $ npx doz-cli app my-app $ cd my-app $ npm start ``` ## Example ```html <div id="app"></div> ``` #### Component definition ButtonCounter.js ```javascript import {Component} from 'doz' export default class extends Component { constructor(o) { super(o); this.props = { counter: 0 }; } template(h) { return h` <style> button { font-size: 16px; padding: 20px; } </style> <button onclick="${this.increase}"> ${this.props.title} ${this.props.counter} </button> ` } increase() { this.props.counter++; } }; ``` #### Make an app with the component defined above app.js ```javascript import Doz from 'doz' import ButtonCounter from './ButtonCounter' new Doz({ root: '#app', template(h) { return h` <${ButtonCounter} title="Click me!"/> ` } }); ``` ## Doz ecosystem - šŸ‘ØšŸ»ā€šŸ’» [doz-cli](https://github.com/dozjs/doz-cli) provides a boilerplate to creating app and component - šŸ‘ØšŸ¼ā€šŸŽØ [doz-ssr](https://github.com/dozjs/doz-ssr) server side rendering - šŸ¤³šŸ¼ [doz-snap](https://github.com/dozjs/doz-snap) transforms app to static HTML - šŸ‘©šŸ¼ā€šŸš€ [doz-router](https://github.com/dozjs-cmp/doz-router) a complete component for routing - āœšŸ¼ [doz-metatag](https://github.com/dozjs/doz-metatag) a plugin for managing basic OG meta tag in your app (perfect with doz-ssr) #### CDN unpkg ```html <script src="https://unpkg.com/doz/dist/doz.min.js"></script> ``` ## Changelog You can view the changelog <a target="_blank" href="https://github.com/dozjs/doz/blob/master/CHANGELOG.md">here</a> ## License Doz is open-sourced software licensed under the <a target="_blank" href="http://opensource.org/licenses/MIT">MIT license</a> ## Author <a target="_blank" href="http://rica.li">Fabio Ricali</a>