GithubHelp home page GithubHelp logo

mohebifar / vidact Goto Github PK

View Code? Open in Web Editor NEW
786.0 13.0 9.0 3.73 MB

A compiler that converts React-compatible codes to VanillaJS with no Virtual DOM

Home Page: https://mohebifar.github.io/vidact/

License: MIT License

TypeScript 91.04% JavaScript 8.96%

vidact's Introduction

Travis (.org) npm

Vidact

Vidact compiles your React source codes to VanillaJS code with No Virtual DOM ™️. It is similar to Svelte, but unlike Svelte, Vidact does not introduce a new syntax. It takes in pure React-compatible JavaScript (JSX) and outputs plain JavaScript.

Vidact currently is in alpha phase and has known limitations. It does not fully comply with React's behaviour in some edge cases, and probably never will, but the goal is to get as close behaviour to React as possible. Also, it currently only supports functional components and does not support class components.

How does it work and how is it different from React?

Vidact is a babel-plugin that scans your source code to find what parts of the UI need to be updated in response to a prop or state change and generates a plain JavaScript code that should have the same DOM result as the equivalent React code. Note that all of this is done in build time! Whereas React does the bulk of its work in runtime in the browser by leveraging Virtual DOMs to determine what needs to be updated in the actual DOM.

When should I use it instead of React?

Vidact is not currently ready to be used in production.

The goal is to have an alternative library for those who love React, but are looking for a more lightweight and high-performance implementation for smaller projects.

Roadmap

  • JSX conversion for native HTML elements
  • JSX conversion for component elements
  • Support event listeners for native HTML elements
    • Proxy onChange for text inputs and textarea
  • Support inline styles
  • Reactive props
  • Basic array child nodes support
  • useState: Stateful components
  • Dangerously set innerHTML
  • useRef
  • useEffect
  • useEffect with cleanup (detect component unmount)
  • useCallback
  • useMemo
  • Conditional expression performance
  • Support custom hook functions built upon native hooks
  • Improve array child support
    • Avoid refreshing elements with the same key and only do prop updates instead
    • Avoid refreshing rearranged elements with the same key
  • SVG support
  • Support components with multiple conditional return statements
  • Support context
  • SSR support
  • Props spread

vidact's People

Contributors

mohebifar avatar

Stargazers

funcpp avatar Mashy avatar Dee Cheung avatar 伊撒尔 avatar Andy Gower avatar Junhea Hong avatar  avatar fab avatar Monir Abu Hilal avatar Vasu Singh avatar Edward Thomas avatar  avatar 莉特雅 avatar UIUX Lab avatar Nikita Zhenev avatar  avatar  avatar Abhishek Das avatar Shahab Movahhedi avatar Simón Rondón avatar  avatar  avatar  avatar  avatar Adem Meral avatar Nick Rabone avatar Guillaume Dumoulin avatar Manu avatar Tamara Rimski-Korsakov avatar Alfred Westerveld avatar Kingsley Ochu avatar Roman avatar Simon O avatar  avatar  avatar  avatar Zach Sim avatar Alexandre Sarfati avatar Feli avatar Luis Lozada avatar Cyberdrey avatar Jordan smith avatar Favour (ThankGod)  Afenikhena avatar S V avatar Joshua avatar  avatar Artur avatar Fang Zhang avatar 김지윤(Jiyun Kim) avatar JiYun-VIRNECT avatar Carlos Villarreal avatar  avatar Luis Eduardo Brito avatar Patrick Organ avatar Shun avatar Abouzar Pourranjbar avatar Ali Torki avatar  avatar Kai avatar Scott Fischer avatar Simon Norman avatar Sung Jeon avatar Mundi Morgado avatar K-Sato avatar CorentinGC avatar Viacheslav Poturaev avatar Egor A. Trubnikov-Panov avatar TestCold avatar Boulmane Anas avatar Daniel M. avatar Emmanuel Omonzebaguan avatar Yulia Garanok avatar  avatar Seif Eddine Slimene avatar Nikhil Jain avatar  avatar Eugene Zhlobo avatar Stefan Huber avatar Oren Elbaum avatar Awf Wiswasi avatar  avatar Jacob Leger avatar  avatar Matteo Piotto avatar Jean-Baptiste Musso avatar  avatar Logan King (DarkComet) avatar Yuri Vyatkin avatar turusuke avatar Dawid Bonik avatar Marek avatar Tim avatar  avatar Roy Li avatar Mike Wabst avatar  avatar José Morais avatar Yasin ATEŞ avatar Oskar Ekehäll avatar Mitej Madan avatar

Watchers

arpu avatar Brad Jones avatar Pierre Martin avatar Jacob Groß avatar Eugene Zhlobo avatar Noel Koutlis avatar  avatar Sanborn Hilland avatar Muhammad Athif avatar Thomas Herzog avatar  avatar  avatar Adem Meral avatar

vidact's Issues

Join forces with Svelte.dev

Svelte.dev has a similar idea.
It has the only other source files.
vidact - JSX to Precision DOM
svelte.dev - svelte file to Precision DOM

What do you think?

I assume that in theory they should have a lot in common. If they don't have it yet, it probably results only from not working out some ideas.

Printing 0

<div>{0}</div> leads to empty div while it should print 0

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.