diff options
author | Teemu Pòˆntelin <teemu@vaadin.com> | 2015-11-18 14:30:14 +0200 |
---|---|---|
committer | Teemu Pòˆntelin <teemu@vaadin.com> | 2015-11-18 14:44:43 +0200 |
commit | 89abefc57ce902fd4d406c8127f8f87eabec07a2 (patch) | |
tree | a875844107de452caa1993fa8c2ccafc8de42631 | |
parent | da1836a25b501bc5dbde710ec5802552a9bea218 (diff) | |
download | vaadin-core-89abefc57ce902fd4d406c8127f8f87eabec07a2.tar.gz vaadin-core-89abefc57ce902fd4d406c8127f8f87eabec07a2.zip |
Add index page for apidocs contained within the elements
-rw-r--r-- | apidoc/index.html | 167 | ||||
-rw-r--r-- | bower.json | 8 | ||||
-rw-r--r-- | ga.js | 20 | ||||
-rw-r--r-- | tasks/cdn.js | 6 |
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> @@ -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" @@ -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);}); }); |