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

vue-survey-engine-headless

v4.13.0

Published

A headless Vue survey engine: the survey as a typed document on the headless block editor — its question kinds, the checks on a save, a runner of plain functions and the Vue composable over them, with no styling or DOM.

Readme

vue-survey-engine-headless

Apache-2.0 licensed NPM version NPM downloads NPM Unpacked Size (with version)

This package is a headless Vue survey engine. It defines a survey as a typed document on the headless block editor: one node type per question kind, the checks a save passes, and a runner of plain functions over the document and a record of answers. Its useSurveyRunner composable holds one respondent's session in refs for a Vue component. It has no styling or DOM.

Design notes live in the specs.

Table of Contents


🚀 Getting Started

pnpm i vue-survey-engine-headless zod
import {
  completeSurvey,
  createSurveyRunnerState,
  setSurveyAnswer,
  SurveyNodeType,
  surveyDocumentSchema,
} from "vue-survey-engine-headless";

const document = surveyDocumentSchema.parse({
  content: [
    {
      props: {
        children: [{ props: { id: v7(), isRequired: true, name: "email" }, type: SurveyNodeType.Text }],
        id: v7(),
      },
      type: SurveyNodeType.Page,
    },
  ],
  root: { props: {} },
});
const answered = setSurveyAnswer(createSurveyRunnerState(document, {}, 0), "email", "[email protected]");
const completion = completeSurvey(document, answered, new Date());
// completion.state.isCompleted is true, and completion.answers holds the email
  • zod is the peer the question schemas are written in. Install it beside the package.
  • vue is the peer useSurveyRunner is written against. Install it beside the package when a component uses that composable.
  • surveyDocumentSchema is the save check. Parse a document with it before a respondent runs the survey.

🧩 Key Exports

| Export | Kind | Purpose | | :------------------------- | :--------- | :----------------------------------------------------------------------------------------------------------------------- | | createSurveyDocument | function | The empty survey: one page with the root's defaults, where a new survey and a cleared one both start | | SurveyDocument | type | A survey's pages, the nodes its root accepts, and the root props it declares | | surveyDocumentSchema | schema | Parses a whole document, refusing a duplicate id, a node a slot does not allow, props its type refuses or too many nodes | | SurveyNode | type | Any node a survey holds, narrowed by its type tag | | surveyNodeSchema | schema | Parses any one node, checked by its type tag and then by its own kind's schema | | SurveyNodeType | enum | Each node type a survey holds, named by the type tag its node carries in the document | | checkSurveyDocument | function | The save check of a parsed survey, returning every refusal in document order rather than the first | | SurveyAnswers | type | A respondent's answers, keyed by the name of the question each answers | | SurveyAnswerValue | type | What one answer holds: text, a number, a boolean, a list of answers, or a record from a name to an answer | | validateSurveyAnswers | function | The issues a response's answers hold against the document, checked as a draft or as a submit | | completeSurvey | function | Completes the survey once every visible page is valid, else returns the first page's errors and moves to that page | | createSurveyRunnerState | function | A session's starting state, its page index clamped into the document's pages | | getSurveyPageElements | function | The views of the elements on the current page, as the respondent sees them | | getSurveyPanelRowViews | function | The template questions one dynamic panel row shows, each with whether the row enables and requires it | | getSurveyRunnerValues | function | The answers and calculated values as the expressions read them | | goToNextSurveyPage | function | Moves to the next page with an element on it, or holds the respondent on the current page with its errors | | goToPreviousSurveyPage | function | Moves back to the previous page with an element on it, without validating | | setSurveyAnswer | function | Sets one answer, where an empty value removes it, so the record holds only answers somebody gave | | SurveyRunnerState | type | Where a session stands: its answers, its page index among the document's pages, and whether it is complete | | useSurveyRunner | composable | A respondent's session over a survey document: its state and errors in refs, the page's elements, and the moves | | MATRIX_CELL_RATING_COUNT | constant | The steps every rating cell of a matrix takes, since a column sets no scale of its own for its cells | | MAX_SURVEY_IMAGE_SIZE | constant | The largest width or height, in pixels, a picture may be drawn at, so it cannot outgrow the screen it is read on |

⚖️ License

Licensed under Apache-2.0.