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

@scenar/core

v0.1.19

Published

Pure TypeScript types, timing, and utilities for the Scenar scenario engine.

Downloads

339

Readme

@scenar/core

Pure TypeScript types, timing constants, and utility functions for the Scenar scenario playback engine. Zero framework dependencies — no React, no DOM (except scroll utilities).

Install

pnpm add @scenar/core

What's inside

Scenario types

  • ScenarioStep<T> — A single step in a scenario timeline with typed data payload, delay, caption, narration text, and inline interactions.
  • StepAction — A timed interaction within a step (click, type, hover, drag, scroll_to, set_cursor, clear_cursor, viewport_transition).

Timeline computation

  • computeStepTimeline(steps, manifest) — Pre-compute step start times and total duration from step delays and narration clip durations.
  • deriveStepFromTime(currentTimeMs, stepStartTimesMs, maxIndex) — Find the active step for a given playback time (used by the video-export path).
  • getStepDurationMs(stepIndex, manifest, steps) — Effective duration of a step for interaction timing.

Timing constants

  • CLICK_DELAY_MS (450) — Cursor settle time before click ripple.
  • TYPE_CHAR_DELAY_MS (50) — Default per-character typing delay.
  • HOVER_HOLD_MS (1500) — Default hover dwell time.
  • DRAG_SETTLE_MS (200) — Pause at drag source before movement.
  • VIEWPORT_SETTLE_MS (500) — Viewport transition spring settle time.

DOM utilities

  • findScrollParent(el) — Walk up the DOM to find the nearest scrollable ancestor.
  • scrollTargetIntoView(el) — Smooth-scroll an element into its scroll container.
  • scrollTargetIntoViewInstant(el) — Instant-scroll variant for video export.

Cursor position

  • computeCursorPosition(container, el) — Compute cursor position accounting for CSS zoom.

Data-attribute contract

The engine identifies interactive elements via data attributes. These constants are the single source of truth:

  • CURSOR_TARGET_ATTRIBUTE"data-cursor-target"
  • SCROLL_TARGET_ATTRIBUTE"data-scroll-target"
  • HOVER_STATE_ATTRIBUTE"data-hover"
  • DRAG_STATE_ATTRIBUTE"data-dragging"
  • cursorTargetSelector(id) — Build a CSS selector for a cursor target.
  • scrollTargetSelector(id) — Build a CSS selector for a scroll target.

Viewport transform

  • ViewportTransform{ scale, x, y } for zoom/pan state.
  • VIEWPORT_TRANSFORM_IDENTITY — The no-op transform.

Narration types

  • NarrationEntry{ src, durationMs } for one audio clip.
  • NarrationManifest{ steps: (NarrationEntry | null)[] }.

License

Apache-2.0