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

dotsy

v0.1.1

Published

Display randomly positioned, non-overlapping, customized dots in your HTML.

Downloads

38

Readme

Dotsy

Dotsy is a JavaScript library with which you can create HTML for randomly positioned, non-overlapping, customized dots. You can set:

  • the height and width of the container
  • the radius and color of each dot

Then Dotsy calculates the locations and creates the HTML for you.

This library can be used, for example, in software that may focus on:

  • subitizing
  • counting
  • arithmetic

How to use this library

For a working example to play with online, see symbolinker.github.io/dotsy. The source code of the example can be found in the docs folder of the repository.

How to add it to your project? There are various ways:

Using a <script> element

There is no need to download or install anything. Your website just needs to have a <script> element that results in getting one of the following files from jsDelivr:

  • dotsy.es2020-esm.js
  • dotsy.es2017-esm.js
  • dotsy.es2015-iife.js

esYEAR: those are JavaScript language versions. esm: the ECMAScript module is simply the best choice: easy, safe, future proof. iife: an immediately invoked function expression for browsers that do not support ESM.

For each of those ".js" files there is a minified version (".min.js") - a smaller file (of only 17 kB) with the same capabilities.

A <script> element using the recommended "dotsy.es2017-esm.min.js":

<script type="module">
  import * as dotsy from 'https://cdn.jsdelivr.net/npm/[email protected]/dist/dotsy.es2017-esm.min.js';
  let settings = new dotsy.Settings();
  // ...(set settings here)...
  let html = dotsy.getHtml(settings);
  // ...(get your HTML element)...
  yourElement.innerHTML = html;
</script>

A <script> element using the with-older-browsers-compatible "dotsy.es2015-iife.min.js":

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/dotsy.es2015-iife.min.js"></script>
<script type="text/javascript">
  window.addEventListener('DOMContentLoaded', (event) => {
    let settings = new dotsy.Settings();
    // ...(set settings here)...
    let html = dotsy.getHtml(settings);
    // ...(get your HTML element)...
    yourElement.innerHTML = html;
  });
</script>

Using npm

This library has been published to npm. After opening a folder in VS Code, run in the terminal:

npm i dotsy

Verify that dotsy has been added to the node_modules folder. Then you can choose:

Using the CommonJS module (the .cjs file) in myFile.js:

const dotsy = require('dotsy');
const settings = new dotsy.Settings();

Using the ESM module (the .mjs file) in myFile.js or myFile.ts:

import * as dotsy from 'dotsy';
const settings = new dotsy.Settings();

How to use this repo

Follow these steps to set up (and verify) a development environment for this repository:

  1. Install Node.js, Git and VS Code.
  2. Fork (or clone), checkout and then open the root folder of this repository in VS Code.
  3. Open the VS Code Terminal and run: npm ci This loads all the devDependencies from the tree as specified in package-lock.json.
  4. Compiling the library: All of the following commands run some script as defined in package.json: npm run strictcheck to do type checking, to check whether a successful compilation is possible. npm run clean to run eslint (performing auto-fixes). npm test to run all unit tests from the 'tests' folder. npm run build creates a single-file library in different formats and language versions in the 'dist' folder. Note: the 'src' folder contains all the source code files.
  5. Testing localhost: For testing localhost with live reload from VS Code, you could install the VS Code extension Five Server. Then open '/localhost/index.html' in VS Code and click > Go Live in the bottom right corner of VS Code. The browser starts up automatically.

License

The Dotsy repository uses the most permissive licensing available. The "BSD Zero Clause License" (0BSD) allows for commercial + non-commercial use, closed + open source, with + without modifications, etc. and is equivalent to licenses like:

The "BSD Zero Clause License" (0BSD) does not have the condition

(...), provided that the above copyright notice and this permission notice appear in all copies.

which is part of the "MIT License" (MIT) and its shorter equivalent "ISC License" (ISC). Apart from that they are all equivalent.

Ask or contribute