Web Components engine based on JSX & TypeScript

Overview

WebCell logo

WebCell

Web Components engine based on JSX & TypeScript

NPM Dependency CI & CD

Anti 996 license jaywcjlove/sb

Slideshow Gitter

Edit WebCell demo

NPM

Usage

Demo & GitHub template: https://web-cell.dev/scaffold/

Project bootstrap

Command

npm init -y
npm install web-cell
npm install parcel-bundler -D

package.json

{
    "scripts": {
        "start": "parcel source/index.html --open",
        "build": "parcel build source/index.html --public-url"
    }
}

tsconfig.json

source/index.html

<script
    crossorigin
    src="https://polyfill.app/api/polyfill?features=es.array.flat,es.object.from-entries"
></script>
<script src="https://cdn.jsdelivr.net/npm/@webcomponents/[email protected]/webcomponents-bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@webcomponents/[email protected]/custom-elements-es5-adapter.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.min.js"></script>

<script src="source/SubTag.tsx"></script>
<script src="source/TestTag.tsx"></script>

<sub-tag></sub-tag>
<test-tag></test-tag>

Simple component

source/SubTag.tsx

import { createCell, component, mixin } from 'web-cell';

export function InlineTag({ defaultSlot }: any) {
    return <span>{defaultSlot}</span>;
}

@component({
    tagName: 'sub-tag',
    renderTarget: 'children'
})
export class SubTag extends mixin() {
    render() {
        return <InlineTag>test</InlineTag>;
    }
}

Advanced component

source/TestTag.tsx

import {
    createCell,
    component,
    mixin,
    attribute,
    watch,
    on,
    Fragment
} from 'web-cell';

import { SubTag } from './SubTag';

interface Props {
    title?: string;
}

interface State {
    status: string;
}

@component({
    tagName: 'test-tag',
    style: {
        '.title': {
            color: 'lightblue'
        },
        '.title.active': {
            color: 'lightpink'
        }
    }
})
export class TestTag extends mixin<Props, State>() {
    @attribute
    @watch
    title = 'Test';

    state = { status: '' };

    onClick = () => (this.title = 'Example');

    @on('click', ':host h1')
    onDelegate() {
        this.setState({ status: 'active' });
    }

    render({ title }: Props, { status }: State) {
        return (
            <>
                <h1 title={title} className={`title ${status}`}>
                    {title}
                    <img alt={title} onClick={this.onClick} />

                    <SubTag />
                </h1>
            </>
        );
    }
}

Basic knowledge

Life Cycle hooks

  1. connectedCallback

  2. disconnectedCallback

  3. attributeChangedCallback

  4. adoptedCallback

  5. shouldUpdate

  6. updatedCallback

  7. formAssociatedCallback

  8. formDisabledCallback

  9. formResetCallback

  10. formStateRestoreCallback

Scaffolds

  1. Basic

  2. DashBoard

  3. Static site

Ecosystem

We recommend these libraries to use with WebCell:

Roadmap

Go to contribute!

You might also like...

A W3C standard compliant Web rendering engine based on Flutter.

A W3C standard compliant Web rendering engine based on Flutter.

WebF WebF (Web on the Flutter) is a W3C standard compliant Web rendering engine based on Flutter, it can run web application on Flutter natively. W3C

Dec 25, 2022

A template for a vanilla(no ui-framework) project with webgi engine in typescript using parcel bundler.

WebGi starter project A template for a vanilla(no ui-framework) project with webgi engine in typescript using parcel bundler. For the latest version a

Jan 3, 2023

🌌 Fast, in-memory, full-text search engine written in TypeScript. Now in beta.

🌌  Fast, in-memory, full-text search engine written in TypeScript. Now in beta.

Installation You can install Lyra using npm, yarn, pnpm: npm i @nearform/lyra yarn add @nearform/lyra pnpm add @nearform/lyra Usage Lyra is quite simp

Dec 30, 2022

A template for buildind scrollable landing pages with Gsap, ScrollTrigger and webgi engine in typescript using parcel bundler.

A template for buildind scrollable landing pages with Gsap, ScrollTrigger and webgi engine in typescript using parcel bundler.

Threejs + GSAP + WEBGi 100% Free Course This is a template used in my fast course "building scrolable pages with ScrollTrigger and Threejs" for a vani

Dec 17, 2022

Some out-of-the-box utility features based on the Oasis engine.

Engine Toolkit Some out-of-the-box utility features based on the Oasis engine Script, welcome to enjoy! Features 🛸 Controls - Some camera controllers

Nov 21, 2022

a discord-based monster catching game engine, used for Lozpekamon on our Discord server

discord-monster-catching-game a discord-based monster catching game engine, used for Lozpekamon on our Discord server How to Use Requirements install

Oct 30, 2022

