Giter Site home page Giter Site logo

alvarlaigna / radi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from marcisbee/radi

0.0 3.0 0.0 1.22 MB

Tiny (in size) front-end framework with no extra browser re-flows

Home Page: https://radi.js.org

License: MIT License

JavaScript 100.00%

radi's Introduction

Radi

Radi is a tiny (3kB minified & gzipped) javascript framework.

It's built quite differently from any other framework. It doesn't use any kind of diffing algorithm nor virtual dom which makes it really fast.

With Radi you can create any kind of single-page applications or more complex applications with no dependencies required! Oh did I mention that Radi.js is faster than any popular framework? And yes it is.

npm version npm downloads gzip bundle size radi workspace on slack

Installation

To install the stable version:

npm install --save radi

This assumes you are using npm as your package manager.

If you're not, you can access these files on unpkg, download them, or point your package manager to them.

Browser Compatibility

Radi.js currently is compatible with browsers that support ES6. In stable release v1 it will support ES5 compatible browsers and even some below that, yes - looking at IE8 too.

Ecosystem

Project Status Description
radi-router radi-router-status Single-page application routing

Documentation

Documentation is currently being written. For now just a few examples to work our appetite.

Hello World example

Lets create component using JSX, tho it's not mandatory we can just use hyperscript r('h1', 'Hello', this.sample, '!'). I'm using JSX for html familiarity and to showcase compatibility.

/** @jsx r **/
const { r, mount, component } = radi;

const main = component({
  view: function() {
    return (
      <h1>Hello { this.sample } !</h1>
    )
  },
  state: {
    sample: 'World'
  }
});

mount(new main(), document.body);

This example will mount h1 to body like so <body><h1>Hello World</h1></body>

View this example on codepen

Counter example

This will be different as we'll need to update state and use actions. We'll need to use binder function l(..). It binds any value to real DOM. When something in this function updates, DOM will change too.

/** @jsx r **/
const { r, l, mount, component } = radi;

const counter = component({
  view: function() {
    return (
      <div id="app">
        <div class="counter">
          { l(this.counter) }
        </div>
        <div class="buttons">
          <button onclick={ this.down }
            disabled={ l(this.counter <= 0) }>-</button>
          <button onclick={ this.up }>+</button>
        </div>
      </div>
    )
  },
  state: {
    counter: 0
  },
  actions: {
    up() {
      this.counter += 1;
    },
    down() {
      this.counter -= 1;
    }
  }
});

mount(new counter(), document.body);

View this example on codepen. In codepen I use hyperscript instead jsx for more diverse example purpose.

Architecture

I'm in process of creating some cool examples and diagrams of how exactly Radi works.

Stay In Touch

License

MIT

Copyright (c) 2017-present, Marcis (Marcisbee) Bergmanis

radi's People

Contributors

marcisbee avatar

Watchers

Alvar Laigna avatar James Cloos avatar  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.