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

@pnlight/sdk-react

v0.1.0

Published

PNLight Remote UI React component powered by DivKit

Downloads

132

Readme

@pnlight/sdk-react

A thin React wrapper around the official DivKit Web renderer with PNLight Remote UI behavior installed automatically.

Install

npm install @pnlight/sdk-react

Use

import { RemoteUi } from "@pnlight/sdk-react";
import "@pnlight/sdk-react/styles.css";

export function Screen({ config }: { config: object }) {
  return (
    <RemoteUi
      id="home"
      json={config}
      theme="system"
      onCustomAction={(action) => {
        console.log(action.url);
      }}
      onError={({ error }) => {
        console.error(error);
      }}
    />
  );
}

Like the official @divkitframework/react package, the component accepts the DivKit client render options except target and hydrate. PNLight supplies its own target, custom components, global scaling/safe-area variables, Lottie extension, and protocol handlers.

The package also exports PNLightDivKit as an alias for RemoteUi.

The registered custom components include pnlight.animated_prepend_list. It uses the same props as the iOS component: increasing count by one smoothly prepends the next discovery-ordered item, while larger jumps or resets apply immediately. Rows use intrinsic content height, and instance_id preserves the displayed count if DivKit replaces the underlying custom element.

On the web, DivKit does not make expressions inside custom_props reactive. For a variable-driven list, keep count as a literal initial value and pass the variable name through count_variable:

{
  "custom_props": {
    "count": 0,
    "count_variable": "visible_item_count",
    "items": []
  }
}

The component subscribes to that DivKit variable and applies the same prepend animation for each increment.

PNLight actions

Navigation, dialogs, and haptics are consumed inside the component for schemaVersion: 2 documents. Observe them when needed:

<RemoteUi
  id="offer"
  json={config}
  onPNLightAction={({ kind, url, logId, message }) => {
    console.log(kind, url, logId, message);
  }}
/>

Unconsumed custom URLs continue through DivKit's standard onCustomAction callback.

Styling

Import @pnlight/sdk-react/styles.css once. Give the component or its parent an explicit height when the document uses match_parent:

<RemoteUi id="full-screen" json={config} style={{ minHeight: "100dvh" }} />

Compatibility

  • Missing schemaVersion, or version 1, keeps legacy edge-to-edge behavior.
  • schemaVersion: 2 enables PNLight flows, safe areas, scaling variables, dialogs, and haptics.
  • CTA, icon button, circular loader, animated prepend list, and Lottie support are additive.

This initial package is client-side only. Use it from a client component in SSR frameworks.