diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..ce13b20 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,16 @@ +{ + "extends": ["eslint:recommended", "google"], + "env": { + "browser": true + }, + "plugins": [ + "html" + ], + "rules": { + "no-var": "off", + "new-cap": ["error", { "capIsNewExceptions": ["Polymer"] }] + }, + "globals": { + "Polymer": true + } +} diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..2125666 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..38f6726 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,33 @@ + +### Description + + +### Expected outcome + + + +### Actual outcome + + + +### Live Demo + + +### Steps to reproduce + + + +### Browsers Affected + +- [ ] Chrome +- [ ] Firefox +- [ ] Safari 9 +- [ ] Safari 8 +- [ ] Safari 7 +- [ ] Edge +- [ ] IE 11 +- [ ] IE 10 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..77e759d --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +bower_components/ +build/ +node_modules/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..280e8ec --- /dev/null +++ b/.travis.yml @@ -0,0 +1,19 @@ +language: node_js +sudo: required +dist: trusty +addons: + firefox: latest + apt: + sources: + - google-chrome + packages: + - google-chrome-stable +node_js: + - '6' + - '5' + - '4' +before_script: + - npm install -g bower polymer-cli + - bower install +script: + - xvfb-run npm test diff --git a/README.md b/README.md index 5b06229..3bff793 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,87 @@ -# frontend -Frontend project repository +# Polymer App Toolbox - Starter Kit + +[![Build Status](https://travis-ci.org/PolymerElements/polymer-starter-kit.svg?branch=master)](https://travis-ci.org/PolymerElements/polymer-starter-kit) + +This template is a starting point for building apps using a drawer-based +layout. The layout is provided by `app-layout` elements. + +This template, along with the `polymer-cli` toolchain, also demonstrates use +of the "PRPL pattern" This pattern allows fast first delivery and interaction with +the content at the initial route requested by the user, along with fast subsequent +navigation by pre-caching the remaining components required by the app and +progressively loading them on-demand as the user navigates through the app. + +The PRPL pattern, in a nutshell: + +* **Push** components required for the initial route +* **Render** initial route ASAP +* **Pre-cache** components for remaining routes +* **Lazy-load** and progressively upgrade next routes on-demand + +### Migrating from Polymer Starter Kit v1? + +[Check out our blog post that covers what's changed in PSK2 and how to migrate!](https://www.polymer-project.org/1.0/blog/2016-08-18-polymer-starter-kit-or-polymer-cli.html) + +### Setup + +##### Prerequisites + +First, install [Polymer CLI](https://github.com/Polymer/polymer-cli) using +[npm](https://www.npmjs.com) (we assume you have pre-installed [node.js](https://nodejs.org)). + + npm install -g polymer-cli + +##### Initialize project from template + + mkdir my-app + cd my-app + polymer init starter-kit + +### Start the development server + +This command serves the app at `http://localhost:8080` and provides basic URL +routing for the app: + + polymer serve --open + +### Build + +This command performs HTML, CSS, and JS minification on the application +dependencies, and generates a service-worker.js file with code to pre-cache the +dependencies based on the entrypoint and fragments specified in `polymer.json`. +The minified files are output to the `build/unbundled` folder, and are suitable +for serving from a HTTP/2+Push compatible server. + +In addition the command also creates a fallback `build/bundled` folder, +generated using fragment bundling, suitable for serving from non +H2/push-compatible servers or to clients that do not support H2/Push. + + polymer build + +### Preview the build + +This command serves the minified version of the app at `http://localhost:8080` +in an unbundled state, as it would be served by a push-compatible server: + + polymer serve build/unbundled + +This command serves the minified version of the app at `http://localhost:8080` +generated using fragment bundling: + + polymer serve build/bundled + +### Run tests + +This command will run [Web Component Tester](https://github.com/Polymer/web-component-tester) +against the browsers currently installed on your machine: + + polymer test + +### Adding a new view + +You can extend the app by adding more views that will be demand-loaded +e.g. based on the route, or to progressively render non-critical sections of the +application. Each new demand-loaded fragment should be added to the list of +`fragments` in the included `polymer.json` file. This will ensure those +components and their dependencies are added to the list of pre-cached components +and will be included in the `bundled` build. diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..7e3dc8c --- /dev/null +++ b/bower.json @@ -0,0 +1,33 @@ +{ + "name": "polymer-starter-kit", + "authors": [ + "The Polymer Authors" + ], + "license": "https://polymer.github.io/LICENSE.txt", + "dependencies": { + "app-layout": "PolymerElements/app-layout#^0.10.0", + "app-route": "PolymerElements/app-route#^0.9.0", + "iron-flex-layout": "PolymerElements/iron-flex-layout#^1.0.0", + "iron-icon": "PolymerElements/iron-icon#^1.0.0", + "iron-iconset-svg": "PolymerElements/iron-iconset-svg#^1.0.0", + "iron-localstorage": "PolymerElements/iron-localstorage#^1.0.0", + "iron-media-query": "PolymerElements/iron-media-query#^1.0.0", + "iron-pages": "PolymerElements/iron-pages#^1.0.0", + "iron-selector": "PolymerElements/iron-selector#^1.0.0", + "paper-icon-button": "PolymerElements/paper-icon-button#~1.1.0", + "polymer": "Polymer/polymer#^1.6.0", + "app-pouchdb": "PolymerElements/app-pouchdb#^0.9.5", + "iron-input": "PolymerElements/iron-input#^1.0.10", + "paper-button": "PolymerElements/paper-button#^1.0.14", + "paper-input": "PolymerElements/paper-input#^1.1.23", + "paper-dropdown-menu": "PolymerElements/paper-dropdown-menu#^1.5.0", + "paper-listbox": "polymerelements/paper-listbox#^1.1.2", + "paper-item": "PolymerElements/paper-item#^1.2.1", + "iron-icons": "PolymerElements/iron-icons#^1.2.0", + "paper-toast": "PolymerElements/paper-toast#^1.3.0" + }, + "devDependencies": { + "web-component-tester": "^4.0.0" + }, + "private": true +} diff --git a/images/favicon.ico b/images/favicon.ico new file mode 100644 index 0000000..9cd897e Binary files /dev/null and b/images/favicon.ico differ diff --git a/images/manifest/icon-144x144.png b/images/manifest/icon-144x144.png new file mode 100644 index 0000000..c09f0ce Binary files /dev/null and b/images/manifest/icon-144x144.png differ diff --git a/images/manifest/icon-192x192.png b/images/manifest/icon-192x192.png new file mode 100644 index 0000000..e74d22e Binary files /dev/null and b/images/manifest/icon-192x192.png differ diff --git a/images/manifest/icon-48x48.png b/images/manifest/icon-48x48.png new file mode 100644 index 0000000..15bb11e Binary files /dev/null and b/images/manifest/icon-48x48.png differ diff --git a/images/manifest/icon-512x512.png b/images/manifest/icon-512x512.png new file mode 100644 index 0000000..1f8053f Binary files /dev/null and b/images/manifest/icon-512x512.png differ diff --git a/images/manifest/icon-72x72.png b/images/manifest/icon-72x72.png new file mode 100644 index 0000000..c0af865 Binary files /dev/null and b/images/manifest/icon-72x72.png differ diff --git a/images/manifest/icon-96x96.png b/images/manifest/icon-96x96.png new file mode 100644 index 0000000..712a605 Binary files /dev/null and b/images/manifest/icon-96x96.png differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..9e11668 --- /dev/null +++ b/index.html @@ -0,0 +1,113 @@ + + + + + + + + + + My App + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..1c787ff --- /dev/null +++ b/manifest.json @@ -0,0 +1,20 @@ +{ + "name": "My App", + "short_name": "My App", + "start_url": "/?homescreen=1", + "display": "standalone", + "theme_color": "#3f51b5", + "background_color": "#3f51b5", + "icons": [ + { + "src": "images/manifest/icon-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "images/manifest/icon-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ] +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..2ad9906 --- /dev/null +++ b/package.json @@ -0,0 +1,13 @@ +{ + "name": "polymer-starter-kit", + "license": "BSD-3-Clause", + "devDependencies": { + "eslint": "^3.12.0", + "eslint-config-google": "^0.7.1", + "eslint-plugin-html": "^1.7.0" + }, + "scripts": { + "lint": "eslint . --ext js,html --ignore-path .gitignore", + "test": "npm run lint && polymer test" + } +} diff --git a/polymer.json b/polymer.json new file mode 100644 index 0000000..302b288 --- /dev/null +++ b/polymer.json @@ -0,0 +1,19 @@ +{ + "entrypoint": "index.html", + "shell": "src/my-app.html", + "fragments": [ + "src/my-view1.html", + "src/my-view2.html", + "src/my-view3.html", + "src/my-view404.html" + ], + "sourceGlobs": [ + "src/**/*", + "images/**/*", + "bower.json" + ], + "includeDependencies": [ + "manifest.json", + "bower_components/webcomponentsjs/webcomponents-lite.min.js" + ] +} \ No newline at end of file diff --git a/service-worker.js b/service-worker.js new file mode 100644 index 0000000..93e9d49 --- /dev/null +++ b/service-worker.js @@ -0,0 +1,15 @@ +/** + * @license + * Copyright (c) 2016 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 + */ + +/* eslint no-console: ["error", { allow: ["info"] }] */ + +console.info( + 'Service worker disabled for development, will be generated at build time.' +); diff --git a/src/ml4u-icons.html b/src/ml4u-icons.html new file mode 100644 index 0000000..cd9df39 --- /dev/null +++ b/src/ml4u-icons.html @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ml4u-page-home.html b/src/ml4u-page-home.html new file mode 100644 index 0000000..137bc51 --- /dev/null +++ b/src/ml4u-page-home.html @@ -0,0 +1,49 @@ + + + + + + + + + + diff --git a/src/ml4u-page-login.html b/src/ml4u-page-login.html new file mode 100644 index 0000000..c664ee1 --- /dev/null +++ b/src/ml4u-page-login.html @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/ml4u-page-schedule.html b/src/ml4u-page-schedule.html new file mode 100644 index 0000000..ad60963 --- /dev/null +++ b/src/ml4u-page-schedule.html @@ -0,0 +1,134 @@ + + + + + + + + + + diff --git a/src/ml4u-pouchdb/ml4u-pouchdb-document.html b/src/ml4u-pouchdb/ml4u-pouchdb-document.html new file mode 100644 index 0000000..5f51a95 --- /dev/null +++ b/src/ml4u-pouchdb/ml4u-pouchdb-document.html @@ -0,0 +1,221 @@ + + + + + + + + diff --git a/src/ml4u-pouchdb/ml4u-pouchdb-sync.html b/src/ml4u-pouchdb/ml4u-pouchdb-sync.html new file mode 100644 index 0000000..2c33bc5 --- /dev/null +++ b/src/ml4u-pouchdb/ml4u-pouchdb-sync.html @@ -0,0 +1,129 @@ + + + + + diff --git a/src/ml4u-user-profile.html b/src/ml4u-user-profile.html new file mode 100644 index 0000000..ac4ad0b --- /dev/null +++ b/src/ml4u-user-profile.html @@ -0,0 +1,55 @@ + + + + + + + + + + diff --git a/src/ml4u-view404.html b/src/ml4u-view404.html new file mode 100644 index 0000000..89d611c --- /dev/null +++ b/src/ml4u-view404.html @@ -0,0 +1,35 @@ + + + + + + + + + diff --git a/src/shared-styles.html b/src/shared-styles.html new file mode 100644 index 0000000..5e4f249 --- /dev/null +++ b/src/shared-styles.html @@ -0,0 +1,45 @@ + + + + + + + + diff --git a/sw-precache-config.js b/sw-precache-config.js new file mode 100644 index 0000000..301bb56 --- /dev/null +++ b/sw-precache-config.js @@ -0,0 +1,20 @@ +/** + * @license + * Copyright (c) 2016 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 + */ + +/* eslint-env node */ + +module.exports = { + staticFileGlobs: [ + '/index.html', + '/manifest.json', + '/bower_components/webcomponentsjs/webcomponents-lite.min.js', + ], + navigateFallback: 'index.html', +}; diff --git a/test/.eslintrc.json b/test/.eslintrc.json new file mode 100644 index 0000000..72c9403 --- /dev/null +++ b/test/.eslintrc.json @@ -0,0 +1,10 @@ +{ + "env": { + "mocha": true + }, + "globals": { + "assert": false, + "fixture": false, + "WCT": false + } +} diff --git a/test/index.html b/test/index.html new file mode 100644 index 0000000..8678e38 --- /dev/null +++ b/test/index.html @@ -0,0 +1,29 @@ + + + + + + + + + Tests + + + + + + + diff --git a/test/my-view1.html b/test/my-view1.html new file mode 100644 index 0000000..bcb7962 --- /dev/null +++ b/test/my-view1.html @@ -0,0 +1,47 @@ + + + + + + + + + my-view1 + + + + + + + + + + + + + + +