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

@mochabug/adapt-electron

v2.0.0-beta.10

Published

Electron client library for Adapt automation platform

Readme

@mochabug/adapt-electron

Adapt automations in native Electron views.

Electron 34.1.0 or later is required. This minimum comes from the View.getVisible() API added in Electron 34.1.0, which the client uses when applying content sizes. The peer dependency has no upper version limit; the development dependency selects the version used for building and testing.

Main area and forks

When no main content is present, the least nested non-minimized fork occupies the main area. A shallower arrival replaces it; equal-depth arrivals keep the current occupant. Real main content always wins, including retained completed content. When main arrives, the promoted fork returns to its previous group if it still exists, otherwise the default group for forkDisplay. The same WebContentsView is transferred, preserving its document and state without navigation.

Set reserveMain: true to reserve the main area for main content. Its default is false; client.setReserveMain(boolean) changes it at runtime without reloading views. Explicitly minimized forks stay minimized. Placement changes wait for active tab and separator drags to finish.

Completion and URL lifecycle

Session completion keeps the last main and fork views alive. URL policies control automatic closure: unspecified/retain keeps the view, recycle allows reuse, and close closes on URL completion, optionally after timeoutSeconds. Delayed closes continue after the session ends. Explicit stopping, panel dismissal, and client destruction still clean up views.

onContentActive(active) reports whether any main or fork URL remains open, including retained and minimized views. Keep Stop enabled while the session is running or content is active; disable it when the session has ended and the last URL closes.

Application theme

The Electron host owns one application-wide theme using Electron's native API:

import { nativeTheme } from "electron";

nativeTheme.themeSource = "dark"; // "light" or "system" also work

Set it before creating the client/views for the initial theme. Changes update native views and Adapt window chrome live. The client follows nativeTheme.shouldUseDarkColors; setTheme() supplies chrome color/font tokens. There is no per-client theme mode.

Plugins use the same HTML and CSS as web frames: an HTML-linked stylesheet with prefers-color-scheme media queries and a corresponding root color-scheme. This works for SSG before JavaScript runs. No Electron-specific plugin code or theme messages are needed. Existing IPC for trusted window chrome remains internal.

Content sizing

Plugins call init({ resize: true }) from @mochabug/adapt-sdk/browser. The SDK reports immediately and on content/viewport changes. The preload relays only adapt-resize reports; the main process validates the current main frame and expected origin. Native navigation clears cached sizes.

autoResizing controls docked reports to onContentResize(viewId, height); the host owns the surrounding window/layout bounds. floatingAutoResize fits a floating window once, preserving later manual sizing. Both policies can change without reloading plugins. Measurements remain cached while sizing is disabled and are applied only to visible active views at the reported viewport width.

init({ resize: false }) installs no SDK observers or messages. Use it for layouts whose height follows the viewport, such as height: 100vh. Themes work independently.

Run npm test for builds/unit tests and npm run test:e2e for real Electron window, splitter, theme, and resizing tests.