vidscroll0.3.3

TypeScript types

Everything each entry point exports, values and types.

vidscroll is written in TypeScript and ships its types; there’s nothing extra to install. It has three entry points, and each exports only what it needs.

vidscroll (React)

ExportKindWhat it is
ScrollVideo, Section, ScrollFramescomponentsThe React components
useScrollVideo, useScrollVideoState, useScrollVideoUpdatehooksSee Hooks
easingvalueThe preset curves as functions, such as easing.inOutSine
VidscrollErrorclassErrors with a code; use with instanceof
ScrollVideoProps, SectionProps, ScrollFramesPropstypesComponent props
ScrollVideoApitypeThe api from useScrollVideo
ScrollVideoStatetypeWhat useScrollVideoState returns
ScrollVideoSnapshottypeThe state passed to useScrollVideoUpdate and events
ScrollVideoEventstypeEvent names and their payloads
LoaderStatetypeThe argument of a loader function
EasingNametypeThe preset names accepted by easing
VidscrollErrorCodetype“unsupported-url” | “http-error” | “not-a-video” | “unplayable”
OptimizeOptions, SmoothScrollOptions, ScrollToOptionstypesOption objects
SectionRangetypeA range for addSection
LoadedVideo, VideoProbetypesWhat onLoad describes: the source and the file’s measurements

vidscroll/core

ExportKindWhat it is
createScrollVideofunctionCreates a controller. See vidscroll/core
stylesvalueThe default CSS as a string
easing, VidscrollErrorvalue, classAs in the React entry
ScrollVideoControllertypeThe controller
ScrollVideoOptionstypeOptions for createScrollVideo, update and setOptions
ScrollVideoEventMap, ScrollVideoEventtypesEvent payloads (including loader) and event names
LoaderState, EasingName, VidscrollErrorCode, ScrollVideoSnapshot, ScrollToOptions, SectionRange, OptimizeOptions, SmoothScrollOptions, LoadedVideo, VideoProbetypesAs in the React entry

vidscroll/element

Importing this entry registers <vid-scroll> and <vid-scroll-section>, and adds them to HTMLElementTagNameMap, so document.querySelector("vid-scroll") is typed.

ExportKindWhat it is
VidScrollElement, VidScrollSectionElementclassesThe element classes
VidScrollEventMaptypeThe DOM events and their detail types
LoaderState, ScrollVideoController, ScrollVideoOptionstypesAs in the core entry

Two naming details

  • The React entry calls the event map ScrollVideoEvents; the core entry calls it ScrollVideoEventMap and includes the loader event, which the React api doesn’t list.
  • onLoad receives { source, probe }. source is "original", "optimized", "cache" or "stream". probe describes the file (duration, width, height, frameCount, maxKeyframeGap) and is null for cached and streamed videos.