All Projects → chialab → Dna

chialab / Dna

Licence: mit
Progressive Web Components.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Dna

Omi
Front End Cross-Frameworks Framework - 前端跨框架跨平台框架
Stars: ✭ 12,153 (+55140.91%)
Mutual labels:  virtual-dom, webcomponents, custom-elements, shadow-dom
Switzerland
🇨🇭Switzerland takes a functional approach to Web Components by applying middleware to your components. Supports Redux, attribute mutations, CSS variables, React-esque setState/state, etc… out-of-the-box, along with Shadow DOM for style encapsulation and Custom Elements for interoperability.
Stars: ✭ 261 (+1086.36%)
Mutual labels:  virtual-dom, webcomponents, custom-elements, shadow-dom
Hybrids
Extraordinary JavaScript framework with unique declarative and functional architecture
Stars: ✭ 2,529 (+11395.45%)
Mutual labels:  webcomponents, custom-elements, shadow-dom
Custom Element
A base class for Web Components (Custom Elements) which provides simple data binding.
Stars: ✭ 60 (+172.73%)
Mutual labels:  webcomponents, custom-elements, shadow-dom
Nutmeg
Build, test, and publish vanilla Web Components with a little spice
Stars: ✭ 111 (+404.55%)
Mutual labels:  webcomponents, custom-elements, shadow-dom
lego
🚀 Web-components made lightweight & Future-Proof.
Stars: ✭ 69 (+213.64%)
Mutual labels:  virtual-dom, webcomponents, custom-elements
Ioing
Implement the solutions of performance improvement and componentization for your SPA (single page application) products with this Progressive Web App Development Engine.
Stars: ✭ 224 (+918.18%)
Mutual labels:  virtual-dom, webcomponents, shadow-dom
material-webcomponents
Material Design implemented in Web Components (Custom Elements v1)
Stars: ✭ 110 (+400%)
Mutual labels:  webcomponents, custom-elements, shadow-dom
crab
JavaScript library for building user interfaces with Custom Elements, Shadow DOM and React like API
Stars: ✭ 22 (+0%)
Mutual labels:  webcomponents, custom-elements, shadow-dom
Crab
JavaScript library for building user interfaces with Custom Elements, Shadow DOM and React like API
Stars: ✭ 22 (+0%)
Mutual labels:  webcomponents, custom-elements, shadow-dom
domy
Custom Elements Storage
Stars: ✭ 77 (+250%)
Mutual labels:  webcomponents, custom-elements
highcharts-webcomponent
Highcharts Web Component usable with any Framework
Stars: ✭ 21 (-4.55%)
Mutual labels:  webcomponents, custom-elements
lazy-image
Lazily load your images with <lazy-image> custom element
Stars: ✭ 42 (+90.91%)
Mutual labels:  webcomponents, custom-elements
toggle-icon
toggle-icon is a custom element created with Polymer. It provides an extremely powerful and customizable switch that looks like a paper-icon-button.
Stars: ✭ 21 (-4.55%)
Mutual labels:  webcomponents, custom-elements
cwco
Powerful and Fast Web Component Library with a Simple API
Stars: ✭ 27 (+22.73%)
Mutual labels:  webcomponents, custom-elements
vite-plugin-sloth
Fresh take on static site generation, using HTML-first approach to build website. Powered by ⚡️ Vite
Stars: ✭ 39 (+77.27%)
Mutual labels:  webcomponents, custom-elements
custom-elements-manifest
Custom Elements Manifest is a file format that describes custom elements in your project.
Stars: ✭ 81 (+268.18%)
Mutual labels:  webcomponents, custom-elements
codeceptjs-bdd
Javascript BDD UI Automation Framework. Exclusive LWC Shadow DOM Support. Playwright, Webdriver.io, Appium, Saucelabs.
Stars: ✭ 35 (+59.09%)
Mutual labels:  webcomponents, shadow-dom
vaadin-text-field
The themable Web Component providing input controls. Part of the Vaadin components.
Stars: ✭ 29 (+31.82%)
Mutual labels:  webcomponents, custom-elements
svelte-webcomponents
A ready-to-use project template to build custom elements (web components) with Svelte 3 with support and examples for web components, jest, sass, nested components with props, eslinting, stylelinting, Github actions, propagating custom events from shadow-DOM to real-DOM etc.
Stars: ✭ 22 (+0%)
Mutual labels:  custom-elements, shadow-dom

DNA logo

DNA • Progressive Web Components

Documentation link Source link Authors link NPM License


DNA is a component library which aims to provide a temporary interface to define declarative Web Components until browsers support is complete. Instead of requiring heavy polyfills in order to work in all browsers, DNA's philosophy is to use its template engine to handle Custom Elements life cycle, resulting more efficient, reliable and light.

Design Web Components

DNA does not introduce any custom pattern for Component definitions, since it is based on the standard Custom Elements specifications, so the life cycle is almost the same, with some helper methods.

Fast and reliable

In order to be fast, predictive and easier to install, DNA uses a custom template engine. Components automatically re-render when the state change and only the necessary patches are applied to the DOM tree thanks to an in-place diffing algorithm.

Interpolation and JSX

If you are familiar with JSX, you can write your templates using the React syntax, but if you prefer to use standard JavaScript you can also use template strings to avoid the build step in your workflow.

Properties, slots, Promises and Observables!

DNA comes with a lot of features in a very small package. You can use <slot> elements like in Shadow DOM contexts, observe properties changes and delegate events. It can also resolve Promises and pipe Observables directly in the template.

Browsers support

Tests are run against all ever green browsers, Internet Explorer and old Safari versions. DNA itself does not require any polyfill and it is distribute as ES6 module (with untranspiled classes and async/await statements) and as UMD module (targeting ES5), but some Babel helpers if you want to use decorators need support for Symbol, Object.assign and Array.prototype.find. Also, a polyfill for Promise is required in IE11 if you are using async methods or the registry's whenDefined method.

Sauce Test Status

Get the library

Usage via unpkg.com, as UMD package:

<script src="https://unpkg.com/@chialab/dna" type="text/javascript"></script>

or as ES6 module:

import { Component, customElements, html, ... } from 'https://unpkg.com/@chialab/dna?module';

Install via NPM:

$ npm i @chialab/dna
import { Component, customElements, html, ... } from '@chialab/dna';

Define a Component

This is an example of Component defined via DNA. Please refer to the documentation for more examples and cases of use.

Define the Component

import { Component, customElement, html, property } from '@chialab/dna';

@customElement('hello-world')
class HelloWorld extends Component {
    static get observedAttributes() {
        return ['name'];
    }

    static get listeners() {
        return {
            // delegate an event
            'change input[name="firstName"]': function() {
                this.name = target.value;
            },
        };
    }

    // define an observed property
    @property() name = '';

    render() {
        return html`
            <input name="firstName" value="${this.name}" />
            <h1>Hello ${this.name || 'World'}!</h1>
        `;
    }
}

Then use the element in your HTML:

<hello-world />

Development

Build status codecov

Requirements

In order to build and test DNA, the following requirements are needed:

Build the project

Install the dependencies and run the build script:

$ yarn install
$ yarn build

This will generate the UMD and ESM bundles in the dist folder, as well as the declaration file.

Test the project

Run the test script:

$ yarn test

License

DNA is released under the MIT license.

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].