
Company News
Andrew Becherer Joins Socket as Chief Information Security Officer
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.
@reelkit/stories-core
Advanced tools
Framework-agnostic stories state machine, timer, and utilities for ReelKit
Framework-agnostic stories state machine for ReelKit. Story and group navigation (tap to advance within a group, swipe to switch between users), auto-advance timer with pause/resume, tap zone detection, and segmented progress bar with sliding window for 50+ stories. ~1.7 kB gzip.
npm install @reelkit/stories-core @reelkit/core
import {
createStoriesController,
getTapAction,
getSegments,
} from '@reelkit/stories-core';
const controller = createStoriesController({
groupCount: 5,
storyCounts: [3, 4, 2, 5, 3],
});
// Navigate stories
controller.nextStory();
controller.prevStory();
// Switch between users
controller.nextGroup();
controller.prevGroup();
// Read state via signals
console.log(controller.state.activeGroupIndex.value); // 0
console.log(controller.state.activeStoryIndex.value); // 1
// Tap zone detection
getTapAction(50, 400); // 'prev' (left 30%)
getTapAction(300, 400); // 'next' (right 70%)
// Progress bar segments
const segments = getSegments(5, 2, 0.6);
// [completed, completed, active(60%), upcoming, upcoming]
requestAnimationFrame progress and pause/resume@reelkit/core| Config | Type | Default | Description |
|---|---|---|---|
groupCount | number | required | Number of story groups |
storyCounts | number[] | required | Stories per group |
initialGroupIndex | number | 0 | Starting group index |
initialStoryIndex | number | 0 | Starting story index |
defaultImageDuration | number | 5000 | Default auto-advance (ms) |
tapZoneSplit | number | 0.3 | Left zone ratio (0-1) |
| Method / Property | Type | Description |
|---|---|---|
state.activeGroupIndex | Signal<number> | Current group index |
state.activeStoryIndex | Signal<number> | Current story index |
state.isPaused | Signal<boolean> | Paused state |
nextStory() | void | Advance to next story |
prevStory() | void | Go to previous story |
nextGroup() | void | Switch to next user group |
prevGroup() | void | Switch to previous user group |
goToGroup(index) | void | Jump to specific group |
pause() | void | Pause timer and auto-advance |
resume() | void | Resume timer |
dispose() | void | Clean up subscriptions |
| Event | Type | Description |
|---|---|---|
onStoryChange | (groupIndex, storyIndex) => void | Fired after story navigation |
onGroupChange | (groupIndex) => void | Fired after group switch |
onStoryViewed | (groupIndex, storyIndex) => void | Fired when a story is viewed |
onComplete | () => void | Last story of last group finished |
onClose | () => void | Close requested (boundary navigation) |
function getTapAction(
tapX: number,
containerWidth: number,
splitRatio?: number, // default: 0.3
): 'prev' | 'next';
function getSegments(
totalStories: number,
activeIndex: number,
timerProgress: number, // 0-1
): SegmentState[];
function getVisibleWindow(
totalStories: number,
activeIndex: number,
timerProgress: number,
containerWidth: number,
minSegmentWidth?: number, // default: 4
gap?: number,
): VisibleWindow;
type TapAction = 'prev' | 'next';
type SegmentStatus = 'completed' | 'active' | 'upcoming';
interface SegmentState {
status: SegmentStatus;
fillPercentage: number; // 0-100
}
interface VisibleWindow {
startIndex: number;
endIndex: number;
segments: SegmentState[];
}
API reference and guides at reelkit.dev.
If ReelKit saved you some time, a star on GitHub would mean a lot.
FAQs
Framework-agnostic stories state machine, timer, and utilities for ReelKit
We found that @reelkit/stories-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.

Company News
Replit is integrating Socket Firewall into its AI-powered development experience to help protect builders from malicious open source packages.

Security News
npm confirmed a tooling bug incorrectly marked several one-character packages as security holders and said it was working on a rollback.