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

pdb-web-components

v0.2.0

Published

pdb web-components

Downloads

13

Readme

PDB web components

in development

A standard web component (v1) implementation of the PDB components (PDB Component Library)

Usage

Examples

<pdb-prints>
  <pdb-data-loader pdbid="1cbs">
</pdb-prints>
<pdb-prints size="64" orientation="vertical" style="--theme-color: transparent;">
 <pdb-data-loader pdbid="2cbs">
</pdb-prints>

Use with custom namespace

Only needed if pdb-prints or pdb-data-loader names clash with an other existing Custom Element.

import {PdbDataLoader, PdbPrints} from 'pdb-web-components';

// If `data-loader` elements also namespaced, need to pass
// new name to PdbDataLoader to use it correctly
PdbDataLoader.dataLoaderElementName = 'namespaced-data-loader';

// Register the Custom Elements
customElements.define('namespaced-pdb-data-loader', PdbDataLoader);
customElements.define('namespaced-pdb-prints', PdbPrints);

And then in the HTML, use like so:

<namespaced-pdb-prints>
  <namespaced-pdb-data-loader pdbid="1cbs">
</namespaced-pdb-prints>

Compatibility

This element assumes support for at least ES2015. To support older browsers you might need to transpile the code you use down to the version you are planning on supporting.

You might need to use a polyfill for browsers not supporting Custom Elements v1 (not v0). See webcomponents.js or SkateJS Web Components.

Check in the test folder for example of simple usage with optional loading of the polyfill.

List of components included

They work independently from one another, so you can pick and choose which ones to load and use in your page.

pdb-data-loader

Not a visible element. Use to retrieve data from the PDB API.

Generates a data-loader element with the correct source element to get data from the PDB API for the PDB entry specified.

pdb-prints

Visible element. Only displays data.

Generates the visual representation of the data passed to the data property or coming from a load event bubbling from lower in the DOM tree.

Visual representation can be modified from the public API of the component (see after)

API

pdb-data-loader

Properties

|name|default value|accepted values|information|DOM attribute|writable| |----|-------------|---------------|-----------|-------------|--------| |pdbid|null|valid PDB ID|4 character string corresponding to an existing PDB ID|yes|yes|

Events

none, but the data-loader component generated as its child will dispatch bubbling events (see data-loader)

CSS custom properties

none

pdb-prints

Properties

|name|default value|accepted values|information|DOM attribute|writable| |----|-------------|---------------|-----------|-------------|--------| |data|null|object|object used to access information about the PDB entry|no|yes| |orientation|'horizontal'|any of horizontal or vertical|orientation of the logos|yes|yes| |size|36|any of 36, 48, 64, or 128|size of the logos|yes|yes| |include|['PrimaryCitation', 'Taxonomy', 'Expressed', 'Experimental', 'Protein', 'NucleicAcid', 'Ligands']|any one or multiple value part of the default set of values|list of rendered logos|yes|yes| |exclude|[]|same than for `include' property used to access information about the PDB entry|list of non-rendered logos|yes|yes|

Note: the list of logos rendered is the include set minus the exclude set.

Events

none

CSS custom properties

|name|default value|accepted values|information| |----|-------------|---------------|-----------| |--theme-color|#81C16E|any valid CSS value for color|color applied to the background of the logos|