# interpro-components

> InterPro components using standard Web Components

Latest version **0.8.2** (published 2022-04-25) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install interpro-components
pnpm add interpro-components
yarn add interpro-components
bun add interpro-components
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.8.2 |
| Published | 2022-04-25 |
| First published | 2016-10-25 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 364.2 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Aurélien Luciani |
| Maintainers | 4ndr01d3, aurel-l |
| Keywords | webcomponents, customelements, shadowdom, interpro, ebi |

## Links

- npm: https://www.npmjs.com/package/interpro-components
- Repository: https://github.com/ProteinsWebTeam/interpro-components
- Homepage: https://github.com/ProteinsWebTeam/interpro-components#readme
- Issues: https://github.com/ProteinsWebTeam/interpro-components/issues
- npm.io page: https://npm.io/package/interpro-components

## Dependencies (3)

- [core-js](https://npm.io/package/core-js.md) ^3.1.3
- [lit-html](https://npm.io/package/lit-html.md) 1.3.0
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) 7.12.5

## Alternatives

- [promise-throttle](https://npm.io/package/promise-throttle.md) — 44.2K weekly downloads
- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads

## Recent versions

- 0.8.2 (latest) — 2022-04-25
- 0.8.1 — 2019-06-06
- 0.8.0 — 2018-09-28
- 0.7.0 — 2018-09-28
- 0.6.2 — 2018-09-17
- 0.6.1 — 2018-04-12
- 0.6.0 — 2018-04-02
- 0.5.0 — 2018-03-26
- 0.4.1 — 2018-02-22
- 0.4.0 — 2018-02-22
- 0.3.4 — 2017-10-11
- 0.3.3 — 2017-08-24
- 0.3.2 — 2017-07-31
- 0.3.1 — 2017-07-31
- 0.3.0 — 2017-07-31
- … 11 more at https://npm.io/package/interpro-components/versions

## README

InterPro web components
=======================

:warning:️ _in development_

A standard web component (v1) implementation of InterPro components.

You can see a very basic demo [HERE](https://proteinswebteam.github.io/interpro-components/index.html).

For more advanced components used in the interpro website, you can see the nightingale project: [ [Repo](https://github.com/ebi-webcomponents/nightingale) | [Website](https://ebi-webcomponents.github.io/nightingale) ]

## Usage

### Examples
```html
<interpro-type>
  <interpro-data-loader accession="IPR011528">
</interpro-type>
```

```html
<interpro-type expanded>
 <interpro-data-loader accession="IPR011528">
</interpro-type>
```

### Use with custom namespace

Only needed if `interpro-type` or `interpro-data-loader` names clash with an
other existing Custom Element.

```js
import { InterproDataLoader, InterproType } from 'interpro-components';

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

// Register the Custom Elements
customElements.define('namespaced-interpro-data-loader', InterproDataLoader);
customElements.define('namespaced-interpro-type', InterproType);
```

And then in the HTML, use like so:

```html
<namespaced-interpro-type>
  <namespaced-interpro-data-loader accession="IPR011528">
</namespaced-interpro-type>
```

## 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](https://github.com/webcomponents/webcomponentsjs).

## List of components included

### `interpro-data-loader`

_using development endpoint, see note at the top_

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

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

### `interpro-type`

Visible element. Only displays data.

Generates the visual representation of the data passed to the `type`
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)

### `interpro-entry`

Visible element. Only displays data.

Generates a one line visual representation of an entry (_type_ _name_ (_accession_)).

It supports nested entries, displaying them as a subtree. 

## API

### `interpro-data-loader`

#### Properties

|name|default value|accepted values|information|DOM attribute|writable|
|----|-------------|---------------|-----------|-------------|--------|
|`accession`|`null`|valid entry ID|string corresponding to an existing entry ID|yes|yes|

#### Events

none, but the `data-loader` component generated as its child will
dispatch bubbling events
(see [data-loader](https://github.com/ebi-webcomponents/data-loader))

#### CSS custom properties

none

### `interpro-type`

#### Properties

|name|default value|accepted values|information|DOM attribute|writable|
|----|-------------|---------------|-----------|-------------|--------|
|`type`|`'undefined'`|any of 'family', 'domain', 'repeat', 'site', 'active site', 'binding site', 'conserved site', 'ptm', or 'undefined'|corresponds to an entry type|yes|yes|
|`dimension`|computed lineHeight|string|any size valid in CSS|yes|yes|
|`expanded`|`false`|boolean|expanded view of the component|yes|yes|

#### Events

none

#### CSS custom properties

none

### `interpro-entry`

#### Properties

|name|default value|accepted values|information|DOM attribute|writable|
|----|-------------|---------------|-----------|-------------|--------|
|`accession`|`null`|valid entry ID|string corresponding to an existing entry ID|yes|yes|
|`name`|`''`|valid entry ID|string corresponding to an existing entry ID|yes|yes|
|`href`|`''`|valid URL|string corresponding the URL of the entry|yes|yes|
|`type`|`'undefined'`|any of 'family', 'domain', 'repeat', 'site', 'active site', 'binding site', 'conserved site', 'ptm', or 'undefined'|corresponds to an entry type|yes|yes|
|`selected`|`false`|boolean|To show that is the current entry, and avoid links into the same page.|yes|yes|

#### Events

none

#### CSS custom properties

none

## Development and testing

1. Get the code via git clone:

   ```$ git clone https://github.com/ProteinsWebTeam/interpro-components.git```
   
2. Install dependencies via npm:

   ```interpro-components$ npm install```
   
3. Start the app. This includes re-bundling, and starts live-reload, so it
refresh the page when the JavaScript code changes.

   ```interpro-components$ npm run start```

4. Check the test page in your server. e.g. http://localhost:8080/ (or whatever
address is displayed when running step 3)

---
_Source: https://npm.io/package/interpro-components · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
