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

@editora/data-binding

v1.0.1

Published

Data binding plugin for Editora rich text editor with key-path tokens, preview rendering, and API/static data sources

Readme

@editora/data-binding

Version License TypeScript Size

[!IMPORTANT] Live Website: https://editora-ecosystem.netlify.app/
Storybook: https://editora-ecosystem-storybook.netlify.app/

@editora/data-binding adds merge-style data tokens to Editora with runtime preview from static data, callback data, or API sources.

Features

  • Native framework-agnostic plugin (no framework dependency)
  • Works in React (Vite/CRA) and Web Component without code changes
  • Insert and edit data tokens like {{user.firstName}}
  • Preview mode renders live values from runtime data
  • Supports static object data, async callback data, and API fetch data
  • Multi-instance safe (preview/data cache is isolated per editor)
  • Accessible dialog (role="dialog", focus trap, Esc close)
  • Light/dark theme support

Install

npm install @editora/data-binding

Basic Usage (React)

import { EditoraEditor } from '@editora/react';
import { BoldPlugin, HistoryPlugin, DataBindingPlugin } from '@editora/plugins';

const plugins = [
  BoldPlugin(),
  HistoryPlugin(),
  DataBindingPlugin({
    data: {
      user: { firstName: 'Ava', role: 'Admin' },
      order: { total: 4999.9, currency: 'USD' },
    },
  }),
];

export default function App() {
  return <EditoraEditor plugins={plugins} />;
}

Basic Usage (Web Component)

<editora-editor id="editor"></editora-editor>
<script>
  const editor = document.getElementById('editor');
  editor.setConfig({
    plugins: 'bold history dataBinding',
    toolbar: {
      items: 'bold undo redo | dataBinding dataBindingPreview',
    },
  });
</script>

Accepted aliases: dataBinding, data-binding, databinding.

Toolbar Commands

  • openDataBindingDialog -> open insert/edit dialog
  • insertDataBindingToken -> insert token directly
  • editDataBindingToken -> update selected token
  • toggleDataBindingPreview -> toggle rendered preview
  • setDataBindingData -> override data object for current editor
  • refreshDataBindings -> clear cache and re-render tokens

Keyboard Shortcuts

  • Ctrl/Cmd + Alt + Shift + D -> open data binding dialog
  • Ctrl/Cmd + Alt + Shift + B -> toggle preview
  • F7 -> open dialog (fallback)
  • F8 -> toggle preview (fallback)
  • Esc -> close dialog

API Data Source (Advanced)

DataBindingPlugin({
  api: {
    url: '/api/template/context',
    method: 'POST',
    headers: ({ editorRoot }) => ({
      'Content-Type': 'application/json',
      'X-Doc-Id': editorRoot.getAttribute('data-doc-id') || '',
    }),
    body: ({ editorRoot }) => ({
      locale: editorRoot.getAttribute('data-locale') || 'en-US',
      audience: editorRoot.getAttribute('data-audience') || 'public',
    }),
    responsePath: 'data',
    timeoutMs: 10000,
  },
  cacheTtlMs: 15000,
});

Callback Data Source

DataBindingPlugin({
  async getData({ editorRoot }) {
    const locale = editorRoot.getAttribute('data-locale') || 'en-US';
    const res = await fetch(`/api/context?locale=${encodeURIComponent(locale)}`);
    if (!res.ok) return {};
    return res.json();
  },
});

Runtime Data Update

(window as any).executeEditorCommand?.('setDataBindingData', {
  user: { firstName: 'Liam' },
  order: { total: 1200.5 },
});

(window as any).executeEditorCommand?.('toggleDataBindingPreview', true);

Edge Cases Covered

  • Tokens remain non-editable (contenteditable="false").
  • Preview state and data cache are per-editor instance.
  • Dialog is keyboard accessible and closes reliably on Esc or outside click.
  • Missing values fall back to configured fallback text.
  • History records token insert/edit when History plugin is present.