Simple and elegant component-based UI library

Overview

Riot logo

Simple and elegant component-based UI library

Build Status MIT License Join the discord community channel Join the chat (ja) at https://riot-jp-slackin.herokuapp.com/ OpenCollective Backers OpenCollective Sponsors

NPM version NPM downloads jsDelivr Hits Coverage Status Riot Size Code Quality

Sauce Test Status

Custom components • Concise syntax • Simple API • Tiny Size

Riot brings custom components to all modern browsers. It is designed to offer you everything you wished the native web components API provided.

Tag definition

<timer>
  <p>Seconds Elapsed: { state.time }</p>

  <script>
    export default {
      tick() {
        this.update({ time: ++this.state.time })
      },
      onBeforeMount(props) {
        // create the component initial state
        this.state = {
          time: props.start
        }

        this.timer = setInterval(this.tick, 1000)
      },
      onUnmounted() {
        clearInterval(this.timer)
      }
    }
  </script>
</timer>

Open this example on Plunker

Mounting

// mount the timer with its initial props
riot.mount('timer', { start: 0 })

Nesting

Custom components let you build complex views with HTML.

<timetable>
  <timer start="0"></timer>
  <timer start="10"></timer>
  <timer start="20"></timer>
</timetable>

HTML syntax is the de facto language on the web and it's designed for building user interfaces. The syntax is explicit, nesting is inherent to the language and attributes offer a clean way to provide options for custom tags.

Performant and predictable

  • Absolutely the smallest possible amount of DOM updates and reflows.
  • Fast expressions bindings instead of virtual DOM memory performance issues and drawbacks.
  • One way data flow: updates and unmounts are propagated downwards from parent to children.
  • No "magic" or "smart" reactive properties or hooks
  • Expressions are pre-compiled and cached for high performance.
  • Lifecycle methods for more control.

Close to standards

  • No proprietary event system.
  • Future proof thanks to the javascript module syntax.
  • The rendered DOM can be freely manipulated with other tools.
  • No extra HTML root elements, data- attributes or fancy custom attributes.
  • No new syntax to learn.
  • Plays well with any frontend framework.

Use your dearest language and tools

Powerful and modular ecosystem

The Riot.js ecosystem is completely modular, it's designed to let you pick only the stuff you really need:

CDN hosting

How to contribute

If you are reading this it's already a good sign and I am thankful for it! I try my best working as much as I can on riot but your help is always appreciated.

If you want to contribute to riot helping the project maintenance please check first the list of open issues to understand whether there is a task where you could help.

Riot is mainly developed on UNIX systems so you will be able to run all the commands necessary to build and test the library using our Makefile. If you are on a Microsoft machine it could be harder to set up your development environment properly.

Following the steps below you should be able to properly submit your patch to the project

1) Clone the repo and browse to the riot folder

$ git clone [email protected]:riot/riot.git && cd riot

2) Set up your git branch

$ git checkout -b feature/my-awesome-patch

3) Install the npm dependencies

$ npm i

4) Build and test riot using the Makefile

# To build and test riot
$ make riot

# To build without testing
$ make raw

5) Pull request only against the dev branch making sure you have read our pull request template

6) Be patient

Credits

Riot is actively maintained with ❤️ by:


Gianluca Guarini

Many thanks to all smart people from all over the world who helped improving it.

Official Website

https://riot.js.org

Backers

Support us with a monthly donation and help us continue our activities. Become a backer

Backers

Sponsors

Become a sponsor to get your logo on our README. Become a sponsor

Sponsors

Thanks

Special thanks to Browserstack and JetBrains for their support

