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

sokeio

v0.0.0-beta.4

Published

a Laravel-based web application development package that provides support for developing modules, plugins, themes, livewire, and shortcodes.

Downloads

249

Readme

Sokeio Framework - No Build

Sokeio is a lightweight framework that allows you to build interactive applications without the need for a complex build process.

Installation

If you prefer to use a CDN, you can include Sokeio directly in your HTML file:

<script src="https://cdn.jsdelivr.net/npm/sokeio/dist/sokeio.umd.js" type="text/javascript"></script>

Alternatively, you can install Sokeio via npm:

npm install sokeio

Registering a Plugin

To register a plugin, listen for the sokeio::plugin::load event and use the provided API:

document.addEventListener("sokeio::plugin::load", function ({ detail: plugin }) {
  plugin.register({
    css: [], // Add your CSS files here
    js: [],  // Add your JavaScript files here
    check: function () {
      return true; // Check if JS is loaded successfully.
    },
    execute: function (component, event) {
      console.log("plugin_new:execute", event, component);
    },
  });
});

Template Usage

You can define a Sokeio application template using the sokeio-application-template attribute. Here’s an example:

<script sokeio-application-template type="javascript/x-template">
  const template = {
    state: {
      count: 0,
    },
    updateTime() {
      setTimeout(() => {
        this.count = new Date();
        this.updateTime();
      }, 1000);
    },
    ready() {
      this.updateTime();
    },
    render() {
      return `<div>
          <h1>hello world</h1>
          <p so-text="count">dfdfdfdf</p>
          <button class="btn btn-primary" so-on:click="count++;">click</button>
      </div>`;
    }
  };

  export default {
    components: {
      'sokeio::template': template
    },
    state: {
      count: 0,
    },
    updateTime() {
      setTimeout(() => {
        this.count = new Date();
        this.updateTime();
      }, 1000);
    },
    ready() {
      this.updateTime();
    },
    render() {
      return `<div>
          <h1>hello world</h1>
          <p so-text="count">dfdfdfdf</p>
          <button class="btn btn-primary" so-on:click="count++;">click</button>
          <button class="btn btn-primary" so-on:click="refresh();">Refresh</button>
          [sokeio::template/]
      </div>`;
    },
  };
</script>

Sure! Here’s how you can add additional templates to your HTML using Sokeio. This allows you to define multiple templates that can be reused throughout your application.

Example: Using Multiple Templates in HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Sokeio Example</title>
    <script src="https://cdn.jsdelivr.net/npm/sokeio/dist/sokeio.umd.js" type="text/javascript"></script>
</head>
<body>

    <!-- One Template -->
    <script sokeio-application-template type="javascript/x-template">
      const mainTemplate = {
        state: {
          count: 0,
        },
        updateTime() {
          setTimeout(() => {
            this.count = new Date().toLocaleTimeString();
            this.updateTime();
          }, 1000);
        },
        ready() {
          this.updateTime();
        },
        render() {
          return `<div>
              <h1>Main Application</h1>
              <p so-text="count">Current Time: </p>
              <button class="btn btn-primary" so-on:click="count++;">Increment</button>
          </div>`;
        },
      };

      export default {
        components: {
          'sokeio::main-template': mainTemplate
        },
        state: {
          count: 0,
        },
        updateTime() {
          setTimeout(() => {
            this.count = new Date().toLocaleTimeString();
            this.updateTime();
          }, 1000);
        },
        ready() {
          this.updateTime();
        },
        render() {
          return `<div>
              <h1>Main Application</h1>
              <p so-text="count">Current Time: </p>
              <button class="btn btn-primary" so-on:click="count++;">Increment</button>
              <button class="btn btn-secondary" so-on:click="refresh();">Refresh</button>
              [sokeio::main-template/]
          </div>`;
        },
      };
    </script>

    <!-- Secondary Template -->
    <script sokeio-application-template type="javascript/x-template">
      const secondaryTemplate = {
        state: {
          message: "Welcome to the Sokeio Framework!",
        },
        render() {
          return `<div>
              <h2>Secondary Template</h2>
              <p so-text="message"></p>
          </div>`;
        },
      };

      export default {
        components: {
          'sokeio::secondary-template': secondaryTemplate
        },
            render() {
          return `<div>
              [sokeio::secondary-template/]
          </div>`;
        },
      };
    </script>

</body>
</html>

Explanation

If you need more examples or further assistance, feel free to ask!

Usage Notes

  • Use the attribute [sokeio-application-template] to define your application templates. The template will execute once it is loaded.