iron-demo-helpers
Utility classes to make building demo pages easier
<demo-snippet>
demo-snippet
is a helper element that displays the source of a code snippet and
its rendered demo. It can be used for both native elements and
Polymer elements.
See: Documentation, Demo.
Usage
Installation
npm install --save @polymer/iron-demo-helpers
In an html file
<html>
<head>
<script type="module">
import '@polymer/iron-demo-helpers/demo-snippet.js';
import '@polymer/paper-checkbox/paper-checkbox.js';
</script>
</head>
<body>
<demo-snippet>
<template>
<input type="date">
<paper-checkbox>Checkbox</paper-checkbox>
</template>
</demo-snippet>
</body>
</html>
In a Polymer 3 element
import {PolymerElement, html} from '@polymer/polymer';
import '@polymer/iron-demo-helpers/demo-snippet.js';
import '@polymer/paper-checkbox/paper-checkbox.js';
class SampleElement extends PolymerElement {
static get template() {
return html`
<demo-snippet>
<template>
<input type="date">
<paper-checkbox>Checkbox</paper-checkbox>
</template>
</demo-snippet>
`;
}
}
customElements.define('sample-element', SampleElement);
<url-bar>
url-bar
is a helper element that displays a simple read-only URL bar if
and only if the page is in an iframe. In this way we can demo elements that
deal with the URL in our iframe-based demo environments.
If the page is not in an iframe, the url-bar element is not displayed.
Contributing
If you want to send a PR to this element, here are the instructions for running the tests and demo locally:
Installation
git clone https://github.com/PolymerElements/iron-demo-helpers
cd iron-demo-helpers
npm install
npm install -g polymer-cli
Running the demo locally
polymer serve --npm
open http://127.0.0.1:<port>/demo/
Running the tests
polymer test --npm
Known Issues
If you add a script type="module"
inside a demo-snippet
, the demo will
not be functional on non-module browsers (like IE11). If you need to
use a script type="module"
and want to display its code in the demo-snippet
,
a possible workaround is to duplicate the contents of the script outside of the
demo-snippet
-- that way polymer serve
(or whatever solution you're using to
ES5-ify the code) will convert the main document module
to UMD, but will leave the
displayed code untouched. Here is an example:
<body>
<demo-snippet>
<template>
...
<script type="module">
import {SomeExport} from '../foo.js';
SomeExport.aFunction();
</script>
</template>
</demo-snippet>
<!-- Hack: on non-module browsers the demo-snippet script doesn't
do anything, so add the content here again to make sure the demo works -->
<script type="module">
import {SomeExport} from '../foo.js';
SomeExport.aFunction();
</script>
</body>
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
Dependencies
- polymer#Polymer/polymer#1.9 - 2
- font-roboto#PolymerElements/font-roboto#^1
- iron-flex-layout#polymerelements/iron-flex-layout#1 - 2
- iron-location#PolymerElements/iron-location#1 - 2
- marked-element#polymerelements/marked-element#1 - 2
- prism-element#PolymerElements/prism-element#1 - 2
- Released
- 2017-05-15
- Maturity
- IMPORTED
- License
- Other
Compatibility
- Framework
- Polymer 2.0+
- Polymer 1.0+ in 1.0.0
- Polymer 3.0+ in 0.0.1
- Browser
- Browser Independent
iron-demo-helpers - Vaadin Add-on Directory
Utility classes to make building demo pages easierView on GitHub
Issue tracker
Online Demo
License
View on NPM
iron-demo-helpers version 1.0.0
### Dependencies
* polymer#Polymer/polymer#^1.1.0
* paper-styles#PolymerElements/paper-styles#^1.0.0
iron-demo-helpers version 1.0.1
### Dependencies
* polymer#Polymer/polymer#^1.1.0
* paper-styles#PolymerElements/paper-styles#^1.0.0
iron-demo-helpers version 1.0.2
### Dependencies
* polymer#Polymer/polymer#^1.1.0
* paper-styles#PolymerElements/paper-styles#^1.0.0
iron-demo-helpers version 1.0.3
### Dependencies
* polymer#Polymer/polymer#^1.1.0
* paper-styles#PolymerElements/paper-styles#^1.0.0
* marked-element#polymerelements/marked-element#^1.0.0
* prism-element#PolymerElements/prism-element#^1.0.0
iron-demo-helpers version 0.0.1
### Dependencies
* @polymer/polymer#^1.2.5-npm-test.2
* @polymer/paper-styles#^0.0.1
* @polymer/marked-element#^0.0.1
* @polymer/prism-element#^0.0.1
iron-demo-helpers version 0.0.3
### Dependencies
* @polymer/polymer#^1.2.5-npm-test.2
* @polymer/paper-styles#^0.0.3
* @polymer/marked-element#^0.0.3
* @polymer/prism-element#^0.0.3
iron-demo-helpers version 1.1.0
### Dependencies
* polymer#Polymer/polymer#^1.1.0
* iron-icons#PolymerElements/iron-icons#^1.0.0
* paper-icon-button#PolymerElements/paper-icon-button#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.0.0
* marked-element#polymerelements/marked-element#^1.0.0
* prism-element#PolymerElements/prism-element#^1.0.0
iron-demo-helpers version 1.1.1
### Dependencies
* polymer#Polymer/polymer#^1.1.0
* iron-icons#PolymerElements/iron-icons#^1.0.0
* paper-icon-button#PolymerElements/paper-icon-button#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.0.0
* marked-element#polymerelements/marked-element#^1.0.0
* prism-element#PolymerElements/prism-element#^1.0.0
iron-demo-helpers version 1.2.0
### Dependencies
* polymer#Polymer/polymer#^1.1.0
* iron-icons#PolymerElements/iron-icons#^1.0.0
* paper-icon-button#PolymerElements/paper-icon-button#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.0.0
* marked-element#polymerelements/marked-element#^1.0.0
* prism-element#PolymerElements/prism-element#^1.0.0
* iron-location#PolymerElements/iron-location#^0.8.0
iron-demo-helpers version 1.2.1
### Dependencies
* polymer#Polymer/polymer#^1.1.0
* iron-icons#PolymerElements/iron-icons#^1.0.0
* paper-icon-button#PolymerElements/paper-icon-button#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.0.0
* marked-element#polymerelements/marked-element#^1.0.0
* prism-element#PolymerElements/prism-element#^1.0.0
* iron-location#PolymerElements/iron-location#^0.8.0
* iron-flex-layout#PolymerElements/iron-flex-layout#^1.3.1
iron-demo-helpers version 1.2.2
### Dependencies
* polymer#Polymer/polymer#^1.1.0
* iron-icons#PolymerElements/iron-icons#^1.0.0
* paper-icon-button#PolymerElements/paper-icon-button#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.0.0
* marked-element#polymerelements/marked-element#^1.0.0
* prism-element#PolymerElements/prism-element#^1.0.0
* iron-location#PolymerElements/iron-location#^0.8.0
* iron-flex-layout#PolymerElements/iron-flex-layout#^1.3.1
iron-demo-helpers version 1.2.3
### Dependencies
* polymer#Polymer/polymer#^1.1.0
* iron-icons#PolymerElements/iron-icons#^1.0.0
* paper-icon-button#PolymerElements/paper-icon-button#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.0.0
* marked-element#polymerelements/marked-element#^1.0.0
* prism-element#PolymerElements/prism-element#^1.0.0
* iron-location#PolymerElements/iron-location#^0.8.0
* iron-flex-layout#PolymerElements/iron-flex-layout#^1.0.0
iron-demo-helpers version 1.2.4
### Dependencies
* polymer#Polymer/polymer#^1.5.0
* iron-icons#PolymerElements/iron-icons#^1.0.0
* paper-icon-button#PolymerElements/paper-icon-button#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.0.0
* marked-element#polymerelements/marked-element#^1.0.0
* prism-element#PolymerElements/prism-element#^1.0.0
* iron-location#PolymerElements/iron-location#^0.8.0
* iron-flex-layout#PolymerElements/iron-flex-layout#^1.0.0
iron-demo-helpers version 1.2.5
### Dependencies
* polymer#Polymer/polymer#^1.5.0
* iron-icons#PolymerElements/iron-icons#^1.0.0
* paper-icon-button#PolymerElements/paper-icon-button#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.0.0
* marked-element#polymerelements/marked-element#^1.0.0
* prism-element#PolymerElements/prism-element#^1.1.0
* iron-location#PolymerElements/iron-location#^0.8.0
* iron-flex-layout#PolymerElements/iron-flex-layout#^1.0.0
iron-demo-helpers version 1.2.6
### Dependencies
* polymer#Polymer/polymer#^1.5.0
* iron-icons#PolymerElements/iron-icons#^1.0.0
* paper-icon-button#PolymerElements/paper-icon-button#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.0.0
* marked-element#polymerelements/marked-element#^1.0.0
* prism-element#PolymerElements/prism-element#^1.1.0
* iron-location#PolymerElements/iron-location#^0.8.0
* iron-flex-layout#PolymerElements/iron-flex-layout#^1.0.0
iron-demo-helpers version 2.0.0
### Dependencies
* polymer#Polymer/polymer#1.9 - 2
* font-roboto#PolymerElements/font-roboto#^1
* iron-flex-layout#polymerelements/iron-flex-layout#1 - 2
* iron-location#PolymerElements/iron-location#1 - 2
* marked-element#polymerelements/marked-element#1 - 2
* prism-element#PolymerElements/prism-element#1 - 2
iron-demo-helpers version 3.0.0-pre.1
### Dependencies
* @polymer/polymer#^3.0.0-pre.1
* @polymer/font-roboto#^3.0.0-pre.1
* @polymer/iron-flex-layout#^3.0.0-pre.1
* @polymer/iron-location#^3.0.0-pre.1
* @polymer/marked-element#^3.0.0-pre.1
* @polymer/prism-element#^3.0.0-pre.1
iron-demo-helpers version 3.0.0-pre.2
### Dependencies
* @polymer/polymer#^3.0.0-pre.1
* @polymer/font-roboto#^3.0.0-pre.1
* @polymer/iron-flex-layout#^3.0.0-pre.1
* @polymer/iron-location#^3.0.0-pre.1
* @polymer/marked-element#^3.0.0-pre.1
* @polymer/prism-element#^3.0.0-pre.1
iron-demo-helpers version 3.0.0-pre.3
### Dependencies
* @polymer/polymer#^3.0.0-pre.3
* @polymer/font-roboto#^3.0.0-pre.3
* @polymer/iron-flex-layout#^3.0.0-pre.3
* @polymer/iron-location#^3.0.0-pre.3
* @polymer/marked-element#^3.0.0-pre.3
* @polymer/prism-element#^3.0.0-pre.3
iron-demo-helpers version 3.0.0-pre.4
### Dependencies
* @polymer/polymer#^3.0.0-pre.4
* @polymer/font-roboto#^3.0.0-pre.4
* @polymer/iron-flex-layout#^3.0.0-pre.4
* @polymer/iron-location#^3.0.0-pre.4
* @polymer/marked-element#^3.0.0-pre.4
* @polymer/prism-element#^3.0.0-pre.4
iron-demo-helpers version 3.0.0-pre.6
### Dependencies
* @polymer/polymer#^3.0.0-pre.6
* @polymer/font-roboto#^3.0.0-pre.6
* @polymer/iron-flex-layout#^3.0.0-pre.6
* @polymer/iron-location#^3.0.0-pre.6
* @polymer/marked-element#^3.0.0-pre.6
* @polymer/prism-element#^3.0.0-pre.6
iron-demo-helpers version 3.0.0-pre.7
### Dependencies
* @polymer/polymer#^3.0.0-pre.7
* @polymer/font-roboto#^3.0.0-pre.7
* @polymer/iron-flex-layout#^3.0.0-pre.7
* @polymer/iron-location#^3.0.0-pre.7
* @polymer/marked-element#^3.0.0-pre.7
* @polymer/prism-element#^3.0.0-pre.7
iron-demo-helpers version 3.0.0-pre.8
### Dependencies
* @polymer/polymer#^3.0.0-pre.7
* @polymer/font-roboto#^3.0.0-pre.7
* @polymer/iron-flex-layout#^3.0.0-pre.7
* @polymer/iron-location#^3.0.0-pre.7
* @polymer/marked-element#^3.0.0-pre.7
* @polymer/prism-element#^3.0.0-pre.7
iron-demo-helpers version 3.0.0-pre.10
### Dependencies
* @polymer/polymer#^3.0.0-pre.10
* @polymer/font-roboto#^3.0.0-pre.10
* @polymer/iron-flex-layout#^3.0.0-pre.10
* @polymer/iron-location#^3.0.0-pre.10
* @polymer/marked-element#^3.0.0-pre.10
* @polymer/prism-element#^3.0.0-pre.10
iron-demo-helpers version 3.0.0-pre.11
### Dependencies
* @polymer/polymer#^3.0.0-pre.10
* @polymer/font-roboto#^3.0.0-pre.10
* @polymer/iron-flex-layout#^3.0.0-pre.10
* @polymer/iron-location#^3.0.0-pre.10
* @polymer/marked-element#^3.0.0-pre.10
* @polymer/prism-element#^3.0.0-pre.10
iron-demo-helpers version 2.1.0
### Dependencies
* polymer#Polymer/polymer#1.9 - 2
* font-roboto#PolymerElements/font-roboto#^1
* iron-flex-layout#PolymerElements/iron-flex-layout#1 - 2
* iron-location#PolymerElements/iron-location#1 - 2
* marked-element#PolymerElements/marked-element#1 - 2
* prism-element#PolymerElements/prism-element#1 - 2
iron-demo-helpers version 3.0.0-pre.12
### Dependencies
* @polymer/polymer#3.0.0-pre.12
* @polymer/font-roboto#3.0.0-pre.12
* @polymer/iron-flex-layout#3.0.0-pre.12
* @polymer/iron-location#3.0.0-pre.12
* @polymer/marked-element#3.0.0-pre.12
* @polymer/prism-element#3.0.0-pre.12
iron-demo-helpers version 3.0.0-pre.13
### Dependencies
* @polymer/polymer#^3.0.0-pre.13
* @polymer/font-roboto#^3.0.0-pre.13
* @polymer/iron-flex-layout#^3.0.0-pre.13
* @polymer/iron-location#^3.0.0-pre.13
* @polymer/marked-element#^3.0.0-pre.13
* @polymer/prism-element#^3.0.0-pre.13
iron-demo-helpers version 2.1.1
### Dependencies
* polymer#Polymer/polymer#1.9 - 2
* font-roboto#PolymerElements/font-roboto#^1
* iron-flex-layout#PolymerElements/iron-flex-layout#1 - 2
* iron-location#PolymerElements/iron-location#1 - 2
* marked-element#PolymerElements/marked-element#1 - 2
* prism-element#PolymerElements/prism-element#1 - 2
iron-demo-helpers version 3.0.0-pre.14
### Dependencies
* @polymer/polymer#^3.0.0-pre.13
* @polymer/font-roboto#^3.0.0-pre.14
* @polymer/iron-flex-layout#^3.0.0-pre.14
* @polymer/iron-location#^3.0.0-pre.14
* @polymer/marked-element#^3.0.0-pre.14
* @polymer/prism-element#^3.0.0-pre.14
iron-demo-helpers version 3.0.0-pre.15
### Dependencies
* @polymer/polymer#^3.0.0-pre.13
* @polymer/font-roboto#^3.0.0-pre.15
* @polymer/iron-flex-layout#^3.0.0-pre.15
* @polymer/iron-location#^3.0.0-pre.15
* @polymer/marked-element#^3.0.0-pre.15
* @polymer/prism-element#^3.0.0-pre.15
iron-demo-helpers version 3.0.0-pre.16
### Dependencies
* @polymer/polymer#^3.0.0-pre.13
* @polymer/font-roboto#^3.0.0-pre.16
* @polymer/iron-flex-layout#^3.0.0-pre.16
* @polymer/iron-location#^3.0.0-pre.16
* @polymer/marked-element#^3.0.0-pre.16
* @polymer/prism-element#^3.0.0-pre.16
iron-demo-helpers version 3.0.0-pre.17
### Dependencies
* @polymer/polymer#^3.0.0-pre.13
* @polymer/font-roboto#^3.0.0-pre.17
* @polymer/iron-flex-layout#^3.0.0-pre.17
* @polymer/iron-location#^3.0.0-pre.17
* @polymer/marked-element#^3.0.0-pre.17
* @polymer/prism-element#^3.0.0-pre.17
iron-demo-helpers version 3.0.0-pre.18
### Dependencies
* @polymer/polymer#^3.0.0
* @polymer/font-roboto#^3.0.0-pre.18
* @polymer/iron-flex-layout#^3.0.0-pre.18
* @polymer/iron-location#^3.0.0-pre.18
* @polymer/marked-element#^3.0.0-pre.18
* @polymer/prism-element#^3.0.0-pre.18
iron-demo-helpers version 3.0.0-pre.19
### Dependencies
* @polymer/polymer#^3.0.0
* @polymer/font-roboto#^3.0.0-pre.19
* @polymer/iron-flex-layout#^3.0.0-pre.19
* @polymer/iron-location#^3.0.0-pre.19
* @polymer/marked-element#^3.0.0-pre.19
* @polymer/prism-element#^3.0.0-pre.19
iron-demo-helpers version 2.1.2
### Dependencies
* polymer#Polymer/polymer#1.9 - 2
* font-roboto#PolymerElements/font-roboto#^1
* iron-flex-layout#PolymerElements/iron-flex-layout#1 - 2
* iron-location#PolymerElements/iron-location#1 - 2
* marked-element#PolymerElements/marked-element#1 - 2
* prism-element#PolymerElements/prism-element#1 - 2
iron-demo-helpers version 3.0.0-pre.20
### Dependencies
* @polymer/polymer#^3.0.0
* @polymer/font-roboto#^3.0.0-pre.20
* @polymer/iron-flex-layout#^3.0.0-pre.20
* @polymer/iron-location#^3.0.0-pre.20
* @polymer/marked-element#^3.0.0-pre.20
* @polymer/prism-element#^3.0.0-pre.20
iron-demo-helpers version 3.0.0-pre.21
### Dependencies
* @polymer/polymer#^3.0.0
* @polymer/font-roboto#^3.0.0-pre.21
* @polymer/iron-flex-layout#^3.0.0-pre.21
* @polymer/iron-location#^3.0.0-pre.21
* @polymer/marked-element#^3.0.0-pre.21
* @polymer/prism-element#^3.0.0-pre.21
iron-demo-helpers version 3.0.0-pre.22
### Dependencies
* @polymer/polymer#^3.0.0
* @polymer/font-roboto#^3.0.0-pre.20
* @polymer/iron-flex-layout#^3.0.0-pre.20
* @polymer/iron-location#^3.0.0-pre.20
* @polymer/marked-element#^3.0.0-pre.20
* @polymer/prism-element#^3.0.0-pre.20
iron-demo-helpers version 3.0.0-pre.23
### Dependencies
* @polymer/polymer#^3.0.0
* @polymer/font-roboto#^3.0.0-pre.22
* @polymer/iron-flex-layout#^3.0.0-pre.22
* @polymer/iron-location#^3.0.0-pre.22
* @polymer/marked-element#^3.0.0-pre.22
* @polymer/prism-element#^3.0.0-pre.22
iron-demo-helpers version 3.0.0-pre.24
### Dependencies
* @polymer/polymer#^3.0.0
* @polymer/font-roboto#^3.0.0-pre.22
* @polymer/iron-flex-layout#^3.0.0-pre.22
* @polymer/iron-location#^3.0.0-pre.22
* @polymer/marked-element#^3.0.0-pre.22
* @polymer/prism-element#^3.0.0-pre.22
iron-demo-helpers version 3.0.0-pre.25
### Dependencies
* @polymer/polymer#^3.0.0
* @polymer/font-roboto#^3.0.0-pre.24
* @polymer/iron-flex-layout#^3.0.0-pre.24
* @polymer/iron-location#^3.0.0-pre.24
* @polymer/marked-element#^3.0.0-pre.24
* @polymer/prism-element#^3.0.0-pre.24
iron-demo-helpers version 3.0.0
### Dependencies
* @polymer/polymer#^3.0.0
* @polymer/font-roboto#^3.0.0-pre.25
* @polymer/iron-flex-layout#^3.0.0-pre.25
* @polymer/iron-location#^3.0.0-pre.25
* @polymer/marked-element#^3.0.0-pre.25
* @polymer/prism-element#^3.0.0-pre.25
iron-demo-helpers version 3.0.1
### Dependencies
* @polymer/polymer#^3.0.0
* @polymer/font-roboto#^3.0.0-pre.25
* @polymer/iron-flex-layout#^3.0.0-pre.25
* @polymer/iron-location#^3.0.0-pre.25
* @polymer/marked-element#^3.0.0-pre.25
* @polymer/prism-element#^3.0.0-pre.25
iron-demo-helpers version 3.0.2
### Dependencies
* @polymer/polymer#^3.0.0
* @polymer/font-roboto#^3.0.0-pre.25
* @polymer/iron-flex-layout#^3.0.0-pre.25
* @polymer/iron-location#^3.0.0-pre.25
* @polymer/marked-element#^3.0.0-pre.25
* @polymer/prism-element#^3.0.0-pre.25
iron-demo-helpers version 3.1.0
### Dependencies
* @polymer/polymer#^3.0.0
* @polymer/font-roboto#^3.0.0-pre.25
* @polymer/iron-flex-layout#^3.0.0-pre.25
* @polymer/iron-location#^3.0.0-pre.25
* @polymer/marked-element#^3.0.0-pre.25
* @polymer/prism-element#^3.0.0-pre.25