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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@maelgruand/simple-way

v2.0.0

Published

Simple Way, a better way to develop applications

Downloads

28

Readme

Simple Way

Simple Way is a lightweight JavaScript/TypeScript framework to easily create DOM components: View, Button, Form, Input, Text, Link, Form, Span, List, Modal, Tab, Toast, Toat Container, Navbar , Notifications
It’s simple, fast, and usable in any front-end project.


🚀 Installation

From GitHub

npm install github:MaelProgramming/simple-way

From npm (once published)

npm install @maelgruand/[email protected]

Basic Exemples

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Test Simple Way</title>
</head>

<body>
  <script type="module">
    import { View, Button, Input, Text, NavBar, Toast } 
      from "https://unpkg.com/@maelgruand/simple-way/dist/index.js";

    // Create main container
    const app = View("app");
    document.body.appendChild(app);

    // Input field
    const input = Input("name", "text");

    // Button with click event
    const btn = Button("btn1", () => {
      alert(`Hello ${input.value}`);
      Toast(`Hello ${input.value}`, "success");
    }, "Click me");

    app.appendChild(input);
    app.appendChild(btn);

    // Add a simple navigation bar
    const navbar = NavBar("mainNav", [
      { label: "Home", href: "#" },
      { label: "About", href: "#about" },
      { label: "Contact", href: "#contact" }
    ]);
    document.body.prepend(navbar);

  </script>
</body>
</html>

| Component | Description | | ---------------------------------------- | --------------------------------------------------------------------- | | View(id) | Creates a <div> with a specific id | | Text(id, content) | Creates a <p> element with given content | | Input(id, type) | Creates an <input> of type text, password, checkbox, etc. | | Button(id, functionToExecute, content) | Creates a <button> with a click callback and text | | Form(id, method, onSubmit) | Creates a <form> with a method (get/post) and onsubmit callback | | Link(id, href) | Creates an <a> element with a link | | Span(id, content, className) | Creates a <span> element with text and CSS class | | List(id, items, ordered) | Creates a <ul> or <ol> list with items | | Modal(id, title, content) | Creates a modal window with title and content | | Tab(id, tabs) | Creates a tabs component with multiple tabs | | Toast(message, type) | Shows a temporary notification (success, error, info) | | ToastContainer() | Creates a container for toasts | | NavBar(id, links, background, color) | Creates a sticky navigation bar with links and optional styling |

Notifications

That framework include Notification creation using:

import { Notification } from "@maelgruand/simple-way";


Notification.create("Hello !", { 
  body: "That's a notification.", 
  icon: "/icon.png" // your own icon of your page
}, () => {
  console.log("Notification cliquée !");
});

Included CSS classes

| Element | CSS Classes | |-----------|-------------| | Buttons | .muil-btn, .muil-btn-primary, .muil-btn-secondary | | Inputs | .muil-input | | Modals | .muil-modal-overlay, .muil-modal-box | | Toasts | .muil-toast, .muil-toast-success, .muil-toast-error, .muil-toast-info | | Navbar | .muil-navbar | | Tabs | .muil-tabs-header button, .muil-tabs-header button.active |

New Modification

Added database provider in core/Elements.ts

  • Introduced the createDatabase function to initialize and connect a database.

  • Currently supports IndexedDBDriver as the default provider.

  • Allows specifying the database name (providerName) and stores/collections (stores).

  • Returns a ready-to-use Database instance with all CRUD operations.

import { DB } from './index.ts'

const db = DB("MyAppDB", ["users", "posts"]);
await db.insert("users", { name: "YourName", age: 18 })

Adding backend integration

This framework now supports dynamic PHP backend calls via HTTP, making it easy to connect frontend logic to PHP scripts.

Setup

  1. Make sure a PHP server is running (XAMPP, WAMP, Laragon, etc.).

  2. Place your PHP scripts in a folder, e.g., php/. Example:

php/
├─ getUser.php
└─ processData.php

Example for php/getUser.php

<?php
header('Content-Type: application/json');

$input = json_decode(file_get_contents('php://input'), true);
$userId = $input['userId'] ?? null;

$users = [
    "1" => ["id" => "1", "name" => "Mael"],
    "2" => ["id" => "2", "name" => "Alice"]
];

echo json_encode($users[$userId] ?? null);

Usage

import { Backend } from '@maelgruand/simple-way';

const backend = new Backend('http://localhost/php');

// Dynamically call any PHP script
const user = await backend.call<{ id: string; name: string }>('getUser', { userId: '1' });
console.log(user); // { id: "1", name: "Mael" }

const result = await backend.call('processData', { data: { value: 42 } });
console.log(result);

npm License