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

@softwarity/livewire

v0.4.0

Published

Live query synchronisation for Angular: subscribe to a query over one WebSocket, get its answer and every answer after it. Virtual-scroll data source included.

Readme

@softwarity/livewire

Live query synchronisation for Angular. A screen subscribes to a query over one WebSocket; it gets the answer, then every answer after it.

// app.config.ts
providers: [provideLivewire({ path: '/my-service/ws' })];
@Injectable()
export class MessagesService {
  private readonly topic = new LiveTopic<MessageRow>(inject(LivewireClient), 'messages');

  window = (query: object, offset: number, limit: number) => this.topic.window(query, offset, limit);
  resync = () => this.topic.resync();
}
readonly source = new LiveWindowDataSource<MessageRow>(
  () => this.messages.resync(),   // a gap in the sequence: ask again
  100,                            // rows per window - a transport budget
);

// What the list holds, as signals: read them in a template, derive from them
// in a `computed`. `source.length()` is what the server says the list is.

constructor() {
  effect(() => {
    const query = this.queryOf();
    this.source.reset((offset, limit) => this.messages.window(query, offset, limit));
  });
  effect(() => {
    const viewport = this.viewport();
    if (viewport) this.source.track(viewport.renderedRangeStream);
  });
}
<cdk-virtual-scroll-viewport [itemSize]="44">
  <table mat-table [dataSource]="source">…</table>
</cdk-virtual-scroll-viewport>

<lw-live-indicator />

Commands and notifications

// Something to do. One answer, whatever happens.
this.client.command('flight.acknowledge', { id }).subscribe((ack) => {
  if (!ack.ok) this.toast(ack.reason);
});

// Something that happened, outside any window.
this.client.notifications('import.finished').subscribe((payload) => this.toast(payload));

The list does not come back in the answer: whatever the command changed reaches the screen through the subscription already watching it. So do not reach into ack.result for rows - read them where they were already coming from.

Three rules that are not obvious

Each of these cost a debugging session in the application this came from.

1. Build the data source in the component that shows the list. A row arriving from a socket callback schedules no change detection at all in a zoneless application: the field is right and the screen is wrong. Built in a component field, the data source injects that view's ChangeDetectorRef and calls markForCheck() on every publication — which marks the view dirty and notifies the zoneless scheduler. Built outside an injection context it throws, and that is the intended answer: a data source with no view to repaint has nobody to answer. (ApplicationRef.tick() is the other way and the wrong one: it throws when it lands inside a cycle already in progress.)

2. The window size is a constant per screen, never derived from the viewport. Deriving it loops: publish → the viewport re-measures → a new window → publish. It is a transport budget anyway — some proxies silently drop a frame past ~64 kB — so it is rows × bytes-per-row < the ceiling you tested. Measure before raising it: the failure gives no clue, just an empty screen.

3. Viewport buffers have to fit inside the window, with room to spare. The rendered range is what the window must cover; a viewport rendering nearly as many rows as the window holds leaves no hysteresis, and it moves on every scrolled pixel.

No backend yet?

@softwarity/livewire-mock speaks the same protocol in memory:

const server = new MockServer().register('messages', { windowFor: () => ({ rows, total: rows.length }) });
provideLivewire({ path: '', connect: () => server.connect() });

Same for a demo, and for tests.

Theming the indicator

lw-live-indicator {
  --lw-live: #1b7f3b;
  --lw-down: #b26a00;
}

See SPEC.md for the contract this speaks.