aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Virkki <tomivirkki@users.noreply.github.com>2015-11-19 11:22:09 +0200
committerTomi Virkki <tomivirkki@users.noreply.github.com>2015-11-19 11:22:09 +0200
commit7f830907ef147848471ba46255bf43022cb11450 (patch)
treecdb6cd09e05763c4da084dbb6f6acd5ceef2e624
parente8ae2738be4264e47dfe0e559db3723216207403 (diff)
parent89abefc57ce902fd4d406c8127f8f87eabec07a2 (diff)
downloadvaadin-core-7f830907ef147848471ba46255bf43022cb11450.tar.gz
vaadin-core-7f830907ef147848471ba46255bf43022cb11450.zip
Merge pull request #22 from vaadin/feature/apidocs
Add index page for apidocs contained within the elements
-rw-r--r--apidoc/index.html167
-rw-r--r--bower.json8
-rw-r--r--ga.js20
-rw-r--r--tasks/cdn.js6
4 files changed, 57 insertions, 144 deletions
diff --git a/apidoc/index.html b/apidoc/index.html
index 522a6a1..1ff94a5 100644
--- a/apidoc/index.html
+++ b/apidoc/index.html
@@ -2,123 +2,58 @@
<html>
<head lang="en">
<meta charset="UTF-8">
- <title></title>
-
- <script src="../ga.js"></script>
- <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
- <script src="../../lodash/lodash.js"></script>
- <link rel="import" href="../../polymer/polymer.html">
- <link rel="import" href="../../hydrolysis/hydrolysis-analyzer.html">
- <link rel="import" href="../../iron-doc-viewer/iron-doc-viewer.html">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>vaadin-elements</title>
+ <style>
+ body {
+ font-family: 'Roboto', 'Noto', sans-serif;
+ font-size: 16px;
+ background: #fafafa;
+ color: #212121;
+ }
+ section {
+ width: 50%;
+ margin: 50px auto;
+ background: #fff;
+ border: 1px solid #e5e5e5;
+ }
+ @media (max-width: 700px) {
+ section {
+ width: 100%;
+ }
+ }
+ h1 {
+ font-size: 150%;
+ font-weight: 400;
+ }
+ ul {
+ padding-left: 0;
+ list-style: none;
+ border-bottom: 1px solid #e5e5e5;
+ }
+ li {
+ line-height: 1.4;
+ border-top: 1px solid #e5e5e5;
+ }
+ li p {
+ margin: 0;
+ }
+ h1,
+ li {
+ padding: 14px 24px;
+ }
+ </style>
</head>
-<body>
- <div id="container" style="display:none">
- <div id="viewer" style="width: 60%;left: 20%; position: absolute;">
- <iron-doc-viewer></iron-doc-viewer>
- </div>
- </div>
- <script>
- window.addEventListener("WebComponentsReady", function() {
- var hyd = require('hydrolysis');
-
- function hidePrivateToggle() {
- document.querySelector('#togglePrivate').setAttribute('style', 'display:none');
- }
-
- function hideCollapsedToggle() {
- var collapsed = document.querySelector('#toggleCollapsed');
- if(collapsed) {
- collapsed.setAttribute('style', 'display:none');
- }
- }
-
- function getElementTag() {
- var elementTag = window.location.search.replace('?', '');
- if(elementTag === '') {
- elementTag = 'vaadin-grid';
- }
-
- return elementTag;
- }
-
- function getPropertyType(type) {
- return type.textContent.replace('Array.<', '').replace('>', '');
- }
-
- function createLinkElement(type) {
- var a = document.createElement('a');
- a.textContent = type.textContent;
- a.setAttribute('href', '?' + getPropertyType(type));
-
- return a;
- }
-
- function addLinkElementsForDocumentedTypes(result) {
- var types = document.querySelectorAll('.type');
-
- for(var i=0;i < types.length; i++) {
- var type = getPropertyType(types[i]);
-
- if(result.elementsByTagName[type] || result.behaviorsByName[type]) {
- var a = createLinkElement(types[i]);
- types[i].textContent = '';
- types[i].appendChild(a);
- }
- }
-
- return result;
- }
-
- function hidePropertySetterMethods() {
- var propertyNames = _.map(document.querySelector('#properties').querySelectorAll('.name'), function(p) {
- return p.textContent;
- });
-
- var methods = document.querySelector('#methods').querySelectorAll('iron-doc-property');
-
- _.forEach(methods, function(m) {
- if(_.contains(propertyNames, m.querySelector('.name').textContent)) {
- m.setAttribute('style', 'display:none');
- }
- });
- }
-
- function hideDefaultValuesForNonPrimitiveTypes(result) {
- function isPrimitiveType(t) {
- return /^([Nn]umber|[Bb]oolean|[Ss]tring).*/.test(t);
- }
-
- _.forEach(document.querySelector('#properties').querySelectorAll('iron-doc-property'), function(p) {
- if(!isPrimitiveType(p.querySelector('#type').textContent)) {
- p.querySelector('.annotation').setAttribute('style', 'display:none');
- }
- });
-
- return result;
- }
-
- function showDocViewer() {
- document.querySelector('#container').setAttribute('style', 'display:block');
- }
-
- //*** Main script starts here. ***//
-
- hidePrivateToggle();
- hideCollapsedToggle();
-
- hyd.Analyzer.analyze('../../vaadin-grid/vaadin-grid-doc.html')
- .then(function(result) {
- var descriptor = result.elementsByTagName[getElementTag()] || result.behaviorsByName[getElementTag()];
- document.querySelector('iron-doc-viewer').descriptor = descriptor;
-
- return result;
- })
- .then(hideDefaultValuesForNonPrimitiveTypes)
- .then(addLinkElementsForDocumentedTypes)
- .then(hidePropertySetterMethods)
- .then(showDocViewer);
- });
-</script>
+<body>
+ <section>
+ <h1>API documentation for vaadin-elements</h1>
+ <ul>
+ <li>
+ <a id="vaadin-grid" href="../../vaadin-grid/index.html">vaadin-grid</a>
+ <p>Data grid for showing large amounts of tabular data.</p>
+ </li>
+ </ul>
+ </section>
</body>
</html>
diff --git a/bower.json b/bower.json
index 86ba571..338c4ad 100644
--- a/bower.json
+++ b/bower.json
@@ -18,13 +18,11 @@
"**/tests"
],
"dependencies": {
- "vaadin-grid": "vaadin/vaadin-grid#0.9.0-beta5",
- "elements-demo-resources": "vaadin/elements-demo-resources#master"
+ "vaadin-grid": "vaadin/vaadin-grid#0.9.0-beta5"
},
"devDependencies": {
- "iron-doc-viewer": "polymerelements/iron-doc-viewer#~1.0.3",
- "hydrolysis": "polymer/hydrolysis#~1.15.1",
- "lodash": "~3.9.3"
+ "iron-component-page": "polymerelements/iron-component-page#~1.1.0",
+ "elements-demo-resources": "vaadin/elements-demo-resources#master"
},
"resolutions": {
"polymer": "v1.1.1"
diff --git a/ga.js b/ga.js
deleted file mode 100644
index 51577de..0000000
--- a/ga.js
+++ /dev/null
@@ -1,20 +0,0 @@
-// Analytics for Vaadin Elements
-
-(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
-})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
-
-ga('create', 'UA-658457-6', 'auto');
-
-function locationHashChanged() {
- if(/vaadin/.test(window.location.hostname)) {
- var pageViewUrl = (window.location.pathname + window.location.hash)
- .replace(/vaadin-elements\/latest\/(.+)\/demo/, 'components-examples/$1')
- .replace('#', '/');
- ga('send', 'pageview', pageViewUrl)
- }
-}
-
-window.onhashchange = locationHashChanged;
-locationHashChanged();
diff --git a/tasks/cdn.js b/tasks/cdn.js
index 9ff994a..d6ea3c7 100644
--- a/tasks/cdn.js
+++ b/tasks/cdn.js
@@ -33,11 +33,11 @@ gulp.task('cdn:stage-bower_components', function() {
});
gulp.task('cdn:stage-vaadin-elements', function() {
- return gulp.src(['LICENSE.html', 'README.md', 'ga.js', 'vaadin-elements.html', 'demo/*', 'apidoc/*'], {base:"."})
+ return gulp.src(['LICENSE.html', 'README.md', 'vaadin-elements.html', 'demo/*', 'apidoc/*'], {base:"."})
.pipe(modify({
fileModifier: function(file, contents) {
if (/README.md/.test(file.path)) {
- contents = contents.replace(/\/latest\//mg, '/' + version + '/')
+ contents = contents.replace(/\/latest\//mg, '/' + version + '/');
} else {
contents.replace('https://cdn.vaadin.com/vaadin-elements/latest/', '../../');
}
@@ -133,5 +133,5 @@ gulp.task('verify:cdn', ['cdn-test:stage'], function(done) {
done(err);
});
- }, done)});
+ }, done);});
});