|
7 | 7 |
|
8 | 8 | <title>paper-date-picker Demo</title> |
9 | 9 |
|
10 | | - <script src="../../webcomponentsjs/webcomponents-lite.js"></script> |
| 10 | + <script src="../../@webcomponents/webcomponentsjs/webcomponents-bundle.js"></script> |
11 | 11 |
|
12 | | - <link rel="import" href="../paper-date-picker.html"> |
13 | | - <link rel="import" href="../../paper-styles/demo-pages.html"> |
14 | | - <link rel="import" href="../../paper-dialog/paper-dialog.html"> |
15 | | - <link rel="import" href="../../paper-button/paper-button.html"> |
| 12 | + <script type="module" src="../paper-date-picker.js"></script> |
| 13 | + <script type="module" src="../../@polymer/paper-styles/demo-pages.js"></script> |
| 14 | + <script type="module" src="../../@polymer/paper-dialog/paper-dialog.js"></script> |
| 15 | + <script type="module" src="../../@polymer/paper-button/paper-button.js"></script> |
16 | 16 |
|
17 | | - <style is="custom-style" include="paper-date-picker-dialog-style"> |
| 17 | + <!-- FIXME(polymer-modulizer): |
| 18 | + These imperative modules that innerHTML your HTML are |
| 19 | + a hacky way to be sure that any mixins in included style |
| 20 | + modules are ready before any elements that reference them are |
| 21 | + instantiated, otherwise the CSS @apply mixin polyfill won't be |
| 22 | + able to expand the underlying CSS custom properties. |
| 23 | + See: https://github.com/Polymer/polymer-modulizer/issues/154 |
| 24 | + --> |
| 25 | + <script type="module"> |
| 26 | +const $_documentContainer = document.createElement('template'); |
| 27 | + |
| 28 | +$_documentContainer.innerHTML = `<style is="custom-style" include="paper-date-picker-dialog-style"> |
18 | 29 | section { |
19 | 30 | margin: 24px; |
20 | 31 | } |
21 | | - </style> |
| 32 | + </style>`; |
| 33 | + |
| 34 | +document.head.appendChild($_documentContainer.content); |
| 35 | +</script> |
22 | 36 | </head> |
23 | 37 | <body unresolved> |
24 | | - <template is="dom-bind" id="scope"> |
| 38 | + <script type="module"> |
| 39 | +const $_documentContainer = document.createElement('template'); |
| 40 | + |
| 41 | +$_documentContainer.innerHTML = `<template is="dom-bind" id="scope"> |
25 | 42 | <section> |
26 | 43 | <h1>{{dateFormat(date, 'LL')}}</h1> |
27 | | - <paper-button class="btn" on-tap="showDialog" raised>Change Date</paper-button> |
28 | | - <paper-dialog id="dialog" class="paper-date-picker-dialog" modal on-iron-overlay-closed="dismissDialog"> |
| 44 | + <paper-button class="btn" on-tap="showDialog" raised="">Change Date</paper-button> |
| 45 | + <paper-dialog id="dialog" class="paper-date-picker-dialog" modal="" on-iron-overlay-closed="dismissDialog"> |
29 | 46 | <paper-date-picker id="picker" date="[[date]]"></paper-date-picker> |
30 | 47 | <div class="buttons"> |
31 | | - <paper-button dialog-dismiss>Cancel</paper-button> |
32 | | - <paper-button dialog-confirm>OK</paper-button> |
| 48 | + <paper-button dialog-dismiss="">Cancel</paper-button> |
| 49 | + <paper-button dialog-confirm="">OK</paper-button> |
33 | 50 | </div> |
34 | 51 | </paper-dialog> |
35 | 52 | </section> |
36 | | - </template> |
37 | | - <script> |
38 | | - HTMLImports.whenReady(function() { |
39 | | - var scope = Polymer.dom(document).querySelector('#scope'); |
40 | | - scope.dateFormat = function(date, format) { |
41 | | - return moment(date).format(format); |
42 | | - }; |
43 | | - scope.dismissDialog = function(event) { |
44 | | - if (event.detail.confirmed) { |
45 | | - scope.date = scope.$.picker.date; |
46 | | - } |
47 | | - }; |
48 | | - scope.showDialog = function() { |
49 | | - this.$.dialog.toggle(); |
50 | | - }; |
51 | | - document.addEventListener('WebComponentsReady', function() { |
52 | | - scope.date = new Date(2017, 3, 13); |
53 | | - scope.showDialog(); |
54 | | - }); |
55 | | - }); |
56 | | - </script> |
| 53 | + </template>`; |
| 54 | + |
| 55 | +document.body.appendChild($_documentContainer.content); |
| 56 | +</script> |
| 57 | + <script type="module"> |
| 58 | +import '../paper-date-picker.js'; |
| 59 | +import '@polymer/paper-styles/demo-pages.js'; |
| 60 | +import '@polymer/paper-dialog/paper-dialog.js'; |
| 61 | +import '@polymer/paper-button/paper-button.js'; |
| 62 | +var scope = Polymer.dom(document).querySelector('#scope'); |
| 63 | +scope.dateFormat = function(date, format) { |
| 64 | + return moment(date).format(format); |
| 65 | +}; |
| 66 | +scope.dismissDialog = function(event) { |
| 67 | + if (event.detail.confirmed) { |
| 68 | + scope.date = scope.$.picker.date; |
| 69 | + } |
| 70 | +}; |
| 71 | +scope.showDialog = function() { |
| 72 | + this.$.dialog.toggle(); |
| 73 | +}; |
| 74 | +document.addEventListener('WebComponentsReady', function() { |
| 75 | + scope.date = new Date(2017, 3, 13); |
| 76 | + scope.showDialog(); |
| 77 | +}); |
| 78 | +</script> |
57 | 79 | </body> |
58 | 80 | </html> |
0 commit comments