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

ctrling

v0.8.25

Published

An appealing prototypical GUI for controlling your Web-App, JSON or JavaScript Object Values

Downloads

68

Readme

<ctrl-ing> - A Smart GUI Controller

What is it ... ?

<ctrl-ing> is a tiny HTML custom element used to interactively control your Web-App parameters or JavaScript/JSON/DOM object values in a comfortable way with the following characteristics:

  • tiny footprint 25.3/14.2 kB un/compressed.
  • dependency free.
  • easy prototypical generation with low effort. No programming required.
  • an object given, a menu template can be created automatically.
  • getting a pleasing GUI.

The interactive menu on the right side of Figure 1 was created via:

<ctrl-ing ref="app" darkmode>
  [ {"sec":"hdr","text":"Parameters"},
    {"sec":"num","label":"a","min":0,"max":10,"step":1,"path":"$['a']","unit":"[-]"},
    {"sec":"num","label":"b","min":0,"max":10,"step":1,"path":"$['b']","unit":"[-]"},
    {"sec":"hdr","text":"Animation"},
    {"sec":"chk","label":"run","path":"$['run']"},
    {"sec":"rng","label":"vel","min":1,"max":10,"step":1,"path":"$['vel']"},
    {"sec":"hdr","text":"Style"},
    {"sec":"col","label":"Stroke","path":"$['ls']"},
    {"sec":"col","label":"Fill","path":"$['fs']"}
  ]
</ctrl-ing>

Beside implementing your web application, all you need to do for prototyping an appealing GUI, is inserting a <ctrl-ing> element to your HTML document (see Listing 1). Its content is compact JSON text, representing an array of section objects. Each section corresponds to a single line in the grid-like view structure of the <ctrl-ing> menu and is associated to either

  • input controlling application parameters.
  • output monitoring values.
  • structuring elements.

All section objects are generating plain native HTML (form) elements in the background (shadow DOM). That markup is hidden and separated from other code on the page — thus avoiding code collisions.

Help for getting started and a complete documentation containing an interactive reference is available.

Examples

| Run | Source | Example | |:--|:--|:--| |API | source | Using the API | |array | source | Controlling an array object | |autogenerate | source | Automatically generating a menu | |color | source | Controlling an RGB color | |demo | source | Showing all features | |lissajous | source | Lissajous App | |minimal | source | Minimal menu generation | |parse-error | source | Treating JSON parse error | |paths | source | Using paths as JSONPath strings | |self | source | Controlling the menu itself | |svg | source | Controlling SVG graphics | |todeg | source | Transform property with user setting | |variable | source | Controlling a single variable value | |vector | source | Controlling multiple values as vector |

CDN

Use a local instance or one of the following CDN links for ctrling.js.

  • https://cdn.jsdelivr.net/npm/ctrling/ctrling.js
  • https://cdn.jsdelivr.net/npm/ctrling/ctrling.min.js

FAQ

  • Can I control a single global variable ?
    • In short ... yes.
    • You only need to declare it using var, since let and const variables aren't accessible using globalThis or window object, which is used here for global variables. No restriction for objects or arrays though.
    • See ctrl-variable.html for an example.
  • Can I control an array ?
  • Can I convert values while setting ?
    • Yes.
    • Either use getter/setter pair for get/set value ...
    • ... or use callback function for setting value only.
    • See ctrl-todeg.html for an example.
  • Can you implement feature X and possibly feature Y ?
    • ctrling serves my personal needs very well as it is.
    • So ... no, I won't.
    • Please go ahead and implement it by yourself.
    • If you think, your enhancement is of common interest, you are very welcome, to send me a pull request.

Changelog

[0.8.25] on February 01, 2023

  • Rounding bug with num section removed.

[0.8.23] on January 11, 2023

  • Feature complete.

[0.8.1] on December 20, 2022

  • First published.

License

ctrling is licensed under the MIT License

© Stefan Gössner