api-viewer-element
Advanced tools
Comparing version 0.2.4 to 0.2.5
@@ -19,2 +19,8 @@ # Change Log | ||
## [0.2.5] - 2019-11-13 | ||
### Added | ||
- Exposed `section` property to toggle between docs and demo | ||
## [0.2.4] - 2019-11-11 | ||
@@ -21,0 +27,0 @@ |
@@ -5,2 +5,3 @@ import { LitElement, TemplateResult } from 'lit-element'; | ||
src?: string; | ||
section: string; | ||
private jsonFetched; | ||
@@ -7,0 +8,0 @@ private lastSrc?; |
@@ -10,10 +10,14 @@ import { __decorate } from "tslib"; | ||
super(...arguments); | ||
this.section = 'docs'; | ||
this.jsonFetched = Promise.resolve([]); | ||
} | ||
// eslint-disable-next-line class-methods-use-this | ||
async renderDocs(jsonFetched) { | ||
async renderDocs(jsonFetched, section) { | ||
const elements = await jsonFetched; | ||
return elements.length | ||
? html ` | ||
<api-viewer-content .elements="${elements}"></api-viewer-content> | ||
<api-viewer-content | ||
.elements="${elements}" | ||
.section="${section}" | ||
></api-viewer-content> | ||
` | ||
@@ -63,3 +67,3 @@ : html ` | ||
return html ` | ||
${until(this.renderDocs(this.jsonFetched))} | ||
${until(this.renderDocs(this.jsonFetched, this.section))} | ||
`; | ||
@@ -74,2 +78,5 @@ } | ||
], ApiViewer.prototype, "src", void 0); | ||
__decorate([ | ||
property({ type: String }) | ||
], ApiViewer.prototype, "section", void 0); | ||
ApiViewer = __decorate([ | ||
@@ -76,0 +83,0 @@ customElement('api-viewer') |
{ | ||
"name": "api-viewer-element", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "Web Components API viewer element", | ||
@@ -5,0 +5,0 @@ "author": "Serhii Kulykov <iamkulykov@gmail.com>", |
@@ -83,2 +83,11 @@ # <api-viewer> | ||
### Section | ||
By default, the API documentation is shown. If you want to show the playground instead, set the | ||
`section` property to `demo`: | ||
```html | ||
<api-viewer src="./custom-elements.json" section="demo"></api-viewer> | ||
``` | ||
### Knobs | ||
@@ -85,0 +94,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
206318
2487
200