C7 is a canvas-based UI toolkit.

Overview

C7

npm version LICENSE

C7 is a canvas-based UI toolkit.

中文版

Introduction

C7 re-implements the key technology of modern front-end development based on HTML <canvas> (without any third-party libraries), it includes:

  • 10 commonly used components described in XML (e.g. <button>, <image>, and even <input>)
  • Flex layout and commonly used CSS
  • MVVM
  • Scaffolding and development server out of the box (supports hot reload)
Preview address: c7js.github.io

Usage

  1. Create a project with npx c7 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.c7 in the /src directory, the browser will update and modify in real time (and package it to the /public directory at the same time)

Documentation

code structure

<style>
.hello {
    font-size: 50px;
}
</style>

<template>
    <text class="hello" content="hello { name } !"></text>
</template>

<script>
return {
    data: {
        name: 'world',
    },
}
</script>

built-in components

component name supported props supported CSS
<text> content font-size, color
<image> path width, height
<button> label, @click
<input> value, hint width
<checkbox> value, label
<radio> value, label, option
<switch> value
<color> value
<slider> value width
<select> value, options

Some notes

  • Built-in components and container
    • The tag must have an end tag, and the prop value must be enclosed in double quotes
    • All components support id and class props, and CSS selectors can be used to add styles to them
    • <input> supported functions are:
      • Keyboard input characters, delete characters, move the caret left and right
      • Insert caret at mouse position
      • Mouse drag and drop to select, double click to select all
      • copy (command-c), paste (command-c), cut (command-x), select all (command-a)
    • You can use <div> as a container, but currently only supports single-level nesting (that is, you cannot nest another <div> in a <div>)
  • CSS
    • Flex is the default and only layout method, no need to write "display: flex;"
    • The supported flex-related properties are: justify-content, align-items, flex-direction, flex-wrap, align-content, flex-flow
    • The box model can be applied to <div> but currently the only supported writing method is:
      • padding: length; (e.g. padding: 5px;)
      • border: border-width border-style border-color; (e.g. border: 1px solid black;)
      • margin: length; (e.g. margin: 5px;)
    • Naturally supports border-box, so width includes border and padding
    • CSS selector supports the selection of A's direct child B in the form of A B
  • MVVM
    • The prop value can be a literal value or a variable of the form "{ xx }"
    • All input components (e.g. <input>, <checkbox>, <slider>) can use value="{ variable }" to achieve two-way binding

The developer says

I am the developer of C7, I spent 13 days developing C7, the purpose is to fully understand the top-level design and underlying principles of front-end development. I am currently looking for a suitable job, if you have a suitable position (preferably working remotely), welcome to send an email to [email protected].

You might also like...

The Swiss Army Knife of Vector Graphics Scripting – Scriptographer ported to JavaScript and the browser, using HTML5 Canvas. Created by @lehni & @puckey

Paper.js - The Swiss Army Knife of Vector Graphics Scripting If you want to work with Paper.js, simply download the latest "stable" version from http:

Dec 30, 2022

Financial lightweight charts built with HTML5 canvas

Lightweight Charts Demos | Documentation | Discord community TradingView Lightweight Charts are one of the smallest and fastest financial HTML5 charts

Jan 9, 2023

Interactive visualizations of time series using JavaScript and the HTML canvas tag

Interactive visualizations of time series using JavaScript and the HTML canvas tag

dygraphs JavaScript charting library The dygraphs JavaScript library produces interactive, zoomable charts of time series: Learn more about it at dygr

Jan 3, 2023

Flat, round, designer-friendly pseudo-3D engine for canvas & SVG

Zdog Round, flat, designer-friendly pseudo-3D engine View complete documentation and live demos at zzz.dog. Install Download zdog.dist.min.js minified

Jan 3, 2023

🍞🎨 Full-featured photo image editor using canvas. It is really easy, and it comes with great filters.

🍞🎨 Full-featured photo image editor using canvas. It is really easy, and it comes with great filters.

Full featured image editor using HTML5 Canvas. It's easy to use and provides powerful filters. Packages toast-ui.image-editor - Plain JavaScript compo

Jan 6, 2023

🦍• [Work in Progress] React Renderer to build UI interfaces using canvas/WebGL

🦍• [Work in Progress] React Renderer to build UI interfaces using canvas/WebGL

React Ape React Ape is a react renderer to build UI interfaces using canvas/WebGL. React Ape was built to be an optional React-TV renderer. It's mainl

Jan 4, 2023

Canvas

Canvas

Installation $ npm install knights-canvas Example GoodBye const ling = require("knights-canvas"), const fs = require('fs'); const image = await new

Feb 16, 2022

JAVASCRIPT library with which you can easily draw CANVAS HTML

JAVASCRIPT library with which you can easily draw CANVAS HTML

easycanvas Quick start Documentation: gaidadei.ru/easycanvas Download: gaidadei.ru/easycanvas/easyc.zip Buy premium: gaidadei.ru/easycanvas/premium (A

Nov 12, 2022

An HTML5/Canvas implementation of 8-bit color cycling

An HTML5/Canvas implementation of 8-bit color cycling

Overview Here is the JavaScript and C++ source code to my color cycling engine, written in 2010. I am releasing it under the LGPL v3.0. The package co

Dec 1, 2022
Owner
null
C7 is a canvas-based UI toolkit.

C7 C7 is a canvas-based UI toolkit. 中文版 Introduction C7 re-implements the key technology of modern front-end development based on HTML <canvas> (witho

null 39 Oct 22, 2021
HTML5 Canvas Gauge. Tiny implementation of highly configurable gauge using pure JavaScript and HTML5 canvas. No dependencies. Suitable for IoT devices because of minimum code base.

HTML Canvas Gauges v2.1 Installation Documentation Add-Ons Special Thanks License This is tiny implementation of highly configurable gauge using pure

Mykhailo Stadnyk 1.5k Dec 30, 2022
Konva.js is an HTML5 Canvas JavaScript framework that extends the 2d context by enabling canvas interactivity for desktop and mobile applications.

Konva Konva is an HTML5 Canvas JavaScript framework that enables high performance animations, transitions, node nesting, layering, filtering, caching,

konva 8.7k Jan 8, 2023
React + Canvas = Love. JavaScript library for drawing complex canvas graphics using React.

React Konva React Konva is a JavaScript library for drawing complex canvas graphics using React. It provides declarative and reactive bindings to the

konva 4.9k Jan 9, 2023
Canvas rendering library, Sprite manipulation of canvas

el-canvas Canvas rendering library, Sprite manipulation of canvas hello world <div id="app"><div></div></div> yarn add elem-canvas or npm i

null 15 Apr 13, 2022
A React toolkit for graph visualization based on G6

Graphin A React toolkit for graph analysis based on G6 English | 简体中文 ✨ Features ?? Good-looking elements, standardized style configuration Graphin st

AntV team 823 Jan 7, 2023
🔥 JavaScript Library for HTML5 canvas based heatmaps

heatmap.js Dynamic Heatmaps for the Web. How to get started The fastest way to get started is to install heatmap.js with bower. Just run the following

Patrick Wied 5.9k Jan 2, 2023
JavaScript toolkit for creating interactive real-time graphs

Rickshaw Rickshaw is a JavaScript toolkit for creating interactive time series graphs, developed at Shutterstock Table of Contents Getting Started Ins

Shutterstock 6.5k Dec 28, 2022
Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:

D3: Data-Driven Documents D3 (or D3.js) is a JavaScript library for visualizing data using web standards. D3 helps you bring data to life using SVG, C

D3 103.8k Jan 3, 2023
Simple HTML5 Charts using the tag

Simple yet flexible JavaScript charting for designers & developers Documentation Currently, there are two versions of the library (2.9.4 and 3.x.x). V

Chart.js 59.4k Jan 7, 2023