polymer-paper-elements-rails 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +51 -0
  3. data/Rakefile +1 -0
  4. data/app/assets/components/iron-a11y-announcer/iron-a11y-announcer.html +125 -0
  5. data/app/assets/components/iron-a11y-keys-behavior/iron-a11y-keys-behavior.html +418 -0
  6. data/app/assets/components/iron-autogrow-textarea/hero.svg +33 -0
  7. data/app/assets/components/iron-autogrow-textarea/iron-autogrow-textarea.html +263 -0
  8. data/app/assets/components/iron-behaviors/iron-button-state.html +195 -0
  9. data/app/assets/components/iron-behaviors/iron-control-state.html +102 -0
  10. data/app/assets/components/iron-fit-behavior/iron-fit-behavior.html +230 -0
  11. data/app/assets/components/iron-flex-layout/classes/iron-flex-layout.html +307 -0
  12. data/app/assets/components/iron-flex-layout/classes/iron-shadow-flex-layout.html +302 -0
  13. data/app/assets/components/iron-flex-layout/iron-flex-layout.html +313 -0
  14. data/app/assets/components/iron-form-element-behavior/iron-form-element-behavior.html +50 -0
  15. data/app/assets/components/iron-icon/hero.svg +19 -0
  16. data/app/assets/components/iron-icon/iron-icon.html +187 -0
  17. data/app/assets/components/iron-icons/av-icons.html +73 -0
  18. data/app/assets/components/iron-icons/communication-icons.html +59 -0
  19. data/app/assets/components/iron-icons/device-icons.html +94 -0
  20. data/app/assets/components/iron-icons/editor-icons.html +70 -0
  21. data/app/assets/components/iron-icons/hardware-icons.html +61 -0
  22. data/app/assets/components/iron-icons/hero.svg +35 -0
  23. data/app/assets/components/iron-icons/image-icons.html +164 -0
  24. data/app/assets/components/iron-icons/iron-icons.html +303 -0
  25. data/app/assets/components/iron-icons/maps-icons.html +71 -0
  26. data/app/assets/components/iron-icons/notification-icons.html +62 -0
  27. data/app/assets/components/iron-icons/social-icons.html +40 -0
  28. data/app/assets/components/iron-iconset-svg/iron-iconset-svg.html +191 -0
  29. data/app/assets/components/iron-input/hero.svg +19 -0
  30. data/app/assets/components/iron-input/iron-input.html +235 -0
  31. data/app/assets/components/iron-media-query/hero.svg +29 -0
  32. data/app/assets/components/iron-media-query/iron-media-query.html +84 -0
  33. data/app/assets/components/iron-menu-behavior/iron-menu-behavior.html +214 -0
  34. data/app/assets/components/iron-menu-behavior/iron-menubar-behavior.html +65 -0
  35. data/app/assets/components/iron-meta/hero.svg +33 -0
  36. data/app/assets/components/iron-meta/iron-meta.html +352 -0
  37. data/app/assets/components/iron-overlay-behavior/iron-overlay-backdrop.html +132 -0
  38. data/app/assets/components/iron-overlay-behavior/iron-overlay-behavior.html +432 -0
  39. data/app/assets/components/iron-overlay-behavior/iron-overlay-manager.html +107 -0
  40. data/app/assets/components/iron-range-behavior/iron-range-behavior.html +101 -0
  41. data/app/assets/components/iron-resizable-behavior/iron-resizable-behavior.html +139 -0
  42. data/app/assets/components/iron-selector/iron-multi-selectable.html +120 -0
  43. data/app/assets/components/iron-selector/iron-selectable.html +307 -0
  44. data/app/assets/components/iron-selector/iron-selection.html +115 -0
  45. data/app/assets/components/iron-selector/iron-selector.html +71 -0
  46. data/app/assets/components/iron-validatable-behavior/iron-validatable-behavior.html +100 -0
  47. data/app/assets/components/neon-animation/animations/cascaded-animation.html +84 -0
  48. data/app/assets/components/neon-animation/animations/fade-in-animation.html +49 -0
  49. data/app/assets/components/neon-animation/animations/fade-out-animation.html +49 -0
  50. data/app/assets/components/neon-animation/animations/hero-animation.html +83 -0
  51. data/app/assets/components/neon-animation/animations/opaque-animation.html +46 -0
  52. data/app/assets/components/neon-animation/animations/ripple-animation.html +92 -0
  53. data/app/assets/components/neon-animation/animations/scale-down-animation.html +65 -0
  54. data/app/assets/components/neon-animation/animations/scale-up-animation.html +58 -0
  55. data/app/assets/components/neon-animation/animations/slide-down-animation.html +59 -0
  56. data/app/assets/components/neon-animation/animations/slide-from-left-animation.html +60 -0
  57. data/app/assets/components/neon-animation/animations/slide-from-right-animation.html +60 -0
  58. data/app/assets/components/neon-animation/animations/slide-left-animation.html +59 -0
  59. data/app/assets/components/neon-animation/animations/slide-right-animation.html +59 -0
  60. data/app/assets/components/neon-animation/animations/slide-up-animation.html +59 -0
  61. data/app/assets/components/neon-animation/animations/transform-animation.html +61 -0
  62. data/app/assets/components/neon-animation/guides/neon-animation.md +313 -0
  63. data/app/assets/components/neon-animation/neon-animatable-behavior.html +156 -0
  64. data/app/assets/components/neon-animation/neon-animatable.html +54 -0
  65. data/app/assets/components/neon-animation/neon-animated-pages.html +208 -0
  66. data/app/assets/components/neon-animation/neon-animation-behavior.html +88 -0
  67. data/app/assets/components/neon-animation/neon-animation-runner-behavior.html +110 -0
  68. data/app/assets/components/neon-animation/neon-animation.html +17 -0
  69. data/app/assets/components/neon-animation/neon-animations.html +25 -0
  70. data/app/assets/components/neon-animation/neon-shared-element-animatable-behavior.html +37 -0
  71. data/app/assets/components/neon-animation/neon-shared-element-animation-behavior.html +66 -0
  72. data/app/assets/components/neon-animation/web-animations.html +11 -0
  73. data/app/assets/components/paper-behaviors/paper-button-behavior.html +55 -0
  74. data/app/assets/components/paper-behaviors/paper-inky-focus-behavior.html +44 -0
  75. data/app/assets/components/paper-button/paper-button.html +177 -0
  76. data/app/assets/components/paper-checkbox/metadata.html +17 -0
  77. data/app/assets/components/paper-checkbox/paper-checkbox.css +149 -0
  78. data/app/assets/components/paper-checkbox/paper-checkbox.html +163 -0
  79. data/app/assets/components/paper-dialog-behavior/hero.svg +51 -0
  80. data/app/assets/components/paper-dialog-behavior/paper-dialog-behavior.html +236 -0
  81. data/app/assets/components/paper-dialog-behavior/paper-dialog-common.css +58 -0
  82. data/app/assets/components/paper-dialog-scrollable/hero.svg +69 -0
  83. data/app/assets/components/paper-dialog-scrollable/paper-dialog-scrollable.html +150 -0
  84. data/app/assets/components/paper-dialog/hero.svg +58 -0
  85. data/app/assets/components/paper-dialog/paper-dialog.html +122 -0
  86. data/app/assets/components/paper-drawer-panel/hero.svg +21 -0
  87. data/app/assets/components/paper-drawer-panel/paper-drawer-panel.css +142 -0
  88. data/app/assets/components/paper-drawer-panel/paper-drawer-panel.html +585 -0
  89. data/app/assets/components/paper-fab/paper-fab.html +159 -0
  90. data/app/assets/components/paper-header-panel/hero.svg +38 -0
  91. data/app/assets/components/paper-header-panel/paper-header-panel.html +496 -0
  92. data/app/assets/components/paper-icon-button/paper-icon-button.html +141 -0
  93. data/app/assets/components/paper-input/all-imports.html +12 -0
  94. data/app/assets/components/paper-input/hero.svg +19 -0
  95. data/app/assets/components/paper-input/paper-input-addon-behavior.html +43 -0
  96. data/app/assets/components/paper-input/paper-input-behavior.html +293 -0
  97. data/app/assets/components/paper-input/paper-input-char-counter.html +95 -0
  98. data/app/assets/components/paper-input/paper-input-container.html +495 -0
  99. data/app/assets/components/paper-input/paper-input-error.html +99 -0
  100. data/app/assets/components/paper-input/paper-input.html +126 -0
  101. data/app/assets/components/paper-input/paper-textarea.html +100 -0
  102. data/app/assets/components/paper-item/all-imports.html +13 -0
  103. data/app/assets/components/paper-item/paper-icon-item.html +86 -0
  104. data/app/assets/components/paper-item/paper-item-body.html +93 -0
  105. data/app/assets/components/paper-item/paper-item-shared.css +19 -0
  106. data/app/assets/components/paper-item/paper-item.html +95 -0
  107. data/app/assets/components/paper-material/paper-material.html +98 -0
  108. data/app/assets/components/paper-menu/hero.svg +35 -0
  109. data/app/assets/components/paper-menu/paper-menu.html +133 -0
  110. data/app/assets/components/paper-progress/hero.svg +21 -0
  111. data/app/assets/components/paper-progress/paper-progress.html +199 -0
  112. data/app/assets/components/paper-radio-button/hero.svg +22 -0
  113. data/app/assets/components/paper-radio-button/paper-radio-button.css +109 -0
  114. data/app/assets/components/paper-radio-button/paper-radio-button.html +148 -0
  115. data/app/assets/components/paper-radio-group/hero.svg +25 -0
  116. data/app/assets/components/paper-radio-group/paper-radio-group.html +186 -0
  117. data/app/assets/components/paper-ripple/hero.svg +30 -0
  118. data/app/assets/components/paper-ripple/paper-ripple.html +714 -0
  119. data/app/assets/components/paper-scroll-header-panel/hero.svg +41 -0
  120. data/app/assets/components/paper-scroll-header-panel/paper-scroll-header-panel.html +455 -0
  121. data/app/assets/components/paper-slider/hero.svg +20 -0
  122. data/app/assets/components/paper-slider/paper-slider.css +252 -0
  123. data/app/assets/components/paper-slider/paper-slider.html +449 -0
  124. data/app/assets/components/paper-spinner/hero.svg +27 -0
  125. data/app/assets/components/paper-spinner/paper-spinner.css +325 -0
  126. data/app/assets/components/paper-spinner/paper-spinner.html +222 -0
  127. data/app/assets/components/paper-styles/classes/global.html +96 -0
  128. data/app/assets/components/paper-styles/classes/shadow-layout.html +302 -0
  129. data/app/assets/components/paper-styles/classes/shadow.html +39 -0
  130. data/app/assets/components/paper-styles/classes/typography.html +171 -0
  131. data/app/assets/components/paper-styles/color.html +333 -0
  132. data/app/assets/components/paper-styles/default-theme.html +39 -0
  133. data/app/assets/components/paper-styles/paper-styles-classes.html +14 -0
  134. data/app/assets/components/paper-styles/paper-styles.html +17 -0
  135. data/app/assets/components/paper-styles/shadow.html +61 -0
  136. data/app/assets/components/paper-styles/typography.html +240 -0
  137. data/app/assets/components/paper-tabs/hero.svg +23 -0
  138. data/app/assets/components/paper-tabs/paper-tab.html +158 -0
  139. data/app/assets/components/paper-tabs/paper-tabs-icons.html +18 -0
  140. data/app/assets/components/paper-tabs/paper-tabs.html +483 -0
  141. data/app/assets/components/paper-toast/hero.svg +20 -0
  142. data/app/assets/components/paper-toast/paper-toast.html +164 -0
  143. data/app/assets/components/paper-toggle-button/hero.svg +22 -0
  144. data/app/assets/components/paper-toggle-button/paper-toggle-button.css +108 -0
  145. data/app/assets/components/paper-toggle-button/paper-toggle-button.html +183 -0
  146. data/app/assets/components/paper-toolbar/paper-toolbar.html +375 -0
  147. data/app/assets/components/polymer-gestures/Gruntfile.js +60 -0
  148. data/app/assets/components/polymer-gestures/banner.txt +9 -0
  149. data/app/assets/components/polymer-gestures/build.json +17 -0
  150. data/app/assets/components/polymer-gestures/conf/karma.conf.js +39 -0
  151. data/app/assets/components/polymer-gestures/package.json +20 -0
  152. data/app/assets/components/polymer-gestures/polymer-gestures.html +21 -0
  153. data/app/assets/components/polymer-gestures/polymer-gestures.js +46 -0
  154. data/app/assets/components/polymer-gestures/src/dispatcher.js +474 -0
  155. data/app/assets/components/polymer-gestures/src/eventFactory.js +127 -0
  156. data/app/assets/components/polymer-gestures/src/hold.js +129 -0
  157. data/app/assets/components/polymer-gestures/src/mouse.js +135 -0
  158. data/app/assets/components/polymer-gestures/src/ms.js +80 -0
  159. data/app/assets/components/polymer-gestures/src/pinch.js +186 -0
  160. data/app/assets/components/polymer-gestures/src/platform-events.js +39 -0
  161. data/app/assets/components/polymer-gestures/src/pointer.js +68 -0
  162. data/app/assets/components/polymer-gestures/src/pointermap.js +67 -0
  163. data/app/assets/components/polymer-gestures/src/scope.js +10 -0
  164. data/app/assets/components/polymer-gestures/src/tap.js +103 -0
  165. data/app/assets/components/polymer-gestures/src/targetfind.js +244 -0
  166. data/app/assets/components/polymer-gestures/src/touch-action.js +60 -0
  167. data/app/assets/components/polymer-gestures/src/touch.js +341 -0
  168. data/app/assets/components/polymer-gestures/src/track.js +230 -0
  169. data/app/assets/components/web-animations-js/web-animations-next-lite.min.js +17 -0
  170. data/app/assets/components/web-animations-js/web-animations-next.min.js +17 -0
  171. data/app/assets/components/web-animations-js/web-animations.min.js +17 -0
  172. data/app/assets/components/webcomponentsjs/CustomElements.js +956 -0
  173. data/app/assets/components/webcomponentsjs/CustomElements.min.js +11 -0
  174. data/app/assets/components/webcomponentsjs/HTMLImports.js +1078 -0
  175. data/app/assets/components/webcomponentsjs/HTMLImports.min.js +11 -0
  176. data/app/assets/components/webcomponentsjs/MutationObserver.js +344 -0
  177. data/app/assets/components/webcomponentsjs/MutationObserver.min.js +11 -0
  178. data/app/assets/components/webcomponentsjs/ShadowDOM.js +4414 -0
  179. data/app/assets/components/webcomponentsjs/ShadowDOM.min.js +15 -0
  180. data/app/assets/components/webcomponentsjs/package.json +31 -0
  181. data/app/assets/components/webcomponentsjs/webcomponents-lite.js +2300 -0
  182. data/app/assets/components/webcomponentsjs/webcomponents-lite.min.js +13 -0
  183. data/app/assets/components/webcomponentsjs/webcomponents.js +7112 -0
  184. data/app/assets/components/webcomponentsjs/webcomponents.min.js +15 -0
  185. data/lib/polymer-paper-elements-rails.rb +2 -0
  186. data/lib/polymer-paper-elements-rails/engine.rb +4 -0
  187. data/lib/polymer-paper-elements-rails/version.rb +3 -0
  188. metadata +272 -0
