codepipeline 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (202) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +3 -0
  3. data/Gemfile.lock +7 -7
  4. data/codepipe.gemspec +5 -1
  5. data/lib/codepipe/version.rb +1 -1
  6. data/vendor/aws_data/Gemfile +4 -0
  7. data/vendor/aws_data/Gemfile.lock +48 -0
  8. data/{docs/LICENSE → vendor/aws_data/LICENSE.txt} +4 -4
  9. data/vendor/aws_data/README.md +41 -0
  10. data/vendor/aws_data/Rakefile +6 -0
  11. data/vendor/aws_data/aws_data.gemspec +30 -0
  12. data/vendor/aws_data/bin/console +14 -0
  13. data/vendor/aws_data/bin/setup +8 -0
  14. data/vendor/aws_data/lib/aws_data.rb +89 -0
  15. data/vendor/aws_data/lib/aws_data/version.rb +3 -0
  16. data/vendor/aws_data/spec/aws_data_spec.rb +5 -0
  17. data/vendor/aws_data/spec/spec_helper.rb +14 -0
  18. data/vendor/cfn-status/Gemfile +4 -0
  19. data/vendor/cfn-status/Gemfile.lock +49 -0
  20. data/vendor/cfn-status/LICENSE.txt +21 -0
  21. data/vendor/cfn-status/README.md +56 -0
  22. data/vendor/cfn-status/Rakefile +6 -0
  23. data/vendor/cfn-status/bin/console +14 -0
  24. data/vendor/cfn-status/bin/setup +8 -0
  25. data/vendor/cfn-status/cfn-status.gemspec +30 -0
  26. data/vendor/cfn-status/lib/cfn/aws_service.rb +56 -0
  27. data/vendor/cfn-status/lib/cfn/status.rb +220 -0
  28. data/vendor/cfn-status/lib/cfn/status/version.rb +5 -0
  29. data/vendor/cfn-status/spec/cfn/status_spec.rb +81 -0
  30. data/vendor/cfn-status/spec/fixtures/cfn/stack-events-complete.json +1080 -0
  31. data/vendor/cfn-status/spec/fixtures/cfn/stack-events-in-progress.json +1080 -0
  32. data/vendor/cfn-status/spec/fixtures/cfn/stack-events-update-rollback-complete.json +1086 -0
  33. data/vendor/cfn-status/spec/spec_helper.rb +14 -0
  34. data/vendor/cfn_camelizer/CHANGELOG.md +10 -0
  35. data/vendor/cfn_camelizer/Gemfile +4 -0
  36. data/vendor/cfn_camelizer/LICENSE.txt +21 -0
  37. data/vendor/cfn_camelizer/README.md +40 -0
  38. data/vendor/cfn_camelizer/Rakefile +6 -0
  39. data/vendor/cfn_camelizer/bin/console +14 -0
  40. data/vendor/cfn_camelizer/bin/setup +8 -0
  41. data/vendor/cfn_camelizer/cfn_camelizer.gemspec +32 -0
  42. data/vendor/cfn_camelizer/lib/camelizer.yml +27 -0
  43. data/vendor/cfn_camelizer/lib/cfn_camelizer.rb +92 -0
  44. data/vendor/cfn_camelizer/lib/cfn_camelizer/version.rb +3 -0
  45. data/vendor/cfn_camelizer/spec/cfn_camelizer_spec.rb +79 -0
  46. data/vendor/cfn_camelizer/spec/spec_helper.rb +14 -0
  47. metadata +44 -171
  48. data/docs/.gitignore +0 -4
  49. data/docs/CNAME +0 -1
  50. data/docs/Gemfile +0 -3
  51. data/docs/README.md +0 -25
  52. data/docs/_config.yml +0 -73
  53. data/docs/_docs/contributing.md +0 -99
  54. data/docs/_docs/conventions.md +0 -42
  55. data/docs/_docs/deploy.md +0 -59
  56. data/docs/_docs/dsl.md +0 -39
  57. data/docs/_docs/dsl/approve.md +0 -62
  58. data/docs/_docs/dsl/pipeline.md +0 -55
  59. data/docs/_docs/dsl/pipeline/action.md +0 -28
  60. data/docs/_docs/dsl/pipeline/codebuild.md +0 -62
  61. data/docs/_docs/dsl/pipeline/prefix-and-suffix.md +0 -57
  62. data/docs/_docs/dsl/role.md +0 -79
  63. data/docs/_docs/dsl/schedule.md +0 -29
  64. data/docs/_docs/dsl/sns.md +0 -27
  65. data/docs/_docs/dsl/webhook.md +0 -31
  66. data/docs/_docs/ecs-deploy.md +0 -22
  67. data/docs/_docs/examples/codebuild-project.md +0 -21
  68. data/docs/_docs/examples/different-branches.md +0 -49
  69. data/docs/_docs/examples/multiple-codebuild-projects.md +0 -60
  70. data/docs/_docs/install.md +0 -14
  71. data/docs/_docs/next-steps.md +0 -16
  72. data/docs/_docs/settings.md +0 -34
  73. data/docs/_docs/start.md +0 -31
  74. data/docs/_docs/structure.md +0 -25
  75. data/docs/_includes/commands.html +0 -92
  76. data/docs/_includes/content.html +0 -25
  77. data/docs/_includes/edit-on-github.html +0 -9
  78. data/docs/_includes/example.html +0 -12
  79. data/docs/_includes/footer.html +0 -41
  80. data/docs/_includes/google_analytics.html +0 -10
  81. data/docs/_includes/head.html +0 -45
  82. data/docs/_includes/js.html +0 -15
  83. data/docs/_includes/nav.html +0 -17
  84. data/docs/_includes/prev_next.md +0 -19
  85. data/docs/_includes/reference.md +0 -1
  86. data/docs/_includes/subnav.html +0 -47
  87. data/docs/_includes/tutorials.md +0 -38
  88. data/docs/_layouts/default.html +0 -12
  89. data/docs/_reference/pipe-completion.md +0 -44
  90. data/docs/_reference/pipe-completion_script.md +0 -25
  91. data/docs/_reference/pipe-delete.md +0 -25
  92. data/docs/_reference/pipe-deploy.md +0 -26
  93. data/docs/_reference/pipe-init.md +0 -25
  94. data/docs/_reference/pipe-start.md +0 -25
  95. data/docs/_reference/pipe-version.md +0 -21
  96. data/docs/_sass/_bootstrap-overrides.scss +0 -40
  97. data/docs/_sass/_contact.scss +0 -49
  98. data/docs/_sass/_cta.scss +0 -37
  99. data/docs/_sass/_download.scss +0 -31
  100. data/docs/_sass/_features.scss +0 -47
  101. data/docs/_sass/_footer.scss +0 -49
  102. data/docs/_sass/_global.scss +0 -102
  103. data/docs/_sass/_main.scss +0 -370
  104. data/docs/_sass/_masthead.scss +0 -70
  105. data/docs/_sass/_mixins.scss +0 -79
  106. data/docs/_sass/_navbar.scss +0 -92
  107. data/docs/_sass/_syntax.scss +0 -65
  108. data/docs/_sass/_table.scss +0 -34
  109. data/docs/_sass/_timeline.scss +0 -207
  110. data/docs/_sass/_variables.scss +0 -24
  111. data/docs/bin/web +0 -8
  112. data/docs/docs.md +0 -24
  113. data/docs/img/docs/codepipeline-output.png +0 -0
  114. data/docs/img/docs/multiple-codebuild-projects-pipeline.png +0 -0
  115. data/docs/img/logos/boltops-logo-full.png +0 -0
  116. data/docs/img/logos/boltops-logo.png +0 -0
  117. data/docs/img/logos/project-logo.png +0 -0
  118. data/docs/index.html +0 -37
  119. data/docs/js/nav.js +0 -39
  120. data/docs/js/new-age.js +0 -38
  121. data/docs/js/new-age.min.js +0 -6
  122. data/docs/new-age.scss +0 -20
  123. data/docs/quick-start.md +0 -72
  124. data/docs/reference.md +0 -12
  125. data/docs/support.md +0 -22
  126. data/docs/vendor/bootstrap/css/bootstrap-grid.css +0 -1339
  127. data/docs/vendor/bootstrap/css/bootstrap-grid.css.map +0 -1
  128. data/docs/vendor/bootstrap/css/bootstrap-grid.min.css +0 -1
  129. data/docs/vendor/bootstrap/css/bootstrap-grid.min.css.map +0 -1
  130. data/docs/vendor/bootstrap/css/bootstrap-reboot.css +0 -459
  131. data/docs/vendor/bootstrap/css/bootstrap-reboot.css.map +0 -1
  132. data/docs/vendor/bootstrap/css/bootstrap-reboot.min.css +0 -1
  133. data/docs/vendor/bootstrap/css/bootstrap-reboot.min.css.map +0 -1
  134. data/docs/vendor/bootstrap/css/bootstrap.css +0 -9320
  135. data/docs/vendor/bootstrap/css/bootstrap.css.map +0 -1
  136. data/docs/vendor/bootstrap/css/bootstrap.min.css +0 -6
  137. data/docs/vendor/bootstrap/css/bootstrap.min.css.map +0 -1
  138. data/docs/vendor/bootstrap/js/bootstrap.js +0 -3535
  139. data/docs/vendor/bootstrap/js/bootstrap.min.js +0 -7
  140. data/docs/vendor/font-awesome/css/font-awesome.css +0 -2337
  141. data/docs/vendor/font-awesome/css/font-awesome.min.css +0 -4
  142. data/docs/vendor/font-awesome/fonts/FontAwesome.otf +0 -0
  143. data/docs/vendor/font-awesome/fonts/fontawesome-webfont.eot +0 -0
  144. data/docs/vendor/font-awesome/fonts/fontawesome-webfont.svg +0 -2671
  145. data/docs/vendor/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
  146. data/docs/vendor/font-awesome/fonts/fontawesome-webfont.woff +0 -0
  147. data/docs/vendor/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
  148. data/docs/vendor/font-awesome/less/animated.less +0 -34
  149. data/docs/vendor/font-awesome/less/bordered-pulled.less +0 -25
  150. data/docs/vendor/font-awesome/less/core.less +0 -12
  151. data/docs/vendor/font-awesome/less/fixed-width.less +0 -6
  152. data/docs/vendor/font-awesome/less/font-awesome.less +0 -18
  153. data/docs/vendor/font-awesome/less/icons.less +0 -789
  154. data/docs/vendor/font-awesome/less/larger.less +0 -13
  155. data/docs/vendor/font-awesome/less/list.less +0 -19
  156. data/docs/vendor/font-awesome/less/mixins.less +0 -60
  157. data/docs/vendor/font-awesome/less/path.less +0 -15
  158. data/docs/vendor/font-awesome/less/rotated-flipped.less +0 -20
  159. data/docs/vendor/font-awesome/less/screen-reader.less +0 -5
  160. data/docs/vendor/font-awesome/less/stacked.less +0 -20
  161. data/docs/vendor/font-awesome/less/variables.less +0 -799
  162. data/docs/vendor/font-awesome/scss/_animated.scss +0 -34
  163. data/docs/vendor/font-awesome/scss/_bordered-pulled.scss +0 -25
  164. data/docs/vendor/font-awesome/scss/_core.scss +0 -12
  165. data/docs/vendor/font-awesome/scss/_fixed-width.scss +0 -6
  166. data/docs/vendor/font-awesome/scss/_icons.scss +0 -789
  167. data/docs/vendor/font-awesome/scss/_larger.scss +0 -13
  168. data/docs/vendor/font-awesome/scss/_list.scss +0 -19
  169. data/docs/vendor/font-awesome/scss/_mixins.scss +0 -60
  170. data/docs/vendor/font-awesome/scss/_path.scss +0 -15
  171. data/docs/vendor/font-awesome/scss/_rotated-flipped.scss +0 -20
  172. data/docs/vendor/font-awesome/scss/_screen-reader.scss +0 -5
  173. data/docs/vendor/font-awesome/scss/_stacked.scss +0 -20
  174. data/docs/vendor/font-awesome/scss/_variables.scss +0 -799
  175. data/docs/vendor/font-awesome/scss/font-awesome.scss +0 -18
  176. data/docs/vendor/jquery-easing/jquery.easing.compatibility.js +0 -59
  177. data/docs/vendor/jquery-easing/jquery.easing.js +0 -166
  178. data/docs/vendor/jquery-easing/jquery.easing.min.js +0 -1
  179. data/docs/vendor/jquery/jquery.js +0 -10253
  180. data/docs/vendor/jquery/jquery.min.js +0 -4
  181. data/docs/vendor/simple-line-icons/css/simple-line-icons.css +0 -778
  182. data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.eot +0 -0
  183. data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.svg +0 -200
  184. data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.ttf +0 -0
  185. data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.woff +0 -0
  186. data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.woff2 +0 -0
  187. data/docs/vendor/simple-line-icons/less/simple-line-icons.less +0 -982
  188. data/docs/vendor/simple-line-icons/scss/simple-line-icons.scss +0 -979
  189. data/docs/vendor/tether/tether.js +0 -1811
  190. data/docs/vendor/tether/tether.min.js +0 -1
  191. data/spec/fixtures/app/.codepipeline/pipeline.rb +0 -12
  192. data/spec/fixtures/app/.codepipeline/schedule.rb +0 -1
  193. data/spec/fixtures/app/.codepipeline/webhook.rb +0 -1
  194. data/spec/fixtures/pipelines/approve.rb +0 -22
  195. data/spec/fixtures/pipelines/approve_existing_sns.rb +0 -24
  196. data/spec/lib/cli_spec.rb +0 -18
  197. data/spec/lib/pipeline/approve_spec.rb +0 -32
  198. data/spec/lib/pipeline_spec.rb +0 -12
  199. data/spec/lib/role_spec.rb +0 -12
  200. data/spec/lib/schedule_spec.rb +0 -12
  201. data/spec/lib/webhook_spec.rb +0 -12
  202. data/spec/spec_helper.rb +0 -35
