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/renderer

v0.2.1

Published

Renderer component for the LMS CMS system, providing content display and presentation capabilities.

Downloads

1,166

Readme

@lms-cms/renderer

Renderer component for the LMS CMS system, providing content display and presentation capabilities.

Overview

This package contains the renderer components that display educational content to end users. It transforms the structured data from the core system into beautifully rendered user interfaces, leveraging React Query for efficient data fetching and caching.

Installation

npm install @lms-cms/renderer

Dependencies

  • @lms-cms/core: Core LMS CMS functionality
  • @tanstack/react-query: Data fetching and state management
  • React (peer dependency): >=18.0.0
  • React DOM (peer dependency): >=18.0.0

Features

  • Course Renderer: Display course information and structure
  • Lesson Renderer: Render lesson content with interactive elements
  • Block Renderer: Render individual content blocks
  • Mathematical Rendering: KaTeX-powered equation display
  • Progress Tracking: Track user learning progress
  • Responsive Design: Mobile-friendly content display
  • Accessibility: WCAG compliant components

Usage

Course Renderer

import { CourseRenderer } from '@lms-cms/renderer';

function CoursePage({ courseId }) {
  return (
    <CourseRenderer
      courseId={courseId}
      onLessonSelect={(lessonId) => console.log('Selected:', lessonId)}
    />
  );
}

Lesson Renderer

import { LessonRenderer } from '@lms-cms/renderer';

function LessonPage({ lessonId }) {
  return (
    <LessonRenderer
      lessonId={lessonId}
      onComplete={() => console.log('Lesson completed')}
      onNext={() => console.log('Next lesson')}
    />
  );
}

Block Renderer

import { BlockRenderer } from '@lms-cms/renderer';

function ContentBlock({ block }) {
  return (
    <BlockRenderer
      block={block}
      onInteraction={(data) => console.log('Interaction:', data)}
    />
  );
}

Renderer Components

CourseRenderer

Displays course overview and navigation:

  • Course title and description
  • Lesson listing with progress indicators
  • Course metadata and instructor info
  • Enrollment and completion status

LessonRenderer

Renders lesson content with navigation:

  • Sequential block rendering
  • Progress tracking
  • Navigation controls
  • Interactive elements and assessments

BlockRenderer

Renders individual content blocks:

  • TextBlock: Formatted text content
  • ImageBlock: Image display with captions
  • VideoBlock: Video player with controls
  • PDFBlock: PDF viewer and navigation
  • QuizBlock: Interactive quiz interface
  • AssignmentBlock: Assignment submission interface

ProgressIndicator

Shows learning progress:

  • Course completion percentage
  • Lesson progress bars
  • Achievement badges
  • Time tracking

Data Fetching

The renderer uses React Query for efficient data management:

import { useCourse, useLesson, useProgress } from '@lms-cms/renderer';

function CourseComponent({ courseId }) {
  const { data: course, isLoading, error } = useCourse(courseId);
  const { data: progress } = useProgress(courseId);

  if (isLoading) return <div>Loading...</div>;
  if (error) return <div>Error: {error.message}</div>;

  return <CourseRenderer course={course} progress={progress} />;
}

Customization

Theming

The renderer supports custom theming through CSS variables:

.lms-renderer {
  --primary-color: #007bff;
  --secondary-color: #6c757d;
  --success-color: #28a745;
  --warning-color: #ffc107;
  --error-color: #dc3545;
  --background-color: #ffffff;
  --text-color: #333333;
}

Custom Block Renderers

Create custom renderers for specific block types:

import { BlockRenderer } from '@lms-cms/renderer';

function CustomBlockRenderer({ block, ...props }) {
  switch (block.type) {
    case 'custom':
      return <MyCustomBlock block={block} {...props} />;
    default:
      return <DefaultBlockRenderer block={block} {...props} />;
  }
}

Layout Components

Use layout components for custom page structures:

import { CourseLayout, LessonLayout } from '@lms-cms/renderer';

function CustomCoursePage({ courseId }) {
  return (
    <CourseLayout courseId={courseId}>
      <div>Custom sidebar content</div>
      <div>Custom main content</div>
    </CourseLayout>
  );
}

Performance Optimization

Lazy Loading

The renderer supports lazy loading for better performance:

import { lazy } from "react";

const LazyLessonRenderer = lazy(() =>
  import("@lms-cms/renderer").then((mod) => ({
    default: mod.LessonRenderer,
  })),
);

Caching

React Query provides intelligent caching:

import { QueryClient, QueryClientProvider } from "@tanstack/react-query";

const queryClient = new QueryClient({
  defaultOptions: {
    queries: {
      staleTime: 5 * 60 * 1000, // 5 minutes
      cacheTime: 10 * 60 * 1000, // 10 minutes
    },
  },
});

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

Best Practices

  • Use React Query for all data fetching operations
  • Implement proper loading and error states
  • Ensure accessibility compliance (WCAG 2.1 AA)
  • Optimize for mobile devices and responsive design
  • Test with various content types and sizes
  • Implement proper error boundaries
  • Use semantic HTML for better SEO and accessibility

Architecture

src/
  components/      # Renderer components
  hooks/          # Custom React hooks
  queries/        # React Query configurations
  utils/          # Rendering utilities
  types/          # Renderer-specific types
  styles/         # CSS and styling
  index.ts        # Main exports