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

@openlearning/widget-framework

v1.2.5

Published

Framework for building OpenLearning widgets with parent-window messaging and configuration management

Downloads

981

Readme

Widget Framework

A comprehensive framework for building OpenLearning widgets with reusable UI components, parent-window messaging, and configuration management.

Features

  • Reusable UI Components: Pre-built, accessible components following the OpenLearning design system
  • Parent Messaging: Secure two-way communication between widgets and parent applications
  • Configuration Management: Type-safe widget configuration and setup
  • TypeScript Support: Full TypeScript support with comprehensive type definitions
  • Consistent Styling: CSS-based theming with customizable color variables

Installation

npm install @openlearning/widget-framework

Quick Start

1. Create Your Widget Component

import React from "react";
import { Button } from "@openlearning/widget-framework";
import "@openlearning/widget-framework/styles/button.css";

export function MyWidget() {
  return (
    <div>
      <h1>My First Widget</h1>
      <Button variant="round-filled">Get Started</Button>
    </div>
  );
}

2. Set Up the Learner View

import { createLearnerEntry } from "@openlearning/widget-framework";
import MyWidget from "./MyWidget";

createLearnerEntry(MyWidget);

3. Set Up the Setup View

import { createSetupEntry } from "@openlearning/widget-framework";
import MyWidgetSetup from "./MyWidgetSetup";

createSetupEntry(MyWidgetSetup, {
  // your default setup config
});

Core Features

UI Components

See COMPONENTS.md for full component documentation.

Development Tools

Use DevApp for development and testing:

import { DevApp } from "@openlearning/widget-framework";

export default function App() {
  return (
    <DevApp
      LearnerViewComponent={MyLearnerWidget}
      SetupViewComponent={MySetupWidget}
      defaultConfig={{}}
    />
  );
}

Project Setup

Define your widget project configuration:

import { defineWidgetProject } from "@openlearning/widget-framework";

export const widgetConfig = defineWidgetProject({
  id: "my-widget", 
  name: "My Widget",
  version: "1.0.0",
  /* ... more config ... */
});

Integration Guide

See INTEGRATION_GUIDE.md for practical examples and common patterns.

API Reference

createLearnerEntry(Component, defaultConfig?)

Renders a component as the learner view of your widget.

Parameters:

  • Component - Your LearnerView React component
  • defaultConfig (optional) - Default configuration to use when no config exists

Example:

createLearnerEntry(LearnerView, { /* your default config */ });

createSetupEntry(Component, defaultConfig)

Renders a component as the setup/configuration view of your widget.

Parameters:

  • Component - Your SetupView React component
  • defaultConfig - Default configuration to use when no config exists

Internal APIs

useParentApi(defaultConfig?)

Unified helper for setup data + parent messaging actions.

Parameters:

  • defaultConfig (optional) - Used when init data has no config.

Returns:

  • setupData - Current setup payload (or null until init)
  • sendReady()
  • sendSet(name, value)
  • sendResize(height)
  • sendShare(attachments, thumbnail)
  • sendComplete()

useParentMessaging()

Hook for parent-window communication.

Signature:

useParentMessaging(onMessage: (message: ParentMessage) => void)

Returns: { sendMessage }

DevApp(props)

Development wrapper component for testing widget views.

defineWidgetProject(config)

Defines widget project configuration.

UI Components

Button

import { Button } from "@openlearning/widget-framework";
import "@openlearning/widget-framework/styles/button.css";

<Button 
  variant="round-filled"
  size="medium"
  icon={<MyIcon />}
  iconPosition="left"
  isLoading={false}
  fullWidth={false}
  onClick={handleClick}
>
  Click Me
</Button>

TypeScript Support

Full TypeScript support with type definitions:

import { 
  Button,
  type ButtonProps,
  type LearnerViewProps,
  type WidgetConfigBase 
} from "@openlearning/widget-framework";

Browser Support

  • Chrome/Edge (latest 2 versions)
  • Firefox (latest 2 versions)
  • Safari (latest 2 versions)
  • iOS Safari 12+
  • Android 5+

Contributing

Contributions are welcome! Please follow these guidelines:

  1. Create a feature branch
  2. Make your changes
  3. Write tests for new functionality
  4. Submit a pull request

License

MIT

Support

For issues, questions, or feature requests, please contact the OpenLearning team.