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

pldf-interview-engine

v1.0.0

Published

Interview wizard engine for parsed interviews from pldf-parser

Downloads

3

Readme

PLDF Interview Engine

An interactive interview wizard engine that takes parsed interview data from pldf-parser and generates dynamic, user-friendly interview wizards.

Features

  • Dynamic Question Rendering: Automatically renders questions with various field types
  • State Management: Tracks user progress with auto-save to localStorage
  • Template Processing: Supports variable substitution using ${variable} syntax via pldf-template
  • Code Execution: Safely executes code blocks to compute derived values
  • Dependency Resolution: Automatically orders questions based on variable dependencies
  • Browser & Node.js: Works in both browser and Node.js environments (UMD modules)
  • Customizable Styling: Includes default CSS with easy customization options
  • Event System: Subscribe to interview events for custom integrations

Installation

npm install pldf-interview-engine

Quick Start

Browser Usage

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="node_modules/pldf-interview-engine/css/styles.css">
</head>
<body>
    <div id="interview"></div>

    <script src="node_modules/pldf-interview-engine/js/state-manager.js"></script>
    <script src="node_modules/pldf-interview-engine/js/field-renderer.js"></script>
    <script src="node_modules/pldf-interview-engine/js/code-executor.js"></script>
    <script src="node_modules/pldf-interview-engine/js/interview-wizard.js"></script>

    <script>
        // Your parsed interview data from pldf-parser
        const interview = { /* ... */ };

        const wizard = new InterviewWizard(interview, {
            container: '#interview',
            onComplete: (answers) => {
                console.log('Interview completed:', answers);
            }
        });

        wizard.initialize().then(() => wizard.start());
    </script>
</body>
</html>

Node.js Usage

const InterviewWizard = require('pldf-interview-engine');

const interview = { /* parsed interview data */ };

const wizard = new InterviewWizard(interview, {
    onComplete: (answers) => {
        console.log('Interview completed:', answers);
    }
});

wizard.start();

With pldf-parser Integration

const { DocassembleParser } = require('pldf-parser');
const InterviewWizard = require('pldf-interview-engine');

// Parse a YAML file
const interview = DocassembleParser.parseFile('interview.yml');

// Create and start the wizard
const wizard = new InterviewWizard(interview, {
    container: '#interview',
    autoSave: true,
    onComplete: (answers) => {
        console.log('Answers:', answers);
    }
});

wizard.initialize().then(() => wizard.start());

Configuration Options

new InterviewWizard(interview, {
    container: '#interview',
    autoSave: true,
    saveKey: 'pldf_interview_state',
    onComplete: (answers) => { /* ... */ },
    onBlockChange: (block, index) => { /* ... */ },
    cssPrefix: 'pldf'
});

Supported Field Types

  • text: Single-line text input
  • email: Email address input
  • number: Numeric input
  • currency: Number input with decimal precision
  • date: Date picker
  • yesno: Yes/No radio buttons
  • radio: Single selection from multiple options
  • checkboxes: Multiple selection from options
  • dropdown: Dropdown select menu
  • textarea: Multi-line text input

Interview Structure

The engine expects interview objects with this structure:

{
    filePath: 'interview.yml',
    blocks: [
        {
            blockType: 'question',
            question: 'What is your name?',
            subquestion: 'Optional additional text',
            fields: [ /* field objects */ ],
            buttons: [ /* button objects */ ],
            mandatory: false,
            variables: ['var1', 'var2']
        }
    ],
    getQuestionOrder: function(definedVars) {
        return /* ordered array of blocks */;
    }
}

This structure is automatically created by pldf-parser.

API Reference

InterviewWizard

Methods

  • initialize(): Initializes the wizard (returns Promise)
  • start(): Starts the interview
  • next(): Advances to the next question
  • previous(): Goes back to previous question
  • complete(): Marks interview as complete
  • restart(): Resets and restarts
  • getAnswers(): Returns all collected answers
  • getState(): Returns current state
  • loadState(state): Loads a saved state

Examples

See the examples/ directory for complete examples:

  • basic-usage.js: Simple Node.js example
  • with-parser.js: Integration with pldf-parser
  • demo.html: Interactive browser demo

Development

Running Tests

npm test

Running the Demo

npm start
# Then open http://localhost:3000/examples/demo.html

Integration with PLDF Ecosystem

This package is part of the PLDF ecosystem:

  • pldf-parser: Parses interview YAML files → Interview objects
  • pldf-interview-engine (this package): Interview objects → Interactive wizards
  • pldf-template: Generates documents from answers and templates

License

MIT

Links

  • GitHub: https://github.com/step21/pldf-interview-engine
  • Issues: https://github.com/step21/pldf-interview-engine/issues
  • npm: https://www.npmjs.com/package/pldf-interview-engine