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

@scriptural/react

v0.0.22

Published

A React-based Bible editor component library built on top of Lexical, providing components, hooks, and utilities for creating scripture editing applications

Readme

@scriptural/react

Note: Scriptural is currently in alpha stage. The API may undergo significant changes before the first stable release. While we encourage testing and feedback, it is not yet recommended for production use.

A React-based Bible editor component library built on top of Lexical. This package provides components, hooks, and utilities for creating scripture editing applications.

Installation

npm install @scriptural/react

Quick Start

Here's a simple example of creating a scripture editor:

import React from "react";
import { ScripturalEditorComposer, ToolbarDefault } from "@scriptural/react";
import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin";
import "@scriptural/react/styles/scriptural-editor.css";

// Sample USJ data (normally you'd load this from a file or API)
const sampleUsj = {
  type: "USJ",
  version: "0.2.1",
  content: [
    {
      type: "chapter",
      marker: "c",
      number: "1",
    },
    {
      type: "para",
      marker: "p",
      content: [
        {
          type: "verse",
          marker: "v",
          number: "1",
        },
        "In the beginning...",
      ],
    },
  ],
};

function SimpleEditor() {
  const handleSave = (usj) => {
    console.log("Saving USJ:", usj);
  };

  const handleError = (error) => {
    console.error("Editor error:", error);
  };

  const handleHistoryChange = (editorState) => {
    // Called whenever the history state changes (e.g., after undo/redo)
    console.log("History changed:", editorState);
  };

  const initialConfig = {
    bookCode: "GEN",
    usj: sampleUsj,
    onError: handleError,
    editable: true,
    initialSettings: {
      "toolbar.enhancedCursorPosition": true,
      "toolbar.contextMenuTriggerKey": "\\",
    },
  };

  return (
    <div className="editor-container">
      <ScripturalEditorComposer initialConfig={initialConfig}>
        <ToolbarDefault onSave={handleSave} />
        <HistoryPlugin onChange={handleHistoryChange} />
      </ScripturalEditorComposer>
    </div>
  );
}

export default SimpleEditor;

Add some basic styles:

.editor-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.contentEditable {
  min-height: 400px;
  padding: 20px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

This creates a basic scripture editor with:

  • A toolbar with standard editing actions
  • Built-in scripture reference tracking
  • Built-in context menu for inserting scripture elements (triggered with \)
  • Built-in enhanced cursor positioning
  • Basic error handling
  • Save functionality

The ScripturalEditorComposer component automatically includes several essential plugins:

  • ContentEditablePlugin for basic editing
  • ScripturalHandlersPlugin for handling scripture-specific interactions
  • ScriptureReferencePlugin for tracking references
  • ChapterVerseUpdatePlugin for managing chapter and verse updates

Additional plugins like HistoryPlugin for undo/redo and CursorHandlerPlugin for enhanced cursor positioning can be added as needed. See our GUIDES.md for examples of adding these plugins.

For more advanced examples and customization options, see our GUIDES.md.

Requirements

  • React >= 18.3.1
  • React DOM >= 18.3.1

Features

  • Rich text editing capabilities specifically designed for biblical content
  • Scripture reference tracking
  • Marker management for biblical text formatting
  • Customizable toolbar with common editing actions
  • Support for verse blocks and formatting markers
  • Context menu for quick marker insertion
  • History management (undo/redo)
  • Enhanced cursor positioning

Extending Lexical

Scriptural is built on top of Meta's Lexical framework, extending it with scripture-specific functionality. Here's how Scriptural enhances Lexical:

Custom Nodes

Scriptural adds scripture-specific nodes to Lexical's node system:

  • ScriptureElementNode: Base node for scripture elements
  • InlineNode
  • BlockNode

Plugin Types

You can create several types of plugins for Scriptural:

  1. Scripture Marker Plugins

    • Handle USFM markers and formatting
    • Example: Creating custom markers for specific Bible translations
    • See: Creating Settings Plugins
  2. Toolbar Plugins

    • Add new functionality to the editor toolbar
    • Example: Font size control, custom formatting options
    • See: Font Size Plugin Example
  3. Context Menu Plugins

    • Extend the right-click context menu
    • Add quick actions for scripture editing
    • Based on Lexical's FloatingTextFormatToolbarPlugin
  4. Reference Tracking Plugins

    • Track and manage scripture references
    • Handle chapter and verse navigation
    • Example: The built-in ScriptureReferencePlugin

Lexical Integration

Scriptural uses several Lexical concepts that you should be familiar with:

  1. Editor State

    • Scriptural extends Lexical's EditorState with scripture-specific data
    • Uses Lexical's immutable state management
    • Lexical State Documentation
  2. Commands

  3. Node Transform

For more information on Lexical concepts, visit the Lexical Documentation.

Main Components

ScripturalEditorComposer

The main component that sets up the editor environment:

import { ScripturalEditorComposer } from "@scriptural/react";

function Editor({ usj, onSave }) {
  const initialConfig = {
    bookCode: "GEN",
    usj,
    onError: (error) => console.error(error),
    editable: true,
    onSave,
  };

  return (
    <ScripturalEditorComposer initialConfig={initialConfig}>
      {/* Editor plugins and content */}
    </ScripturalEditorComposer>
  );
}

For complete API documentation, see API.md. For tutorials and guides, see GUIDES.md.

License

MIT - See LICENSE for more details.

Contributing

See CONTRIBUTING.md for more details.