egasimus / sinuous

Small, blazing fast, reactive UI library

Home Page:https://sinuous.netlify.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sinuous

Build Status Badge size codecov code style: prettier

npm: npm install sinuous --save
cdn: https://unpkg.com/sinuous/dist/sinuous.js

Intro

Sinuous provides the clarity of declarative views and the performance of direct DOM manipulation.
It was built with these ideas in mind.

  • Small: use in other mini libraries like custom elements.
  • Simple: plain Javascript feel; template literals, standard HTML.
  • Performance: top ranked of 80+ UI libs

Add-ons

Size Name Description
Badge size sinuous/map Fast list renderer
Badge size sinuous/template Pre-rendered Template
Badge size sinuous/observable Tiny observable

Concept

Sinuous started as a little experiment to get similar behavior as Surplus but with template literals instead of JSX. HTM compiles to an h tag. Adapted code from Ryan Solid's dom expressions + a Reactive library provides the reactivity.

Sinuous returns a hyperscript function which is armed to handle the callback functions from the reactive library and updates the DOM accordingly.

Counter Example (1.4kB gzip) (Codesandbox)

import { o, h } from 'sinuous';

const counter = o(0);
const view = () => {
  return html`
    <div>Counter ${counter}</div>
  `;
};

document.body.append(view());
setInterval(() => counter(counter() + 1), 1000);

Browser Support

Sinuous supports modern browsers and IE11+:

Sauce Test Status

Use your own reactive library

Sinuous can work with different observable libraries. See the wiki for more info.

Big Thanks

Cross-browser Testing Platform and Open Source <3 Provided by Sauce Labs

About

Small, blazing fast, reactive UI library

https://sinuous.netlify.com


Languages

Language:JavaScript 100.0%