jetbrains browser stack
Comments
  • When updating a tag with a loop, rendered result doesn't always reflect the updated data

    When updating a tag with a loop, rendered result doesn't always reflect the updated data

    The below fiddle recreates the issue. Checking an item should remove it. However, checking any but the last item with riot 2.2.2, while the item is removed, the item below becomes checked. It works fine with 2.1.0 and 2.0.15.

    http://jsfiddle.net/cdanielw/bkw5ommu/4/

    bug discussion 
    opened by cdanielw 153
  • 8-10x slower than React at 10k item list reversal

    8-10x slower than React at 10k item list reversal

    I was very interested in seeing how fast Riot was compared to React based on the intro docs.

    So I put together these simple demos to help me learn and compare.

    10k item list with reverse button. After you click the button, you'll see the time it took to reverse and finish rendering. (Actually, in a separate issue, I don't understand why you have to click the button twice on the Riot version before the timing text appears.)

    React: http://jsfiddle.net/brianmfranklin/w674Lv7p/ Riot2: http://jsfiddle.net/brianmfranklin/j05ukz2r/

    On my MacBook Pro, I consistently get about 2500 ms for Riot, and only 250-350ms for React.

    I thought maybe this was a quirk of how I was having to measure the timing. But it DOES seem to actually take longer to do the re-render.

    Is this expected? Or are there more optimizations to do?

    bug fixed enhancement 
    opened by brianmfranklin 145
  • Riot next - roadmap to v4

    Riot next - roadmap to v4

    Roadmap proposal for the future riot major release:

    (this list just a draft and it's going to grow)

    • [ ] Complete rewrite of the compiler simplifying the sourcecode allowing also sourcemaps
    • [ ] Fix all the yield issues introducing the use of <slot> deprecating the <yield>
    • [ ] Make the use of riot-observable optional
    • [ ] Remove this.tags from the tags instances in favor of ref https://github.com/riot/riot/issues/2360
    • [ ] Automounted components deprecating the riot.mount method
    • [ ] Add support for shadow DOM or at least support the :root selector instead of :scope
    • [ ] Make the tags options explicit avoiding to pick per default all the custom tags attributes
    • [ ] Avoid the use of riot.csp in favor of a simpler solution
    • [ ] Cleanup the readme file removing dead links to tutorials or old riot stuff
    • [ ] Simplify the mixin logic avoid the use of es6 classes and functions instances
    • [ ] Remove the shouldUpdate method in favor of a smarter DOM updates strategy
    • [ ] Drop IE9/10/11 support
    • [ ] Use new ES6 features like Proxies and template strings
    • [ ] Drop the use of each={ items } in favor of each={ item in items }
    • [ ] Reduce the source code simplifying a lot the api
    • [ ] Update the api simplifying the core methods arguments handling
    • [ ] Prefer a functional approach over the current objects extension strategy

    We will track the progress here

    ✌️

    discussion 
    opened by GianlucaGuarini 125
  • Riot next - roadmap to riot 2.3

    Riot next - roadmap to riot 2.3

    Riot 2.2.3

    The next riot release the 2.2.3 (maybe we could split it also in 2 releases 2.2.4) will fix the mainly the issues raised up by our users

    • Bugs
      • [x] #1055
      • [x] #1048
      • [x] #1040 #974 #995
      • [x] #1016 #984
      • [x] #976
      • [x] #907
      • [x] #1071

    Riot 2.2.4

    bugs list

    Riot 2.3.0

    I would like also to discuss here the updates I've planned for riot 2.3.*

    • [x] rethink/refactore the riot loops to keep them fast but also updating the DOM node correctly
    • [x] remove the compiler, router, observable (maybe also the cli).. from the riot repo. We could publish all these scripts as separate npm modules riot-* and use them to build riot in this repo (or even extend the basic riot functionalities like the router 4 ex.). This solution allows us to split and test all the riot core modules in their own repos avoiding to pollute this repo with too many unrelated tests. Indeed we could also track better the issues related to small parts of our code base. I have already prepared riot-observable containing the folder structure I would like to use also for the other riot modules. Notice that the doc folder could be used to update the whole riot documentation/website here avoiding to rely on @tipiirai on any new riot release. The submodules versioning should be in sync with riot at least for the major releases
    • [x] remove the ie8 support as one of the main riot pros from the doc, I would like explain the hacks about how to use eventually riot on IE8 only in our FAQ section
    • [ ] remove the dist folder from the .gitignore to easily debug the release in the dev branch
    • [x] decide whether we want to optimize our build using webpack or keep using smash
      • with smash we could only include the index.js files of all our riot submodules
        • Pros: It will keep the riot codebase small
        • Pros/Cons: Our source files will not be processed by any other tool, they will be only concatenated in riot.js
        • Cons: Use of a deprecated technology
        • Cons: We will lose control over the global variables, functions risking global namespace conflicts
      • with webpack
        • Pros: We can get only the methods exported from our riot submodules keeping, the riot context clean
        • Pros/Cons: We could parse our modules, using babeljs using also es2015 features
        • Cons: Our output will not match the codestyle used in the sourcecode
        • Cons: Our output will be bigger containing extra code generated by webpack to handle the commonjs calls
    • [x] merge the new tmpl.js https://github.com/riot/riot/pull/954 version (maybe it could also be a riot submodule riot-tmpl?! )
    • [x] update the riot website automatically on any new riot release enhancing the code [here].(https://github.com/riot/riot.github.io) Do we need to redesign it? Or do you want to keep the current template?
    • [x] enhance the riot-router using the HTML5 history API

    Your feedback is really appreciated @tipiirai @cognitom @rsbondi @aMarCruz

    :v:

    discussion 
    opened by GianlucaGuarini 98
  • Feature request: Specify transclusion position

    Feature request: Specify transclusion position

    It would be great to specify where to include the content of a parent tag. Ie:

    <!-- form-group.tag -->
    <form-group>
      <div class="form-group">
        <label>{ opts.label }</label>
        { innerHTML } <!-- somehow transclude given content here (there is probably a better name than "innerHTML" ;) -->
      </div>
    </form-group>
    
    <!-- index.html -->
    <form>
      <form-group label="Field 1">
        <input type="text" name="field-1"/>
      </form-group>
    </form>
    

    .... producing ....

    <div class="form-group">
      <label>Field 1</label>
      <input type="text" name="field 1"/>
    </div>
    
    opened by johngeorgewright 95
  • Riot 3.0.0 roadmap

    Riot 3.0.0 roadmap

    3.0.0 will be quite a big release for riot. @rsbondi and the new member of the team @rogueg are already working on the next branch fixing many of the important issues that we can solve only by introducing breaking changes. Here you can check the list of the issues we want to close for the next major release:

    • [x] improve the loop performances using the @pakastin's hint http://jsfiddle.net/paldepind/rju8rzmn/4/
    • [ ] ~~switch from makefile to a more crossplatform solution #2024~~
    • [ ] add sourcemaps generation in the compiler compiler/56
    • [x] use the ref attribute instead of names and ids riot/1185
    • [x] allow the es6 import also inside the tags compiler/69
    • [x] build riot using rollup+babel instead of smash using the new es6 modules syntax
    • [x] remove riot-route from the core making it optional https://github.com/riot/riot/issues/1485
    • [x] fix all the issues related to the if conditions https://github.com/riot/riot/issues/1477 https://github.com/riot/riot/pull/1658
    • [x] avoid that the update and the updated events get triggered before any tag has been mounted https://github.com/riot/riot/issues/1661
    • [x] decision regarding how the input/select tags should react on the updates https://github.com/riot/riot/issues/1642
    • [x] remove the automatic preventDefault from the riot DOM events https://github.com/riot/riot/issues/1770 https://github.com/riot/riot/issues/1718 https://github.com/riot/riot/issues/526
    • [x] avoid to inherit properties from the parent in loops of custom children tags https://github.com/riot/riot/issues/1697
    • [x] avoid to update the parent tag on the events generated from a child tags https://github.com/riot/riot/issues/1319
    • [x] remove the __ prefix for the "boolean" html attributes https://github.com/riot/riot/issues/276
    • [x] clean up the tests splitting them into several files
    • [x] Add the shouldUpdate method to the tags to emulate componentShouldUpdate in react

    I also hope to have enough time to add a blog section on our site describing the riot status on any release.

    I would like also to mention that we started a pledgie donation campaign and if you would like to sustain us and you like riot it might be nice to consider a donation at least to let us paying the costs of the riot maintenance (domain, saucelabs, browserstack.. )

    :v:

    discussion 
    opened by GianlucaGuarini 77
  • Riot next

    Riot next

    Bugs:

    • [x] https://github.com/muut/riotjs/issues/766
    • [x] https://github.com/muut/riotjs/issues/764
    • [ ] ~~https://github.com/riot/riot/issues/810~~ in the next release
    • [ ] ~~https://github.com/riot/riot/issues/334~~ in the next release
    • [x] https://github.com/riot/riot/issues/809
    • [x] https://github.com/muut/riotjs/issues/700
    • [x] https://github.com/muut/riotjs/issues/484 ( probably the most important )
    • [x] https://github.com/muut/riotjs/issues/763

    Features/Enhancements

    • [x] faster each rendering ( related to #484 )
    • [x] fix the saucelabs tests on the iPhone/iPad (I have removed them)
    • [x] increase the code coverage
    • [x] enable use strict

    p.s. This list could change at anytime, new ideas and suggestions are welcome Your contribute to riot is precious :v:

    opened by GianlucaGuarini 72
  • Looping is at the wrong level

    Looping is at the wrong level

    I think looping through element is at the wrong tag level. Specially when you have this case you need to write twice the each to get it work as expected.

    <dl class="dl-horizontal" >
        <dt each={name in opts.data.metrics}>{name}</dt>
        <dd each={name, value in opts.data.metrics}>{value}</dd>
    </dl>
    

    It iterates the same list twice right?

    Shouldn't that be like this? And more efficient.

    <dl class="dl-horizontal" each={name, value in opts.data.metrics}>
        <dt>{name}</dt>
        <dd>{value}</dd>
    </dl>
    

    It feels more natural too. If you base on templating engines such as Jinja http://jinja.pocoo.org/docs/dev/templates/#for

    enhancement feature request 
    opened by assertnotnull 70
  • Riot 4 roadmap

    Riot 4 roadmap

    Recap

    It's almost one year that we didn't release updates about Riot v4 so I think opening a new roadmap issue (closing the old one https://github.com/riot/riot/issues/2283) is the cleanest way to keep our community updated regarding the upcoming news.

    Riot v3

    Riot v3 is feature complete and bug free so we will update the source code just in case of security vulnerabilities. All the enhancements and the yield problems submitted by some users will introduce breaking changes so I would like to keep the current API/behavior stable as it is and move forward.

    Core Contributors

    Please see here

    Riot v4

    Riot and Simulacra.js will join forces

    Riot 4 will use Simulacra.js as default rendering engine. Simulacra.js is currently one of the fastest and smartest rendering engine available and its creator @daliwali is now a riot core member. Dali will actively be part of the riot 4 rewrite and we started already working on a new parser/compiler.

    Components Structure

    The riot components structure will be a bit refreshed but it will not be a radical change. We will avoid the current ambiguities in favor of a cleaner and nicer structure.

    Old

    <my-component>
      <h1 if={ title }>{ title }</h1>
      <ul>
        <li onclick={ onClick } each={ items }>{ value }</li>
      </ul>
    
      var goodbye = 'goodbye'
    
      this.on('mount', function() {
        console.log('mounted!')
      })
    
      onClick() {
        this.title = goodbye
      }
    
      <style>
        :scope {
          color: red;
        }
      </style>
    </my-component>
    

    New

    <my-component>
      <h1 if={ title }>{ title }</h1>
      
      <ul>
        <li onclick={ onClick } each={ item in items }>{ item.value }</li>
      </ul>
    
      <script>
        var goodbye = 'goodbye'
    
        export default {
          onMount() {
            console.log('mounted!')
          },
          onClick() {
            this.title = goodbye
          }
        }
      </script>
    
      <style>
        :root {
          color: red;
        }
      </style>
    </my-component>
    

    New Ideas

    We got many new ideas for the rewrite but we need to test them first so you will be informed when the compiler will be in a functional prototype state.

    Release date

    At moment we don't have any fixed release date, we only know that a full rewrite of the framework in 2 of us (working only during our spare time) will take quite some time. We will inform you about a plausible release date when a first prototype will be released. Please donate to our open collective campaign if you want to actively support the development of the new Riot.js major release

    API changes 🚧

    • [ ] Complete rewrite of the compiler simplifying the sourcecode and the parsing
    • [ ] Switch to Simulcra.js as default rendering engine
    • [ ] Remove riot-observable in favor of callbacks lifecycle methods
    • [ ] Remove this.tags from the tags instances in favor of ref https://github.com/riot/riot/issues/2360
    • [ ] Add support for shadow DOM or at least support the :root selector instead of :scope
    • [ ] Remove riot.csp.js in favor of a single version compatible for any environement
    • [ ] Cleanup the readme file removing dead links to tutorials or old riot stuff
    • [ ] Simplify the mixin logic allowing only object
    • [ ] Make the use of <script> and <style> obligatory
    • [ ] Remove the shouldUpdate method
    • [ ] Drop the use of each={ items } in favor of each={ item in items }
    • [ ] Update the API simplifying the arguments overload issue for many riot methods

    ✌️

    discussion 
    opened by GianlucaGuarini 66
  • Test suite with mocha, travis, karma & saucelabs

    Test suite with mocha, travis, karma & saucelabs

    I would like to make a unit test with mocha to check that the code pushed on any pull request does not break. Another advantage could be to check the crossbrowser compatibility on any release automatically. We need to create an account on saucelabs ( email + psw ) and @tipiirai you should create also the travis hook

    opened by GianlucaGuarini 51
  • Super Powerful Routes

    Super Powerful Routes

    This PR introduces a huge improvement in our routes making it easy to define different callbacks for each path. Below I am adding some examples, check the tests for more details.

    // Defining several routes at once
    riot.route({
       // static route
       "/home":  function(params) { ... },
    
       // RegEx route 
       ".*/something": function(params) { ... }, 
    
       // Passing params
       "/items/{item}": function(params) { ... },
    
       // With RegEx and several params 
       ".*/{type}/{id}?.*q={q}.*": function(params) { ... }
    });
    
    // Defining a single route
    riot.route("/somepage", function(params) { ... });
    
    // Trigger a route, this will execute the the callback of this route
    riot.route("/somepage");
    
    opened by 3den 47
  • Class merge not working as expected

    Class merge not working as expected

    Help us to manage our issues by answering the following:

    1. Describe your issue: Classes set on a component element are not merged with classes from the tag's definition. The source code below produces this DOM:
    <counter count="1" class="inline-flex flx-col align-items-center" style="color: lime"></counter>
    

    when I was expecting this:

    <counter count="1" class="mar-r-xl inline-flex flx-col align-items-center" style="color: lime"></counter>
    

    Source code: index.html

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <title>Trying Riot</title>
    </head>
    <body>
        <counter count="1" class="mar-r-xl" style="color: lime"></counter>
        <counter></counter>
    
      <script src="counter.riot" type="riot"></script>
      <script src="https://unpkg.com/[email protected]/riot+compiler.min.js"></script>
      <script>
        (async function main() {
          await riot.compile()
          riot.mount('counter')
        }())
      </script>
    </body>
    </html>
    

    counter.riot

    <counter class="inline-flex flx-col align-items-center">
      <p>Count <span class="fnt-bold">{state.count}</span></p>
      <button onclick="{incrementCount}" ord="primary">Increment</button>
    
      <script>
        export default {
          state: {
            count: 0
          },
    
          incrementCount() {
            this.state.count += 1;
            this.update();
          }
        }
      </script>
    </counter>
    
    1. Can you reproduce the issue?

    The code above can be copy pasted to easily reproduce.

    1. On which browser/OS does the issue appear?

    Chrome on macOS

    1. Which version of Riot does it affect?

    I'm using 7.1.0

    1. How would you tag this issue?
    • [ ] Question
    • [x] Bug
    • [ ] Discussion
    • [ ] Feature request
    • [ ] Tip
    • [ ] Enhancement
    • [ ] Performance
    feature request 
    opened by jfbrennan 0
  • The draggable attribute isn't handled right

    The draggable attribute isn't handled right

    The issue:

    1. The draggable attribute isn't handled right by riot when you assign it a boolean expression.
    2. The HTML standard (and the browser) expects values of "true" or "false" (unlike, "checked", for example, which expects "checked" value or non).
    3. Riot translate a truthy value into the string "draggable" - which doesn't make it draggable.

    Reproduction https://codesandbox.io/embed/riot-js-7-bug-template-forked-1mco0f?fontsize=14&hidenavigation=1&theme=dark

    Test context browsers: Chrome and Firefox, linux OS, riot version 7

    Issue type Bug

    enhancement discussion breaking change 
    opened by dharmax 1
  • Using riot components in an Angular application

    Using riot components in an Angular application

    Help us to manage our issues by answering the following:

    1. Describe your issue:

    In my company we are working on a huge and terrible legacy code written in Angular 11 and we'd like to gradually migrate out of it into Riot, with which we have a good experience in other project. We thought about building an angular component which will function as a bridge between the containing application to the riot component. So far, we managed to do so only when we precompile the riot file into a js file. However, this method would be pretty cumbersome. We didn't manage to properly configure the webpack to do that compilation for us. If you have any ideas how to solve this "bridging problem" we'd be grateful.

    1. Can you reproduce the issue? n/a
    2. On which browser/OS does the issue appear? all
    3. Which version of Riot does it affect? latest (7)
    4. How would you tag this issue?
    • [ ] Question
    question needs repro 
    opened by AndrewPetrishin 3
  • Storybook Support on latest Riot version.

    Storybook Support on latest Riot version.

    Help us to manage our issues by answering the following:

    1. Describe your issue:

    There is an issue in Storybook repository, Storybook does not seem to support the latest Riot.js.

    https://github.com/storybookjs/riot/issues/1

    1. Can you reproduce the issue?
    1. On which browser/OS does the issue appear?
    1. Which version of Riot does it affect?

    v4 and later

    1. How would you tag this issue?
    • [ ] Question
    • [ ] Bug
    • [ ] Discussion
    • [x] Feature request
    • [ ] Tip
    • [ ] Enhancement
    • [ ] Performance
    enhancement 
    opened by nibushibu 3
Releases(v7.1.0)
  • v7.1.0(Nov 7, 2022)

    • Fix https://github.com/riot/riot/issues/2972
    • Fix https://github.com/riot/riot/issues/2967 (enhance the previous patch)
    • Fix https://github.com/riot/riot/issues/2969
    • Update Riot.js has now 0 dependencies. All the needed dependencies will be bundled before the publishing on npm
    • Update dev dependencies
    Source code(tar.gz)
    Source code(zip)
  • v7.0.7(Nov 1, 2022)

    • Fix https://github.com/riot/riot/issues/2971
    • Fix https://github.com/riot/riot/issues/2967 adding support for css complex pseudo selectors
    • Fix riot.version wrong value in the esm export
    • Fix circular dependencies
    • Update improve rendering performance preferring loops over recursion for DOM manipulations
    Source code(tar.gz)
    Source code(zip)
  • v7.0.6(Sep 9, 2022)

  • v7.0.5(Sep 2, 2022)

  • v7.0.4(Aug 23, 2022)

  • v7.0.3(Aug 14, 2022)

  • v7.0.2(Aug 4, 2022)

  • v7.0.1(Aug 3, 2022)

  • v7.0.0(Aug 2, 2022)

    • Update: code cleanup to improve the esm bundle and treeshaking
      • Remove: riot.esm.js in favor of the esm folder
    • Add: runtime slots https://github.com/riot/riot/discussions/2917
      • The runtime slots are available in the riot+compiler.js bundle (A documentation update will be available soon)
    • Update: reduced bundle size to 5kb riot.min.js gzipped
    • Update: new Compiler (riot+compiler.js) bundle 50% lighter than the previous one

    Important: The documentation will be updated during the next few weeks, however no API breaking changes were introduced.

    Source code(tar.gz)
    Source code(zip)
  • v6.1.2(Jan 24, 2022)

  • v6.1.1(Dec 17, 2021)

  • v6.1.0(Dec 11, 2021)

    • Update compiler
      • Components output code will use modern javascript (like arrow functions) reducing heavily their size
      • Components code output will be smaller due to compiler optimizations
    • Update dependencies
    Source code(tar.gz)
    Source code(zip)
  • v6.0.4(Sep 19, 2021)

  • v6.0.3(Aug 6, 2021)

    • Fix tags with only named export statements. Their javascript will be properly generated also without an export default
    • Update @riotjs/dom-bindings types adding better typescript support
    Source code(tar.gz)
    Source code(zip)
  • v6.0.2(Jul 29, 2021)

  • v6.0.1(Jul 14, 2021)

    • Update: update the @riotjs/compiler improving the typescript support for type aliases like export type ComponentInterface = RiotComponent<MyComponentProps, MyComponentState>
    Source code(tar.gz)
    Source code(zip)
  • v6.0.0(Jul 11, 2021)

    • Add strict typescript support https://github.com/riot/riot/pull/2912 Breaking Change: the Riot.js types have been updated
    • Add fallback rendering for slots https://github.com/riot/riot/issues/2920
    • Add typescript Parser as default compiler parser https://github.com/riot/compiler/pull/149
    • Fix https://github.com/riot/riot/issues/2925
    • Fix typescript compilation https://github.com/riot/riot/issues/2926

    If you are not a typescript user this release doesn't introduce any braking change. If you are a typescript user you can start writing Riot.js components as follows

    <my-component>
      <p>{ state.greeting }{ props.username }</p>
    
      <!--
        Notice that lang="ts" does actually nothing.
        It's just needed to let your IDE interpret the below code as typescript.
        The riot compiler will ignore it
      -->
      <script lang="ts">
        import {withTypes, RiotComponent} from 'riot'
    
        export type MyComponentProps = {
          username: string
        }
    
        export type MyComponentState = {
          message: string
        }
    
        export type MyComponent = RiotComponent<MyComponentProps, MyComponentState>
    
        export default withTypes<MyComponent>({
          state: {
            message: 'hello'
          }
        })
      </script>
    </my-component>
    

    Many thanks to https://github.com/kachurun for his help on this major release

    Source code(tar.gz)
    Source code(zip)
  • v5.4.5(Jun 13, 2021)

    • Fix https://github.com/riot/riot/issues/2914 many thanks to @kachurun
    • Fix template tags rendering with empty DOM https://github.com/riot/dom-bindings/pull/19
    Source code(tar.gz)
    Source code(zip)
  • v5.4.4(Jun 5, 2021)

  • v5.4.3(May 29, 2021)

  • v5.4.2(May 15, 2021)

    • Fix mountand unmount type declarations https://github.com/riot/riot/pull/2909 @kachurun
    • Fix Parent Tag access in lifecycle events https://github.com/riot/riot/pull/2910 @kachurun
    Source code(tar.gz)
    Source code(zip)
  • v5.4.1(May 4, 2021)

  • v5.4.0(May 4, 2021)

    • Update: replace the compiler acorn javascript parser with the (bigger but more modern) @babel/parser
    • Add: typescript syntax support in Riot.js <script> tags

    Notice: Riot.js will not type check your components scripts nor transpile them. This version allows you to use the typescript syntax without forcing the use of a typescript preprocessor, but type checking and transpilation should be handled with tools like babel or ts-loader You can check the new compiler here with the following demo component:

    <random>
      <h3>{ props.title }</h3>
    
      <button onclick={ generate }>
        Generate
      </button>
    
      <h1>
        { state.number }
      </h1>
    
      <logs logs={ state.logs } onclear={ clearLogs }></logs>
    
      <script lang="ts">
        import Logs from '../logs/logs.riot'
        import {RandomComponent} from './types'
    
        function Random(): RandomComponent {
          return {
            state: {
              number: null,
              logs: []
            },
            generate(event: MouseEvent): void {
              this.update({
                number: Math.floor(Math.random() * 10000),
                logs: this.state.logs.concat({
                  text: `Generate button clicked. Event type is ${event.type}`
                })
              })
            },
            clearLogs(): void {
              this.update({
                logs: []
              })
            }
          }
        }
    
        Random.components = {
          Logs
        }
    
        export default Random
      </script>
    </random>
    
    
    Source code(tar.gz)
    Source code(zip)
  • v5.3.3(Apr 5, 2021)

  • v5.3.2(Apr 5, 2021)

  • v5.3.1(Feb 28, 2021)

    • Fix https://github.com/riot/riot/issues/2895
    • Update improve compiler legacy syntax support. The following syntax is now also supported
    <my-component>
      <p>{ state.message }</p>
      <button onclick={onClick}>Click Me</button>
    
      <script>
        const context = this
    
        context.state = {
          message: ''
        }
        
        context.onBeforeMount = () => {
          context.state.message = 'Hello'
        }
    
        context.onClick = () => {
          context.update({
            message: 'Goodbye'
          })
        }
      </script>
    </my-component>
    
    Source code(tar.gz)
    Source code(zip)
  • v5.3.0(Feb 13, 2021)

    • Update improve support for legacy Riot.js syntax fixing some edge cases
    • Update improve support for recursive tags

    Now you can recursively render tags without having to register them globally

    <recursive-tree>
      <p>{ props.name }</p>
      <recursive-tree 
        if={ props.children.length && props.children } 
        each={ child in props.children } { ...child }/>
    </recursive-tree>
    
    Source code(tar.gz)
    Source code(zip)
  • v5.2.0(Jan 31, 2021)

    • Add support for old style Riot.js syntax

    Some liked more the old RIot.js syntax so you can now write components also as follows

    <old-syntax>
      <p>{ state.message }</p>
      <button onclick={onClick}>Click Me</button>
    
      <script>
        this.onBeforeMount = () => {
          this.state.message = 'Hello'
        }
    
        this.onClick = () => {
          this.update({
            message: 'Goodbye'
          })
        }
      </script>
    </old-syntax>
    
    Source code(tar.gz)
    Source code(zip)
  • v5.1.4(Jan 23, 2021)

  • v5.1.3(Jan 17, 2021)

Owner
Riot.js
Simple and elegant component-based UI library
Riot.js
Semantic is a UI component framework based around useful principles from natural language.

Semantic UI Semantic is a UI framework designed for theming. Key Features 50+ UI elements 3000 + CSS variables 3 Levels of variable inheritance (simil

Semantic Org 50.3k Jan 3, 2023
Materialize, a CSS Framework based on Material Design

MaterializeCSS Materialize, a CSS Framework based on material design. -- Browse the docs -- Table of Contents Quickstart Documentation Supported Brows

Alvin Wang 38.8k Dec 28, 2022
Enable JSX for Template Literal Tags based projects.

JSX2TAG Social Media Photo by Andre Taissin on Unsplash Enable JSX for Template Literal Tags based projects. µhtml live demo µland live demo µbe live

Andrea Giammarchi 35 Nov 21, 2022
Functional, simple and customizable UI buttons for react native. Also contains loading functionality and automatically changes color for dual tone buttons. TypeScript support.

React Native UI Buttons ✨ Installation If you want to use icons make sure you have react-native-vector-icons installed in your project. npm install --

Hussain Pettiwala 6 Dec 5, 2022
Simple, lightweight, persistent two-way databinding

way.js Simple, lightweight, persistent, framework-agnostic two-way databinding Javascript library. With no to little JS code to write. And no dependen

gwendall 2.9k Dec 30, 2022
Simple TypeScript fastify template.

Simple fastify template. Instructions: 1.) Clone the repo 2.) Type npm i to install all dependencies 3.) Type npm run dev to make it autorecompile on

Nick 2 Mar 17, 2022
Lightweight MVC library for building JavaScript applications

Spine Spine is a lightweight MVC library for building JavaScript web applications. Spine gives you structure and then gets out of your way, allowing y

Spine JS Project 3.6k Jan 4, 2023
Super minimal MVC library

Espresso.js Espresso.js is a tiny MVC library inspired by Backbone and React with a focus on simplicity and speed. We've aimed to bring the ideas of u

TechLayer 534 Dec 11, 2022
:fire: An extremely fast, React-like JavaScript library for building modern user interfaces

Inferno is an insanely fast, React-like library for building high-performance user interfaces on both the client and server. Description The main obje

Inferno 15.6k Jan 3, 2023
🙋‍♀️ 3kb library for tiny web apps

3kb library for tiny web apps. Sometimes, all you want to do is to try and do something—No boilerplate, bundlers, or complex build processes. Lucia ai

Aiden Bai 699 Dec 27, 2022
JavaScript UI library for data-driven web applications

Road to 2.0 The master branch has new, in-progress version of w2ui. You might want to consider 1.5 branch that is stable and supports older browsers.

Vitali Malinouski 2.4k Jan 3, 2023
An unofficial SmartThings websocket API library (alpha)

An unofficial SmartThings websocket API library (alpha) ?? Installation This is a Node.js module available through the npm registry. $ npm i -S smart-

Stephen Mendez 4 Sep 20, 2021
Formily + SemiDesign: The Awesome Components Library with Formily & Semi

Formily + SemiDesign: The Awesome Components Library with Formily & Semi

Formily Organization 12 Dec 19, 2022
🌟 DataFormsJS 🌟 A minimal JavaScript Framework and standalone React and Web Components for rapid development of high quality websites and single page applications.

?? Welcome to DataFormsJS! Thanks for visiting! ?? ?? ?? ?? ?? ?? 中文 (简体) 欢迎来到 DataFormsJS Español Bienvenido a DataFormsJS Português (do Brasil) Bem

DataFormsJS 156 Dec 8, 2022
An HTML5/CSS3 framework used at SAPO for fast and efficient website design and prototyping

Welcome to Ink Ink is an interface kit for quick development of web interfaces, simple to use and expand on. It uses a combination of HTML, CSS and Ja

SAPO 1.9k Dec 15, 2022
A framework for real-time applications and REST APIs with JavaScript and TypeScript

A framework for real-time applications and REST APIs with JavaScript and TypeScript Feathers is a lightweight web-framework for creating real-time app

Feathers 14.2k Dec 28, 2022
Give your JS App some Backbone with Models, Views, Collections, and Events

____ __ __ /\ _`\ /\ \ /\ \ __ \ \ \ \ \ __ ___\ \ \/'\\ \ \_

Jeremy Ashkenas 28k Dec 27, 2022
NativeScript empowers you to access native api's from JavaScript directly. Angular, Vue, Svelte, React and you name it compatible.

NativeScript empowers you to access native APIs from JavaScript directly. The framework currently provides iOS and Android runtimes for rich mobile de

NativeScript 22k Jan 4, 2023
Lightweight and powerful data binding.

Rivets.js Rivets.js is a lightweight data binding and templating system that facilitates building data-driven views. It is agnostic about every aspect

Michael Richards 3.2k Dec 28, 2022