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

cample

v3.2.0-alpha.46

Published

Cample.js - one of the fastest frameworks without a virtual DOM on the Internet!

Downloads

712

Readme

npm-version discussions twitter license

About Cample.js?

Cample.js is an open source javascript framework for creating user interfaces. The framework works on a component-based approach, where each component can be interconnected by importing and exporting the current state. Cample.js doesn't use a virtual DOM to interact with the real DOM, which makes the reactivity process much faster.

Main advantage

Performance diagram of javascript frameworks and libraries. Results based on 123 release

Installation

To create an application, it is better to use the official cample-start command to generate a “starting point”, choosing from two currently available templates.

npx cample-start

The main two templates are based on two module bundlers such as Webpack and Parcel. To select one of them from the list in the terminal, you can select the most suitable one. All of them have official support.

Also, to install only the framework, you can use the following command:

npm i cample

With this installation, functions will still be available directly from the module. Installation using cample-start simply specifies the start files for the application.

Getting started

After setting the starting point of the application, the js file will contain the following code, or the same one, but with html import.

JavaScript

const newComponent = component(
  "new-component",
  `<div class="component">
    <div class="clicks" data-value="{{dynamicData}}">Clicks:{{dynamicData}}</div>
    <button class="button">Click</button>
  </div>`,
  {
    script: ({ element, functions }) => {
      const button = element.querySelector(".button");
      const updateFunction = () => {
        functions?.updateClicks((data) => {
          return data + 1;
        });
      };
      button.addEventListener("click", updateFunction);
    },
    data: () => {
      return {
        dynamicData: 0,
      };
    },
    dataFunctions: {
      updateClicks: "dynamicData"
    },
  }
);
cample("#app", {
  trimHTML: true,
}).render(
`<template data-cample="new-component">
</template>`,
  {
    newComponent
  }
);

HTML

<div id="app"></div>

You can change this code to any other you want. This code is presented as an example of how the framework works.

Link article: Getting started.

Reactivity

Reactivity in the framework is understood as the ability, in response to data changes, to automatically update parts of the javascript code or HTML nodes that used this data.

This diagram shows that data is updated when you use a function that updates it. That is, it is as if a single-threaded data update is being created. In future versions, the structure may change slightly due to the processing of asynchronous data.

Link article: Reactivity.

Changelog

Changelog

Contribution

If you would like to contribute to this framework, please see Contributing Guide. Thank you!

Inspiration

If you like the framework, it will be very cool if you rate the repository with a star ★

Contact

Email - [email protected]

License

Licensed under MIT