npm.io
1.0.9 • Published 3 months ago

@viveksinghind/narrative-form-core

Licence
MIT
Version
1.0.9
Deps
0
Size
207 kB
Vulns
0
Weekly
0

@viveksinghind/narrative-form-core

Core logic and state management for Narrative Form, a dynamic typewriter-style sign-up flow.

Installation

npm install @viveksinghind/narrative-form-core

Usage

This package is intended to be used as a dependency for the framework-specific packages (react, vue, angular, native). It provides the FormStateEngine class which manages form state, validation, and field advancement.

If you're building a custom integration for a new framework:

import { FormStateEngine } from "@viveksinghind/narrative-form-core";

const engine = new FormStateEngine(config);
engine.start();

// Subscribe to state changes
const unsubscribe = engine.subscribe((snapshot) => {
  console.log("Current state:", snapshot);
});

Features

  • Framework agnostic state management
  • Advanced validation engine (sync & async)
  • Typewriter timing engine
  • Field dependency graph

Keywords