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

@markharrison/markjscanvasui

v1.20260113.16

Published

A reusable ui system for canvas applications.

Downloads

43

Readme

MarkJSCanvasUI

npm version License: MIT

A lightweight JavaScript library for creating interactive UI controls within HTML Canvas elements, specifically designed for simple web games and canvas-based applications.

Features

  • Complete UI Controls - Menus (including buttons), toggles, text inputs, radio buttons, carousels, sliders, and panels
  • Modal Dialogs & Toast Notifications - User-friendly pop-ups and temporary messages
  • Comprehensive Theme System - Consistent styling across all controls with easy customization
  • Multi-Input Support - Keyboard, mouse, gamepad, and touch navigation
  • External Input Management - Uses @markharrison/markjsinput for flexible input handling
  • Canvas Scaling Support - Automatically handles responsive canvas sizing
  • Simple API - Minimal setup with maximum flexibility

Installation

npm install @markharrison/markjscanvasui --save

Requirements

MarkJSCanvasUI requires an external input handler to manage user interactions. The recommended input handler is @markharrison/markjsinput.

Quick Start

import { MarkJSCanvasUI, Menu } from './markjscanvasui.js';
import { MarkJSInput } from '@markharrison/markjsinput';

const canvas = document.getElementById('gameCanvas');
const input = new MarkJSInput(canvas);
const ui = new MarkJSCanvasUI(canvas, { input });

// Add a button (using Menu with single item)
const button = new Menu(100, 100, [{ label: 'Click Me!', callback: () => ui.showToast('Hello World!', 'success') }], { width: 200, height: 50 });
ui.addControl(button);

// Game loop
let lastTime = 0;
function gameLoop(currentTime) {
    const deltaTime = currentTime - lastTime;
    lastTime = currentTime;

    ui.update(deltaTime);
    ui.render();

    requestAnimationFrame(gameLoop);
}
requestAnimationFrame(gameLoop);

Available Controls

  • Menu - Horizontal or vertical navigation menus (can be used for buttons with single items)
  • Toggle - On/off switches with labels
  • TextInput - Text input fields with placeholder support
  • Radio - Mutually exclusive option groups
  • Carousel - Cycleable option selectors with arrows
  • Slider - Numeric value selection with range controls
  • Panel - Non-interactive background panels for grouping

Theme System

// Set consistent styling across all controls
ui.setTheme({
    controlColor: '#4CAF50',
    backgroundColor: '#333333',
    textColor: '#ffffff',
    borderRadius: 10,
    fontFamily: 'Arial',
    fontSize: 16,
});

Documentation

📖 Complete Documentation - Detailed API reference, examples, and usage guide

Test Application

🎮 Live Showcase - Interactive demo showing all controls and themes in action

MarkJSCanvasUI Showcase

MarkJSCanvasUI Showcase

MarkJSCanvasUI Showcase

License

MIT License - See LICENSE file for details.