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

@hydrofoil/shaperone-wc

v0.8.1

Published

Web Component rendering SHACL forms

Downloads

430

Readme

shaperone-form

A custom element which renders a form element using graph description in SHACL format. The underlying value is a graph represented using the RDF/JS data model specification

Usage

This example shows the element used with the default lit renderer

import '@hypermedia-app/shaperone-form/shaperone-form.js'
import Environment from '@zazuko/env/Environment.js'
import { configure } from '@hydrofoil/shaperone-wc/configure.js'
import { html } from '@hypermedia-app/shaperone-form'
import alcaeus from 'alcaeus/Factory.js'
import parent from '@zazuko/env/web.js'

const env = new Environment([alcaeus()], { parent })
configure(env)

const shapes = await env.hydra.loadResource('http://example.com/api/shape')
const resource = rdf.clownface().blankNode()

const formTemplate = html`<shaperone-form .shapes=${shapes} .resource=${resource}></shaperone-form>`

The above snippet assumes that shapes get loaded from a remote resource and the form value is initialized with a blank node without any properties.

Such setup will render a very basic and unstyled form using native browser input elements and no specific layout. Check the main documentation page for instructions on customizing the form's rendering.

Mixins: connect

Properties

| Property | Attribute | Modifiers | Type | Default | Description | |---------------------|----------------------|-----------|--------------------------------------------------|-------------------|--------------------------------------------------| | components | components | readonly | ComponentsState | | Gets the state of the editor components | | editors | editors | readonly | EditorsState | | Gets the state of the DASH editors model | | env | | readonly | Environment<any> | | Gets the RDF/JS environment | | isValid | | readonly | boolean | | Gets a value indicating if there are any sh:Violation violation results | | noEditorSwitches | no-editor-switches | | boolean | false | Disables the ability to change object editors. Only the one with highest score will be rendered | | renderer | | | Renderer<UncompiledTemplateResult<ResultType>> | "DefaultRenderer" | Gets or sets the renderer implementation | | rendererOptions | rendererOptions | readonly | RendererState | | Gets the state of the renderer | | resource | | | GraphPointer<BlankNode \| NamedNode<string>, DatasetCore<Quad, Quad>> \| undefined | | Gets or sets the resource graph as graph pointer | | shapes | | | DatasetCore<Quad, Quad> \| AnyPointer<AnyContext, DatasetCore<Quad, Quad>> \| undefined | | Gets or sets the shapes graph | | state | state | | FormState | | Gets the internal state of the form element | | validationReport | | readonly | GraphPointer<Term, DatasetCore<Quad, Quad>> \| undefined | | Gets a graph pointer to the latest SHACL Validation Report | | validationResults | | readonly | ValidationResultState[] | | Get all validation results found in the {@see validationReport} graph | | value | | readonly | RdfResource<DatasetCore<Quad, Quad>> \| null | | Gets the resource as a rdfine object |

Methods

| Method | Type | Description | |-------------|----------------------------------|--------------------------------------------------| | mapEvents | ((): DispatchMap) \| undefined | | | validate | (): void | Triggers validation of the current resource against the shapes graph |

Events

| Event | Type | |-----------|--------------------| | changed | CustomEvent<any> |