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

structural-codes-viewer

v0.1.0-alpha.1

Published

Reference React UI and deterministic artifact client for the structural-codes corpus.

Readme

structural-codes-viewer

structural-codes-viewer è la reference UI React per consultare il corpus structural-codes. Il sottoprogetto contiene anche il consumer standalone locale usato per la revisione editoriale.

  • structural-codes contiene corpus, schema, provenance e relazioni canoniche;
  • structural-codes-viewer contiene UI React, client lazy degli artefatti e generatore deterministico;
  • il viewer standalone Vinext/Vite è un consumer locale della stessa UI e può aggiungere il PDF ufficiale tramite OfficialPdfPanel;
  • un futuro ocfem-website consumerà la stessa UI senza Vinext, Cloudflare o PDF.js.

Uso React

import { NormativeViewer } from "structural-codes-viewer";
import "structural-codes-viewer/styles.css";

export function Normativa() {
  return <NormativeViewer defaultMode="combined" dataBaseUrl="/data/codes" />;
}

La modalità predefinita è combined: la NTC resta la struttura principale e la Circolare viene inserita soltanto tramite relazioni esplicite del corpus. Le relazioni proposed restano tracciate nei dati senza aggiungere etichette testuali alla lettura. Il client verifica formatVersion, schema e manifest; non usa la uguaglianza delle versioni SemVer per interpretare i dati.

API intenzionale:

  • defaultMode: combined, ntc o circ;
  • dataBaseUrl: directory degli artefatti lazy, default /data/codes;
  • assetsBaseUrl: directory delle figure, default /assets;
  • auxiliaryPanel: pannello opzionale o render prop locale;
  • auxiliaryPanelDefaultVisible: visibilità iniziale del pannello opzionale.

La ricerca è sempre visibile ma carica search-index.json soltanto con almeno due caratteri. Manifest, indice documento, chunk e relazioni restano separati. Le figure sono lazy e il package shared non importa pdfjs-dist, non conosce /api/source-pdf e non dipende da Vinext o Cloudflare. React e ReactDOM sono peer dependencies React 19. Nell’indice della consultazione comparata ogni colonna segue la selezione corrente: capitolo → paragrafi → sottoparagrafi → dettagli. I capitoli entro la soglia di caricamento sono continui; quelli più grandi caricano il testo in continuità quando si seleziona il singolo paragrafo.

Artefatti

npm run sync:corpus mantiene il consumer locale aggiornato sotto public/data/codes/:

manifest.json
relations.json
relation-diagnostics.json
search-index.json
ntc2018/index.json
ntc2018/chunks/*.json
circ2019/index.json
circ2019/chunks/*.json

Il generatore condiviso legge soltanto i file pubblici del package structural-codes, è deterministico e non richiede un checkout sibling. La CLI inclusa nel package può materializzare gli stessi artefatti in un consumer:

npx structural-codes-viewer --source structural-codes \
  --output public/data/codes --assets public/assets

Il comando non copia il corpus completo nel package viewer: usa il package structural-codes installato dal consumer come sorgente.

Viewer standalone

npm run dev
npm run build
npm test

La route /consultazione usa NormativeViewer e compone il pannello PDF locale opzionale. PDF.js e il file PDF vengono caricati solo dopo l’azione esplicita “Apri PDF ufficiale”; il PDF non entra nel package shared.

Package

La prerelease non viene pubblicata da questo repository. Per una futura pubblicazione, dopo review:

npm run build:library
npm pack
npm publish --access public

Il tarball contiene soltanto package-dist/, CSS, README e metadati del package; non contiene app standalone, worker Cloudflare, test, cache, corpus completo o pdfjs-dist.