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

@openfaster-standard/shapes

v0.2.1

Published

OpenFASTER's shape-rendering engine -- React components that render SHACL shapes as UI, built on @openfaster-standard/ui.

Readme

@openfaster-standard/shapes

Part of OpenFASTER. Renders SHACL shapes -- sh:PropertyShape/sh:NodeShape citation data produced by OpenFASTER's generator -- as React UI, on top of @openfaster-standard/ui. Kept as a separate package specifically so consumers of the base component kit don't need n3 as a dependency.

Install

npm install @openfaster-standard/shapes @openfaster-standard/ui

Requires React 19 or later (react/react-dom are peer dependencies -- this package never bundles its own copy, so it always runs against your app's real React instance).

Use

import { parseShapeGraph, ShapeField } from "@openfaster-standard/shapes"

const graph = parseShapeGraph(shapeTurtle)

// Required, never defaulted (mirrors generator's own TargetStore(path)
// convention): a citation's oa:hasSource is a file:// URI from wherever
// the corpus was checked out when the citation was made -- this package
// has no business guessing which real, fetchable URL that corresponds to
// for your workspace. Below is a real example for the public
// OpenFASTER-Standard/ontologies corpus, not a default.
function resolveSourceUri(fileUri: string): string {
  return fileUri.replace(
    "file:///work/ontologies/",
    "https://raw.githubusercontent.com/OpenFASTER-Standard/ontologies/main/",
  )
}

function Example() {
  return (
    <ShapeField
      propertyShapeIri="https://openfaster.org/ns/generator#S/Sh/AOrdNr"
      graph={graph}
      resolveSourceUri={resolveSourceUri}
    />
  )
}

parseShapeGraph parses a Turtle document into a queryable N3.js Store wrapper; ShapeField/ ShapeForm/ShapeTable render one or more sh:PropertyShapes from it as labeled fields, resolving and displaying each citation's real cited value (by re-fetching and re-evaluating its selector against its live source, client-side) rather than the raw provenance metadata, using @openfaster-standard/ui's own Form/Table primitives for correct label association and layout. resolveSourceUri can safely be a fresh inline function on every render -- only its behavior, not its identity, affects when a field re-resolves.

Re-citing a value

ReCitationPicker lets a maker/checker point a sh:PropertyShape's citation at a different span of its already-cited source document -- re-pointing the citation, never editing a decoded value (this package never stores one; see generator's own annotation_model for why).

import { ReCitationPicker } from "@openfaster-standard/shapes"

function Example() {
  return (
    <ReCitationPicker
      graph={graph}
      propertyShapeIri="https://openfaster.org/ns/generator#S/Sh/AOrdNr"
      resolveSourceUri={resolveSourceUri}
      onPendingEdit={({ propertyShapeIri, newXPath, previewValue }) => {
        // Submit the new citation (propertyShapeIri + newXPath) to your
        // own maker/checker workflow; previewValue is the real resolved
        // text at newXPath, already confirmed resolvable, for display.
      }}
    />
  )
}

It renders the current citation's own source document as a clickable element tree (SourceDocumentTree), computes an XPath for whichever element is clicked (computeXPathForElement), and only enables "Use this citation" once that XPath resolves to exactly one real element -- onPendingEdit never fires for an ambiguous, not-found, or otherwise uncitable selection.

License

MIT, see LICENSE.