diff --git a/index.html b/index.html
index ad5bdbc..39f3b77 100644
--- a/index.html
+++ b/index.html
@@ -14,8 +14,8 @@
-
-
+
+
diff --git a/iron-component-page.d.ts b/iron-component-page.d.ts
deleted file mode 100644
index eaafc2b..0000000
--- a/iron-component-page.d.ts
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * DO NOT EDIT
- *
- * This file was automatically generated by
- * https://github.com/Polymer/gen-typescript-declarations
- *
- * To modify these typings, edit the source file(s):
- * iron-component-page.html
- */
-
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-
-interface IronComponentPageElement extends Polymer.Element {
-
- /**
- * URL of the Polymer Analyzer descriptor to fetch and display.
- */
- descriptorUrl: string|null|undefined;
-
- /**
- * By default all routing is performed using the URL fragment
- * (e.g. `docs.html#/elements/my-element`).
- *
- * If your server supports it and you would like to use the real URL
- * path instead (e.g. `/api/docs/elements/my-element`), set this to
- * the base path where the page is mounted, omitting the trailing
- * slash (e.g. `/api/docs` or *empty string* for the root path).
- */
- baseHref: string|null|undefined;
-
- /**
- * Instead of displaying items relative to the top level of
- * `descriptor`, start from this namespace.
- */
- rootNamespace: string|null|undefined;
-
- /**
- * URL prefix for demo iframes.
- */
- demoSrcPrefix: string|null|undefined;
- _loading: boolean|null|undefined;
- _error: object|null|undefined;
- _descriptor: object|null|undefined;
- _path: string|null|undefined;
- _narrow: boolean|null|undefined;
- _title: string|null|undefined;
- _onViewChanged(): void;
- _onNavSelect(): void;
- _descriptorUrlChanged(): void;
- _descriptorChanged(descriptor: any): void;
- _titleChanged(title: any): void;
-}
-
-interface HTMLElementTagNameMap {
- "iron-component-page": IronComponentPageElement;
-}
diff --git a/iron-component-page.html b/iron-component-page.html
deleted file mode 100644
index e298758..0000000
--- a/iron-component-page.html
+++ /dev/null
@@ -1,254 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Loading descriptor ...
-
-
-
- Could not load descriptor "[[descriptorUrl]]". [[_error.error]]
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
[[_title]]
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/iron-component-page.js b/iron-component-page.js
new file mode 100644
index 0000000..8767d65
--- /dev/null
+++ b/iron-component-page.js
@@ -0,0 +1,228 @@
+/**
+@license
+Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
+This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
+The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
+The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
+Code distributed by Google as part of the polymer project is also
+subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
+*/
+import '@polymer/polymer/polymer-legacy.js';
+
+import '@polymer/app-layout/app-drawer-layout/app-drawer-layout.js';
+import '@polymer/app-layout/app-drawer/app-drawer.js';
+import '@polymer/app-layout/app-header-layout/app-header-layout.js';
+import '@polymer/app-layout/app-header/app-header.js';
+import '@polymer/app-layout/app-toolbar/app-toolbar.js';
+import '@polymer/iron-ajax/iron-ajax.js';
+import '@polymer/iron-doc-viewer/default-theme.js';
+import '@polymer/iron-doc-viewer/iron-doc-nav.js';
+import '@polymer/iron-doc-viewer/iron-doc-viewer.js';
+import '@polymer/iron-icons/iron-icons.js';
+import '@polymer/paper-icon-button/paper-icon-button.js';
+import '@polymer/paper-styles/color.js';
+import '@polymer/paper-styles/typography.js';
+import '@polymer/paper-toast/paper-toast.js';
+import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js';
+import { html } from '@polymer/polymer/lib/utils/html-tag.js';
+Polymer({
+ _template: html`
+
+
+
+
+
+
+ Loading descriptor ...
+
+
+
+ Could not load descriptor "[[descriptorUrl]]". [[_error.error]]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
[[_title]]
+
+
+
+
+
+
+
+
+`,
+
+ is: 'iron-component-page',
+
+ properties: {
+ /**
+ * URL of the Polymer Analyzer descriptor to fetch and display.
+ */
+ descriptorUrl: {
+ type: String,
+ value: 'analysis.json',
+ observer: '_descriptorUrlChanged'
+ },
+
+ /**
+ * By default all routing is performed using the URL fragment
+ * (e.g. `docs.html#/elements/my-element`).
+ *
+ * If your server supports it and you would like to use the real URL
+ * path instead (e.g. `/api/docs/elements/my-element`), set this to
+ * the base path where the page is mounted, omitting the trailing
+ * slash (e.g. `/api/docs` or *empty string* for the root path).
+ */
+ baseHref: String,
+
+ /**
+ * Instead of displaying items relative to the top level of
+ * `descriptor`, start from this namespace.
+ */
+ rootNamespace: String,
+
+ /**
+ * URL prefix for demo iframes.
+ */
+ demoSrcPrefix: String,
+
+ _loading: Boolean,
+
+ _error: Object,
+
+ _descriptor: {type: Object, observer: '_descriptorChanged'},
+
+ _path: String,
+
+ _narrow: Boolean,
+
+ _title: {type: String, observer: '_titleChanged'}
+ },
+
+ _onViewChanged() {
+ this.$.viewer.scrollIntoView();
+ },
+
+ _onNavSelect() {
+ // Note we need to listen for this event, and can't rely just on the
+ // path changing, because the user might click on the nav item they
+ // are already viewing.
+ this.$.viewer.scrollIntoView();
+ if (this._narrow) {
+ this.$.drawer.close();
+ }
+ },
+
+ _descriptorUrlChanged() {
+ this._error = null;
+ },
+
+ _descriptorChanged(descriptor) {
+ if (!descriptor || this._changing) {
+ return;
+ }
+
+ this._changing = true;
+ this._descriptor = _flatten(descriptor);
+ this._changing = false;
+ },
+
+ _titleChanged(title) {
+ window.document.title = title;
+ }
+});
+
+function _flatten(descriptor, flat) {
+ if (!flat) {
+ flat = {
+ namespaces: [],
+ elements: [],
+ metadata: {polymer: {behaviors: []}},
+ mixins: [],
+ classes: [],
+ };
+ }
+ for (var i = 0; i < (descriptor.namespaces || []).length; i++) {
+ _flatten(descriptor.namespaces[i], flat);
+ flat.namespaces.push(descriptor.namespaces[i]);
+ }
+ for (var i = 0; i < (descriptor.classes || []).length; i++) {
+ flat.classes.push(descriptor.classes[i]);
+ }
+ for (var i = 0; i < (descriptor.elements || []).length; i++) {
+ flat.elements.push(descriptor.elements[i]);
+ }
+ var descriptorBehaviors =
+ ((descriptor.metadata || {}).polymer || {}).behaviors;
+ for (var i = 0; i < (descriptorBehaviors || []).length; i++) {
+ flat.metadata.polymer.behaviors.push(descriptorBehaviors[i]);
+ }
+ for (var i = 0; i < (descriptor.mixins || []).length; i++) {
+ flat.mixins.push(descriptor.mixins[i]);
+ }
+ return flat;
+}
diff --git a/manifest.json b/manifest.json
new file mode 100644
index 0000000..2da4e60
--- /dev/null
+++ b/manifest.json
@@ -0,0 +1,24 @@
+{
+ "files": {
+ "iron-component-page.html": {
+ "convertedUrl": "iron-component-page.js",
+ "exports": {}
+ },
+ "index.html": {
+ "convertedUrl": "index.html",
+ "exports": {}
+ },
+ "demo/index.html": {
+ "convertedUrl": "demo/index.html",
+ "exports": {}
+ },
+ "test/index.html": {
+ "convertedUrl": "test/index.html",
+ "exports": {}
+ },
+ "test/iron-component-page.html": {
+ "convertedUrl": "test/iron-component-page.html",
+ "exports": {}
+ }
+ }
+}
diff --git a/package.json b/package.json
index ae3504d..8c8dab0 100644
--- a/package.json
+++ b/package.json
@@ -1,19 +1,45 @@
{
- "name": "@polymer/iron-component-page",
- "private": true,
"description": "Turns a raw element definition into beautiful documentation",
+ "keywords": [
+ "web-components",
+ "polymer",
+ "docs"
+ ],
"repository": {
"type": "git",
"url": "git://github.com/PolymerElements/iron-component-page.git"
},
+ "name": "@polymer/iron-component-page",
"license": "BSD-3-Clause",
"devDependencies": {
"@polymer/gen-typescript-declarations": "^1.2.2",
"bower": "^1.8.0",
- "webmat": "^0.2.0"
+ "webmat": "^0.2.0",
+ "wct-browser-legacy": "^1.0.1",
+ "@webcomponents/webcomponentsjs": "^2.0.0"
},
"scripts": {
"update-types": "bower install && gen-typescript-declarations --deleteExisting --outDir .",
"format": "webmat && npm run update-types"
+ },
+ "version": "3.0.0-pre.20",
+ "resolutions": {
+ "inherits": "2.0.3",
+ "samsam": "1.1.3",
+ "supports-color": "3.1.2",
+ "type-detect": "1.0.0",
+ "@webcomponents/webcomponentsjs": "2.0.0-beta.2"
+ },
+ "main": "iron-component-page.js",
+ "author": "The Polymer Authors",
+ "dependencies": {
+ "@polymer/app-layout": "^3.0.0-pre.20",
+ "@polymer/iron-ajax": "^3.0.0-pre.20",
+ "@polymer/iron-doc-viewer": "^3.0.0-pre.20",
+ "@polymer/iron-icons": "^3.0.0-pre.20",
+ "@polymer/paper-icon-button": "^3.0.0-pre.20",
+ "@polymer/paper-styles": "^3.0.0-pre.20",
+ "@polymer/paper-toast": "^3.0.0-pre.20",
+ "@polymer/polymer": "^3.0.0"
}
}
diff --git a/test/index.html b/test/index.html
index e142f93..4007c58 100644
--- a/test/index.html
+++ b/test/index.html
@@ -14,8 +14,8 @@
iron-component-page tests
-
-
+
+
diff --git a/test/iron-component-page.html b/test/iron-component-page.html
index d229ae2..257c790 100644
--- a/test/iron-component-page.html
+++ b/test/iron-component-page.html
@@ -14,14 +14,14 @@
iron-component-page tests
-
-
+
+
-
-
+
+
-
+
@@ -31,47 +31,51 @@
-
+ it('fetches default descriptor name and renders from it', function() {
+ var view = page.$$('iron-doc-viewer')
+ .$$('iron-doc-namespace')
+ .$$('iron-doc-summary');
+ var text = dom(view.root).textContent;
+ expect(text).contains('my-element');
+ });
+});
+