npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

modrn

v0.1.7

Published

Web framework based on web components without virtual DOM

Downloads

2

Readme

Introduction

Modrn.ts (https://github.com/alexbfr/modrn) is a pet project trying to resemble a Framework like vue.js or react.js while only focusing on modern browsers and web technologies. Since the browser landscape has shrunk considerably, almost all browsers should be compatible as long as web components and ES6 are supported.

This started as an experiment to see if web components are able to replace the classical web framework approach of a virtual DOM, and also to further my knowledge of typescript and ES6/modern browser features.

Architecture

The approach in Modrn.ts is to use web components (aka custom elements) to render the DOM. Meaning there is no need to build and traverse a virtual dom.

Instead, Modrn.ts renders components directly and clones, updates and removes DOM elements without resorting to another abstraction in between. A component in Modrn.ts is created quite similar to other frameworks, but the HTML template is not parsed separately (or created by emitted code). It is created in a non-document attached DOM node instead, from which it is cloned as required.

Performance

There was no focus on optimizing performance yet. The variable substition code is particularly unoptimized. Nevertheless, the performance is right now broadly comparable to react/vuejs, at least in the synthetic benchmarks under /examples/performance.

So?

Since this is an ongoing experiment, there isn't much of anything aside from code yet. But to provide something to feel and see, and to compare against other frameworks, there are a few examples shamelessly copied from the Vue.js examples:

elastic-header example

  • vuejs: https://vuejs.org/v2/examples/elastic-header.html
  • modrnjs: https://codesandbox.io/s/elasticdraggableheader-modrnjs-example-tr90t?file=/src/index.ts

github-commits example

  • vuejs: https://vuejs.org/v2/examples/commits.html
  • modrnjs: https://codesandbox.io/s/github-commits-modrnjs-example-67768?file=/src/index.ts

todo-mvc

  • vuejs: https://vuejs.org/v2/examples/todomvc.html
  • modrnjs: https://codesandbox.io/s/todomvc-modrnjs-example-g1y22?file=/src/index.ts

All of those examples work exactly the same as the Vue.js examples, to the best of my knowledge.

Code

Interesting bits:

  • Custom element registration: https://github.com/alexbfr/modrn/blob/main/modrn.ts/js/source/core/component-registry.ts

  • Scanning an html fragment for variables: https://github.com/alexbfr/modrn/blob/main/modrn.ts/js/source/core/variable-analysis/find-variables.ts

  • Variable substition: https://github.com/alexbfr/modrn/blob/main/modrn.ts/js/source/core/variable-substition/substitute-variables.ts

  • Dynamic child handling: https://github.com/alexbfr/modrn/blob/main/modrn.ts/js/source/core/hooks/templated-children-hooks.ts