All Projects â†’ HenriqueLimas â†’ Osagai

HenriqueLimas / Osagai

đŸ€„ïžA tiny library for creating WebComponents in a Functional way

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Osagai

Hybrids
Extraordinary JavaScript framework with unique declarative and functional architecture
Stars: ✭ 2,529 (+5921.43%)
Mutual labels:  functional-programming, webcomponents
Redash
Tiny functional programming suite for JavaScript.
Stars: ✭ 40 (-4.76%)
Mutual labels:  functional-programming
Ulmus
A functional-reactive style programming library for Clojure(script)
Stars: ✭ 33 (-21.43%)
Mutual labels:  functional-programming
Imagene
A General Purpose Image Manipulation Tool
Stars: ✭ 36 (-14.29%)
Mutual labels:  functional-programming
Shell Functools
Functional programming tools for the shell
Stars: ✭ 971 (+2211.9%)
Mutual labels:  functional-programming
Fauxgaux
â›łïž Functional Go
Stars: ✭ 36 (-14.29%)
Mutual labels:  functional-programming
Swiftlyext
SwiftlyExt is a collection of useful extensions for Swift 3 standard classes and types 🚀
Stars: ✭ 31 (-26.19%)
Mutual labels:  functional-programming
With Or Without Fp
ç”šć‡œæ•°ćŒçŒ–çš‹é‡æž„ä»Łç ć§ïŒ
Stars: ✭ 41 (-2.38%)
Mutual labels:  functional-programming
Lambda
λ → C++ library for functional programming
Stars: ✭ 38 (-9.52%)
Mutual labels:  functional-programming
Lwc
âšĄïž LWC - A Blazing Fast, Enterprise-Grade Web Components Foundation
Stars: ✭ 974 (+2219.05%)
Mutual labels:  webcomponents
Eslint Plugin Wc
ESLint rules for Web Components
Stars: ✭ 35 (-16.67%)
Mutual labels:  webcomponents
Rexrex
🩖 Composable JavaScript regular expressions
Stars: ✭ 34 (-19.05%)
Mutual labels:  functional-programming
Safedom
đŸ”« safedom is a safe way to you manipulate dom using a purer functional style.
Stars: ✭ 37 (-11.9%)
Mutual labels:  functional-programming
Swift Overture
đŸŽŒ A library for function composition.
Stars: ✭ 968 (+2204.76%)
Mutual labels:  functional-programming
Fx Ts
Computational environments and effects for TypeScript
Stars: ✭ 42 (+0%)
Mutual labels:  functional-programming
Flawless
WIP Delightful, purely functional testing no-framework. Don't even try to use it at work!
Stars: ✭ 33 (-21.43%)
Mutual labels:  functional-programming
Stm4cats
STM monad for cats-effect
Stars: ✭ 35 (-16.67%)
Mutual labels:  functional-programming
Corsair
Corsair using RxJS, Immutable.js and WebGL/three.js
Stars: ✭ 36 (-14.29%)
Mutual labels:  functional-programming
Graphql Lodash
🛠 Data manipulation for GraphQL queries with lodash syntax
Stars: ✭ 1,003 (+2288.1%)
Mutual labels:  functional-programming
Egghead Typescript Vuejs Apps
Stars: ✭ 41 (-2.38%)
Mutual labels:  webcomponents

Osagai đŸ€„ïž Build Status

A tiny library in a functional and browser way.

Why?

Creating WebComponent shouldn't be limited to extending classes. It should be easy to create and in a functional way. It should be able to be framework-agnostic and be reused in different libraries. Updating components should be fast and it should use native solutions without VirtualDOM and data binding magics. It should not need build processes for compiling non native solution (JSX) and take advantage in what the language has. (Template literal)

Install

You can get it on npm.

npm install osagai

Or import from unpkg

import { define } from "https://unpkg.com/osagai/osagai.mjs";
import { on } from "https://unpkg.com/osagai/events.mjs";

Define a Web component

Osagai comes with a function called define that defines a new custom element that you can use in your application. define receives the name of the custom element (it must contain a hyphen) and the Osagai component. The Osagai component is a function that returns a Template with a string representing the layout of the web component.

import { define } from 'osagai'

function MyComponent() {
	return () => `<h1>Hi 👋!</h1>`
}

define('waving-hand', MyComponent)

Now, you just need to use your new custom element in your application.

<waving-hand></waving-hand>

Example

<!DOCTYPE html>
<html lang="en">
  <title>Osagai demo</title>

  <x-items></x-items>

  <script type="module">
    import { define } from "https://unpkg.com/osagai/osagai.mjs";
    import { on } from "https://unpkg.com/osagai/events.mjs";
    import { update } from "https://unpkg.com/osagai/dom.mjs";

    function Items({ element, query }) {
      const initialState = {
        items: []
      };

      on("click", query(".btn"), () => {
        update(element, ({ items } = initialState) => {
          items.push({
            name: `Item nr ${items.length + 1}`
          });

          return {
            items
          };
        });
      });

      return ({ items } = initialState) => `
        <div>
          <button class="btn">Add item</button>
          <ul class="list">
            ${items.map(item => `<li>${item.name}</li>`).join("")}
          </ul>
        </div>`;
    }

    define("x-items", Items);
  </script>
</html>

Project status

Osagai is still under development and it needs some feedback from the community. If you want to collaborate, please add an issue or PR with your suggestions or concerns.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].