Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

api-viewer-element

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api-viewer-element - npm Package Compare versions

Comparing version 0.2.5 to 0.2.6

6

CHANGELOG.md

@@ -19,2 +19,8 @@ # Change Log

## [0.2.6] - 2019-11-15
### Added
- Exposed `selected` property to toggle selected element name
## [0.2.5] - 2019-11-13

@@ -21,0 +27,0 @@

9

lib/api-viewer-select.js

@@ -21,8 +21,9 @@ import { __decorate } from "tslib";

render() {
const { options } = this;
const selected = options.find((_, index) => this.selected === index);
return html `
<select @change="${this._onChange}">
${this.options.map((option, index) => {
const selected = this.selected === index;
<select @change="${this._onChange}" .value="${selected}">
${options.map(option => {
return html `
<option ?selected="${selected}">${option}</option>
<option>${option}</option>
`;

@@ -29,0 +30,0 @@ })}

@@ -6,2 +6,3 @@ import { LitElement, TemplateResult } from 'lit-element';

section: string;
selected?: string;
private jsonFetched;

@@ -8,0 +9,0 @@ private lastSrc?;

@@ -14,4 +14,5 @@ import { __decorate } from "tslib";

// eslint-disable-next-line class-methods-use-this
async renderDocs(jsonFetched, section) {
async renderDocs(jsonFetched, section, selected) {
const elements = await jsonFetched;
const index = elements.findIndex(el => el.name === selected);
return elements.length

@@ -22,2 +23,3 @@ ? html `

.section="${section}"
.selected="${index >= 0 ? index : 0}"
></api-viewer-content>

@@ -68,3 +70,3 @@ `

return html `
${until(this.renderDocs(this.jsonFetched, this.section))}
${until(this.renderDocs(this.jsonFetched, this.section, this.selected))}
`;

@@ -82,2 +84,5 @@ }

], ApiViewer.prototype, "section", void 0);
__decorate([
property({ type: String })
], ApiViewer.prototype, "selected", void 0);
ApiViewer = __decorate([

@@ -84,0 +89,0 @@ customElement('api-viewer')

{
"name": "api-viewer-element",
"version": "0.2.5",
"version": "0.2.6",
"description": "Web Components API viewer element",

@@ -5,0 +5,0 @@ "author": "Serhii Kulykov <iamkulykov@gmail.com>",

@@ -92,2 +92,11 @@ # &lt;api-viewer&gt;

### Selected tag
By default, the first element found in JSON file is shown. Set the `selected` property to configure
it to a different tag name:
```html
<api-viewer src="./custom-elements.json" selected="my-element"></api-viewer>
```
### Knobs

@@ -94,0 +103,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc