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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@kodemo/player

v0.3.4

Published

React component for viewing Kodemo documents.

Downloads

61

Readme

Kodemo

Kodemo is a new format for more engaging and interactive technical documentation. It's great for tutorials and walkthroughs.

Kodemo Player

This repo contains the @kodemo/player package which is responsible for rendering and navigating Kodemo documents. The player is a React component and it needs to be provided with a valid Kodemo document.

Installation

To install and integrate @kodemo/player please follow the docs at https://kodemo.com/docs/player.

TLDR?

  1. Install @kodemo/player using your package manager of choice:
npm i @kodemo/player # yarn add @kodemo/player
  1. Import and render the KodemoPlayer component:
import React from 'react'
import ReactDOM from 'react-dom/client'
import { KodemoPlayer } from '@kodemo/player';

ReactDOM.createRoot(document.getElementById('root')).render(
  <React.StrictMode>
    <KodemoPlayer json={{
      story: '<h1>Example Document</h1>',
      subjects: {
        f992151a: {
          type: 'code',
          name: 'file.js',
          language: "javascript",
          versions: {
            e60944c4: { value: 'const a = 123;', },
          }
        }
      }
    }}></KodemoPlayer>
  </React.StrictMode>
)

Development Setup

If you want to make changes to the @kodemo/player source here's how:

  1. Clone this repository
  2. Run yarn install
  3. Run yarn dev to start the development server
  4. Open the URL from the dev server output and 💥

Other scripts

# run tests
yarn test

# build a new release
yarn build

Adding New Subject Types

Each subject in Kodemo is its own React component. You can easily add your own subject types by following these steps:

  1. Create your subject component in the subjects directory. I recommend using AbstractSubject as a starting point.
  2. Export your subject from subjects/index.ts.
  3. Add your subject to enum/SubjectType.ts.

Terminology

If you're planning to work with the Kodemo source here are a few key concepts and names that are good to know about.

  • The story is the main body text of the documentation.
  • Subjects are the individual pieces of content that the documentation covers. A subject can be an image, code, etc.
  • Subjects can have multiple versions. Each version represents a variant of the same subject. For example, multiple versions are used to animate lines being added or removed from code.
  • The timeline is the bar with vertical line segments that indicate which subject that will become active when scrolling.
  • Effects are keywords within the story that are linked to a specific subject version. They form the relationship between the story and subjects.