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

@singapore-editor/core

v0.2.15

Published

The browser editor at the core of Singapore, with text editing, selections, undo history, themes, and plugins.

Readme

@singapore-editor/core

The browser editor at the core of Singapore, with text editing, selections, undo history, themes, and plugins.

Part of Singapore. A code editor for the browser that keeps every version.

Install

npm install @singapore-editor/core

Usage

import { Editor } from '@singapore-editor/core/editor'

const host = document.createElement('div')
host.style.height = '400px'
document.body.append(host)
const editor = new Editor(host)
editor.setText('const value = 1\n')
// Call editor.dispose() when removing the view.

The editor's stylesheet loads with the module, through any bundler that handles CSS imports, such as Vite. Plugin packages load their own stylesheets the same way. Each package also exports style.css for pages that link the stylesheet themselves.

Content-height embedding

Use content mode for a code sample or document that scrolls with its page. Give the host its width and leave its height automatic.

Create the view with new Editor(host, { height: 'content', wordWrap: true }), then load the sample with setText().

Content mode paints every display row and grows after edits, font changes, preview replacements and resizing. Caret and search reveal scroll outside ancestors. setScrollMode('content') switches an existing view to this layout. static keeps its existing all-row layout with horizontal editor scrolling; virtualized keeps a bounded window of rows.

Use maxHeight to switch to internal scrolling when the document reaches a chosen height. See browser layout for the sizing and paint limits.

Touch selection

Status: experimental, in the source only. The npm releases (core 0.1.2, plugin-ui 0.1.0) have no touch code, and mobile is not a supported target.

Hold a word or double-tap it, keep that contact down, and drag by words across rows. Triple-tap selects a whole line and its held contact drags by lines. Four taps select the document. Ordinary swipes scroll. These gestures use the same document selections and boundaries as desktop clicks.

Touch menu chrome is opt-in through createTouchSelectionPlugin from @singapore-editor/plugin-ui/touch-selection-plugin. The plugin owns its menu, extension items and optional haptics. Core view contributions expose onDidTouchSelection, getTouchSelectionAnchor, getSelectedText, getInputCommandState and runInputCommand for input-aware plugins. Clipboard commands retain active paste providers and browser clipboard authorization.

What tests cover it:

  • Unit tests for the gesture recognizer (test/touchSelection.test.ts in this package) and the menu and plugin (packages/plugin-ui/test/touchSelection*.test.ts).
  • Playwright specs in examples/app/test/mobile-*.spec.ts, which run in Chromium and WebKit with an iPhone 13 profile. The repository's CI workflows do not run them. Run them with bun run --cwd examples/app test:e2e.
  • Notes on a Mobile Safari run on the iOS 26.5 simulator in Browser quirks.

The automated tests above do not run on a physical phone, and Browser quirks lists physical-device haptic feedback as unverified.

VS Code themes and optional Shiki

@singapore-editor/core/rendering exports editorThemeFromVscodeTheme and related converters for VS Code theme definitions without pulling in Shiki or Oniguruma. For syntax colors, use @singapore-editor/tree-sitter or @singapore-editor/highlighting. If you specifically want Shiki or TextMate grammars, install the separate optional @singapore-editor/shiki package.

API highlights

  • Editor.setText() loads text into a view.
  • openDocument() gives a document its own identity.
  • dispose() releases the view and its plugins.

Generated API reference

In the Singapore family

Start with @singapore-editor/core. Add optional packages for gutters, search, syntax, or language server features.

Singapore README · Documentation

License

MIT. License