Coder Social home page Coder Social logo

soinalastudio / lemonadejs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lemonadejs/lemonadejs

0.0 0.0 0.0 253 KB

LemonadeJS is a micro (6Kb) reactive, with a two-way data binding, no dependencies, JavaScript library that aims to be as close to JavaScript Vanilla as possible.

Home Page: https://lemonadejs.net

License: MIT License

CSS 100.00%

lemonadejs's Introduction

LemonadeJS: Reactive micro library

Create amazing web-based interfaces with LemonadeJS v2

LemonadeJS is a super lightweight reactive vanilla javascript micro-library (6 KBytes). It aims to help the integration between the JavaScript (controllers) and the HTML (view). It supports two-way binding and integrates natively with jSuites to help to create amazing interfaces quicker.

It would help you deliver reusable components and does not require transpilers, babel, or hundreds of other dependencies. It works just fine in any javascript dev environment. LemonadeJS has a quick learning curve and keeps coding fun and very close to native JS.

  • Make rich and user-friendly web interfaces and applications
  • Handle complicated data inputs with ease and convenience
  • Improve the software user experience
  • Create rich CRUDS and beautiful UI
  • Highly flexible and customizable
  • Lightweight and simple to use

Examples

Node

Build modern applications with lemonadeJS and node.

See this example on codesandbox

import lemonade from "lemonadejs";
import Hello from "./Hello";

export default function App() {
  let self = {};
  self.count = 1;

  let template = `<div>
        <div><Hello /></div>
        <p>You clicked {{self.count}} times</p>
        <button onclick="self.count++;">Click me</button>
    </div>`;

  return lemonade.element(template, self, { Hello });
}

Browser

Simplicity to run in the browser without dependencies, servers, transpilers.

<html>
    <body>
        <div id="root"></div>

        <script src="https://cdn.jsdelivr.net/npm/lemonadejs/dist/lemonade.min.js"></script>
        <script>

        function Hello() {
            let self = this;
            let template = `<h1>{{self.title}}</h1>`;

            return lemonade.element(template, self);
        }


        function App() {
            let self = {};
            self.count = 1;

            let template = `<>
                    <Hello title="your title" />
                    <p>You clicked {{self.count}} times</p>
                    <button onclick="self.count++;">Click me</button>
                </>`;

            return lemonade.element(template, self, { Hello });
        }

        lemonade.render(App, document.getElementById('root'));
        </script>
    </body>
</html>

Creating a table from an array of objects

import lemonade from "lemonadejs";

export default function Component() {
    let self = {};

    self.rows = [
        { title:'Google', description: 'The alpha search engine...' },
        { title:'Bind', description: 'The microsoft search engine...' },
        { title:'Duckduckgo', description: 'Privacy in the first place...' },
    ];

    // Custom components such as List should always be unique inside a real tag.
    let template = `<table cellpadding="6">
            <thead><tr><th>Title</th><th>Description</th></th></thead>
            <tbody @loop="self.rows">
                <tr><td>{{self.title}}</td><td>{{self.description}}</td></tr>
            </tbody>
        </table>`;

    return lemonade.element(template, self);
}

The event object

<html>
    <body>
        <div id='root'></div>

        <script src="https://cdn.jsdelivr.net/npm/lemonadejs/dist/lemonade.min.js"></script>
        <script>
        var Component = (function() {
            // Create the self object
            var self = {};
            self.test = function(e) {
                console.log(e);
                e.preventDefault();
            }

            // The property call is added to the observable list when added to the DOM
            var template = `<>
                <input type="button" value="Click test" onclick="self.test(e);"/>
                </>`;

            // Render the template and create the observation
            return lemonade.element(template, self);
        });

        // Render the LemonadeJS element into the DOM
        lemonade.render(Component, document.getElementById('root'));
        </script>
    </body>
</html>

Enable/disable HTML elements

<html>
    <body>
        <div id='root'></div>

        <script src="https://cdn.jsdelivr.net/npm/lemonadejs/dist/lemonade.min.js"></script>
        <script>
        var App = (function() {
            let self = {};
            self.disabled= false;

            let template = `<>
                    <button onclick="self.disabled = !self.disabled">Toggle</button>
                    <input type="text" disabled="{{self.disabled}}" />
                    </>`;

            return lemonade.element(template, self);
        });

        lemonade.render(App, document.getElementById('root'));
        </script>
    </body>
</html>

Installation

% npm install lemonadejs

License

This software is free to use and it is distributed under the MIT license.

Other tools

https://jsuites.net
https://jspreadsheet.com
https://bossanova.uk/jspreadsheet

lemonadejs's People

Contributors

dym-sh avatar frontendneo avatar gbonnaire avatar hodeware avatar pphod 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.