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

@de-view/coatl-sdk

v1.0.1

Published

SDK for mounting Coatl Engine React modules in WordPress

Readme

@de-view/coatl-sdk

SDK for mounting Coatl Engine React modules in WordPress.

Provides the core utilities that every Coatl Engine frontend module uses to mount React components into WordPress pages and communicate with REST APIs.

Installation

npm install @de-view/coatl-sdk

Peer dependencies

npm install react react-dom

API

mountCoatlModule<T>(dataKey, render)

Mounts a React component into a WordPress page. Reads inline data injected by PHP (DataProvider) from window[dataKey], extracts the _coatl.root_id config, finds the DOM element, and renders via createRoot.

import { mountCoatlModule } from '@de-view/coatl-sdk'

interface MyData {
  is_logged_in: boolean
  nonce: string
  api_url: string
}

mountCoatlModule<MyData>('coatl-module-example_data', (data) => (
  <MyComponent data={data} />
))

Parameters:

| Param | Type | Description | |-------|------|-------------| | dataKey | string | Key in window where PHP injected the module data | | render | (data: T) => ReactNode | Render function receiving clean data (without _coatl) |

The component is wrapped in an ErrorBoundary that catches render errors and displays a fallback in dev mode.

useCoatlApi<T>(url, nonce, options?)

React hook for fetching data from Coatl Engine REST API endpoints. Handles loading state, errors, abort on unmount, and refetch.

import { useCoatlApi } from '@de-view/coatl-sdk'

function MyComponent({ apiUrl, nonce }: { apiUrl: string; nonce: string }) {
  const { data, loading, error, refetch } = useCoatlApi<UserData>(apiUrl, nonce)

  if (loading) return <p>Loading...</p>
  if (error) return <p>Error: {error}</p>

  return <div>{data?.name}</div>
}

Parameters:

| Param | Type | Description | |-------|------|-------------| | url | string \| null | REST API endpoint URL. Pass null to skip fetch | | nonce | string \| null | WordPress REST nonce (X-WP-Nonce header) | | options | { method?, body? } | Optional HTTP method and JSON body |

Returns: { data, loading, error, refetch }

How it works

  1. PHP DataProvider injects lightweight data into the page via wp_add_inline_script
  2. The data includes a _coatl.root_id field pointing to the DOM container
  3. mountCoatlModule reads the data, finds the element, and mounts your React tree
  4. useCoatlApi handles async data fetching from WordPress REST endpoints

License

MIT