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

@lms-cms/blocks

v0.2.8

Published

Modular block system for the LMS CMS, providing reusable content components with PDF rendering capabilities.

Downloads

1,830

Readme

@lms-cms/blocks

Modular block system for the LMS CMS, providing reusable content components with PDF rendering capabilities.

Overview

This package contains a collection of modular blocks that can be used to build educational content in the LMS CMS. Each block is a self-contained component that can handle different types of content, including text, images, videos, and PDF documents.

Installation

npm install @lms-cms/blocks

Dependencies

  • @lms-cms/core: Core LMS CMS functionality
  • react-pdf: PDF rendering capabilities
  • zod: Schema validation
  • React (peer dependency): >=18.0.0
  • React DOM (peer dependency): >=18.0.0

Features

  • 12 Built-in Block Types: Comprehensive content block library
  • Modular Registration: Register individual blocks or all at once
  • Type-Safe: Full TypeScript support with proper data schemas
  • Extensible: Easy to create custom blocks following the same pattern
  • LMS-Focused: Blocks specifically designed for educational content
  • Mathematical Rendering: KaTeX-powered equation block with visual builder

API Reference

Block Definitions

  • textBlockDef: Basic text content block
  • headingBlockDef: Heading elements (h1-h6)
  • imageBlockDef: Image display with captions
  • videoBlockDef: Video player integration
  • audioBlockDef: Audio player integration
  • pdfBlockDef: PDF document rendering
  • fileBlockDef: File download links
  • embedBlockDef: Embedded content (iframe)
  • equationBlockDef: Mathematical equations with KaTeX rendering
  • quizBlockDef: Interactive quiz components
  • progressBlockDef: Progress indicators
  • checklistBlockDef: Interactive checklists

Utility Functions

  • allBlocks: Array containing all built-in block definitions
  • registerAllBlocks(): Function to register all built-in blocks

Usage

Register Individual Blocks

import { registerBlock } from '@lms-cms/core';
import { textBlockDef, imageBlockDef, videoBlockDef } from '@lms-cms/blocks';

// Register specific blocks
registerBlock(textBlockDef);
registerBlock(imageBlockDef);
registerBlock(videoBlockDef);

Register All Built-in Blocks

import { registerAllBlocks } from '@lms-cms/blocks';

// Register all built-in blocks at once
registerAllBlocks();

Use Blocks in Content

import { createDoc, createBlock } from '@lms-cms/core';
import { registerAllBlocks } from '@lms-cms/blocks';

// First register the blocks
registerAllBlocks();

// Create content with different block types
const doc = createDoc([
  createBlock('text', { content: 'Welcome to your lesson!' }),
  createBlock('heading', { content: 'Chapter 1', level: 1 }),
  createBlock('image', { url: '/image.jpg', alt: 'Course image' }),
  createBlock('video', { src: '/video.mp4', poster: '/poster.jpg' }),
  createBlock('equation', { 
    latex: 'E = mc^2',
    displayMode: true
  }),
  createBlock('quiz', { 
    question: 'What is 2+2?',
    options: ['3', '4', '5'],
    correctAnswer: 1
  })
]);

Available Block Definitions

Core Text Blocks

textBlockDef

  • Type: text
  • Data: { content: string }
  • Purpose: Basic text content and paragraphs

headingBlockDef

  • Type: heading
  • Data: { content: string, level: number }
  • Purpose: Heading elements (h1-h6)

Core Media Blocks

imageBlockDef

  • Type: image
  • Data: { url: string, alt: string, caption?: string }
  • Purpose: Image display with captions

videoBlockDef

  • Type: video
  • Data: { src: string, poster?: string, title?: string }
  • Purpose: Video player integration

audioBlockDef

  • Type: audio
  • Data: { src: string, title?: string }
  • Purpose: Audio player integration

pdfBlockDef

  • Type: pdf
  • Data: { url: string, title?: string }
  • Purpose: PDF document rendering

fileBlockDef

  • Type: file
  • Data: { url: string, filename: string, size?: number }
  • Purpose: File download links

embedBlockDef

  • Type: embed
  • Data: { url: string, title?: string }
  • Purpose: Embedded content (iframe)

Core Math Blocks

equationBlockDef

  • Type: equation
  • Data: { latex: string, displayMode: boolean }
  • Purpose: Mathematical equations with KaTeX rendering and visual LaTeX builder
  • Features:
    • Live KaTeX preview
    • Visual LaTeX builder with templates (fractions, matrices, calculus, etc.)
    • Quick-insert symbol palette
    • Inline and display mode support
    • Error handling for invalid LaTeX

LMS-Specific Blocks

quizBlockDef

  • Type: quiz
  • Data: { question: string, options: string[], correctAnswer: number }
  • Purpose: Interactive quiz components

progressBlockDef

  • Type: progress
  • Data: { current: number, total: number, label?: string }
  • Purpose: Progress indicators

checklistBlockDef

  • Type: checklist
  • Data: { items: { text: string, checked: boolean }[] }
  • Purpose: Interactive checklists

Development

# Install dependencies
npm install

# Run development build
npm run dev

# Build for production
npm run build

# Run tests
npm run test

# Type checking
npm run type-check

Scripts

  • npm run build: Build the package for production
  • npm run dev: Build in watch mode for development
  • npm run test: Run tests with Vitest
  • npm run type-check: Run TypeScript type checking without emitting files

Contributing

When adding new blocks:

  1. Create the block component in src/blocks/
  2. Add proper TypeScript types
  3. Include comprehensive tests
  4. Update the export in src/index.ts
  5. Document the block in this README