@@ -1,1811 +0,0 @@
1
- /*! tether 1.4.0 */
2
-
3
- (function(root, factory) {
4
- if (typeof define === 'function' && define.amd) {
5
- define(factory);
6
- } else if (typeof exports === 'object') {
7
- module.exports = factory(require, exports, module);
8
- } else {
9
- root.Tether = factory();
10
- }
11
- }(this, function(require, exports, module) {
12
-
13
- 'use strict';
14
-
15
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
16
-
17
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
18
-
19
- var TetherBase = undefined;
20
- if (typeof TetherBase === 'undefined') {
21
- TetherBase = { modules: [] };
22
- }
23
-
24
- var zeroElement = null;
25
-
26
- // Same as native getBoundingClientRect, except it takes into account parent <frame> offsets
27
- // if the element lies within a nested document (<frame> or <iframe>-like).
28
- function getActualBoundingClientRect(node) {
29
- var boundingRect = node.getBoundingClientRect();
30
-
31
- // The original object returned by getBoundingClientRect is immutable, so we clone it
32
- // We can't use extend because the properties are not considered part of the object by hasOwnProperty in IE9
33
- var rect = {};
34
- for (var k in boundingRect) {
35
- rect[k] = boundingRect[k];
36
- }
37
-
38
- if (node.ownerDocument !== document) {
39
- var _frameElement = node.ownerDocument.defaultView.frameElement;
40
- if (_frameElement) {
41
- var frameRect = getActualBoundingClientRect(_frameElement);
42
- rect.top += frameRect.top;
43
- rect.bottom += frameRect.top;
44
- rect.left += frameRect.left;
45
- rect.right += frameRect.left;
46
- }
47
- }
48
-
49
- return rect;
50
- }
51
-
52
- function getScrollParents(el) {
53
- // In firefox if the el is inside an iframe with display: none; window.getComputedStyle() will return null;
54
- // https://bugzilla.mozilla.org/show_bug.cgi?id=548397
55
- var computedStyle = getComputedStyle(el) || {};
56
- var position = computedStyle.position;
57
- var parents = [];
58
-
59
- if (position === 'fixed') {
60
- return [el];
61
- }
62
-
63
- var parent = el;
64
- while ((parent = parent.parentNode) && parent && parent.nodeType === 1) {
65
- var style = undefined;
66
- try {
67
- style = getComputedStyle(parent);
68
- } catch (err) {}
69
-
70
- if (typeof style === 'undefined' || style === null) {
71
- parents.push(parent);
72
- return parents;
73
- }
74
-
75
- var _style = style;
76
- var overflow = _style.overflow;
77
- var overflowX = _style.overflowX;
78
- var overflowY = _style.overflowY;
79
-
80
- if (/(auto|scroll)/.test(overflow + overflowY + overflowX)) {
81
- if (position !== 'absolute' || ['relative', 'absolute', 'fixed'].indexOf(style.position) >= 0) {
82
- parents.push(parent);
83
- }
84
- }
85
- }
86
-
87
- parents.push(el.ownerDocument.body);
88
-
89
- // If the node is within a frame, account for the parent window scroll
90
- if (el.ownerDocument !== document) {
91
- parents.push(el.ownerDocument.defaultView);
92
- }
93
-
94
- return parents;
95
- }
96
-
97
- var uniqueId = (function () {
98
- var id = 0;
99
- return function () {
100
- return ++id;
101
- };
102
- })();
103
-
104
- var zeroPosCache = {};
105
- var getOrigin = function getOrigin() {
106
- // getBoundingClientRect is unfortunately too accurate. It introduces a pixel or two of
107
- // jitter as the user scrolls that messes with our ability to detect if two positions
108
- // are equivilant or not. We place an element at the top left of the page that will
109
- // get the same jitter, so we can cancel the two out.
110
- var node = zeroElement;
111
- if (!node || !document.body.contains(node)) {
112
- node = document.createElement('div');
113
- node.setAttribute('data-tether-id', uniqueId());
114
- extend(node.style, {
115
- top: 0,
116
- left: 0,
117
- position: 'absolute'
118
- });
119
-
120
- document.body.appendChild(node);
121
-
122
- zeroElement = node;
123
- }
124
-
125
- var id = node.getAttribute('data-tether-id');
126
- if (typeof zeroPosCache[id] === 'undefined') {
127
- zeroPosCache[id] = getActualBoundingClientRect(node);
128
-
129
- // Clear the cache when this position call is done
130
- defer(function () {
131
- delete zeroPosCache[id];
132
- });
133
- }
134
-
135
- return zeroPosCache[id];
136
- };
137
-
138
- function removeUtilElements() {
139
- if (zeroElement) {
140
- document.body.removeChild(zeroElement);
141
- }
142
- zeroElement = null;
143
- };
144
-
145
- function getBounds(el) {
146
- var doc = undefined;
147
- if (el === document) {
148
- doc = document;
149
- el = document.documentElement;
150
- } else {
151
- doc = el.ownerDocument;
152
- }
153
-
154
- var docEl = doc.documentElement;
155
-
156
- var box = getActualBoundingClientRect(el);
157
-
158
- var origin = getOrigin();
159
-
160
- box.top -= origin.top;
161
- box.left -= origin.left;
162
-
163
- if (typeof box.width === 'undefined') {
164
- box.width = document.body.scrollWidth - box.left - box.right;
165
- }
166
- if (typeof box.height === 'undefined') {
167
- box.height = document.body.scrollHeight - box.top - box.bottom;
168
- }
169
-
170
- box.top = box.top - docEl.clientTop;
171
- box.left = box.left - docEl.clientLeft;
172
- box.right = doc.body.clientWidth - box.width - box.left;
173
- box.bottom = doc.body.clientHeight - box.height - box.top;
174
-
175
- return box;
176
- }
177
-
178
- function getOffsetParent(el) {
179
- return el.offsetParent || document.documentElement;
180
- }
181
-
182
- var _scrollBarSize = null;
183
- function getScrollBarSize() {
184
- if (_scrollBarSize) {
185
- return _scrollBarSize;
186
- }
187
- var inner = document.createElement('div');
188
- inner.style.width = '100%';
189
- inner.style.height = '200px';
190
-
191
- var outer = document.createElement('div');
192
- extend(outer.style, {
193
- position: 'absolute',
194
- top: 0,
195
- left: 0,
196
- pointerEvents: 'none',
197
- visibility: 'hidden',
198
- width: '200px',
199
- height: '150px',
200
- overflow: 'hidden'
201
- });
202
-
203
- outer.appendChild(inner);
204
-
205
- document.body.appendChild(outer);
206
-
207
- var widthContained = inner.offsetWidth;
208
- outer.style.overflow = 'scroll';
209
- var widthScroll = inner.offsetWidth;
210
-
211
- if (widthContained === widthScroll) {
212
- widthScroll = outer.clientWidth;
213
- }
214
-
215
- document.body.removeChild(outer);
216
-
217
- var width = widthContained - widthScroll;
218
-
219
- _scrollBarSize = { width: width, height: width };
220
- return _scrollBarSize;
221
- }
222
-
223
- function extend() {
224
- var out = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
225
-
226
- var args = [];
227
-
228
- Array.prototype.push.apply(args, arguments);
229
-
230
- args.slice(1).forEach(function (obj) {
231
- if (obj) {
232
- for (var key in obj) {
233
- if (({}).hasOwnProperty.call(obj, key)) {
234
- out[key] = obj[key];
235
- }
236
- }
237
- }
238
- });
239
-
240
- return out;
241
- }
242
-
243
- function removeClass(el, name) {
244
- if (typeof el.classList !== 'undefined') {
245
- name.split(' ').forEach(function (cls) {
246
- if (cls.trim()) {
247
- el.classList.remove(cls);
248
- }
249
- });
250
- } else {
251
- var regex = new RegExp('(^| )' + name.split(' ').join('|') + '( |$)', 'gi');
252
- var className = getClassName(el).replace(regex, ' ');
253
- setClassName(el, className);
254
- }
255
- }
256
-
257
- function addClass(el, name) {
258
- if (typeof el.classList !== 'undefined') {
259
- name.split(' ').forEach(function (cls) {
260
- if (cls.trim()) {
261
- el.classList.add(cls);
262
- }
263
- });
264
- } else {
265
- removeClass(el, name);
266
- var cls = getClassName(el) + (' ' + name);
267
- setClassName(el, cls);
268
- }
269
- }
270
-
271
- function hasClass(el, name) {
272
- if (typeof el.classList !== 'undefined') {
273
- return el.classList.contains(name);
274
- }
275
- var className = getClassName(el);
276
- return new RegExp('(^| )' + name + '( |$)', 'gi').test(className);
277
- }
278
-
279
- function getClassName(el) {
280
- // Can't use just SVGAnimatedString here since nodes within a Frame in IE have
281
- // completely separately SVGAnimatedString base classes
282
- if (el.className instanceof el.ownerDocument.defaultView.SVGAnimatedString) {
283
- return el.className.baseVal;
284
- }
285
- return el.className;
286
- }
287
-
288
- function setClassName(el, className) {
289
- el.setAttribute('class', className);
290
- }
291
-
292
- function updateClasses(el, add, all) {
293
- // Of the set of 'all' classes, we need the 'add' classes, and only the
294
- // 'add' classes to be set.
295
- all.forEach(function (cls) {
296
- if (add.indexOf(cls) === -1 && hasClass(el, cls)) {
297
- removeClass(el, cls);
298
- }
299
- });
300
-
301
- add.forEach(function (cls) {
302
- if (!hasClass(el, cls)) {
303
- addClass(el, cls);
304
- }
305
- });
306
- }
307
-
308
- var deferred = [];
309
-
310
- var defer = function defer(fn) {
311
- deferred.push(fn);
312
- };
313
-
314
- var flush = function flush() {
315
- var fn = undefined;
316
- while (fn = deferred.pop()) {
317
- fn();
318
- }
319
- };
320
-
321
- var Evented = (function () {
322
- function Evented() {
323
- _classCallCheck(this, Evented);
324
- }
325
-
326
- _createClass(Evented, [{
327
- key: 'on',
328
- value: function on(event, handler, ctx) {
329
- var once = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3];
330
-
331
- if (typeof this.bindings === 'undefined') {
332
- this.bindings = {};
333
- }
334
- if (typeof this.bindings[event] === 'undefined') {
335
- this.bindings[event] = [];
336
- }
337
- this.bindings[event].push({ handler: handler, ctx: ctx, once: once });
338
- }
339
- }, {
340
- key: 'once',
341
- value: function once(event, handler, ctx) {
342
- this.on(event, handler, ctx, true);
343
- }
344
- }, {
345
- key: 'off',
346
- value: function off(event, handler) {
347
- if (typeof this.bindings === 'undefined' || typeof this.bindings[event] === 'undefined') {
348
- return;
349
- }
350
-
351
- if (typeof handler === 'undefined') {
352
- delete this.bindings[event];
353
- } else {
354
- var i = 0;
355
- while (i < this.bindings[event].length) {
356
- if (this.bindings[event][i].handler === handler) {
357
- this.bindings[event].splice(i, 1);
358
- } else {
359
- ++i;
360
- }
361
- }
362
- }
363
- }
364
- }, {
365
- key: 'trigger',
366
- value: function trigger(event) {
367
- if (typeof this.bindings !== 'undefined' && this.bindings[event]) {
368
- var i = 0;
369
-
370
- for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
371
- args[_key - 1] = arguments[_key];
372
- }
373
-
374
- while (i < this.bindings[event].length) {
375
- var _bindings$event$i = this.bindings[event][i];
376
- var handler = _bindings$event$i.handler;
377
- var ctx = _bindings$event$i.ctx;
378
- var once = _bindings$event$i.once;
379
-
380
- var context = ctx;
381
- if (typeof context === 'undefined') {
382
- context = this;
383
- }
384
-
385
- handler.apply(context, args);
386
-
387
- if (once) {
388
- this.bindings[event].splice(i, 1);
389
- } else {
390
- ++i;
391
- }
392
- }
393
- }
394
- }
395
- }]);
396
-
397
- return Evented;
398
- })();
399
-
400
- TetherBase.Utils = {
401
- getActualBoundingClientRect: getActualBoundingClientRect,
402
- getScrollParents: getScrollParents,
403
- getBounds: getBounds,
404
- getOffsetParent: getOffsetParent,
405
- extend: extend,
406
- addClass: addClass,
407
- removeClass: removeClass,
408
- hasClass: hasClass,
409
- updateClasses: updateClasses,
410
- defer: defer,
411
- flush: flush,
412
- uniqueId: uniqueId,
413
- Evented: Evented,
414
- getScrollBarSize: getScrollBarSize,
415
- removeUtilElements: removeUtilElements
416
- };
417
- /* globals TetherBase, performance */
418
-
419
- 'use strict';
420
-
421
- var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();
422
-
423
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
424
-
425
- var _get = function get(_x6, _x7, _x8) { var _again = true; _function: while (_again) { var object = _x6, property = _x7, receiver = _x8; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x6 = parent; _x7 = property; _x8 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
426
-
427
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
428
-
429
- function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
430
-
431
- if (typeof TetherBase === 'undefined') {
432
- throw new Error('You must include the utils.js file before tether.js');
433
- }
434
-
435
- var _TetherBase$Utils = TetherBase.Utils;
436
- var getScrollParents = _TetherBase$Utils.getScrollParents;
437
- var getBounds = _TetherBase$Utils.getBounds;
438
- var getOffsetParent = _TetherBase$Utils.getOffsetParent;
439
- var extend = _TetherBase$Utils.extend;
440
- var addClass = _TetherBase$Utils.addClass;
441
- var removeClass = _TetherBase$Utils.removeClass;
442
- var updateClasses = _TetherBase$Utils.updateClasses;
443
- var defer = _TetherBase$Utils.defer;
444
- var flush = _TetherBase$Utils.flush;
445
- var getScrollBarSize = _TetherBase$Utils.getScrollBarSize;
446
- var removeUtilElements = _TetherBase$Utils.removeUtilElements;
447
-
448
- function within(a, b) {
449
- var diff = arguments.length <= 2 || arguments[2] === undefined ? 1 : arguments[2];
450
-
451
- return a + diff >= b && b >= a - diff;
452
- }
453
-
454
- var transformKey = (function () {
455
- if (typeof document === 'undefined') {
456
- return '';
457
- }
458
- var el = document.createElement('div');
459
-
460
- var transforms = ['transform', 'WebkitTransform', 'OTransform', 'MozTransform', 'msTransform'];
461
- for (var i = 0; i < transforms.length; ++i) {
462
- var key = transforms[i];
463
- if (el.style[key] !== undefined) {
464
- return key;
465
- }
466
- }
467
- })();
468
-
469
- var tethers = [];
470
-
471
- var position = function position() {
472
- tethers.forEach(function (tether) {
473
- tether.position(false);
474
- });
475
- flush();
476
- };
477
-
478
- function now() {
479
- if (typeof performance !== 'undefined' && typeof performance.now !== 'undefined') {
480
- return performance.now();
481
- }
482
- return +new Date();
483
- }
484
-
485
- (function () {
486
- var lastCall = null;
487
- var lastDuration = null;
488
- var pendingTimeout = null;
489
-
490
- var tick = function tick() {
491
- if (typeof lastDuration !== 'undefined' && lastDuration > 16) {
492
- // We voluntarily throttle ourselves if we can't manage 60fps
493
- lastDuration = Math.min(lastDuration - 16, 250);
494
-
495
- // Just in case this is the last event, remember to position just once more
496
- pendingTimeout = setTimeout(tick, 250);
497
- return;
498
- }
499
-
500
- if (typeof lastCall !== 'undefined' && now() - lastCall < 10) {
501
- // Some browsers call events a little too frequently, refuse to run more than is reasonable
502
- return;
503
- }
504
-
505
- if (pendingTimeout != null) {
506
- clearTimeout(pendingTimeout);
507
- pendingTimeout = null;
508
- }
509
-
510
- lastCall = now();
511
- position();
512
- lastDuration = now() - lastCall;
513
- };
514
-
515
- if (typeof window !== 'undefined' && typeof window.addEventListener !== 'undefined') {
516
- ['resize', 'scroll', 'touchmove'].forEach(function (event) {
517
- window.addEventListener(event, tick);
518
- });
519
- }
520
- })();
521
-
522
- var MIRROR_LR = {
523
- center: 'center',
524
- left: 'right',
525
- right: 'left'
526
- };
527
-
528
- var MIRROR_TB = {
529
- middle: 'middle',
530
- top: 'bottom',
531
- bottom: 'top'
532
- };
533
-
534
- var OFFSET_MAP = {
535
- top: 0,
536
- left: 0,
537
- middle: '50%',
538
- center: '50%',
539
- bottom: '100%',
540
- right: '100%'
541
- };
542
-
543
- var autoToFixedAttachment = function autoToFixedAttachment(attachment, relativeToAttachment) {
544
- var left = attachment.left;
545
- var top = attachment.top;
546
-
547
- if (left === 'auto') {
548
- left = MIRROR_LR[relativeToAttachment.left];
549
- }
550
-
551
- if (top === 'auto') {
552
- top = MIRROR_TB[relativeToAttachment.top];
553
- }
554
-
555
- return { left: left, top: top };
556
- };
557
-
558
- var attachmentToOffset = function attachmentToOffset(attachment) {
559
- var left = attachment.left;
560
- var top = attachment.top;
561
-
562
- if (typeof OFFSET_MAP[attachment.left] !== 'undefined') {
563
- left = OFFSET_MAP[attachment.left];
564
- }
565
-
566
- if (typeof OFFSET_MAP[attachment.top] !== 'undefined') {
567
- top = OFFSET_MAP[attachment.top];
568
- }
569
-
570
- return { left: left, top: top };
571
- };
572
-
573
- function addOffset() {
574
- var out = { top: 0, left: 0 };
575
-
576
- for (var _len = arguments.length, offsets = Array(_len), _key = 0; _key < _len; _key++) {
577
- offsets[_key] = arguments[_key];
578
- }
579
-
580
- offsets.forEach(function (_ref) {
581
- var top = _ref.top;
582
- var left = _ref.left;
583
-
584
- if (typeof top === 'string') {
585
- top = parseFloat(top, 10);
586
- }
587
- if (typeof left === 'string') {
588
- left = parseFloat(left, 10);
589
- }
590
-
591
- out.top += top;
592
- out.left += left;
593
- });
594
-
595
- return out;
596
- }
597
-
598
- function offsetToPx(offset, size) {
599
- if (typeof offset.left === 'string' && offset.left.indexOf('%') !== -1) {
600
- offset.left = parseFloat(offset.left, 10) / 100 * size.width;
601
- }
602
- if (typeof offset.top === 'string' && offset.top.indexOf('%') !== -1) {
603
- offset.top = parseFloat(offset.top, 10) / 100 * size.height;
604
- }
605
-
606
- return offset;
607
- }
608
-
609
- var parseOffset = function parseOffset(value) {
610
- var _value$split = value.split(' ');
611
-
612
- var _value$split2 = _slicedToArray(_value$split, 2);
613
-
614
- var top = _value$split2[0];
615
- var left = _value$split2[1];
616
-
617
- return { top: top, left: left };
618
- };
619
- var parseAttachment = parseOffset;
620
-
621
- var TetherClass = (function (_Evented) {
622
- _inherits(TetherClass, _Evented);
623
-
624
- function TetherClass(options) {
625
- var _this = this;
626
-
627
- _classCallCheck(this, TetherClass);
628
-
629
- _get(Object.getPrototypeOf(TetherClass.prototype), 'constructor', this).call(this);
630
- this.position = this.position.bind(this);
631
-
632
- tethers.push(this);
633
-
634
- this.history = [];
635
-
636
- this.setOptions(options, false);
637
-
638
- TetherBase.modules.forEach(function (module) {
639
- if (typeof module.initialize !== 'undefined') {
640
- module.initialize.call(_this);
641
- }
642
- });
643
-
644
- this.position();
645
- }
646
-
647
- _createClass(TetherClass, [{
648
- key: 'getClass',
649
- value: function getClass() {
650
- var key = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];
651
- var classes = this.options.classes;
652
-
653
- if (typeof classes !== 'undefined' && classes[key]) {
654
- return this.options.classes[key];
655
- } else if (this.options.classPrefix) {
656
- return this.options.classPrefix + '-' + key;
657
- } else {
658
- return key;
659
- }
660
- }
661
- }, {
662
- key: 'setOptions',
663
- value: function setOptions(options) {
664
- var _this2 = this;
665
-
666
- var pos = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1];
667
-
668
- var defaults = {
669
- offset: '0 0',
670
- targetOffset: '0 0',
671
- targetAttachment: 'auto auto',
672
- classPrefix: 'tether'
673
- };
674
-
675
- this.options = extend(defaults, options);
676
-
677
- var _options = this.options;
678
- var element = _options.element;
679
- var target = _options.target;
680
- var targetModifier = _options.targetModifier;
681
-
682
- this.element = element;
683
- this.target = target;
684
- this.targetModifier = targetModifier;
685
-
686
- if (this.target === 'viewport') {
687
- this.target = document.body;
688
- this.targetModifier = 'visible';
689
- } else if (this.target === 'scroll-handle') {
690
- this.target = document.body;
691
- this.targetModifier = 'scroll-handle';
692
- }
693
-
694
- ['element', 'target'].forEach(function (key) {
695
- if (typeof _this2[key] === 'undefined') {
696
- throw new Error('Tether Error: Both element and target must be defined');
697
- }
698
-
699
- if (typeof _this2[key].jquery !== 'undefined') {
700
- _this2[key] = _this2[key][0];
701
- } else if (typeof _this2[key] === 'string') {
702
- _this2[key] = document.querySelector(_this2[key]);
703
- }
704
- });
705
-
706
- addClass(this.element, this.getClass('element'));
707
- if (!(this.options.addTargetClasses === false)) {
708
- addClass(this.target, this.getClass('target'));
709
- }
710
-
711
- if (!this.options.attachment) {
712
- throw new Error('Tether Error: You must provide an attachment');
713
- }
714
-
715
- this.targetAttachment = parseAttachment(this.options.targetAttachment);
716
- this.attachment = parseAttachment(this.options.attachment);
717
- this.offset = parseOffset(this.options.offset);
718
- this.targetOffset = parseOffset(this.options.targetOffset);
719
-
720
- if (typeof this.scrollParents !== 'undefined') {
721
- this.disable();
722
- }
723
-
724
- if (this.targetModifier === 'scroll-handle') {
725
- this.scrollParents = [this.target];
726
- } else {
727
- this.scrollParents = getScrollParents(this.target);
728
- }
729
-
730
- if (!(this.options.enabled === false)) {
731
- this.enable(pos);
732
- }
733
- }
734
- }, {
735
- key: 'getTargetBounds',
736
- value: function getTargetBounds() {
737
- if (typeof this.targetModifier !== 'undefined') {
738
- if (this.targetModifier === 'visible') {
739
- if (this.target === document.body) {
740
- return { top: pageYOffset, left: pageXOffset, height: innerHeight, width: innerWidth };
741
- } else {
742
- var bounds = getBounds(this.target);
743
-
744
- var out = {
745
- height: bounds.height,
746
- width: bounds.width,
747
- top: bounds.top,
748
- left: bounds.left
749
- };
750
-
751
- out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top));
752
- out.height = Math.min(out.height, bounds.height - (bounds.top + bounds.height - (pageYOffset + innerHeight)));
753
- out.height = Math.min(innerHeight, out.height);
754
- out.height -= 2;
755
-
756
- out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left));
757
- out.width = Math.min(out.width, bounds.width - (bounds.left + bounds.width - (pageXOffset + innerWidth)));
758
- out.width = Math.min(innerWidth, out.width);
759
- out.width -= 2;
760
-
761
- if (out.top < pageYOffset) {
762
- out.top = pageYOffset;
763
- }
764
- if (out.left < pageXOffset) {
765
- out.left = pageXOffset;
766
- }
767
-
768
- return out;
769
- }
770
- } else if (this.targetModifier === 'scroll-handle') {
771
- var bounds = undefined;
772
- var target = this.target;
773
- if (target === document.body) {
774
- target = document.documentElement;
775
-
776
- bounds = {
777
- left: pageXOffset,
778
- top: pageYOffset,
779
- height: innerHeight,
780
- width: innerWidth
781
- };
782
- } else {
783
- bounds = getBounds(target);
784
- }
785
-
786
- var style = getComputedStyle(target);
787
-
788
- var hasBottomScroll = target.scrollWidth > target.clientWidth || [style.overflow, style.overflowX].indexOf('scroll') >= 0 || this.target !== document.body;
789
-
790
- var scrollBottom = 0;
791
- if (hasBottomScroll) {
792
- scrollBottom = 15;
793
- }
794
-
795
- var height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom;
796
-
797
- var out = {
798
- width: 15,
799
- height: height * 0.975 * (height / target.scrollHeight),
800
- left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15
801
- };
802
-
803
- var fitAdj = 0;
804
- if (height < 408 && this.target === document.body) {
805
- fitAdj = -0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58;
806
- }
807
-
808
- if (this.target !== document.body) {
809
- out.height = Math.max(out.height, 24);
810
- }
811
-
812
- var scrollPercentage = this.target.scrollTop / (target.scrollHeight - height);
813
- out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth);
814
-
815
- if (this.target === document.body) {
816
- out.height = Math.max(out.height, 24);
817
- }
818
-
819
- return out;
820
- }
821
- } else {
822
- return getBounds(this.target);
823
- }
824
- }
825
- }, {
826
- key: 'clearCache',
827
- value: function clearCache() {
828
- this._cache = {};
829
- }
830
- }, {
831
- key: 'cache',
832
- value: function cache(k, getter) {
833
- // More than one module will often need the same DOM info, so
834
- // we keep a cache which is cleared on each position call
835
- if (typeof this._cache === 'undefined') {
836
- this._cache = {};
837
- }
838
-
839
- if (typeof this._cache[k] === 'undefined') {
840
- this._cache[k] = getter.call(this);
841
- }
842
-
843
- return this._cache[k];
844
- }
845
- }, {
846
- key: 'enable',
847
- value: function enable() {
848
- var _this3 = this;
849
-
850
- var pos = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
851
-
852
- if (!(this.options.addTargetClasses === false)) {
853
- addClass(this.target, this.getClass('enabled'));
854
- }
855
- addClass(this.element, this.getClass('enabled'));
856
- this.enabled = true;
857
-
858
- this.scrollParents.forEach(function (parent) {
859
- if (parent !== _this3.target.ownerDocument) {
860
- parent.addEventListener('scroll', _this3.position);
861
- }
862
- });
863
-
864
- if (pos) {
865
- this.position();
866
- }
867
- }
868
- }, {
869
- key: 'disable',
870
- value: function disable() {
871
- var _this4 = this;
872
-
873
- removeClass(this.target, this.getClass('enabled'));
874
- removeClass(this.element, this.getClass('enabled'));
875
- this.enabled = false;
876
-
877
- if (typeof this.scrollParents !== 'undefined') {
878
- this.scrollParents.forEach(function (parent) {
879
- parent.removeEventListener('scroll', _this4.position);
880
- });
881
- }
882
- }
883
- }, {
884
- key: 'destroy',
885
- value: function destroy() {
886
- var _this5 = this;
887
-
888
- this.disable();
889
-
890
- tethers.forEach(function (tether, i) {
891
- if (tether === _this5) {
892
- tethers.splice(i, 1);
893
- }
894
- });
895
-
896
- // Remove any elements we were using for convenience from the DOM
897
- if (tethers.length === 0) {
898
- removeUtilElements();
899
- }
900
- }
901
- }, {
902
- key: 'updateAttachClasses',
903
- value: function updateAttachClasses(elementAttach, targetAttach) {
904
- var _this6 = this;
905
-
906
- elementAttach = elementAttach || this.attachment;
907
- targetAttach = targetAttach || this.targetAttachment;
908
- var sides = ['left', 'top', 'bottom', 'right', 'middle', 'center'];
909
-
910
- if (typeof this._addAttachClasses !== 'undefined' && this._addAttachClasses.length) {
911
- // updateAttachClasses can be called more than once in a position call, so
912
- // we need to clean up after ourselves such that when the last defer gets
913
- // ran it doesn't add any extra classes from previous calls.
914
- this._addAttachClasses.splice(0, this._addAttachClasses.length);
915
- }
916
-
917
- if (typeof this._addAttachClasses === 'undefined') {
918
- this._addAttachClasses = [];
919
- }
920
- var add = this._addAttachClasses;
921
-
922
- if (elementAttach.top) {
923
- add.push(this.getClass('element-attached') + '-' + elementAttach.top);
924
- }
925
- if (elementAttach.left) {
926
- add.push(this.getClass('element-attached') + '-' + elementAttach.left);
927
- }
928
- if (targetAttach.top) {
929
- add.push(this.getClass('target-attached') + '-' + targetAttach.top);
930
- }
931
- if (targetAttach.left) {
932
- add.push(this.getClass('target-attached') + '-' + targetAttach.left);
933
- }
934
-
935
- var all = [];
936
- sides.forEach(function (side) {
937
- all.push(_this6.getClass('element-attached') + '-' + side);
938
- all.push(_this6.getClass('target-attached') + '-' + side);
939
- });
940
-
941
- defer(function () {
942
- if (!(typeof _this6._addAttachClasses !== 'undefined')) {
943
- return;
944
- }
945
-
946
- updateClasses(_this6.element, _this6._addAttachClasses, all);
947
- if (!(_this6.options.addTargetClasses === false)) {
948
- updateClasses(_this6.target, _this6._addAttachClasses, all);
949
- }
950
-
951
- delete _this6._addAttachClasses;
952
- });
953
- }
954
- }, {
955
- key: 'position',
956
- value: function position() {
957
- var _this7 = this;
958
-
959
- var flushChanges = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
960
-
961
- // flushChanges commits the changes immediately, leave true unless you are positioning multiple
962
- // tethers (in which case call Tether.Utils.flush yourself when you're done)
963
-
964
- if (!this.enabled) {
965
- return;
966
- }
967
-
968
- this.clearCache();
969
-
970
- // Turn 'auto' attachments into the appropriate corner or edge
971
- var targetAttachment = autoToFixedAttachment(this.targetAttachment, this.attachment);
972
-
973
- this.updateAttachClasses(this.attachment, targetAttachment);
974
-
975
- var elementPos = this.cache('element-bounds', function () {
976
- return getBounds(_this7.element);
977
- });
978
-
979
- var width = elementPos.width;
980
- var height = elementPos.height;
981
-
982
- if (width === 0 && height === 0 && typeof this.lastSize !== 'undefined') {
983
- var _lastSize = this.lastSize;
984
-
985
- // We cache the height and width to make it possible to position elements that are
986
- // getting hidden.
987
- width = _lastSize.width;
988
- height = _lastSize.height;
989
- } else {
990
- this.lastSize = { width: width, height: height };
991
- }
992
-
993
- var targetPos = this.cache('target-bounds', function () {
994
- return _this7.getTargetBounds();
995
- });
996
- var targetSize = targetPos;
997
-
998
- // Get an actual px offset from the attachment
999
- var offset = offsetToPx(attachmentToOffset(this.attachment), { width: width, height: height });
1000
- var targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize);
1001
-
1002
- var manualOffset = offsetToPx(this.offset, { width: width, height: height });
1003
- var manualTargetOffset = offsetToPx(this.targetOffset, targetSize);
1004
-
1005
- // Add the manually provided offset
1006
- offset = addOffset(offset, manualOffset);
1007
- targetOffset = addOffset(targetOffset, manualTargetOffset);
1008
-
1009
- // It's now our goal to make (element position + offset) == (target position + target offset)
1010
- var left = targetPos.left + targetOffset.left - offset.left;
1011
- var top = targetPos.top + targetOffset.top - offset.top;
1012
-
1013
- for (var i = 0; i < TetherBase.modules.length; ++i) {
1014
- var _module2 = TetherBase.modules[i];
1015
- var ret = _module2.position.call(this, {
1016
- left: left,
1017
- top: top,
1018
- targetAttachment: targetAttachment,
1019
- targetPos: targetPos,
1020
- elementPos: elementPos,
1021
- offset: offset,
1022
- targetOffset: targetOffset,
1023
- manualOffset: manualOffset,
1024
- manualTargetOffset: manualTargetOffset,
1025
- scrollbarSize: scrollbarSize,
1026
- attachment: this.attachment
1027
- });
1028
-
1029
- if (ret === false) {
1030
- return false;
1031
- } else if (typeof ret === 'undefined' || typeof ret !== 'object') {
1032
- continue;
1033
- } else {
1034
- top = ret.top;
1035
- left = ret.left;
1036
- }
1037
- }
1038
-
1039
- // We describe the position three different ways to give the optimizer
1040
- // a chance to decide the best possible way to position the element
1041
- // with the fewest repaints.
1042
- var next = {
1043
- // It's position relative to the page (absolute positioning when
1044
- // the element is a child of the body)
1045
- page: {
1046
- top: top,
1047
- left: left
1048
- },
1049
-
1050
- // It's position relative to the viewport (fixed positioning)
1051
- viewport: {
1052
- top: top - pageYOffset,
1053
- bottom: pageYOffset - top - height + innerHeight,
1054
- left: left - pageXOffset,
1055
- right: pageXOffset - left - width + innerWidth
1056
- }
1057
- };
1058
-
1059
- var doc = this.target.ownerDocument;
1060
- var win = doc.defaultView;
1061
-
1062
- var scrollbarSize = undefined;
1063
- if (win.innerHeight > doc.documentElement.clientHeight) {
1064
- scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
1065
- next.viewport.bottom -= scrollbarSize.height;
1066
- }
1067
-
1068
- if (win.innerWidth > doc.documentElement.clientWidth) {
1069
- scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
1070
- next.viewport.right -= scrollbarSize.width;
1071
- }
1072
-
1073
- if (['', 'static'].indexOf(doc.body.style.position) === -1 || ['', 'static'].indexOf(doc.body.parentElement.style.position) === -1) {
1074
- // Absolute positioning in the body will be relative to the page, not the 'initial containing block'
1075
- next.page.bottom = doc.body.scrollHeight - top - height;
1076
- next.page.right = doc.body.scrollWidth - left - width;
1077
- }
1078
-
1079
- if (typeof this.options.optimizations !== 'undefined' && this.options.optimizations.moveElement !== false && !(typeof this.targetModifier !== 'undefined')) {
1080
- (function () {
1081
- var offsetParent = _this7.cache('target-offsetparent', function () {
1082
- return getOffsetParent(_this7.target);
1083
- });
1084
- var offsetPosition = _this7.cache('target-offsetparent-bounds', function () {
1085
- return getBounds(offsetParent);
1086
- });
1087
- var offsetParentStyle = getComputedStyle(offsetParent);
1088
- var offsetParentSize = offsetPosition;
1089
-
1090
- var offsetBorder = {};
1091
- ['Top', 'Left', 'Bottom', 'Right'].forEach(function (side) {
1092
- offsetBorder[side.toLowerCase()] = parseFloat(offsetParentStyle['border' + side + 'Width']);
1093
- });
1094
-
1095
- offsetPosition.right = doc.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right;
1096
- offsetPosition.bottom = doc.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom;
1097
-
1098
- if (next.page.top >= offsetPosition.top + offsetBorder.top && next.page.bottom >= offsetPosition.bottom) {
1099
- if (next.page.left >= offsetPosition.left + offsetBorder.left && next.page.right >= offsetPosition.right) {
1100
- // We're within the visible part of the target's scroll parent
1101
- var scrollTop = offsetParent.scrollTop;
1102
- var scrollLeft = offsetParent.scrollLeft;
1103
-
1104
- // It's position relative to the target's offset parent (absolute positioning when
1105
- // the element is moved to be a child of the target's offset parent).
1106
- next.offset = {
1107
- top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top,
1108
- left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left
1109
- };
1110
- }
1111
- }
1112
- })();
1113
- }
1114
-
1115
- // We could also travel up the DOM and try each containing context, rather than only
1116
- // looking at the body, but we're gonna get diminishing returns.
1117
-
1118
- this.move(next);
1119
-
1120
- this.history.unshift(next);
1121
-
1122
- if (this.history.length > 3) {
1123
- this.history.pop();
1124
- }
1125
-
1126
- if (flushChanges) {
1127
- flush();
1128
- }
1129
-
1130
- return true;
1131
- }
1132
-
1133
- // THE ISSUE
1134
- }, {
1135
- key: 'move',
1136
- value: function move(pos) {
1137
- var _this8 = this;
1138
-
1139
- if (!(typeof this.element.parentNode !== 'undefined')) {
1140
- return;
1141
- }
1142
-
1143
- var same = {};
1144
-
1145
- for (var type in pos) {
1146
- same[type] = {};
1147
-
1148
- for (var key in pos[type]) {
1149
- var found = false;
1150
-
1151
- for (var i = 0; i < this.history.length; ++i) {
1152
- var point = this.history[i];
1153
- if (typeof point[type] !== 'undefined' && !within(point[type][key], pos[type][key])) {
1154
- found = true;
1155
- break;
1156
- }
1157
- }
1158
-
1159
- if (!found) {
1160
- same[type][key] = true;
1161
- }
1162
- }
1163
- }
1164
-
1165
- var css = { top: '', left: '', right: '', bottom: '' };
1166
-
1167
- var transcribe = function transcribe(_same, _pos) {
1168
- var hasOptimizations = typeof _this8.options.optimizations !== 'undefined';
1169
- var gpu = hasOptimizations ? _this8.options.optimizations.gpu : null;
1170
- if (gpu !== false) {
1171
- var yPos = undefined,
1172
- xPos = undefined;
1173
- if (_same.top) {
1174
- css.top = 0;
1175
- yPos = _pos.top;
1176
- } else {
1177
- css.bottom = 0;
1178
- yPos = -_pos.bottom;
1179
- }
1180
-
1181
- if (_same.left) {
1182
- css.left = 0;
1183
- xPos = _pos.left;
1184
- } else {
1185
- css.right = 0;
1186
- xPos = -_pos.right;
1187
- }
1188
-
1189
- if (window.matchMedia) {
1190
- // HubSpot/tether#207
1191
- var retina = window.matchMedia('only screen and (min-resolution: 1.3dppx)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 1.3)').matches;
1192
- if (!retina) {
1193
- xPos = Math.round(xPos);
1194
- yPos = Math.round(yPos);
1195
- }
1196
- }
1197
-
1198
- css[transformKey] = 'translateX(' + xPos + 'px) translateY(' + yPos + 'px)';
1199
-
1200
- if (transformKey !== 'msTransform') {
1201
- // The Z transform will keep this in the GPU (faster, and prevents artifacts),
1202
- // but IE9 doesn't support 3d transforms and will choke.
1203
- css[transformKey] += " translateZ(0)";
1204
- }
1205
- } else {
1206
- if (_same.top) {
1207
- css.top = _pos.top + 'px';
1208
- } else {
1209
- css.bottom = _pos.bottom + 'px';
1210
- }
1211
-
1212
- if (_same.left) {
1213
- css.left = _pos.left + 'px';
1214
- } else {
1215
- css.right = _pos.right + 'px';
1216
- }
1217
- }
1218
- };
1219
-
1220
- var moved = false;
1221
- if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) {
1222
- css.position = 'absolute';
1223
- transcribe(same.page, pos.page);
1224
- } else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) {
1225
- css.position = 'fixed';
1226
- transcribe(same.viewport, pos.viewport);
1227
- } else if (typeof same.offset !== 'undefined' && same.offset.top && same.offset.left) {
1228
- (function () {
1229
- css.position = 'absolute';
1230
- var offsetParent = _this8.cache('target-offsetparent', function () {
1231
- return getOffsetParent(_this8.target);
1232
- });
1233
-
1234
- if (getOffsetParent(_this8.element) !== offsetParent) {
1235
- defer(function () {
1236
- _this8.element.parentNode.removeChild(_this8.element);
1237
- offsetParent.appendChild(_this8.element);
1238
- });
1239
- }
1240
-
1241
- transcribe(same.offset, pos.offset);
1242
- moved = true;
1243
- })();
1244
- } else {
1245
- css.position = 'absolute';
1246
- transcribe({ top: true, left: true }, pos.page);
1247
- }
1248
-
1249
- if (!moved) {
1250
- if (this.options.bodyElement) {
1251
- this.options.bodyElement.appendChild(this.element);
1252
- } else {
1253
- var offsetParentIsBody = true;
1254
- var currentNode = this.element.parentNode;
1255
- while (currentNode && currentNode.nodeType === 1 && currentNode.tagName !== 'BODY') {
1256
- if (getComputedStyle(currentNode).position !== 'static') {
1257
- offsetParentIsBody = false;
1258
- break;
1259
- }
1260
-
1261
- currentNode = currentNode.parentNode;
1262
- }
1263
-
1264
- if (!offsetParentIsBody) {
1265
- this.element.parentNode.removeChild(this.element);
1266
- this.element.ownerDocument.body.appendChild(this.element);
1267
- }
1268
- }
1269
- }
1270
-
1271
- // Any css change will trigger a repaint, so let's avoid one if nothing changed
1272
- var writeCSS = {};
1273
- var write = false;
1274
- for (var key in css) {
1275
- var val = css[key];
1276
- var elVal = this.element.style[key];
1277
-
1278
- if (elVal !== val) {
1279
- write = true;
1280
- writeCSS[key] = val;
1281
- }
1282
- }
1283
-
1284
- if (write) {
1285
- defer(function () {
1286
- extend(_this8.element.style, writeCSS);
1287
- _this8.trigger('repositioned');
1288
- });
1289
- }
1290
- }
1291
- }]);
1292
-
1293
- return TetherClass;
1294
- })(Evented);
1295
-
1296
- TetherClass.modules = [];
1297
-
1298
- TetherBase.position = position;
1299
-
1300
- var Tether = extend(TetherClass, TetherBase);
1301
- /* globals TetherBase */
1302
-
1303
- 'use strict';
1304
-
1305
- var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();
1306
-
1307
- var _TetherBase$Utils = TetherBase.Utils;
1308
- var getBounds = _TetherBase$Utils.getBounds;
1309
- var extend = _TetherBase$Utils.extend;
1310
- var updateClasses = _TetherBase$Utils.updateClasses;
1311
- var defer = _TetherBase$Utils.defer;
1312
-
1313
- var BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom'];
1314
-
1315
- function getBoundingRect(tether, to) {
1316
- if (to === 'scrollParent') {
1317
- to = tether.scrollParents[0];
1318
- } else if (to === 'window') {
1319
- to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset];
1320
- }
1321
-
1322
- if (to === document) {
1323
- to = to.documentElement;
1324
- }
1325
-
1326
- if (typeof to.nodeType !== 'undefined') {
1327
- (function () {
1328
- var node = to;
1329
- var size = getBounds(to);
1330
- var pos = size;
1331
- var style = getComputedStyle(to);
1332
-
1333
- to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top];
1334
-
1335
- // Account any parent Frames scroll offset
1336
- if (node.ownerDocument !== document) {
1337
- var win = node.ownerDocument.defaultView;
1338
- to[0] += win.pageXOffset;
1339
- to[1] += win.pageYOffset;
1340
- to[2] += win.pageXOffset;
1341
- to[3] += win.pageYOffset;
1342
- }
1343
-
1344
- BOUNDS_FORMAT.forEach(function (side, i) {
1345
- side = side[0].toUpperCase() + side.substr(1);
1346
- if (side === 'Top' || side === 'Left') {
1347
- to[i] += parseFloat(style['border' + side + 'Width']);
1348
- } else {
1349
- to[i] -= parseFloat(style['border' + side + 'Width']);
1350
- }
1351
- });
1352
- })();
1353
- }
1354
-
1355
- return to;
1356
- }
1357
-
1358
- TetherBase.modules.push({
1359
- position: function position(_ref) {
1360
- var _this = this;
1361
-
1362
- var top = _ref.top;
1363
- var left = _ref.left;
1364
- var targetAttachment = _ref.targetAttachment;
1365
-
1366
- if (!this.options.constraints) {
1367
- return true;
1368
- }
1369
-
1370
- var _cache = this.cache('element-bounds', function () {
1371
- return getBounds(_this.element);
1372
- });
1373
-
1374
- var height = _cache.height;
1375
- var width = _cache.width;
1376
-
1377
- if (width === 0 && height === 0 && typeof this.lastSize !== 'undefined') {
1378
- var _lastSize = this.lastSize;
1379
-
1380
- // Handle the item getting hidden as a result of our positioning without glitching
1381
- // the classes in and out
1382
- width = _lastSize.width;
1383
- height = _lastSize.height;
1384
- }
1385
-
1386
- var targetSize = this.cache('target-bounds', function () {
1387
- return _this.getTargetBounds();
1388
- });
1389
-
1390
- var targetHeight = targetSize.height;
1391
- var targetWidth = targetSize.width;
1392
-
1393
- var allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')];
1394
-
1395
- this.options.constraints.forEach(function (constraint) {
1396
- var outOfBoundsClass = constraint.outOfBoundsClass;
1397
- var pinnedClass = constraint.pinnedClass;
1398
-
1399
- if (outOfBoundsClass) {
1400
- allClasses.push(outOfBoundsClass);
1401
- }
1402
- if (pinnedClass) {
1403
- allClasses.push(pinnedClass);
1404
- }
1405
- });
1406
-
1407
- allClasses.forEach(function (cls) {
1408
- ['left', 'top', 'right', 'bottom'].forEach(function (side) {
1409
- allClasses.push(cls + '-' + side);
1410
- });
1411
- });
1412
-
1413
- var addClasses = [];
1414
-
1415
- var tAttachment = extend({}, targetAttachment);
1416
- var eAttachment = extend({}, this.attachment);
1417
-
1418
- this.options.constraints.forEach(function (constraint) {
1419
- var to = constraint.to;
1420
- var attachment = constraint.attachment;
1421
- var pin = constraint.pin;
1422
-
1423
- if (typeof attachment === 'undefined') {
1424
- attachment = '';
1425
- }
1426
-
1427
- var changeAttachX = undefined,
1428
- changeAttachY = undefined;
1429
- if (attachment.indexOf(' ') >= 0) {
1430
- var _attachment$split = attachment.split(' ');
1431
-
1432
- var _attachment$split2 = _slicedToArray(_attachment$split, 2);
1433
-
1434
- changeAttachY = _attachment$split2[0];
1435
- changeAttachX = _attachment$split2[1];
1436
- } else {
1437
- changeAttachX = changeAttachY = attachment;
1438
- }
1439
-
1440
- var bounds = getBoundingRect(_this, to);
1441
-
1442
- if (changeAttachY === 'target' || changeAttachY === 'both') {
1443
- if (top < bounds[1] && tAttachment.top === 'top') {
1444
- top += targetHeight;
1445
- tAttachment.top = 'bottom';
1446
- }
1447
-
1448
- if (top + height > bounds[3] && tAttachment.top === 'bottom') {
1449
- top -= targetHeight;
1450
- tAttachment.top = 'top';
1451
- }
1452
- }
1453
-
1454
- if (changeAttachY === 'together') {
1455
- if (tAttachment.top === 'top') {
1456
- if (eAttachment.top === 'bottom' && top < bounds[1]) {
1457
- top += targetHeight;
1458
- tAttachment.top = 'bottom';
1459
-
1460
- top += height;
1461
- eAttachment.top = 'top';
1462
- } else if (eAttachment.top === 'top' && top + height > bounds[3] && top - (height - targetHeight) >= bounds[1]) {
1463
- top -= height - targetHeight;
1464
- tAttachment.top = 'bottom';
1465
-
1466
- eAttachment.top = 'bottom';
1467
- }
1468
- }
1469
-
1470
- if (tAttachment.top === 'bottom') {
1471
- if (eAttachment.top === 'top' && top + height > bounds[3]) {
1472
- top -= targetHeight;
1473
- tAttachment.top = 'top';
1474
-
1475
- top -= height;
1476
- eAttachment.top = 'bottom';
1477
- } else if (eAttachment.top === 'bottom' && top < bounds[1] && top + (height * 2 - targetHeight) <= bounds[3]) {
1478
- top += height - targetHeight;
1479
- tAttachment.top = 'top';
1480
-
1481
- eAttachment.top = 'top';
1482
- }
1483
- }
1484
-
1485
- if (tAttachment.top === 'middle') {
1486
- if (top + height > bounds[3] && eAttachment.top === 'top') {
1487
- top -= height;
1488
- eAttachment.top = 'bottom';
1489
- } else if (top < bounds[1] && eAttachment.top === 'bottom') {
1490
- top += height;
1491
- eAttachment.top = 'top';
1492
- }
1493
- }
1494
- }
1495
-
1496
- if (changeAttachX === 'target' || changeAttachX === 'both') {
1497
- if (left < bounds[0] && tAttachment.left === 'left') {
1498
- left += targetWidth;
1499
- tAttachment.left = 'right';
1500
- }
1501
-
1502
- if (left + width > bounds[2] && tAttachment.left === 'right') {
1503
- left -= targetWidth;
1504
- tAttachment.left = 'left';
1505
- }
1506
- }
1507
-
1508
- if (changeAttachX === 'together') {
1509
- if (left < bounds[0] && tAttachment.left === 'left') {
1510
- if (eAttachment.left === 'right') {
1511
- left += targetWidth;
1512
- tAttachment.left = 'right';
1513
-
1514
- left += width;
1515
- eAttachment.left = 'left';
1516
- } else if (eAttachment.left === 'left') {
1517
- left += targetWidth;
1518
- tAttachment.left = 'right';
1519
-
1520
- left -= width;
1521
- eAttachment.left = 'right';
1522
- }
1523
- } else if (left + width > bounds[2] && tAttachment.left === 'right') {
1524
- if (eAttachment.left === 'left') {
1525
- left -= targetWidth;
1526
- tAttachment.left = 'left';
1527
-
1528
- left -= width;
1529
- eAttachment.left = 'right';
1530
- } else if (eAttachment.left === 'right') {
1531
- left -= targetWidth;
1532
- tAttachment.left = 'left';
1533
-
1534
- left += width;
1535
- eAttachment.left = 'left';
1536
- }
1537
- } else if (tAttachment.left === 'center') {
1538
- if (left + width > bounds[2] && eAttachment.left === 'left') {
1539
- left -= width;
1540
- eAttachment.left = 'right';
1541
- } else if (left < bounds[0] && eAttachment.left === 'right') {
1542
- left += width;
1543
- eAttachment.left = 'left';
1544
- }
1545
- }
1546
- }
1547
-
1548
- if (changeAttachY === 'element' || changeAttachY === 'both') {
1549
- if (top < bounds[1] && eAttachment.top === 'bottom') {
1550
- top += height;
1551
- eAttachment.top = 'top';
1552
- }
1553
-
1554
- if (top + height > bounds[3] && eAttachment.top === 'top') {
1555
- top -= height;
1556
- eAttachment.top = 'bottom';
1557
- }
1558
- }
1559
-
1560
- if (changeAttachX === 'element' || changeAttachX === 'both') {
1561
- if (left < bounds[0]) {
1562
- if (eAttachment.left === 'right') {
1563
- left += width;
1564
- eAttachment.left = 'left';
1565
- } else if (eAttachment.left === 'center') {
1566
- left += width / 2;
1567
- eAttachment.left = 'left';
1568
- }
1569
- }
1570
-
1571
- if (left + width > bounds[2]) {
1572
- if (eAttachment.left === 'left') {
1573
- left -= width;
1574
- eAttachment.left = 'right';
1575
- } else if (eAttachment.left === 'center') {
1576
- left -= width / 2;
1577
- eAttachment.left = 'right';
1578
- }
1579
- }
1580
- }
1581
-
1582
- if (typeof pin === 'string') {
1583
- pin = pin.split(',').map(function (p) {
1584
- return p.trim();
1585
- });
1586
- } else if (pin === true) {
1587
- pin = ['top', 'left', 'right', 'bottom'];
1588
- }
1589
-
1590
- pin = pin || [];
1591
-
1592
- var pinned = [];
1593
- var oob = [];
1594
-
1595
- if (top < bounds[1]) {
1596
- if (pin.indexOf('top') >= 0) {
1597
- top = bounds[1];
1598
- pinned.push('top');
1599
- } else {
1600
- oob.push('top');
1601
- }
1602
- }
1603
-
1604
- if (top + height > bounds[3]) {
1605
- if (pin.indexOf('bottom') >= 0) {
1606
- top = bounds[3] - height;
1607
- pinned.push('bottom');
1608
- } else {
1609
- oob.push('bottom');
1610
- }
1611
- }
1612
-
1613
- if (left < bounds[0]) {
1614
- if (pin.indexOf('left') >= 0) {
1615
- left = bounds[0];
1616
- pinned.push('left');
1617
- } else {
1618
- oob.push('left');
1619
- }
1620
- }
1621
-
1622
- if (left + width > bounds[2]) {
1623
- if (pin.indexOf('right') >= 0) {
1624
- left = bounds[2] - width;
1625
- pinned.push('right');
1626
- } else {
1627
- oob.push('right');
1628
- }
1629
- }
1630
-
1631
- if (pinned.length) {
1632
- (function () {
1633
- var pinnedClass = undefined;
1634
- if (typeof _this.options.pinnedClass !== 'undefined') {
1635
- pinnedClass = _this.options.pinnedClass;
1636
- } else {
1637
- pinnedClass = _this.getClass('pinned');
1638
- }
1639
-
1640
- addClasses.push(pinnedClass);
1641
- pinned.forEach(function (side) {
1642
- addClasses.push(pinnedClass + '-' + side);
1643
- });
1644
- })();
1645
- }
1646
-
1647
- if (oob.length) {
1648
- (function () {
1649
- var oobClass = undefined;
1650
- if (typeof _this.options.outOfBoundsClass !== 'undefined') {
1651
- oobClass = _this.options.outOfBoundsClass;
1652
- } else {
1653
- oobClass = _this.getClass('out-of-bounds');
1654
- }
1655
-
1656
- addClasses.push(oobClass);
1657
- oob.forEach(function (side) {
1658
- addClasses.push(oobClass + '-' + side);
1659
- });
1660
- })();
1661
- }
1662
-
1663
- if (pinned.indexOf('left') >= 0 || pinned.indexOf('right') >= 0) {
1664
- eAttachment.left = tAttachment.left = false;
1665
- }
1666
- if (pinned.indexOf('top') >= 0 || pinned.indexOf('bottom') >= 0) {
1667
- eAttachment.top = tAttachment.top = false;
1668
- }
1669
-
1670
- if (tAttachment.top !== targetAttachment.top || tAttachment.left !== targetAttachment.left || eAttachment.top !== _this.attachment.top || eAttachment.left !== _this.attachment.left) {
1671
- _this.updateAttachClasses(eAttachment, tAttachment);
1672
- _this.trigger('update', {
1673
- attachment: eAttachment,
1674
- targetAttachment: tAttachment
1675
- });
1676
- }
1677
- });
1678
-
1679
- defer(function () {
1680
- if (!(_this.options.addTargetClasses === false)) {
1681
- updateClasses(_this.target, addClasses, allClasses);
1682
- }
1683
- updateClasses(_this.element, addClasses, allClasses);
1684
- });
1685
-
1686
- return { top: top, left: left };
1687
- }
1688
- });
1689
- /* globals TetherBase */
1690
-
1691
- 'use strict';
1692
-
1693
- var _TetherBase$Utils = TetherBase.Utils;
1694
- var getBounds = _TetherBase$Utils.getBounds;
1695
- var updateClasses = _TetherBase$Utils.updateClasses;
1696
- var defer = _TetherBase$Utils.defer;
1697
-
1698
- TetherBase.modules.push({
1699
- position: function position(_ref) {
1700
- var _this = this;
1701
-
1702
- var top = _ref.top;
1703
- var left = _ref.left;
1704
-
1705
- var _cache = this.cache('element-bounds', function () {
1706
- return getBounds(_this.element);
1707
- });
1708
-
1709
- var height = _cache.height;
1710
- var width = _cache.width;
1711
-
1712
- var targetPos = this.getTargetBounds();
1713
-
1714
- var bottom = top + height;
1715
- var right = left + width;
1716
-
1717
- var abutted = [];
1718
- if (top <= targetPos.bottom && bottom >= targetPos.top) {
1719
- ['left', 'right'].forEach(function (side) {
1720
- var targetPosSide = targetPos[side];
1721
- if (targetPosSide === left || targetPosSide === right) {
1722
- abutted.push(side);
1723
- }
1724
- });
1725
- }
1726
-
1727
- if (left <= targetPos.right && right >= targetPos.left) {
1728
- ['top', 'bottom'].forEach(function (side) {
1729
- var targetPosSide = targetPos[side];
1730
- if (targetPosSide === top || targetPosSide === bottom) {
1731
- abutted.push(side);
1732
- }
1733
- });
1734
- }
1735
-
1736
- var allClasses = [];
1737
- var addClasses = [];
1738
-
1739
- var sides = ['left', 'top', 'right', 'bottom'];
1740
- allClasses.push(this.getClass('abutted'));
1741
- sides.forEach(function (side) {
1742
- allClasses.push(_this.getClass('abutted') + '-' + side);
1743
- });
1744
-
1745
- if (abutted.length) {
1746
- addClasses.push(this.getClass('abutted'));
1747
- }
1748
-
1749
- abutted.forEach(function (side) {
1750
- addClasses.push(_this.getClass('abutted') + '-' + side);
1751
- });
1752
-
1753
- defer(function () {
1754
- if (!(_this.options.addTargetClasses === false)) {
1755
- updateClasses(_this.target, addClasses, allClasses);
1756
- }
1757
- updateClasses(_this.element, addClasses, allClasses);
1758
- });
1759
-
1760
- return true;
1761
- }
1762
- });
1763
- /* globals TetherBase */
1764
-
1765
- 'use strict';
1766
-
1767
- var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();
1768
-
1769
- TetherBase.modules.push({
1770
- position: function position(_ref) {
1771
- var top = _ref.top;
1772
- var left = _ref.left;
1773
-
1774
- if (!this.options.shift) {
1775
- return;
1776
- }
1777
-
1778
- var shift = this.options.shift;
1779
- if (typeof this.options.shift === 'function') {
1780
- shift = this.options.shift.call(this, { top: top, left: left });
1781
- }
1782
-
1783
- var shiftTop = undefined,
1784
- shiftLeft = undefined;
1785
- if (typeof shift === 'string') {
1786
- shift = shift.split(' ');
1787
- shift[1] = shift[1] || shift[0];
1788
-
1789
- var _shift = shift;
1790
-
1791
- var _shift2 = _slicedToArray(_shift, 2);
1792
-
1793
- shiftTop = _shift2[0];
1794
- shiftLeft = _shift2[1];
1795
-
1796
- shiftTop = parseFloat(shiftTop, 10);
1797
- shiftLeft = parseFloat(shiftLeft, 10);
1798
- } else {
1799
- shiftTop = shift.top;
1800
- shiftLeft = shift.left;
1801
- }
1802
-
1803
- top += shiftTop;
1804
- left += shiftLeft;
1805
-
1806
- return { top: top, left: left };
1807
- }
1808
- });
1809
- return Tether;
1810
-
1811
- }));