Elements for rendering Polymer component documentation.
npm install @polymer/iron-doc-viewer


A collection of elements that display documentation about custom elements,
mixins, classes, and more using the JSON descriptor format produced by Polymer
Analyzer.
See:
Documentation,
Demo.
You may also be interested in,
which composes the iron-doc elements into a more complete documentation
browser.
* Show a table-of-contents.
* Manage routing and delegate to a child doc element.
* Show docs about a custom element.
* Show docs about a Polymer behavior.
* Show docs about a JavaScript namespace.
* Show docs about a JavaScript class.
* Show docs about a JavaScript mixin.
npm install --save @polymer/iron-doc-viewer
`$3
`html
auto
url="./analysis.json"
last-response="{{descriptor}}">
descriptor="[[descriptor]]"
root-namespace="MyNamespace">
`$3
`js
import {PolymerElement, html} from '@polymer/polymer';
import '@polymer/iron-doc-viewer/iron-doc-viewer.js';class SampleElement extends PolymerElement {
static get template() {
return html
;
}, static get properties() {
return {
descriptor: {
type: Object,
value: {
// Analyzer descriptor goes here.
}
}
};
}
}
customElements.define('sample-element', SampleElement);
`$3
handles URL routing to provide permanent addresses for all
locations in the documentation tree, including scroll anchor targets.By default it uses the URL fragment for routing (e.g.
docs.html#/elements/my-element#property-foo), in order to support simple
static file hosts.To use the real URL path for routing, set the
base-href property to the
server mount point, omitting the trailing slash (e.g. /api/docs or *empty
string* for the root path). Note that this requires a host that serves the
application from all paths that should be handled by the doc viewer.$3
The iron-doc elements come with an optional material-design default theme that
must be explicitly included as custom style:
`html
`The following custom properties and mixins are available for styling:
Custom property | Description | Default
----------------|-------------|----------
--iron-doc-accent-color | Color for emphasis (e.g. hyperlink hover). | #1565c0
--iron-doc-font-body | Mixin applied to non-code text. | {}
--iron-doc-font-code | Mixin applied to code snippets. | {}
--iron-doc-title | Mixin applied to page titles. | {}
--iron-doc-heading | Mixin applied to section headings. | {}Contributing
If you want to send a PR to this element, here are
the instructions for running the tests and demo locally:$3
`sh
git clone https://github.com/PolymerElements/iron-doc-viewer
cd iron-doc-viewer
npm install
npm install -g polymer-cli
`$3
`sh
polymer serve --npm
open http://127.0.0.1:/demo/
`$3
`sh
polymer test --npm
``