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-context-meta

v1.5.7

Published

Webcomponent blockquote-controller-context-meta following open-wc recommendations

Readme

Lit

BlockquoteControllerContextMeta is a Lit Reactive Controller that encapsulates the controllers provided by @lit/context

Features:

  • Allows a component to act simultaneously as a provider and a consumer.
  • Delays consumer initialization until after the first update, minimizing the risk of a consumer in the Light DOM requesting a context before a provider is available.

Demo

Open in StackBlitz

Usage


import { html, LitElement, css } from 'lit';
import { BlockquoteControllerContextMeta } from '@blockquote-web-components/blockquote-controller-context-meta';

export class ProviderEl extends LitElement {
  static styles = css`
    slot {
      display: block;
      border: dashed 4px grey;
      padding: 10px;
    }

    :host {
      display: block;
      border: solid 4px gainsboro;
      padding: 2px;
    }

    h3 {
      margin-top: 0;
    }
  `;

  static properties = {
    data: {},
  };

  constructor() {
    super();
    this._provider = new BlockquoteControllerContextMeta(this, {
      context: Symbol.for('contextKey')
    });

    this.data = 'Initial';
  }

   // `data` will be provided to any consumer that is in the DOM tree below it.
  set data(value) {
    this._data = value;
    this._provider.setValue(value);
  }

  get data() {
    return this._data;
  }

  render() {
    return html`
      <h3>Provider's data: <code>${this.data}</code></h3>
      <slot></slot>
    `;
  }
}
customElements.define('provider-el', ProviderEl);

export class ConsumerEl extends LitElement {
  _consumer = new BlockquoteControllerContextMeta(this, {
    context: Symbol.for('contextKey')
    callback: (v) => {
      this.setAttribute('data-callback', v);
    },
  });


  // `providedData` will be populated by the first ancestor element which
  // provides a value for `context`.

  get providedData() {
    return this._consumer.value;
  }

  render() {
    return html`<h3>Consumer data: <code>${this.providedData}</code></h3>
      <hr />
      <slot></slot>`;
  }
}
customElements.define('consumer-el', ConsumerEl);

src/BlockquoteControllerContextMeta.js:

class: ContextMeta

Fields

| Name | Privacy | Type | Default | Description | Inherited From | | -------------- | ------- | ---- | -------------- | ----------- | -------------- | | value | | | | | | | context | | | | | | | initialValue | | | initialValue | | | | callback | | | callback | | | | host | | | host | | |

Methods

| Name | Privacy | Description | Parameters | Return | Inherited From | | --------------- | ------- | ----------- | ---------- | ------ | -------------- | | setValue | | | v, force | | | | hostConnected | | | | | |

Variables

| Name | Description | Type | | ------------------- | ----------- | ---- | | contextMetaSymbol | | |

Exports

| Kind | Name | Declaration | Module | Package | | ---- | --------------------------------- | ----------------- | -------------------------------------- | ------- | | js | contextMetaSymbol | contextMetaSymbol | src/BlockquoteControllerContextMeta.js | | | js | BlockquoteControllerContextMeta | ContextMeta | src/BlockquoteControllerContextMeta.js | |

src/index.js:

Exports

| Kind | Name | Declaration | Module | Package | | ---- | --------------------------------- | ------------------------------- | ------------------------------------------- | ------- | | js | BlockquoteControllerContextMeta | BlockquoteControllerContextMeta | ./BlockquoteControllerContextMeta.js | | | js | BaseContextMetaElement | BaseContextMetaElement | ./BaseContextMetaElement.js | | | js | contextMetaProvider | contextMetaProvider | ./directives/context-meta-provider.js | | | js | cacheContextMetaProvider | cacheContextMetaProvider | ./directives/cache-context-meta-provider.js | |

Lit

contextMetaProviderDirective is a Lit directive that enables normal DOM elements to act as context providers. You can use this directive in both attribute and element bindings in Lit templates.

https://github.com/lit/lit/discussions/4690

Usage: This directive transforms a DOM element into a Lit context provider using the BlockquoteControllerContextMeta class, a Lit Reactive Controller that encapsulates controllers provided by @lit/context.

Features

  • Enables non-Lit elements to provide context.
  • Works seamlessly with @lit/context.
  • Utilizes BlockquoteControllerContextMeta, a Lit Reactive Controller for managing context.
  <div ${contextMetaProviderDirective(someValue, myContext)}>
    <!-- Children can consume the provided context -->
  </div>
  //
  <div data-info="${contextMetaProviderDirective(someValue, myContext)}">
    <!-- Children can consume the provided context -->
  </div>

src/directives/context-meta-provider.js:

class: README

Variables

| Name | Description | Type | | --------------------- | ----------- | ---- | | contextMetaProvider | | |

Exports

| Kind | Name | Declaration | Module | Package | | ---- | --------------------- | ------------------- | --------------------------------------- | ------- | | js | README | README | src/directives/context-meta-provider.js | | | js | contextMetaProvider | contextMetaProvider | src/directives/context-meta-provider.js | |

src/directives/cache-context-meta-provider.js:

Functions

| Name | Description | Parameters | Return | | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ------ | | cacheContextMetaProvider | Return or create a cached BlockquoteControllerContextMeta for (element, context). This function memoizes BlockquoteControllerContextMeta instances per (element, contextKey). If a BlockquoteControllerContextMeta already exists for the given element and context, it is returned; otherwise a new BlockquoteControllerContextMeta is created, cached and returned. | element: HTMLElement\|*, {context = contextMetaSymbol, initialValue}, arg: { * context?: *, * initialValue?: ContextType<*>, * } | |

Exports

| Kind | Name | Declaration | Module | Package | | ---- | -------------------------- | ------------------------ | --------------------------------------------- | ------- | | js | cacheContextMetaProvider | cacheContextMetaProvider | src/directives/cache-context-meta-provider.js | |

Lit

BaseContextMetaElement emulates the behavior of a flow element using ARIA, preserving standard HTML functionality while enhancing its features.

Demo

Open in StackBlitz

Features

  • Acts as a structural element that follows HTML flow content rules.
  • Provides a default ARIA role (none) to avoid unintended semantics.
  • Can be used as a wrapper for contextual metadata.

Accessibility

By default, BaseContextMetaElement assigns the role="none", ensuring that it does not introduce unintended semantics in assistive technologies. This behavior can be overridden by explicitly setting a different role.

Related: ARIA Structural Roles

Inspired by the discussion: Is it possible to make normal DOM elements context providers? See Also: contextmeta provider directive

With this setup, BaseContextMetaElement behaves like a flow element.

src/BaseContextMetaElement.js:

class: BaseContextMetaElement, base-context-meta

Exports

| Kind | Name | Declaration | Module | Package | | --------------------------- | ------------------------ | ---------------------- | ----------------------------- | ------- | | js | BaseContextMetaElement | BaseContextMetaElement | src/BaseContextMetaElement.js | | | custom-element-definition | base-context-meta | BaseContextMetaElement | src/BaseContextMetaElement.js | |