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

@clipkit/protocol

v1.4.0

Published

The Clipkit Protocol — types, runtime validation, and spec for the Clipkit video runtime. Implementations target this package.

Readme

@clipkit/protocol

The canonical implementation of the Clipkit Protocol. Conforming runtimes target this package: it exports the Zod schemas every implementation validates against, the TypeScript types every consumer reads, and the defaults for every element kind. Runtime validation here is the trust boundary between AI-generated JSON and the rest of the system.

Install

import {
  validate,
  type Source,
  type Element,
  applyDefaults,
} from '@clipkit/protocol';

Source structure

{
  output_format?: 'mp4' | 'gif' | 'jpg' | 'png',  // default 'mp4'
  width?: number,                                   // pixels, default 1920
  height?: number,                                  // pixels, default 1080
  duration?: number | 'auto',                       // seconds, default 'auto'
  frame_rate?: number,                              // fps, default 30
  background_color?: string,
  elements: Element[],
}

Element types

Every element has a type discriminator plus the base properties shared across all types: id, name, track, time, duration, x, y, x_anchor, y_anchor, width, height, rotation, scale, opacity, animations, keyframe_animations.

Numeric properties may also accept a Keyframe[] array for time-driven values.

video

{ type: 'video', source: string, volume?, playback_rate?, trim_start?, trim_duration?, loop? }

image

{ type: 'image', source: string, fit?: 'cover' | 'contain' | 'fill' | 'none', brightness?, contrast?, saturation?, blur? }

text

{
  type: 'text',
  text: string,
  font_family?, font_size?, font_weight?, font_style?,
  fill_color?, stroke_color?, stroke_width?,
  text_align?, vertical_align?, y_alignment?,
  line_height?, letter_spacing?,
  background_color?, background_border_radius?,
  shadow_color?, shadow_x?, shadow_y?, shadow_blur?,
}

shape

{
  type: 'shape',
  shape?: 'rectangle' | 'ellipse' | 'triangle' | 'polygon',
  path?: string,        // SVG path (overrides `shape`)
  fill_color?, stroke_color?, stroke_width?, border_radius?,
  sides?,               // polygon only
}

audio

{ type: 'audio', source: string, volume?, trim_start?, trim_duration?, loop? }

caption (Clipkit extension)

Word-timed captions with kinetic styles.

{
  type: 'caption',
  words: [
    { text: 'Hello', start: 0.0, end: 0.4 },
    { text: 'world', start: 0.4, end: 0.9 },
  ],
  style?: 'tiktok_bounce' | 'fade_reveal' | 'kinetic_typewriter' | 'word_pop',
  // ...all text styling properties (font_family, fill_color, etc.)
  highlight_color?: string,             // active word color
  highlight_background_color?: string,  // active word background
}

words[].start and words[].end are seconds, relative to the caption element's time.

Animations

Two parallel systems:

Named animations (animations: Animation[]) — preset entrance/exit motions.

{ type: 'fade-in' | 'slide-up-in' | 'scale-out' | ..., duration?, easing?, time?: 'start' | 'end' | number }

The full list of types: fade-in, fade-out, slide-left-in, slide-right-in, slide-up-in, slide-down-in, slide-left-out, slide-right-out, slide-up-out, slide-down-out, scale-in, scale-out, rotate-in, rotate-out, bounce-in, bounce-out.

Keyframe animations (keyframe_animations: KeyframeAnimation[]) — arbitrary property-over-time control.

{
  property: 'x' | 'opacity' | string,
  keyframes: [{ time: 0, value: 0, easing: 'ease-out' }, { time: 1, value: 100 }],
  easing?,
}

Validation

import { validate } from '@clipkit/protocol';

const result = validate(sourceJson);
if (result.valid) {
  console.log(result.data); // typed as Source
} else {
  result.errors.forEach(e => console.log(e.path, e.message));
}

Pure function — no I/O. Accepts a parsed object or a raw JSON string. Unknown properties are preserved (.passthrough() semantics) so vendor-specific fields round-trip unchanged.

Defaults

import { applyDefaults } from '@clipkit/protocol';

const element = applyDefaults({ type: 'video', source: 'clip.mp4' });
// → video with track: 1, time: 0, x: '50%', y: '50%', etc.

Const-driven design

The const arrays in types.ts are the single source of truth. Adding a value there propagates to Zod enums and any consumers that iterate the registry:

  • ELEMENT_TYPES — every valid type discriminator.
  • OUTPUT_FORMATSmp4, gif, jpg, png.
  • CAPTION_STYLES — kinetic caption presets.
  • ANIMATION_TYPES — named animation presets.
  • EASING_FUNCTIONS — all 29 supported easings.
  • UNITSpx, %, vw, vh, vmin, vmax.