{"id":27888157,"url":"https://github.com/polymerelements/iron-demo-helpers","last_synced_at":"2025-05-05T09:05:45.576Z","repository":{"id":57132137,"uuid":"46450850","full_name":"PolymerElements/iron-demo-helpers","owner":"PolymerElements","description":"Utility classes to make building demo pages easier","archived":false,"fork":false,"pushed_at":"2025-03-10T23:46:15.000Z","size":251,"stargazers_count":16,"open_issues_count":9,"forks_count":29,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-05-05T09:05:37.512Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://webcomponents.org/element/PolymerElements/iron-demo-helpers","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PolymerElements.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-18T22:12:13.000Z","updated_at":"2020-05-22T23:05:52.000Z","dependencies_parsed_at":"2024-06-18T15:26:07.769Z","dependency_job_id":"91c0a535-141f-4b84-8fdf-12f2d99dc0b7","html_url":"https://github.com/PolymerElements/iron-demo-helpers","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolymerElements%2Firon-demo-helpers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolymerElements%2Firon-demo-helpers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolymerElements%2Firon-demo-helpers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolymerElements%2Firon-demo-helpers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PolymerElements","download_url":"https://codeload.github.com/PolymerElements/iron-demo-helpers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252470779,"owners_count":21753047,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-05T09:05:44.681Z","updated_at":"2025-05-05T09:05:45.571Z","avatar_url":"https://github.com/PolymerElements.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003c!---\n\nThis README is automatically generated from the comments in these files:\ndemo-snippet.html  url-bar.html\n\nEdit those files, and our readme bot will duplicate them over here!\nEdit this file, and the bot will squash your changes :)\n\nThe bot does some handling of markdown. Please file a bug if it does the wrong\nthing! https://github.com/PolymerLabs/tedium/issues\n\n--\u003e\n\n[![Published on NPM](https://img.shields.io/npm/v/@polymer/iron-demo-helpers.svg)](https://www.npmjs.com/package/@polymer/iron-demo-helpers)\n[![Build status](https://travis-ci.org/PolymerElements/iron-demo-helpers.svg?branch=master)](https://travis-ci.org/PolymerElements/iron-demo-helpers)\n[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://webcomponents.org/element/@polymer/iron-demo-helpers)\n\n## \u0026lt;demo-snippet\u0026gt;\n\n`demo-snippet` is a helper element that displays the source of a code snippet and\nits rendered demo. It can be used for both native elements and\nPolymer elements.\n\nSee: [Documentation](https://www.webcomponents.org/element/@polymer/iron-demo-helpers),\n  [Demo](https://www.webcomponents.org/element/@polymer/iron-demo-helpers/demo/demo/index.html).\n\n## Usage\n\n### Installation\n```\nnpm install --save @polymer/iron-demo-helpers\n```\n\n### In an html file\n```html\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003cscript type=\"module\"\u003e\n      import '@polymer/iron-demo-helpers/demo-snippet.js';\n      import '@polymer/paper-checkbox/paper-checkbox.js';\n    \u003c/script\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003cdemo-snippet\u003e\n      \u003ctemplate\u003e\n        \u003cinput type=\"date\"\u003e\n        \u003cpaper-checkbox\u003eCheckbox\u003c/paper-checkbox\u003e\n      \u003c/template\u003e\n    \u003c/demo-snippet\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n### In a Polymer 3 element\n```js\nimport {PolymerElement, html} from '@polymer/polymer';\nimport '@polymer/iron-demo-helpers/demo-snippet.js';\nimport '@polymer/paper-checkbox/paper-checkbox.js';\n\nclass SampleElement extends PolymerElement {\n  static get template() {\n    return html`\n      \u003cdemo-snippet\u003e\n        \u003ctemplate\u003e\n          \u003cinput type=\"date\"\u003e\n          \u003cpaper-checkbox\u003eCheckbox\u003c/paper-checkbox\u003e\n        \u003c/template\u003e\n      \u003c/demo-snippet\u003e\n    `;\n  }\n}\ncustomElements.define('sample-element', SampleElement);\n```\n\n## \u0026lt;url-bar\u0026gt;\n\n`url-bar` is a helper element that displays a simple read-only URL bar if\nand only if the page is in an iframe. In this way we can demo elements that\ndeal with the URL in our iframe-based demo environments.\n\nIf the page is not in an iframe, the url-bar element is not displayed.\n\n## Contributing\nIf you want to send a PR to this element, here are\nthe instructions for running the tests and demo locally:\n\n### Installation\n```sh\ngit clone https://github.com/PolymerElements/iron-demo-helpers\ncd iron-demo-helpers\nnpm install\nnpm install -g polymer-cli\n```\n\n### Running the demo locally\n```sh\npolymer serve --npm\nopen http://127.0.0.1:\u003cport\u003e/demo/\n```\n\n### Running the tests\n```sh\npolymer test --npm\n```\n\n## Known Issues\nIf you add a `script type=\"module\"` inside a `demo-snippet`, the demo will\nnot be functional on non-module browsers (like IE11). If you need to\nuse a `script type=\"module\"` and want to display its code in the `demo-snippet`,\na possible workaround is to duplicate the contents of the script outside of the\n`demo-snippet` -- that way `polymer serve` (or whatever solution you're using to\nES5-ify the code) will convert the main document `module` to UMD, but will leave the\ndisplayed code untouched. Here is an example:\n\n```html\n\u003cbody\u003e\n  \u003cdemo-snippet\u003e\n    \u003ctemplate\u003e\n      ...\n      \u003cscript type=\"module\"\u003e\n        import {SomeExport} from '../foo.js';\n        SomeExport.aFunction();\n      \u003c/script\u003e\n    \u003c/template\u003e\n  \u003c/demo-snippet\u003e\n\n  \u003c!-- Hack: on non-module browsers the demo-snippet script doesn't\n    do anything, so add the content here again to make sure the demo works --\u003e\n  \u003cscript type=\"module\"\u003e\n    import {SomeExport} from '../foo.js';\n    SomeExport.aFunction();\n  \u003c/script\u003e\n\u003c/body\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolymerelements%2Firon-demo-helpers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolymerelements%2Firon-demo-helpers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolymerelements%2Firon-demo-helpers/lists"}