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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@jefko/conversation

v1.1.0

Published

Flow graph oriented form navigation, generated from a UML flowchart.

Downloads

3

Readme

Conversation

A module to progammatically and modularly navigate a conversation from a UML flowchart.

Definitions

Conversation : A collection of potential steps for an end user that's directed by the end user's actions and/or response.

Step : A single set of information and/or questions for an end user that may or may not be required for the conversation.

Installation

NPM

npm install @jefko/conversation

Yarn

yarn install @jefko/conversation

Getting Started

  1. Create a Mermaid flowchart

    flowchart LR
      start([Start]) --continue--> collection[Collect Info]
      collection --validate/submit--> END([End])
  • Only stadium nodes without incoming connections will be used as starting points.
  1. Ensure each step has a module property for handling the step step[|module:./step.mjs|]

  2. Create a conversation instance, handle the navigation events, trigger navigation, etc.

    import conversation from '@jefko/conversation';
    
    const convo = conversation({ src: '[path to mermaid UML file]' });
    
    // Add an event listener
    const listener = (action, step) => {
      if (action === 'done') {
        // The conversation is complete, do whatever is next.
        // step should be undefined
        return;
      }
    
      if (action === 'continue') {
        // We're continuing the conversation
        // The step may be the same as previous if the step's module returns false for isComplete().
      }
    
      if (action === 'back') {
        // We're navigating to the previous step
        if (step === undefined) {
          // There's no previous step
        }
      }
    };
    convo.subscribe(listener);
    
    // Check if the conversation is ready
    const readyToStart = await convo.isReady();
    
    // Continue to the next step
    const next = await convo.continue();
    
    // Continue to a specific step
    const specific = await convo.continue('[step ID]');
    
    // Navigate back to the previous step
    const previous = await convo.back();
    
    // Render the step
    const output = await convo.render();
    
    // Remove the listener
    convo.unsubscribe(listener);