polymer-paper-elements-rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
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,102 @@
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
+
13
+ <script>
14
+
15
+ /** @polymerBehavior */
16
+
17
+ Polymer.IronControlState = {
18
+
19
+ properties: {
20
+
21
+ /**
22
+ * If true, the element currently has focus.
23
+ *
24
+ * @attribute focused
25
+ * @type boolean
26
+ * @default false
27
+ */
28
+ focused: {
29
+ type: Boolean,
30
+ value: false,
31
+ notify: true,
32
+ readOnly: true,
33
+ reflectToAttribute: true
34
+ },
35
+
36
+ /**
37
+ * If true, the user cannot interact with this element.
38
+ *
39
+ * @attribute disabled
40
+ * @type boolean
41
+ * @default false
42
+ */
43
+ disabled: {
44
+ type: Boolean,
45
+ value: false,
46
+ notify: true,
47
+ observer: '_disabledChanged',
48
+ reflectToAttribute: true
49
+ },
50
+
51
+ _oldTabIndex: {
52
+ type: Number
53
+ }
54
+ },
55
+
56
+ observers: [
57
+ '_changedControlState(focused, disabled)'
58
+ ],
59
+
60
+ listeners: {
61
+ focus: '_focusHandler',
62
+ blur: '_blurHandler'
63
+ },
64
+
65
+ ready: function() {
66
+ // TODO(sjmiles): ensure read-only property is valued so the compound
67
+ // observer will fire
68
+ if (this.focused === undefined) {
69
+ this._setFocused(false);
70
+ }
71
+ },
72
+
73
+ _focusHandler: function() {
74
+ this._setFocused(true);
75
+ },
76
+
77
+ _blurHandler: function() {
78
+ this._setFocused(false);
79
+ },
80
+
81
+ _disabledChanged: function(disabled, old) {
82
+ this.setAttribute('aria-disabled', disabled ? 'true' : 'false');
83
+ this.style.pointerEvents = disabled ? 'none' : '';
84
+ if (disabled) {
85
+ this._oldTabIndex = this.tabIndex;
86
+ this.focused = false;
87
+ this.tabIndex = -1;
88
+ } else if (this._oldTabIndex !== undefined) {
89
+ this.tabIndex = this._oldTabIndex;
90
+ }
91
+ },
92
+
93
+ _changedControlState: function() {
94
+ // _controlStateChanged is abstract, follow-on behaviors may implement it
95
+ if (this._controlStateChanged) {
96
+ this._controlStateChanged();
97
+ }
98
+ }
99
+
100
+ };
101
+
102
+ </script>
@@ -0,0 +1,230 @@
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
+
13
+ <script>
14
+
15
+ /**
16
+ Polymer.IronFitBehavior fits an element in another element using `max-height` and `max-width`, and
17
+ optionally centers it in the window or another element.
18
+
19
+ The element will only be sized and/or positioned if it has not already been sized and/or positioned
20
+ by CSS.
21
+
22
+ CSS properties | Action
23
+ -----------------------------|-------------------------------------------
24
+ `position` set | Element is not centered horizontally or vertically
25
+ `top` or `bottom` set | Element is not vertically centered
26
+ `left` or `right` set | Element is not horizontally centered
27
+ `max-height` or `height` set | Element respects `max-height` or `height`
28
+ `max-width` or `width` set | Element respects `max-width` or `width`
29
+
30
+ @demo demo/index.html
31
+ @polymerBehavior
32
+ */
33
+
34
+ Polymer.IronFitBehavior = {
35
+
36
+ properties: {
37
+
38
+ /**
39
+ * The element that will receive a `max-height`/`width`. By default it is the same as `this`,
40
+ * but it can be set to a child element. This is useful, for example, for implementing a
41
+ * scrolling region inside the element.
42
+ */
43
+ sizingTarget: {
44
+ type: Object,
45
+ value: function() {
46
+ return this;
47
+ }
48
+ },
49
+
50
+ /**
51
+ * The element to fit `this` into.
52
+ */
53
+ fitInto: {
54
+ type: Object,
55
+ value: window
56
+ },
57
+
58
+ /**
59
+ * Set to true to auto-fit on attach.
60
+ */
61
+ autoFitOnAttach: {
62
+ type: Boolean,
63
+ value: false
64
+ },
65
+
66
+ _fitInfo: {
67
+ type: Object
68
+ }
69
+
70
+ },
71
+
72
+ get _fitWidth() {
73
+ var fitWidth;
74
+ if (this.fitInto === window) {
75
+ fitWidth = this.fitInto.innerWidth;
76
+ } else {
77
+ fitWidth = this.fitInto.getBoundingClientRect().width;
78
+ }
79
+ return fitWidth;
80
+ },
81
+
82
+ get _fitHeight() {
83
+ var fitHeight;
84
+ if (this.fitInto === window) {
85
+ fitHeight = this.fitInto.innerHeight;
86
+ } else {
87
+ fitHeight = this.fitInto.getBoundingClientRect().height;
88
+ }
89
+ return fitHeight;
90
+ },
91
+
92
+ attached: function() {
93
+ if (this.autoFitOnAttach) {
94
+ if (window.getComputedStyle(this).display === 'none') {
95
+ setTimeout(function() {
96
+ this.fit();
97
+ }.bind(this));
98
+ } else {
99
+ this.fit();
100
+ }
101
+ }
102
+ },
103
+
104
+ /**
105
+ * Fits and optionally centers the element into the window, or `fitInfo` if specified.
106
+ */
107
+ fit: function() {
108
+ this._discoverInfo();
109
+ this.constrain();
110
+ this.center();
111
+ },
112
+
113
+ /**
114
+ * Memoize information needed to position and size the target element.
115
+ */
116
+ _discoverInfo: function() {
117
+ if (this._fitInfo) {
118
+ return;
119
+ }
120
+ var target = window.getComputedStyle(this);
121
+ var sizer = window.getComputedStyle(this.sizingTarget);
122
+ this._fitInfo = {
123
+ positionedBy: {
124
+ vertically: target.top !== 'auto' ? 'top' : (target.bottom !== 'auto' ?
125
+ 'bottom' : null),
126
+ horizontally: target.left !== 'auto' ? 'left' : (target.right !== 'auto' ?
127
+ 'right' : null),
128
+ css: target.position
129
+ },
130
+ sizedBy: {
131
+ height: sizer.maxHeight !== 'none',
132
+ width: sizer.maxWidth !== 'none'
133
+ },
134
+ margin: {
135
+ top: parseInt(target.marginTop, 10) || 0,
136
+ right: parseInt(target.marginRight, 10) || 0,
137
+ bottom: parseInt(target.marginBottom, 10) || 0,
138
+ left: parseInt(target.marginLeft, 10) || 0
139
+ }
140
+ };
141
+ },
142
+
143
+ /**
144
+ * Resets the target element's position and size constraints, and clear
145
+ * the memoized data.
146
+ */
147
+ resetFit: function() {
148
+ if (!this._fitInfo || !this._fitInfo.sizedBy.height) {
149
+ this.sizingTarget.style.maxHeight = '';
150
+ this.style.top = '';
151
+ }
152
+ if (!this._fitInfo || !this._fitInfo.sizedBy.width) {
153
+ this.sizingTarget.style.maxWidth = '';
154
+ this.style.left = '';
155
+ }
156
+ if (this._fitInfo) {
157
+ this.style.position = this._fitInfo.positionedBy.css;
158
+ }
159
+ this._fitInfo = null;
160
+ },
161
+
162
+ /**
163
+ * Equivalent to calling `resetFit()` and `fit()`. Useful to call this after the element,
164
+ * the window, or the `fitInfo` element has been resized.
165
+ */
166
+ refit: function() {
167
+ this.resetFit();
168
+ this.fit();
169
+ },
170
+
171
+ /**
172
+ * Constrains the size of the element to the window or `fitInfo` by setting `max-height`
173
+ * and/or `max-width`.
174
+ */
175
+ constrain: function() {
176
+ var info = this._fitInfo;
177
+ // position at (0px, 0px) if not already positioned, so we can measure the natural size.
178
+ if (!this._fitInfo.positionedBy.vertically) {
179
+ this.style.top = '0px';
180
+ }
181
+ if (!this._fitInfo.positionedBy.horizontally) {
182
+ this.style.left = '0px';
183
+ }
184
+ // need border-box for margin/padding
185
+ this.sizingTarget.style.boxSizing = 'border-box';
186
+ // constrain the width and height if not already set
187
+ var rect = this.getBoundingClientRect();
188
+ if (!info.sizedBy.height) {
189
+ this._sizeDimension(rect, info.positionedBy.vertically, 'top', 'bottom', 'Height');
190
+ }
191
+ if (!info.sizedBy.width) {
192
+ this._sizeDimension(rect, info.positionedBy.horizontally, 'left', 'right', 'Width');
193
+ }
194
+ },
195
+
196
+ _sizeDimension: function(rect, positionedBy, start, end, extent) {
197
+ var info = this._fitInfo;
198
+ var max = extent === 'Width' ? this._fitWidth : this._fitHeight;
199
+ var flip = (positionedBy === end);
200
+ var offset = flip ? max - rect[end] : rect[start];
201
+ var margin = info.margin[flip ? start : end];
202
+ var offsetExtent = 'offset' + extent;
203
+ var sizingOffset = this[offsetExtent] - this.sizingTarget[offsetExtent];
204
+ this.sizingTarget.style['max' + extent] = (max - margin - offset - sizingOffset) + 'px';
205
+ },
206
+
207
+ /**
208
+ * Centers horizontally and vertically if not already positioned. This also sets
209
+ * `position:fixed`.
210
+ */
211
+ center: function() {
212
+ if (!this._fitInfo.positionedBy.vertically || !this._fitInfo.positionedBy.horizontally) {
213
+ // need position:fixed to center
214
+ this.style.position = 'fixed';
215
+ }
216
+ if (!this._fitInfo.positionedBy.vertically) {
217
+ var top = (this._fitHeight - this.offsetHeight) / 2;
218
+ top -= this._fitInfo.margin.top;
219
+ this.style.top = top + 'px';
220
+ }
221
+ if (!this._fitInfo.positionedBy.horizontally) {
222
+ var left = (this._fitWidth - this.offsetWidth) / 2;
223
+ left -= this._fitInfo.margin.left;
224
+ this.style.left = left + 'px';
225
+ }
226
+ }
227
+
228
+ };
229
+
230
+ </script>
@@ -0,0 +1,307 @@
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="iron-shadow-flex-layout.html">
12
+
13
+ <style>
14
+
15
+ /*******************************
16
+ Flex Layout
17
+ *******************************/
18
+
19
+ .layout.horizontal,
20
+ .layout.horizontal-reverse,
21
+ .layout.vertical,
22
+ .layout.vertical-reverse {
23
+ display: -ms-flexbox;
24
+ display: -webkit-flex;
25
+ display: flex;
26
+ }
27
+
28
+ .layout.inline {
29
+ display: -ms-inline-flexbox;
30
+ display: -webkit-inline-flex;
31
+ display: inline-flex;
32
+ }
33
+
34
+ .layout.horizontal {
35
+ -ms-flex-direction: row;
36
+ -webkit-flex-direction: row;
37
+ flex-direction: row;
38
+ }
39
+
40
+ .layout.horizontal-reverse {
41
+ -ms-flex-direction: row-reverse;
42
+ -webkit-flex-direction: row-reverse;
43
+ flex-direction: row-reverse;
44
+ }
45
+
46
+ .layout.vertical {
47
+ -ms-flex-direction: column;
48
+ -webkit-flex-direction: column;
49
+ flex-direction: column;
50
+ }
51
+
52
+ .layout.vertical-reverse {
53
+ -ms-flex-direction: column-reverse;
54
+ -webkit-flex-direction: column-reverse;
55
+ flex-direction: column-reverse;
56
+ }
57
+
58
+ .layout.wrap {
59
+ -ms-flex-wrap: wrap;
60
+ -webkit-flex-wrap: wrap;
61
+ flex-wrap: wrap;
62
+ }
63
+
64
+ .layout.wrap-reverse {
65
+ -ms-flex-wrap: wrap-reverse;
66
+ -webkit-flex-wrap: wrap-reverse;
67
+ flex-wrap: wrap-reverse;
68
+ }
69
+
70
+ .flex-auto {
71
+ -ms-flex: 1 1 auto;
72
+ -webkit-flex: 1 1 auto;
73
+ flex: 1 1 auto;
74
+ }
75
+
76
+ .flex-none {
77
+ -ms-flex: none;
78
+ -webkit-flex: none;
79
+ flex: none;
80
+ }
81
+
82
+ .flex,
83
+ .flex-1 {
84
+ -ms-flex: 1;
85
+ -webkit-flex: 1;
86
+ flex: 1;
87
+ }
88
+
89
+ .flex-2 {
90
+ -ms-flex: 2;
91
+ -webkit-flex: 2;
92
+ flex: 2;
93
+ }
94
+
95
+ .flex-3 {
96
+ -ms-flex: 3;
97
+ -webkit-flex: 3;
98
+ flex: 3;
99
+ }
100
+
101
+ .flex-4 {
102
+ -ms-flex: 4;
103
+ -webkit-flex: 4;
104
+ flex: 4;
105
+ }
106
+
107
+ .flex-5 {
108
+ -ms-flex: 5;
109
+ -webkit-flex: 5;
110
+ flex: 5;
111
+ }
112
+
113
+ .flex-6 {
114
+ -ms-flex: 6;
115
+ -webkit-flex: 6;
116
+ flex: 6;
117
+ }
118
+
119
+ .flex-7 {
120
+ -ms-flex: 7;
121
+ -webkit-flex: 7;
122
+ flex: 7;
123
+ }
124
+
125
+ .flex-8 {
126
+ -ms-flex: 8;
127
+ -webkit-flex: 8;
128
+ flex: 8;
129
+ }
130
+
131
+ .flex-9 {
132
+ -ms-flex: 9;
133
+ -webkit-flex: 9;
134
+ flex: 9;
135
+ }
136
+
137
+ .flex-10 {
138
+ -ms-flex: 10;
139
+ -webkit-flex: 10;
140
+ flex: 10;
141
+ }
142
+
143
+ .flex-11 {
144
+ -ms-flex: 11;
145
+ -webkit-flex: 11;
146
+ flex: 11;
147
+ }
148
+
149
+ .flex-12 {
150
+ -ms-flex: 12;
151
+ -webkit-flex: 12;
152
+ flex: 12;
153
+ }
154
+
155
+ /* alignment in cross axis */
156
+
157
+ .layout.start {
158
+ -ms-flex-align: start;
159
+ -webkit-align-items: flex-start;
160
+ align-items: flex-start;
161
+ }
162
+
163
+ .layout.center,
164
+ .layout.center-center {
165
+ -ms-flex-align: center;
166
+ -webkit-align-items: center;
167
+ align-items: center;
168
+ }
169
+
170
+ .layout.end {
171
+ -ms-flex-align: end;
172
+ -webkit-align-items: flex-end;
173
+ align-items: flex-end;
174
+ }
175
+
176
+ /* alignment in main axis */
177
+
178
+ .layout.start-justified {
179
+ -ms-flex-pack: start;
180
+ -webkit-justify-content: flex-start;
181
+ justify-content: flex-start;
182
+ }
183
+
184
+ .layout.center-justified,
185
+ .layout.center-center {
186
+ -ms-flex-pack: center;
187
+ -webkit-justify-content: center;
188
+ justify-content: center;
189
+ }
190
+
191
+ .layout.end-justified {
192
+ -ms-flex-pack: end;
193
+ -webkit-justify-content: flex-end;
194
+ justify-content: flex-end;
195
+ }
196
+
197
+ .layout.around-justified {
198
+ -ms-flex-pack: around;
199
+ -webkit-justify-content: space-around;
200
+ justify-content: space-around;
201
+ }
202
+
203
+ .layout.justified {
204
+ -ms-flex-pack: justify;
205
+ -webkit-justify-content: space-between;
206
+ justify-content: space-between;
207
+ }
208
+
209
+ /* self alignment */
210
+
211
+ .self-start {
212
+ -ms-align-self: flex-start;
213
+ -webkit-align-self: flex-start;
214
+ align-self: flex-start;
215
+ }
216
+
217
+ .self-center {
218
+ -ms-align-self: center;
219
+ -webkit-align-self: center;
220
+ align-self: center;
221
+ }
222
+
223
+ .self-end {
224
+ -ms-align-self: flex-end;
225
+ -webkit-align-self: flex-end;
226
+ align-self: flex-end;
227
+ }
228
+
229
+ .self-stretch {
230
+ -ms-align-self: stretch;
231
+ -webkit-align-self: stretch;
232
+ align-self: stretch;
233
+ }
234
+
235
+ /*******************************
236
+ Other Layout
237
+ *******************************/
238
+
239
+ .block {
240
+ display: block;
241
+ }
242
+
243
+ /* IE 10 support for HTML5 hidden attr */
244
+ [hidden] {
245
+ display: none !important;
246
+ }
247
+
248
+ .invisible {
249
+ visibility: hidden !important;
250
+ }
251
+
252
+ .relative {
253
+ position: relative;
254
+ }
255
+
256
+ .fit {
257
+ position: absolute;
258
+ top: 0;
259
+ right: 0;
260
+ bottom: 0;
261
+ left: 0;
262
+ }
263
+
264
+ body.fullbleed {
265
+ margin: 0;
266
+ height: 100vh;
267
+ }
268
+
269
+ .scroll {
270
+ -webkit-overflow-scrolling: touch;
271
+ overflow: auto;
272
+ }
273
+
274
+ /* fixed position */
275
+
276
+ .fixed-bottom,
277
+ .fixed-left,
278
+ .fixed-right,
279
+ .fixed-top {
280
+ position: fixed;
281
+ }
282
+
283
+ .fixed-top {
284
+ top: 0;
285
+ left: 0;
286
+ right: 0;
287
+ }
288
+
289
+ .fixed-right {
290
+ top: 0;
291
+ right: 0;
292
+ bottom: 0;
293
+ }
294
+
295
+ .fixed-bottom {
296
+ right: 0;
297
+ bottom: 0;
298
+ left: 0;
299
+ }
300
+
301
+ .fixed-left {
302
+ top: 0;
303
+ bottom: 0;
304
+ left: 0;
305
+ }
306
+
307
+ </style>