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

@rasamjs/boolean

v0.2.0

Published

Boolean path operations for rasam drawings: union, subtract, intersect and exclude.

Readme

@rasamjs/boolean

The optional editor adapter registers boolean commands through structural capabilities, with no editor runtime dependency.

Boolean path operations for rasam drawings: union, subtract, intersect and exclude. The result keeps curves: arcs and Bézier segments stay curves instead of turning into many short lines. Geometry comes from PathBool.js (path-bool), a peer of this package only, so apps that don't use boolean operations don't download it.

import { combinePaths, combineSelection } from '@rasamjs/boolean';

const square = drawing.rect({ x: 0, y: 0, width: 100, height: 100, fill: '#a5d8ff' });
const circle = drawing.circle({ cx: 100, cy: 50, r: 50, fill: '#ffd8a8' });
const shape = combinePaths([square, circle], 'union'); // one <path>, one undo step

// With a selection (rasam Selection, or anything with nodes and select()):
combineSelection(selection, 'subtract');

Operations

| Operation | Result | Style from | | ----------- | ---------------------------------------- | -------------------- | | union | Everything covered by any shape | The front-most shape | | subtract | The back-most shape minus all the others | The back-most shape | | intersect | Only what every shape covers | The front-most shape | | exclude | What an odd number of shapes covers | The front-most shape |

Front and back follow document order, so the result matches what you see. The new path takes the front-most shape's place in its parent. Every transform, including those of parent groups, is baked into its path data, so it has no transform attribute. Paint and presentation attributes (fill, stroke, opacity, dashes, class and style) come from the style source, and the path uses fill-rule="evenodd", which renders the result's holes correctly.

The operation is one change group labelled "Union", "Subtract", "Intersect" or "Exclude", so @rasamjs/history records one undo step that restores the original shapes. Pass prepare to name the result inside the same step. When the result is empty, for example intersecting shapes that don't overlap, nothing changes and the call returns null.

Shapes

Rectangles (including rounded corners), circles, ellipses, polygons, polylines and paths are supported; booleanShapes lists them. A polyline counts as its filled area, closed the way SVG fills it. Text, images, lines and groups are rejected; canCombine(nodes) tells you whether a set of nodes can be combined. Geometry attributes must be plain numbers, and an input's fill-rule="evenodd" attribute is honored; CSS fill-rule is not read.

outline(node, space) returns a shape's filled outline as path data in another node's user space, with transforms applied. It is useful on its own, for example to convert a shape to a path.

Requirements

@rasamjs/core, and path-bool 1.0.4 or a later 1.x release. PathBool.js describes itself as early in development; report reduced failure cases upstream. See API.md.