Giter Club home page Giter Club logo

canvasui's Introduction

CanvasUI

CanvasUI is a canvas-based UI framework.

Online Demo (a page with only one <canvas>)

Introduction

CanvasUI re-implements key technologies of modern front-end development. It is based on HTML <canvas>, just using Vanilla JS, no external dependency, it contains:

  • Declarative tags (e.g. <button>, <image>, and even <input>)
  • Layout engine that supports Flex
  • Commonly used CSS
  • MVVM
  • Timeline and Animation
  • Mobile-compatible gestures
  • Scaffolding out of the box and development server that supports hot reload

Usage

  1. Create a project with npx canvasui project-name
  2. Use vscode to open the project root directory to enjoy code highlighting
  3. Run npm run build in the root directory of the project to start the development server (the code will also be packaged into the /public directory)
  4. Use a browser to visit http://127.0.0.1:3000/
  5. Modify main.ui in the /src directory, the browser will update and modify in real time (and package it to the /public directory at the same time)

Sample code

<script>
let count = 0

function increment() {
    count += 1
}

return { count, increment }
</script>

<template>
    <button label="click { count } times" @click="{ increment }"></button>
</template>

<style>
template {
    justify-content: center;
    align-items: center;
}
</style>

Built-in components

component namesupported propssupported CSS
<button>label, @click
<checkbox>value, label
<color>value
<div>width, height, padding, margin, border, border-radius, background
<image>pathwidth, height, border-radius
<input>value, hintwidth
<radio>value, label, option
<select>value, options
<slider>valuewidth
<switch>value
<template>width, height
<text>contentfont-size, color

canvasui's People

Contributors

devlzl avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.