Macaron is an open-source design tool to visually create Web Components, which can be used in most Web frameworks, or in vanilla HTML/JavaScript

Macaron is an open-source design tool to visually create Web Components, which can be used in most Web frameworks, or in vanilla HTML/JavaScript

Macaron is an open-source design tool to visually create Web Components, which can be used in most Web frameworks, or in vanilla HTML/JavaScript

Dec 29, 2022

A Typescript Hardhat-based template to develop evm-based smart contracts with all the tooling you need.

EVM-based Smart Contract Scaffold A Typescript Hardhat-based template to develop evm-based smart contracts with all the tooling you need. Features Use

Oct 24, 2022

An efficient (and the fastest!) way to search the web privately using Brave Search Engine

Brave Search An efficient (and the fastest) way to search the web privately using Brave Search Engine. Not affiliated with Brave Search. Tested on Chr

Jun 2, 2022
Comments
  • Add license scan report and status

    Add license scan report and status

    Your FOSSA integration was successful! Attached in this PR is a badge and license report to track scan status in your README.

    Below are docs for integrating FOSSA license checks into your CI:

    opened by fossabot 1
  • [optimize] upgrade to Snabbdom v3 & Parcel v2

    [optimize] upgrade to Snabbdom v3 & Parcel v2

    1. [optimize] upgrade to Snabbdom v3 & Parcel v2
    2. [optimize] migrate Jest configuration from JSON to TS
    3. [optimize] add Yarn lock for CI cache
    4. [optimize] upgrade Upstream packages
    enhancement 
    opened by TechQuery 0
  • add New Features document

    add New Features document

    • [ ] cd1f5230f79c1ea66739c3d69f881857498dd338
    • [ ] 654975d31b18d16a635f59a0313da842f2e016e3
    • [ ] c1e69152ab4fa5d219469deaf310ef5a483d8861 : https://github.com/mobxjs/mobx/blob/mobx4and5/docs/refguide/reaction.md
    feature 
    opened by TechQuery 0
Owner
Offical Team & Projects of EasyWebApp.js
null
The project integrates workflow engine, report engine and organization authority management background, which can be applied to the development of OA, HR, CRM, PM and other systems. With tlv8 IDE, business system development, testing and deployment can be realized quickly.

介绍 项目集成了工作流引擎、报表引擎和组织机构权限管理后台,可以应用于OA、HR、CRM、PM等系统开发。配合使用tlv8 ide可以快速实现业务系统开发、测试、部署。 后台采用Spring MVC架构简单方便,前端使用流行的layui界面美观大方。 采用组件开发技术,提高系统的灵活性和可扩展性;采

Qian Chen 38 Dec 27, 2022
Like JSX, but native and fast

esx High throughput React Server Side Rendering For a simplified example of esx in action, check out esx-demo. esx is designed to be a high speed SSR

ESX 645 Jan 2, 2023
✏️ Super lightweight JSX syntax highlighter, around 1KB after minified and gzipped

Sugar High Introduction Super lightweight JSX syntax highlighter, around 1KB after minified and gzipped Usage npm install --save sugar-high import { h

Jiachi Liu 67 Dec 8, 2022
Create a html response with JSX.

Htm Create a text/html response with JSX, powered by Preact and UnoCSS. Usage To use Htm, create a server.tsx file like this: /** @jsx h */ import {

X. 34 Dec 9, 2022
Converts JSX to HTML strings at compile time.

unplugin-jsx-string Converts JSX to HTML strings at compile time. Installation npm i unplugin-jsx-string Vite // vite.config.ts import JsxString from

三咲智子 9 Sep 3, 2022
Add the `className` to all JSX elements in your project

Babel Plugin Transform JSX Classes This babel plugin adds the className in each JSX element. Before After function FancyComponent () { return (

Xinhe 13 Jul 15, 2022
Unofficial Library for using Discord.JS with JSX Syntax.

@chooks22/discord.jsx WARNING! This project is in very early stage of development. And while I do have plans to finish it to completion, consider this

Chooks22 4 Nov 14, 2022
Use jsx to make scriptable's layout.

scriptable-jsx This project helps you to write Scriptable widgets with JSX syntax. And add some useful tools by the way. you can check demos in demo f

毛球 8 Oct 10, 2022
🖼️ Tiny JSX helper function for high-DPI (Retina Display) images.

img-srcx Tiny JSX helper function for high-DPI (Retina Display) images. 394 bytes minified and gzipped for ESM (830 bytes for ES5). Installation npm i

Chariz 4 Oct 6, 2022
A JSX transformer with extra hints around interpolations and outer templates.

@ungap/babel-plugin-transform-hinted-jsx This plugin is a follow up of this post and it can be used together with @babel/plugin-transform-react-jsx. A

ungap 12 Nov 12, 2022