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

@blockquote-web-components/blockquote-controller-rxjs

v1.6.0

Published

A modern architecture for building composable and reusable Web Components

Readme

BlockquoteControllerRxjs

Lit

Connect Observables with Lit

BlockquoteControllerRxjs is a Lit Reactive Controller that subscribes to an RxJS 9 / Web Platform Observable while the host is connected, stores the latest emitted value and requests a host update when it changes.

  • One controller per stream, the latest value is available (typed) in value
  • It subscribes on hostConnected and unsubscribes (AbortSignal) on hostDisconnected, so it re-subscribes if the element is moved in the DOM
  • The stream can be replaced at any time by assigning stream$; the previous one is unsubscribed
  • Repeated values (Object.is) do not trigger an update
  • Optional callback, onError and onComplete handlers

Original idea by Adrian Fâciu - observables-litelement

Demo

Open in StackBlitz

Usage

new BlockquoteControllerRxjs(this, {stream$, initialValue?, callback?, onError?, onComplete?})

import {html, LitElement} from 'lit';
import {fromEventPattern} from 'rxjs/from-event-pattern';
import {map} from 'rxjs/map';
import {BlockquoteControllerRxjs} from '@blockquote-web-components/blockquote-controller-rxjs';

const mousemove$ = fromEventPattern(
  (handler) => window.addEventListener('mousemove', handler),
  (handler) => window.removeEventListener('mousemove', handler)
);

class BlockquoteControllerRxjsDemo extends LitElement {
  pos = new BlockquoteControllerRxjs(this, {
    stream$: mousemove$[map](({clientX, clientY}) => ({x: clientX, y: clientY})),
    initialValue: {x: 0, y: 0},
  });

  render() {
    const {x, y} = this.pos.value;
    return html`
      <p>The mouse is at:</p>
      <pre>x: ${x} y: ${y}</pre>
    `;
  }
}

Use callback to copy the value into a reactive property when you need it in willUpdate / updated:

new BlockquoteControllerRxjs(this, {
  stream$,
  callback: (value) => (this._pos = value),
});

src/BlockquoteControllerRxjs.ts:

class: BlockquoteControllerRxjs

Fields

| Name | Privacy | Type | Default | Description | Inherited From | | ------------ | ------- | --------------------------------------- | -------------- | ------------------------------------------------------------------------- | -------------- | | host | | THost | | | | | value | | T \| I | initialValue | Latest value emitted by the stream (or `initialValue`). | | | error | | unknown | | Last error emitted by the stream, `undefined` otherwise. | | | completed | | boolean | false | `true` once the current stream has completed. | | | callback | | (value: T) => void \| undefined | callback | Called with every new (distinct) value emitted by the stream. | | | onError | | (error: unknown) => void \| undefined | onError | Called when the stream errors (falls back to `globalThis.reportError`). | | | onComplete | | () => void \| undefined | onComplete | Called when the stream completes. | | | stream$ | | ObservableLike<T> | | The current Observable. Assigning a different one re-subscribes. | | | subscribed | | boolean | | `true` while there is an active subscription. | |

Methods

| Name | Privacy | Description | Parameters | Return | Inherited From | | ------------------ | ------- | ------------------------------------------------------- | ---------- | ------ | -------------- | | subscribe | | Subscribes to `stream$`. No-op if already subscribed. | | void | | | unsubscribe | | Aborts the current subscription, if any. | | void | | | hostConnected | | | | void | | | hostDisconnected | | | | void | |

Fields

| Name | Privacy | Type | Default | Description | Inherited From | | ------------------ | ------- | ------------------------------ | --------- | ----------- | -------------- | | #stream$ | private | ObservableLike<T> | stream$ | | | | #abortController | private | AbortController \| undefined | | | |

Methods

| Name | Privacy | Description | Parameters | Return | Inherited From | | --------- | ------- | ----------- | ---------------------------------- | ------ | -------------- | | #settle | private | | abortController: AbortController | void | |

Exports

| Kind | Name | Declaration | Module | Package | | ---- | -------------------------- | ------------------------ | ------------------------------- | ------- | | js | BlockquoteControllerRxjs | BlockquoteControllerRxjs | src/BlockquoteControllerRxjs.ts | |

src/index.ts:

Exports

| Kind | Name | Declaration | Module | Package | | ---- | --------------------------------- | ------------------------------- | ----------------------------- | ------- | | js | BlockquoteControllerRxjs | BlockquoteControllerRxjs | ./BlockquoteControllerRxjs.js | | | js | BlockquoteControllerRxjsOptions | BlockquoteControllerRxjsOptions | ./BlockquoteControllerRxjs.js | | | js | ObservableLike | ObservableLike | ./BlockquoteControllerRxjs.js | | | js | ObserverLike | ObserverLike | ./BlockquoteControllerRxjs.js | |