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

@tishlang/tish-macos

v3.1.0

Published

AppKit native UI host for Tish JSX

Downloads

125

Readme

tish-macos

AppKit host for Tish JSX. Published to npm as @tishlang/tish-macos — apps npm install @tishlang/tish-macos and import { macos } from "@tishlang/tish-macos". (Inside the tish monorepo only, import … from "tish:macos" resolves this crate directly — local debug.) See crate docs in src/lib.rs and the examples/ tree.

Editor: go to definition and hover

Native window.* helpers are implemented with Rust closures, not pub fn exports, so tish-lsp resolves them via lsp-pragmas.d.tish at this repo root (same // @tish-source convention as tish/stdlib/builtins.d.tish, with an optional | hover text suffix).

  • Go to definition on e.g. window.innerHeight jumps to src/appkit/window_api.rs.
  • Hover shows the optional doc line and a clickable file:// link to that Rust location (no compiler checkout required for macos-only sources).

To also jump built-in JS globals (console, …) from the main compiler tree, set tish.tishlangSourceRoot to your tish repository root (directory that contains crates/).

Quick test layout

  1. Open tish-macos-dev.code-workspace (adds the sibling tish folder and sets tish.tishlangSourceRoot), or open examples/kitchen-sink-macos alone (folder settings point at ../../../tish for the compiler repo).
  2. Build the language server once: cargo build -p tishlang_lsp from the tish repo (debug binary: target/debug/tish-lsp). This repo’s .vscode/settings.json, tish-macos-dev.code-workspace, and examples/kitchen-sink-macos/.vscode/settings.json already set tish.languageServerPath to that binary via ${workspaceFolder} / ${workspaceFolder:tish-compiler} (expanded by the Tish extension).
  3. In examples/kitchen-sink-macos/src/main.tish, hover innerHeight on the window.innerHeight() line — you should see the pragma doc and an “Open Rust implementation” link.

Async on the main thread

On the native backend await blocks the thread it runs on, and Tish code must stay on the thread that started it. In an AppKit app that thread is the main one, so awaiting a fetch there freezes the UI. Two calls let the app keep going and be called back on the main thread:

  • macos.whenSettled(promise, cb) waits for any Tish promise (fetch(url), res.text(), reader.read(), …) on a background thread, then calls cb(value, error) on the main thread (error is null when it fulfilled). A non-promise value is passed to cb on the next turn.
  • macos.startTimers() drives the global setTimeout / setInterval from the main run loop (every 32 ms). macos.run already does this; call it when your app sets up AppKit itself.

Streaming a response, chunk by chunk as the server sends it:

fn pump(reader, onChunk, done) {
  macos.whenSettled(reader.read(), (r, err) => {
    if (err !== null || r.done) { done(err); return }
    onChunk(r.value)
    pump(reader, onChunk, done)
  })
}

macos.whenSettled(fetch(url), (res, err) => pump(res.body.getReader(), show, finish))

A failed request settles with an error response ({ ok: false, error }), like await fetch. See examples/async-macos.

System services

Namespaces on macos for macOS services that aren't UI. Callbacks run on the main thread.

| API | What | |---|---| | macos.timeZones.names() / .local() / .at(id, unix) / .byAbbreviation(abbr) | macOS's time-zone database: ids, the local zone, { offset, abbreviation } at a moment (daylight saving included), a zone for "CET" | | macos.dictionary.lookup(word) | the plain text of each homograph in the system dictionary, first one first | | macos.pasteboard.readText() / .writeText(text) / .watch(cb) | the general pasteboard's text; watch calls cb({ text, app, appPath }) for each copy, skipping password-manager items, with app "" for this app's own writes | | macos.workspace.open(target) / .reveal(path) / .trash(path) / .appsFor(path) / .openWith(path, app) | open a URL or path, select a file in Finder, move to the Trash ({ ok, path, error }), the apps that can open a file (default first), open with one | | macos.watchFolders(paths, latency, cb) | cb() after changes under paths, coalesced over latency seconds (FSEvents) | | macos.onOpenUrl(cb) | cb(url) for each URL macOS opens with the app (a scheme in its Info.plist); call before the run loop starts | | macos.system.lockScreen() / .sleep() / .sleepDisplays() / .screenSaver() / .restart() / .shutDown() / .logOut() / .emptyTrash(cb) / .darkMode() / .setDarkMode(on) / .volume() / .setVolume(n) / .setMuted(on) / .ejectAll(cb) | system actions; each returns null or why it failed (emptyTrash and ejectAll answer cb from a background thread's work) | | macos.apps.running() / .act(pid, action) / .quitAll() / .hideAll() | apps in the Dock with their memory footprint; switch, hide, unhide, quit or force-quit one | | macos.shell.run(command, { cwd, args, timeoutMs }, cb) | /bin/sh -c command in the background -> id; cb({ id, code, stdout, stderr, ms, timedOut }). args are $1, $2, …; output capped at 1 MB; killed with its children after timeoutMs (60 s) | | macos.systemInfo() | { os, model, chip, cores, memory, uptime, diskTotal, diskFree, battery } | | macos.contacts.status() / .request(cb) / .query(text, limit, cb) | the address book; needs NSContactsUsageDescription in the app's Info.plist | | macos.accessibility.trusted(prompt) / .selectedText() / .replaceBeforeCursor(typed, text) / .focusedWindow() / .setFocusedWindowFrame(x, y, w, h) / .windowAction(pid, action) | other apps through Accessibility; windowAction minimizes, unminimizes (all), toggles full screen, closes or raises an app's window -> { count } or { error } (needs the app in System Settings › Privacy & Security › Accessibility) | | macos.screens() | [{ visible, frame }] for every display, in Accessibility's top-left coordinates | | macos.icons.file(path) / .symbol(name) / .image(path, template, reload) / .onLoaded(cb) | named images for <image src>: Finder icons (loaded in the background; onLoaded when done), SF Symbols, image files | | macos.statusItem({ image, title, tooltip, menu, onClick, onMenu }) | a menu bar icon with a menu ([{ title, id, key, enabled } \| { separator: true }]); calling again updates it | | macos.spotlight.query(query, { scope, max }, cb?) | files from Spotlight's index for an MDQuery string: [{ path, contentType, size, created, modified, lastUsed }]; with cb it runs on a background thread |

The native backend lowers some method names to the string/array built-ins whatever the receiver (at, search, match, replace, push, slice, …), so these APIs avoid them, except macos.timeZones.at: bind it to a name before calling it (let zoneAt = macos.timeZones.at).