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

@storysdk/types

v2.1.0

Published

Common types for StorySDK

Readme

@storysdk/types

TypeScript definitions and interfaces for StorySDK. This package provides shared type definitions used across all StorySDK packages, ensuring type safety and consistency.

Installation

npm install @storysdk/types

Overview

This package contains TypeScript definitions for:

  • Common data structures (colors, fonts, backgrounds, etc.)
  • Widget type definitions (text, image, video, quiz widgets, etc.)
  • Story and group structures
  • UI element types (buttons, icons, animations)

Package Structure

src/
├── common/           # Common data types and utilities
├── widgets/          # Widget-specific type definitions
├── groups/           # Group and story structure types
├── WidgetType.ts     # Core widget type definitions
├── GroupType.ts      # Core group type definitions
├── StoryContext.ts   # Story context and state types
└── index.ts          # Main exports

Basic Usage

import { 
  GroupType, 
  WidgetType, 
  MaterialIconValueType,
  BackgroundType,
  ColorValue
} from '@storysdk/types';

// Define a custom group
const myGroup: GroupType = {
  id: 'custom-group',
  name: 'My Custom Group',
  // ... other properties
};

// Type-safe widget configuration
const textWidget: TextWidgetParamsType = {
  text: 'Hello World',
  fontParams: {
    fontSize: 16,
    fontWeight: 'bold'
  }
};

Type Categories

Common Types (common/)

Core data types used throughout the SDK:

  • MaterialIconValueType - Enumeration of supported Material Design icons
  • BackgroundType - Background configuration (color, gradient, image)
  • BorderType - Border styling properties
  • ColorValue - Color representation (hex, rgba, named colors)
  • FontParamsType - Typography configuration
  • VideoMetadataType - Video file metadata and properties
  • QuizAnswersScoreParams - Quiz scoring and answer validation
  • EmojiItemType - Emoji data structure

Widget Types (widgets/)

Type definitions for all supported widget types:

  • TextWidgetParamsType - Text content and styling
  • ImageWidgetParamsType - Image display and positioning
  • VideoWidgetParamsType - Video playback and controls
  • RectangleWidgetParamsType - Shape and container widgets
  • QuizWidgetParamsType - Interactive quiz elements
  • EmojiWidgetParamsType - Emoji reaction widgets
  • IconWidgetParamsType - Icon display and styling
  • WidgetType - Base widget interface

Group and Story Types

High-level structure definitions:

  • GroupType - Story group configuration and metadata
  • StoryContext - Runtime story state and context
  • GroupsListProps - Props for rendering story groups

Advanced Usage

Custom Widget Development

import { WidgetType, WidgetParamsType } from '@storysdk/types';

// Define custom widget parameters
interface CustomWidgetParams extends WidgetParamsType {
  customProperty: string;
  customConfig: {
    enabled: boolean;
    value: number;
  };
}

// Use in widget implementation
const customWidget: WidgetType<CustomWidgetParams> = {
  type: 'custom',
  params: {
    customProperty: 'value',
    customConfig: {
      enabled: true,
      value: 42
    }
  }
};

Type Guards and Validation

import { WidgetType } from '@storysdk/types';

function isTextWidget(widget: WidgetType): widget is WidgetType<TextWidgetParamsType> {
  return widget.type === 'text';
}

// Usage
if (isTextWidget(someWidget)) {
  // TypeScript now knows this is a text widget
  console.log(someWidget.params.text);
}

Contributing

When adding new types:

  1. Place common types in common/
  2. Widget-specific types go in widgets/
  3. Export new types from index.ts
  4. Add JSDoc comments for complex types
  5. Ensure backward compatibility

Version Compatibility

  • v1.6.x: Compatible with StorySDK Core 1.9.x and React 1.9.x
  • Follows semantic versioning for type additions and changes
  • Breaking changes will increment major version

Related Packages

For more information, visit storysdk.com.