LemonadeJS

A micro reactive, with a two-way data binding, no dependencies, JavaScript ...

README

LemonadeJS: Reactive micro library

Create amazing web-based interfaces with LemonadeJS v2


LemonadeJS is a super lightweight reactive vanilla javascript micro-library (7 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

  1. ``` js
  2. import lemonade from "lemonadejs";
  3. import Hello from "./Hello";

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

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

  12.   return lemonade.element(template, self, { Hello });
  13. }
  14. ```

Browser


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

  1. ``` html
  2. <html>
  3. <body>
  4. <div id="root"></div>
  5. <script src="https://cdn.jsdelivr.net/npm/lemonadejs/dist/lemonade.min.js"></script>
  6. <script>
  7. function Hello() {
  8.     let self = this;
  9.     let template = `<h1>{{self.title}}</h1>`;
  10.     return lemonade.element(template, self);
  11. }
  12. function App() {
  13.     let self = {};
  14.     self.count = 1;
  15.     let template = `<>
  16.       <Hello title="your title" />
  17.       <p>You clicked {{self.count}} times</p>
  18.         <button onclick="self.count++;">Click me</button>
  19.       </>`;
  20.     return lemonade.element(template, self, { Hello });
  21. }
  22. lemonade.render(App, document.getElementById('root'));
  23. </script>
  24. </body>
  25. </html>
  26. ```

Creating a table from an array of objects


  1. ``` js
  2. import lemonade from "lemonadejs";

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

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

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

  17.     return lemonade.element(template, self);
  18. }
  19. ```


The event object


  1. ``` js
  2. <html>
  3. <body>
  4. <div id='root'></div>
  5. <script src="https://cdn.jsdelivr.net/npm/lemonadejs/dist/lemonade.min.js"></script>
  6. <script>
  7. var Component = (function() {
  8.     // Create the self object
  9.     var self = {};
  10.     self.test = function(e) {
  11.         console.log(e);
  12.         e.preventDefault();
  13.     }

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

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

  21. // Render the LemonadeJS element into the DOM
  22. lemonade.render(Component, document.getElementById('root'));
  23. </script>
  24. </body>
  25. </html>
  26. ```

Enable/disable HTML elements


  1. ``` js
  2. <html>
  3. <body>
  4. <div id='root'></div>
  5. <script src="https://cdn.jsdelivr.net/npm/lemonadejs/dist/lemonade.min.js"></script>
  6. <script>
  7. var App = (function() {
  8.     let self = {};
  9.     self.disabled= false;

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

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

  16. lemonade.render(App, document.getElementById('root'));
  17. </script>
  18. </body>
  19. </html>
  20. ```


Installation


% npm install lemonadejs


License


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

Documentation

Other tools


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