@@ -0,0 +1,132 @@
1
+ <!--
2
+ @license
3
+ Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
4
+ This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5
+ The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6
+ The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7
+ Code distributed by Google as part of the polymer project is also
8
+ subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9
+ -->
10
+
11
+ <link rel="import" href="../polymer/polymer.html">
12
+ <link rel="import" href="iron-overlay-manager.html">
13
+
14
+ <!--
15
+ `iron-overlay-backdrop` is a backdrop used by `Polymer.IronOverlayBehavior`. It should be a
16
+ singleton.
17
+
18
+ ### Styling
19
+
20
+ The following custom properties and mixins are available for styling.
21
+
22
+ Custom property | Description | Default
23
+ -------------------------------------------|------------------------|---------
24
+ `--iron-overlay-backdrop-background-color` | Backdrop background color | #000
25
+ `--iron-overlay-backdrop-opacity` | Backdrop opacity | 0.6
26
+ `--iron-overlay-backdrop` | Mixin applied to `iron-overlay-backdrop`. | {}
27
+ `--iron-overlay-backdrop-opened` | Mixin applied to `iron-overlay-backdrop` when it is displayed | {}
28
+ -->
29
+
30
+ <dom-module id="iron-overlay-backdrop">
31
+
32
+ <style>
33
+
34
+ :host {
35
+ position: fixed;
36
+ top: 0;
37
+ left: 0;
38
+ width: 100vw;
39
+ height: 100vh;
40
+ background-color: var(--iron-overlay-backdrop-background-color, #000);
41
+ opacity: 0;
42
+ transition: opacity 0.2s;
43
+
44
+ @apply(--iron-overlay-backdrop);
45
+ }
46
+
47
+ :host([opened]) {
48
+ opacity: var(--iron-overlay-backdrop-opacity, 0.6);
49
+
50
+ @apply(--iron-overlay-backdrop-opened);
51
+ }
52
+
53
+ </style>
54
+
55
+ <template>
56
+ <content></content>
57
+ </template>
58
+
59
+ </dom-module>
60
+
61
+ <script>
62
+
63
+ (function() {
64
+
65
+ Polymer({
66
+
67
+ is: 'iron-overlay-backdrop',
68
+
69
+ properties: {
70
+
71
+ /**
72
+ * Returns true if the backdrop is opened.
73
+ */
74
+ opened: {
75
+ readOnly: true,
76
+ reflectToAttribute: true,
77
+ type: Boolean,
78
+ value: false
79
+ },
80
+
81
+ _manager: {
82
+ type: Object,
83
+ value: Polymer.IronOverlayManager
84
+ }
85
+
86
+ },
87
+
88
+ /**
89
+ * Appends the backdrop to document body and sets its `z-index` to be below the latest overlay.
90
+ */
91
+ prepare: function() {
92
+ if (!this.parentNode) {
93
+ Polymer.dom(document.body).appendChild(this);
94
+ this.style.zIndex = this._manager.currentOverlayZ() - 1;
95
+ }
96
+ },
97
+
98
+ /**
99
+ * Shows the backdrop if needed.
100
+ */
101
+ open: function() {
102
+ // only need to make the backdrop visible if this is called by the first overlay with a backdrop
103
+ if (this._manager.getBackdrops().length < 2) {
104
+ this._setOpened(true);
105
+ }
106
+ },
107
+
108
+ /**
109
+ * Hides the backdrop if needed.
110
+ */
111
+ close: function() {
112
+ // only need to make the backdrop invisible if this is called by the last overlay with a backdrop
113
+ if (this._manager.getBackdrops().length < 2) {
114
+ this._setOpened(false);
115
+ }
116
+ },
117
+
118
+ /**
119
+ * Removes the backdrop from document body if needed.
120
+ */
121
+ complete: function() {
122
+ // only remove the backdrop if there are no more overlays with backdrops
123
+ if (this._manager.getBackdrops().length === 0 && this.parentNode) {
124
+ Polymer.dom(this.parentNode).removeChild(this);
125
+ }
126
+ }
127
+
128
+ });
129
+
130
+ })();
131
+
132
+ </script>
@@ -0,0 +1,432 @@
1
+ <!--
2
+ @license
3
+ Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
4
+ This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5
+ The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6
+ The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7
+ Code distributed by Google as part of the polymer project is also
8
+ subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9
+ -->
10
+
11
+ <link rel="import" href="../polymer/polymer.html">
12
+ <link rel="import" href="../iron-fit-behavior/iron-fit-behavior.html">
13
+ <link rel="import" href="../iron-resizable-behavior/iron-resizable-behavior.html">
14
+ <link rel="import" href="iron-overlay-backdrop.html">
15
+ <link rel="import" href="iron-overlay-manager.html">
16
+
17
+ <script>
18
+
19
+ /*
20
+ Use `Polymer.IronOverlayBehavior` to implement an element that can be hidden or shown, and displays
21
+ on top of other content. It includes an optional backdrop, and can be used to implement a variety
22
+ of UI controls including dialogs and drop downs. Multiple overlays may be displayed at once.
23
+
24
+ ### Closing and canceling
25
+
26
+ A dialog may be hidden by closing or canceling. The difference between close and cancel is user
27
+ intent. Closing generally implies that the user acknowledged the content on the overlay. By default,
28
+ it will cancel whenever the user taps outside it or presses the escape key. This behavior is
29
+ configurable with the `no-cancel-on-esc-key` and the `no-cancel-on-outside-click` properties.
30
+ `close()` should be called explicitly by the implementer when the user interacts with a control
31
+ in the overlay element.
32
+
33
+ ### Positioning
34
+
35
+ By default the element is sized and positioned to fit and centered inside the window. You can
36
+ position and size it manually using CSS. See `Polymer.IronFitBehavior`.
37
+
38
+ ### Backdrop
39
+
40
+ Set the `with-backdrop` attribute to display a backdrop behind the overlay. The backdrop is
41
+ appended to `<body>` and is of type `<iron-overlay-backdrop>`. See its doc page for styling
42
+ options.
43
+
44
+ ### Limitations
45
+
46
+ The element is styled to appear on top of other content by setting its `z-index` property. You
47
+ must ensure no element has a stacking context with a higher `z-index` than its parent stacking
48
+ context. You should place this element as a child of `<body>` whenever possible.
49
+
50
+ @demo demo/index.html
51
+ @polymerBehavior Polymer.IronOverlayBehavior
52
+ */
53
+
54
+ Polymer.IronOverlayBehaviorImpl = {
55
+
56
+ properties: {
57
+
58
+ /**
59
+ * True if the overlay is currently displayed.
60
+ */
61
+ opened: {
62
+ observer: '_openedChanged',
63
+ type: Boolean,
64
+ value: false
65
+ },
66
+
67
+ /**
68
+ * True if the overlay was canceled when it was last closed.
69
+ */
70
+ canceled: {
71
+ observer: '_canceledChanged',
72
+ readOnly: true,
73
+ type: Boolean,
74
+ value: false
75
+ },
76
+
77
+ /**
78
+ * Set to true to display a backdrop behind the overlay.
79
+ */
80
+ withBackdrop: {
81
+ type: Boolean,
82
+ value: false
83
+ },
84
+
85
+ /**
86
+ * Set to true to disable auto-focusing the overlay or child nodes with
87
+ * the `autofocus` attribute` when the overlay is opened.
88
+ */
89
+ noAutoFocus: {
90
+ type: Boolean,
91
+ value: false
92
+ },
93
+
94
+ /**
95
+ * Set to true to disable canceling the overlay with the ESC key.
96
+ */
97
+ noCancelOnEscKey: {
98
+ type: Boolean,
99
+ value: false
100
+ },
101
+
102
+ /**
103
+ * Set to true to disable canceling the overlay by clicking outside it.
104
+ */
105
+ noCancelOnOutsideClick: {
106
+ type: Boolean,
107
+ value: false
108
+ },
109
+
110
+ /**
111
+ * Returns the reason this dialog was last closed.
112
+ */
113
+ closingReason: {
114
+ // was a getter before, but needs to be a property so other
115
+ // behaviors can override this.
116
+ type: Object
117
+ },
118
+
119
+ _manager: {
120
+ type: Object,
121
+ value: Polymer.IronOverlayManager
122
+ },
123
+
124
+ _boundOnCaptureClick: {
125
+ type: Function,
126
+ value: function() {
127
+ return this._onCaptureClick.bind(this);
128
+ }
129
+ },
130
+
131
+ _boundOnCaptureKeydown: {
132
+ type: Function,
133
+ value: function() {
134
+ return this._onCaptureKeydown.bind(this);
135
+ }
136
+ }
137
+
138
+ },
139
+
140
+ listeners: {
141
+ 'click': '_onClick',
142
+ 'iron-resize': '_onIronResize'
143
+ },
144
+
145
+ /**
146
+ * The backdrop element.
147
+ * @type Node
148
+ */
149
+ get backdropElement() {
150
+ return this._backdrop;
151
+ },
152
+
153
+ get _focusNode() {
154
+ return Polymer.dom(this).querySelector('[autofocus]') || this;
155
+ },
156
+
157
+ registered: function() {
158
+ this._backdrop = document.createElement('iron-overlay-backdrop');
159
+ },
160
+
161
+ ready: function() {
162
+ this._ensureSetup();
163
+ if (this._callOpenedWhenReady) {
164
+ this._openedChanged();
165
+ }
166
+ },
167
+
168
+ detached: function() {
169
+ this.opened = false;
170
+ this._completeBackdrop();
171
+ this._manager.removeOverlay(this);
172
+ },
173
+
174
+ /**
175
+ * Toggle the opened state of the overlay.
176
+ */
177
+ toggle: function() {
178
+ this.opened = !this.opened;
179
+ },
180
+
181
+ /**
182
+ * Open the overlay.
183
+ */
184
+ open: function() {
185
+ this.opened = true;
186
+ this.closingReason = {canceled: false};
187
+ },
188
+
189
+ /**
190
+ * Close the overlay.
191
+ */
192
+ close: function() {
193
+ this.opened = false;
194
+ this._setCanceled(false);
195
+ },
196
+
197
+ /**
198
+ * Cancels the overlay.
199
+ */
200
+ cancel: function() {
201
+ this.opened = false,
202
+ this._setCanceled(true);
203
+ },
204
+
205
+ _ensureSetup: function() {
206
+ if (this._overlaySetup) {
207
+ return;
208
+ }
209
+ this._overlaySetup = true;
210
+ this.style.outline = 'none';
211
+ this.style.display = 'none';
212
+ },
213
+
214
+ _openedChanged: function() {
215
+ if (this.opened) {
216
+ this.removeAttribute('aria-hidden');
217
+ } else {
218
+ this.setAttribute('aria-hidden', 'true');
219
+ }
220
+
221
+ // wait to call after ready only if we're initially open
222
+ if (!this._overlaySetup) {
223
+ this._callOpenedWhenReady = this.opened;
224
+ return;
225
+ }
226
+ if (this._openChangedAsync) {
227
+ this.cancelAsync(this._openChangedAsync);
228
+ }
229
+
230
+ this._toggleListeners();
231
+
232
+ if (this.opened) {
233
+ this._prepareRenderOpened();
234
+ }
235
+
236
+ // async here to allow overlay layer to become visible.
237
+ this._openChangedAsync = this.async(function() {
238
+ // overlay becomes visible here
239
+ this.style.display = '';
240
+ // force layout to ensure transitions will go
241
+ this.offsetWidth;
242
+ if (this.opened) {
243
+ this._renderOpened();
244
+ } else {
245
+ this._renderClosed();
246
+ }
247
+ this._openChangedAsync = null;
248
+ });
249
+
250
+ },
251
+
252
+ _canceledChanged: function() {
253
+ this.closingReason = this.closingReason || {};
254
+ this.closingReason.canceled = this.canceled;
255
+ },
256
+
257
+ _toggleListener: function(enable, node, event, boundListener, capture) {
258
+ if (enable) {
259
+ node.addEventListener(event, boundListener, capture);
260
+ } else {
261
+ node.removeEventListener(event, boundListener, capture);
262
+ }
263
+ },
264
+
265
+ _toggleListeners: function() {
266
+ if (this._toggleListenersAsync) {
267
+ this.cancelAsync(this._toggleListenersAsync);
268
+ }
269
+ // async so we don't auto-close immediately via a click.
270
+ this._toggleListenersAsync = this.async(function() {
271
+ this._toggleListener(this.opened, document, 'click', this._boundOnCaptureClick, true);
272
+ this._toggleListener(this.opened, document, 'keydown', this._boundOnCaptureKeydown, true);
273
+ this._toggleListenersAsync = null;
274
+ });
275
+ },
276
+
277
+ // tasks which must occur before opening; e.g. making the element visible
278
+ _prepareRenderOpened: function() {
279
+ this._manager.addOverlay(this);
280
+
281
+ if (this.withBackdrop) {
282
+ this.backdropElement.prepare();
283
+ this._manager.trackBackdrop(this);
284
+ }
285
+
286
+ this._preparePositioning();
287
+ this.fit();
288
+ this._finishPositioning();
289
+ },
290
+
291
+ // tasks which cause the overlay to actually open; typically play an
292
+ // animation
293
+ _renderOpened: function() {
294
+ if (this.withBackdrop) {
295
+ this.backdropElement.open();
296
+ }
297
+ this._finishRenderOpened();
298
+ },
299
+
300
+ _renderClosed: function() {
301
+ if (this.withBackdrop) {
302
+ this.backdropElement.close();
303
+ }
304
+ this._finishRenderClosed();
305
+ },
306
+
307
+ _onTransitionend: function(event) {
308
+ // make sure this is our transition event.
309
+ if (event && event.target !== this) {
310
+ return;
311
+ }
312
+ if (this.opened) {
313
+ this._finishRenderOpened();
314
+ } else {
315
+ this._finishRenderClosed();
316
+ }
317
+ },
318
+
319
+ _finishRenderOpened: function() {
320
+ // focus the child node with [autofocus]
321
+ if (!this.noAutoFocus) {
322
+ this._focusNode.focus();
323
+ }
324
+
325
+ this.fire('iron-overlay-opened');
326
+
327
+ this._squelchNextResize = true;
328
+ this.async(this.notifyResize);
329
+ },
330
+
331
+ _finishRenderClosed: function() {
332
+ // hide the overlay and remove the backdrop
333
+ this.resetFit();
334
+ this.style.display = 'none';
335
+ this._completeBackdrop();
336
+ this._manager.removeOverlay(this);
337
+
338
+ this._focusNode.blur();
339
+ // focus the next overlay, if there is one
340
+ this._manager.focusOverlay();
341
+
342
+ this.fire('iron-overlay-closed', this.closingReason);
343
+
344
+ this._squelchNextResize = true;
345
+ this.async(this.notifyResize);
346
+ },
347
+
348
+ _completeBackdrop: function() {
349
+ if (this.withBackdrop) {
350
+ this._manager.trackBackdrop(this);
351
+ this.backdropElement.complete();
352
+ }
353
+ },
354
+
355
+ _preparePositioning: function() {
356
+ this.style.transition = this.style.webkitTransition = 'none';
357
+ this.style.transform = this.style.webkitTransform = 'none';
358
+ this.style.display = '';
359
+ },
360
+
361
+ _finishPositioning: function(target) {
362
+ this.style.display = 'none';
363
+ this.style.transform = this.style.webkitTransform = '';
364
+ // force layout to avoid application of transform
365
+ this.offsetWidth;
366
+ this.style.transition = this.style.webkitTransition = '';
367
+ },
368
+
369
+ _applyFocus: function() {
370
+ if (this.opened) {
371
+ if (!this.noAutoFocus) {
372
+ this._focusNode.focus();
373
+ }
374
+ } else {
375
+ this._focusNode.blur();
376
+ this._manager.focusOverlay();
377
+ }
378
+ },
379
+
380
+ _onCaptureClick: function(event) {
381
+ // attempt to close asynchronously and prevent the close of a tap event is immediately heard
382
+ // on target. This is because in shadow dom due to event retargetting event.target is not
383
+ // useful.
384
+ if (!this.noCancelOnOutsideClick && (this._manager.currentOverlay() == this)) {
385
+ this._cancelJob = this.async(function() {
386
+ this.cancel();
387
+ }, 10);
388
+ }
389
+ },
390
+
391
+ _onClick: function(event) {
392
+ if (this._cancelJob) {
393
+ this.cancelAsync(this._cancelJob);
394
+ this._cancelJob = null;
395
+ }
396
+ },
397
+
398
+ _onCaptureKeydown: function(event) {
399
+ var ESC = 27;
400
+ if (!this.noCancelOnEscKey && (event.keyCode === ESC)) {
401
+ this.cancel();
402
+ event.stopPropagation();
403
+ }
404
+ },
405
+
406
+ _onIronResize: function() {
407
+ if (this._squelchNextResize) {
408
+ this._squelchNextResize = false;
409
+ return;
410
+ }
411
+ if (this.opened) {
412
+ this.refit();
413
+ }
414
+ }
415
+
416
+ };
417
+
418
+ /** @polymerBehavior */
419
+ Polymer.IronOverlayBehavior = [Polymer.IronFitBehavior, Polymer.IronResizableBehavior, Polymer.IronOverlayBehaviorImpl];
420
+
421
+ /*
422
+ * Fired after the `iron-overlay` opens.
423
+ * @event iron-overlay-opened
424
+ */
425
+
426
+ /*
427
+ * Fired after the `iron-overlay` closes.
428
+ * @event iron-overlay-closed {{canceled: boolean}} detail -
429
+ * canceled: True if the overlay was canceled.
430
+ */
431
+
432
+ </script>