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

pict-section-accordion

v1.0.0

Published

Pict-native multi-step container — renders the same step set as an accordion, a back/next wizard, or a numbered stepper, over one shared serializable step state with per-step CanAdvance gating.

Readme

pict-section-accordion

A pict-native multi-step container that renders the same step set as a collapsible accordion, a back/next wizard, or a numbered stepper — over one shared, serializable nav state with per-step CanAdvance gating.

The control owns the chrome + navigation only. The host renders each step's body into the step's always-present body container, so switching steps is pure visibility toggling — it never wipes the content a host rendered.

Install

npm install pict-section-accordion

Depends only on pict-provider + pict-view.

Usage

const libPictSectionAccordion = require('pict-section-accordion');
pict.addProvider('Pict-Section-Accordion', libPictSectionAccordion.default_configuration, libPictSectionAccordion);
const tmpAccordion = pict.providers['Pict-Section-Accordion'];

tmpAccordion.createAccordion('Setup',
{
    DestinationAddress: '#Setup',
    RenderMode: 'wizard',                 // 'accordion' | 'wizard' | 'stepper'
    Steps:
    [
        { Hash: 'account', Title: 'Account', Subtitle: 'Your details',
          CanAdvance: () => pict.views['AccountForm'].validate() },   // gate Next
        { Hash: 'plan',    Title: 'Plan' },
        { Hash: 'review',  Title: 'Review' },
    ],
    OnStepChange: (pTo, pFrom) => { /* render the body for pTo into its container */ },
    OnComplete:   () => { /* last step's Next was accepted */ },
});
pict.views['Setup'].render();
// Host renders each step's body into #PSA_Body_Setup_<stepHash> (or the step's DestinationAddress).

The host renders bodies

Each step has a body container at #PSA_Body_<accordionHash>_<stepHash> (overridable via the step's DestinationAddress). Render your body views/content there — once. The accordion shows/hides them as the active (wizard/stepper) or open (accordion) step changes; it never re-creates them. Use OnStepChange(to, from) to lazily render a body the first time its step is shown.

Gating

A step's CanAdvance(ctx) runs when next() is called. Return true to allow, false to block, or { allow:false, message:'…' } to block with a specific error shown on the step. Async is supported (return a Promise). LinearGating (default on, wizard/stepper) stops rail-jumps past the furthest-reached step.

API (view methods)

| Method | Purpose | |---|---| | goToStep(hash) → Promise | Navigate to / open a step (honors Enabled + gating). | | next() → Promise | Run the gate, mark complete, advance (or fire OnComplete on the last step). | | back() → Promise | Go to the previous enabled step. | | toggleStep(hash) | Accordion: open/close a panel. Wizard/stepper: navigate. | | setStepComplete/Enabled/Error(hash, …) | Mutate a step's flags (targeted chrome repaint — bodies untouched). | | getActiveStep() / getOpenSteps() | Inspect current state. | | getState() | The serializable nav state (function-free; persist + re-seed to resume). |

Theming

All chrome CSS uses var(--theme-color-*, fallback) tokens (registered at priority 500), so panels, the stepper rail, the wizard footer, and state icons follow the host theme.

Demo

example_applications/accordion_demo — the same step set in all three modes, a gated wizard step, and external setStep* / goToStep controls driving the stepper. Build with npm run build, serve dist/.

Test

npm test     # mocha TDD