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

@hexchess/hexchess-board

v1.0.17

Published

A simple web component

Downloads

163

Readme

hexchess-board

hexchess-board is a performant, dependency-free web component implementation of Glinsky's Hexagonal Chess.

Features:

  1. Performant - The component has been extensively benchmarked against Chess.com's own board, and clocks in at ~118 FPS when dragging pieces around the board (based on Chrome's developer tools) and ~80 FPS when resizing the window (the most expensive operation).

  2. Completely customizable - every single color you see can be changed to whatever fits your style and liking! Soon, we will support slots, which will also allow you to customize the pieces on the board.

  3. Can be standalone without a server! hexchess-board ships with a complete game engine that can detect illegal moves, checkmate, stalemate, and more! You can play with two players on the same laptop without any other dependencies, should you choose.

  4. Minimal dependencies - the web component has a single dependency that, when shipped in production mode, can mostly be tree shaken away. We use Lit for developer convenience when creating the web component, but the footprint is extremely small.

Read the full documentation on the website.

Installing

hexchess-board is packaged as a Web Component and should be usable directly in most modern browsers. It bundles its own (configurable) styles, inline assets (for chess pieces), and code.

In HTML (using unpkg)

<!-- Polyfills only needed for Firefox and Edge. -->
<script src="https://unpkg.com/@webcomponents/webcomponentsjs@latest/webcomponents-loader.js"></script>
<!-- Do NOT use unpkg due to https://github.com/mjackson/unpkg/issues/351 -->
<script type="module" src="https://esm.sh/@hexchess/hexchess-board@latest/hexchess-board.js?module"></script>

As a module import

First, install from NPM:

npm install '@hexchess/hexchess-board'

JS

import { HexchessBoard } from 'https://esm.sh/@hexchess/hexchess-board@latest/hexchess-board.js?module';

Developing

Run npm run docs after making any changes to documentation, and npm run docs:serve in the background to consistently have the local changes reflected.

When developing on the actual web component, keep npm run serve running in the background. After making changes, run npm run build and you'll see them show up.

Remember to format all code after modifications with npm run format!

Both npm run serve and npm run docs:serve will try to use http://localhost:8000, but if that port is taken they will keep incrementing until they find an available port.

Attribution

Chess piece SVG images included in this library were adapted from Category:SVG chess pieces on Wikmedia.

Acknowledgements

This could not be possible without the sage advice of Milind Ganjoo, who has built an extremely impressive gchessboard web component! A lot of the inspiration for this project came from him, and many of the early bugs were squashed with his help.