materialize-sass 0.97.0 → 1.0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +5 -5
  2. data/.gitattributes +1 -0
  3. data/.gitignore +3 -0
  4. data/README.md +48 -10
  5. data/Rakefile +129 -1
  6. data/assets/javascripts/materialize/anime.min.js +417 -0
  7. data/assets/javascripts/materialize/autocomplete.js +504 -0
  8. data/assets/javascripts/materialize/buttons.js +409 -0
  9. data/assets/javascripts/materialize/cards.js +34 -0
  10. data/assets/javascripts/materialize/carousel.js +797 -0
  11. data/assets/javascripts/materialize/cash.js +990 -0
  12. data/assets/javascripts/materialize/characterCounter.js +180 -0
  13. data/assets/javascripts/materialize/chips.js +564 -0
  14. data/assets/javascripts/materialize/collapsible.js +337 -0
  15. data/assets/javascripts/materialize/component.js +57 -0
  16. data/assets/javascripts/materialize/datepicker.js +935 -0
  17. data/assets/javascripts/materialize/dropdown.js +659 -0
  18. data/assets/javascripts/materialize/extras/nouislider.js +2147 -0
  19. data/assets/javascripts/materialize/extras/nouislider.min.js +1 -0
  20. data/assets/javascripts/materialize/forms.js +244 -0
  21. data/assets/javascripts/materialize/global.js +408 -0
  22. data/assets/javascripts/materialize/materialbox.js +513 -0
  23. data/assets/javascripts/materialize/modal.js +449 -0
  24. data/assets/javascripts/materialize/parallax.js +173 -0
  25. data/assets/javascripts/materialize/pushpin.js +179 -0
  26. data/assets/javascripts/materialize/range.js +310 -0
  27. data/assets/javascripts/materialize/scrollspy.js +328 -0
  28. data/assets/javascripts/materialize/select.js +497 -0
  29. data/assets/javascripts/materialize/sidenav.js +655 -0
  30. data/assets/javascripts/materialize/slider.js +424 -0
  31. data/assets/javascripts/materialize/tabs.js +476 -0
  32. data/assets/javascripts/materialize/tapTarget.js +364 -0
  33. data/assets/javascripts/materialize/timepicker.js +647 -0
  34. data/assets/javascripts/materialize/toasts.js +355 -0
  35. data/assets/javascripts/materialize/tooltip.js +351 -0
  36. data/{app/assets → assets}/javascripts/materialize/waves.js +42 -47
  37. data/assets/javascripts/materialize-sprockets.js +29 -0
  38. data/assets/javascripts/materialize.js +12374 -0
  39. data/assets/stylesheets/materialize/components/_badges.scss +55 -0
  40. data/assets/stylesheets/materialize/components/_buttons.scss +322 -0
  41. data/{app/assets → assets}/stylesheets/materialize/components/_cards.scss +72 -29
  42. data/assets/stylesheets/materialize/components/_carousel.scss +90 -0
  43. data/assets/stylesheets/materialize/components/_chips.scss +90 -0
  44. data/{app/assets → assets}/stylesheets/materialize/components/_collapsible.scss +23 -17
  45. data/assets/stylesheets/materialize/components/_color-classes.scss +32 -0
  46. data/{app/assets/stylesheets/materialize/components/_color.scss → assets/stylesheets/materialize/components/_color-variables.scss} +22 -64
  47. data/assets/stylesheets/materialize/components/_datepicker.scss +191 -0
  48. data/assets/stylesheets/materialize/components/_dropdown.scss +85 -0
  49. data/{app/assets → assets}/stylesheets/materialize/components/_global.scss +197 -144
  50. data/{app/assets → assets}/stylesheets/materialize/components/_grid.scss +57 -18
  51. data/assets/stylesheets/materialize/components/_icons-material-design.scss +5 -0
  52. data/{app/assets → assets}/stylesheets/materialize/components/_materialbox.scss +15 -13
  53. data/{app/assets → assets}/stylesheets/materialize/components/_modal.scss +18 -14
  54. data/{app/assets → assets}/stylesheets/materialize/components/_navbar.scss +89 -25
  55. data/assets/stylesheets/materialize/components/_normalize.scss +447 -0
  56. data/{app/assets → assets}/stylesheets/materialize/components/_preloader.scss +5 -3
  57. data/assets/stylesheets/materialize/components/_pulse.scss +34 -0
  58. data/assets/stylesheets/materialize/components/_sidenav.scss +208 -0
  59. data/{app/assets → assets}/stylesheets/materialize/components/_slider.scss +2 -2
  60. data/{app/assets → assets}/stylesheets/materialize/components/_table_of_contents.scss +5 -5
  61. data/assets/stylesheets/materialize/components/_tabs.scss +99 -0
  62. data/assets/stylesheets/materialize/components/_tapTarget.scss +103 -0
  63. data/assets/stylesheets/materialize/components/_timepicker.scss +183 -0
  64. data/{app/assets → assets}/stylesheets/materialize/components/_toast.scss +17 -22
  65. data/assets/stylesheets/materialize/components/_tooltip.scss +32 -0
  66. data/assets/stylesheets/materialize/components/_transitions.scss +13 -0
  67. data/{app/assets → assets}/stylesheets/materialize/components/_typography.scss +11 -9
  68. data/assets/stylesheets/materialize/components/_variables.scss +349 -0
  69. data/assets/stylesheets/materialize/components/_waves.scss +114 -0
  70. data/assets/stylesheets/materialize/components/forms/_checkboxes.scss +200 -0
  71. data/assets/stylesheets/materialize/components/forms/_file-input.scss +44 -0
  72. data/assets/stylesheets/materialize/components/forms/_forms.scss +22 -0
  73. data/assets/stylesheets/materialize/components/forms/_input-fields.scss +354 -0
  74. data/assets/stylesheets/materialize/components/forms/_radio-buttons.scss +115 -0
  75. data/assets/stylesheets/materialize/components/forms/_range.scss +161 -0
  76. data/assets/stylesheets/materialize/components/forms/_select.scss +190 -0
  77. data/assets/stylesheets/materialize/components/forms/_switches.scss +89 -0
  78. data/assets/stylesheets/materialize/extras/nouislider.css +406 -0
  79. data/{app/assets → assets}/stylesheets/materialize.scss +13 -10
  80. data/lib/materialize-sass/engine.rb +11 -6
  81. data/lib/materialize-sass/helpers.rb +38 -0
  82. data/lib/materialize-sass/version.rb +1 -1
  83. data/lib/materialize-sass.rb +13 -28
  84. data/materialize-sass.gemspec +5 -5
  85. metadata +97 -105
  86. data/app/assets/fonts/material-design-icons/LICENSE.txt +0 -428
  87. data/app/assets/fonts/material-design-icons/Material-Design-Icons.eot +0 -0
  88. data/app/assets/fonts/material-design-icons/Material-Design-Icons.svg +0 -769
  89. data/app/assets/fonts/material-design-icons/Material-Design-Icons.ttf +0 -0
  90. data/app/assets/fonts/material-design-icons/Material-Design-Icons.woff +0 -0
  91. data/app/assets/fonts/material-design-icons/Material-Design-Icons.woff2 +0 -0
  92. data/app/assets/fonts/roboto/Roboto-Bold.ttf +0 -0
  93. data/app/assets/fonts/roboto/Roboto-Bold.woff +0 -0
  94. data/app/assets/fonts/roboto/Roboto-Bold.woff2 +0 -0
  95. data/app/assets/fonts/roboto/Roboto-Light.ttf +0 -0
  96. data/app/assets/fonts/roboto/Roboto-Light.woff +0 -0
  97. data/app/assets/fonts/roboto/Roboto-Light.woff2 +0 -0
  98. data/app/assets/fonts/roboto/Roboto-Medium.ttf +0 -0
  99. data/app/assets/fonts/roboto/Roboto-Medium.woff +0 -0
  100. data/app/assets/fonts/roboto/Roboto-Medium.woff2 +0 -0
  101. data/app/assets/fonts/roboto/Roboto-Regular.ttf +0 -0
  102. data/app/assets/fonts/roboto/Roboto-Regular.woff +0 -0
  103. data/app/assets/fonts/roboto/Roboto-Regular.woff2 +0 -0
  104. data/app/assets/fonts/roboto/Roboto-Thin.ttf +0 -0
  105. data/app/assets/fonts/roboto/Roboto-Thin.woff +0 -0
  106. data/app/assets/fonts/roboto/Roboto-Thin.woff2 +0 -0
  107. data/app/assets/javascripts/materialize/animation.js +0 -9
  108. data/app/assets/javascripts/materialize/buttons.js +0 -61
  109. data/app/assets/javascripts/materialize/cards.js +0 -27
  110. data/app/assets/javascripts/materialize/character_counter.js +0 -59
  111. data/app/assets/javascripts/materialize/collapsible.js +0 -139
  112. data/app/assets/javascripts/materialize/date_picker/picker.date.js +0 -1430
  113. data/app/assets/javascripts/materialize/date_picker/picker.js +0 -1123
  114. data/app/assets/javascripts/materialize/dropdown.js +0 -178
  115. data/app/assets/javascripts/materialize/forms.js +0 -456
  116. data/app/assets/javascripts/materialize/global.js +0 -36
  117. data/app/assets/javascripts/materialize/hammer.min.js +0 -1
  118. data/app/assets/javascripts/materialize/init.js +0 -136
  119. data/app/assets/javascripts/materialize/jquery.easing.1.3.js +0 -205
  120. data/app/assets/javascripts/materialize/jquery.hammer.js +0 -33
  121. data/app/assets/javascripts/materialize/jquery.timeago.min.js +0 -1
  122. data/app/assets/javascripts/materialize/leanModal.js +0 -178
  123. data/app/assets/javascripts/materialize/materialbox.js +0 -249
  124. data/app/assets/javascripts/materialize/parallax.js +0 -58
  125. data/app/assets/javascripts/materialize/prism.js +0 -8
  126. data/app/assets/javascripts/materialize/pushpin.js +0 -62
  127. data/app/assets/javascripts/materialize/scrollFire.js +0 -44
  128. data/app/assets/javascripts/materialize/scrollspy.js +0 -284
  129. data/app/assets/javascripts/materialize/sideNav.js +0 -312
  130. data/app/assets/javascripts/materialize/slider.js +0 -301
  131. data/app/assets/javascripts/materialize/tabs.js +0 -136
  132. data/app/assets/javascripts/materialize/toasts.js +0 -125
  133. data/app/assets/javascripts/materialize/tooltip.js +0 -166
  134. data/app/assets/javascripts/materialize/transitions.js +0 -154
  135. data/app/assets/javascripts/materialize/velocity.min.js +0 -4
  136. data/app/assets/javascripts/materialize-sprockets.js +0 -27
  137. data/app/assets/javascripts/materialize.js +0 -6159
  138. data/app/assets/stylesheets/materialize/components/_buttons.scss +0 -157
  139. data/app/assets/stylesheets/materialize/components/_dropdown.scss +0 -40
  140. data/app/assets/stylesheets/materialize/components/_form.scss +0 -886
  141. data/app/assets/stylesheets/materialize/components/_icons-material-design.scss +0 -3257
  142. data/app/assets/stylesheets/materialize/components/_mixins.scss +0 -5
  143. data/app/assets/stylesheets/materialize/components/_normalize.scss +0 -427
  144. data/app/assets/stylesheets/materialize/components/_prefixer.scss +0 -376
  145. data/app/assets/stylesheets/materialize/components/_roboto.scss +0 -38
  146. data/app/assets/stylesheets/materialize/components/_sideNav.scss +0 -111
  147. data/app/assets/stylesheets/materialize/components/_tabs.scss +0 -47
  148. data/app/assets/stylesheets/materialize/components/_tooltip.scss +0 -34
  149. data/app/assets/stylesheets/materialize/components/_variables.scss +0 -152
  150. data/app/assets/stylesheets/materialize/components/_waves.scss +0 -167
  151. data/app/assets/stylesheets/materialize/components/date_picker/_default.date.scss +0 -435
  152. data/app/assets/stylesheets/materialize/components/date_picker/_default.scss +0 -201
  153. data/app/assets/stylesheets/materialize/components/date_picker/_default.time.scss +0 -125
@@ -0,0 +1,337 @@
1
+ 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; }; }();
2
+
3
+ var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
4
+
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+
7
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
8
+
9
+ 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; }
10
+
11
+ (function ($, anim) {
12
+ 'use strict';
13
+
14
+ var _defaults = {
15
+ accordion: true,
16
+ onOpenStart: undefined,
17
+ onOpenEnd: undefined,
18
+ onCloseStart: undefined,
19
+ onCloseEnd: undefined,
20
+ inDuration: 300,
21
+ outDuration: 300
22
+ };
23
+
24
+ /**
25
+ * @class
26
+ *
27
+ */
28
+
29
+ var Collapsible = function (_Component) {
30
+ _inherits(Collapsible, _Component);
31
+
32
+ /**
33
+ * Construct Collapsible instance
34
+ * @constructor
35
+ * @param {Element} el
36
+ * @param {Object} options
37
+ */
38
+ function Collapsible(el, options) {
39
+ _classCallCheck(this, Collapsible);
40
+
41
+ var _this = _possibleConstructorReturn(this, (Collapsible.__proto__ || Object.getPrototypeOf(Collapsible)).call(this, Collapsible, el, options));
42
+
43
+ _this.el.M_Collapsible = _this;
44
+
45
+ /**
46
+ * Options for the collapsible
47
+ * @member Collapsible#options
48
+ * @prop {Boolean} [accordion=false] - Type of the collapsible
49
+ * @prop {Function} onOpenStart - Callback function called before collapsible is opened
50
+ * @prop {Function} onOpenEnd - Callback function called after collapsible is opened
51
+ * @prop {Function} onCloseStart - Callback function called before collapsible is closed
52
+ * @prop {Function} onCloseEnd - Callback function called after collapsible is closed
53
+ * @prop {Number} inDuration - Transition in duration in milliseconds.
54
+ * @prop {Number} outDuration - Transition duration in milliseconds.
55
+ */
56
+ _this.options = $.extend({}, Collapsible.defaults, options);
57
+
58
+ // Setup tab indices
59
+ _this.$headers = _this.$el.children('li').children('.collapsible-header');
60
+ _this.$headers.attr('tabindex', 0);
61
+
62
+ _this._setupEventHandlers();
63
+
64
+ // Open first active
65
+ var $activeBodies = _this.$el.children('li.active').children('.collapsible-body');
66
+ if (_this.options.accordion) {
67
+ // Handle Accordion
68
+ $activeBodies.first().css('display', 'block');
69
+ } else {
70
+ // Handle Expandables
71
+ $activeBodies.css('display', 'block');
72
+ }
73
+ return _this;
74
+ }
75
+
76
+ _createClass(Collapsible, [{
77
+ key: 'destroy',
78
+
79
+
80
+ /**
81
+ * Teardown component
82
+ */
83
+ value: function destroy() {
84
+ this._removeEventHandlers();
85
+ this.el.M_Collapsible = undefined;
86
+ }
87
+
88
+ /**
89
+ * Setup Event Handlers
90
+ */
91
+
92
+ }, {
93
+ key: '_setupEventHandlers',
94
+ value: function _setupEventHandlers() {
95
+ var _this2 = this;
96
+
97
+ this._handleCollapsibleClickBound = this._handleCollapsibleClick.bind(this);
98
+ this._handleCollapsibleKeydownBound = this._handleCollapsibleKeydown.bind(this);
99
+ this.el.addEventListener('click', this._handleCollapsibleClickBound);
100
+ this.$headers.each(function (header) {
101
+ header.addEventListener('keydown', _this2._handleCollapsibleKeydownBound);
102
+ });
103
+ }
104
+
105
+ /**
106
+ * Remove Event Handlers
107
+ */
108
+
109
+ }, {
110
+ key: '_removeEventHandlers',
111
+ value: function _removeEventHandlers() {
112
+ var _this3 = this;
113
+
114
+ this.el.removeEventListener('click', this._handleCollapsibleClickBound);
115
+ this.$headers.each(function (header) {
116
+ header.removeEventListener('keydown', _this3._handleCollapsibleKeydownBound);
117
+ });
118
+ }
119
+
120
+ /**
121
+ * Handle Collapsible Click
122
+ * @param {Event} e
123
+ */
124
+
125
+ }, {
126
+ key: '_handleCollapsibleClick',
127
+ value: function _handleCollapsibleClick(e) {
128
+ var $header = $(e.target).closest('.collapsible-header');
129
+ if (e.target && $header.length) {
130
+ var $collapsible = $header.closest('.collapsible');
131
+ if ($collapsible[0] === this.el) {
132
+ var $collapsibleLi = $header.closest('li');
133
+ var $collapsibleLis = $collapsible.children('li');
134
+ var isActive = $collapsibleLi[0].classList.contains('active');
135
+ var index = $collapsibleLis.index($collapsibleLi);
136
+
137
+ if (isActive) {
138
+ this.close(index);
139
+ } else {
140
+ this.open(index);
141
+ }
142
+ }
143
+ }
144
+ }
145
+
146
+ /**
147
+ * Handle Collapsible Keydown
148
+ * @param {Event} e
149
+ */
150
+
151
+ }, {
152
+ key: '_handleCollapsibleKeydown',
153
+ value: function _handleCollapsibleKeydown(e) {
154
+ if (e.keyCode === 13) {
155
+ this._handleCollapsibleClickBound(e);
156
+ }
157
+ }
158
+
159
+ /**
160
+ * Animate in collapsible slide
161
+ * @param {Number} index - 0th index of slide
162
+ */
163
+
164
+ }, {
165
+ key: '_animateIn',
166
+ value: function _animateIn(index) {
167
+ var _this4 = this;
168
+
169
+ var $collapsibleLi = this.$el.children('li').eq(index);
170
+ if ($collapsibleLi.length) {
171
+ var $body = $collapsibleLi.children('.collapsible-body');
172
+
173
+ anim.remove($body[0]);
174
+ $body.css({
175
+ display: 'block',
176
+ overflow: 'hidden',
177
+ height: 0,
178
+ paddingTop: '',
179
+ paddingBottom: ''
180
+ });
181
+
182
+ var pTop = $body.css('padding-top');
183
+ var pBottom = $body.css('padding-bottom');
184
+ var finalHeight = $body[0].scrollHeight;
185
+ $body.css({
186
+ paddingTop: 0,
187
+ paddingBottom: 0
188
+ });
189
+
190
+ anim({
191
+ targets: $body[0],
192
+ height: finalHeight,
193
+ paddingTop: pTop,
194
+ paddingBottom: pBottom,
195
+ duration: this.options.inDuration,
196
+ easing: 'easeInOutCubic',
197
+ complete: function (anim) {
198
+ $body.css({
199
+ overflow: '',
200
+ paddingTop: '',
201
+ paddingBottom: '',
202
+ height: ''
203
+ });
204
+
205
+ // onOpenEnd callback
206
+ if (typeof _this4.options.onOpenEnd === 'function') {
207
+ _this4.options.onOpenEnd.call(_this4, $collapsibleLi[0]);
208
+ }
209
+ }
210
+ });
211
+ }
212
+ }
213
+
214
+ /**
215
+ * Animate out collapsible slide
216
+ * @param {Number} index - 0th index of slide to open
217
+ */
218
+
219
+ }, {
220
+ key: '_animateOut',
221
+ value: function _animateOut(index) {
222
+ var _this5 = this;
223
+
224
+ var $collapsibleLi = this.$el.children('li').eq(index);
225
+ if ($collapsibleLi.length) {
226
+ var $body = $collapsibleLi.children('.collapsible-body');
227
+ anim.remove($body[0]);
228
+ $body.css('overflow', 'hidden');
229
+ anim({
230
+ targets: $body[0],
231
+ height: 0,
232
+ paddingTop: 0,
233
+ paddingBottom: 0,
234
+ duration: this.options.outDuration,
235
+ easing: 'easeInOutCubic',
236
+ complete: function () {
237
+ $body.css({
238
+ height: '',
239
+ overflow: '',
240
+ padding: '',
241
+ display: ''
242
+ });
243
+
244
+ // onCloseEnd callback
245
+ if (typeof _this5.options.onCloseEnd === 'function') {
246
+ _this5.options.onCloseEnd.call(_this5, $collapsibleLi[0]);
247
+ }
248
+ }
249
+ });
250
+ }
251
+ }
252
+
253
+ /**
254
+ * Open Collapsible
255
+ * @param {Number} index - 0th index of slide
256
+ */
257
+
258
+ }, {
259
+ key: 'open',
260
+ value: function open(index) {
261
+ var _this6 = this;
262
+
263
+ var $collapsibleLi = this.$el.children('li').eq(index);
264
+ if ($collapsibleLi.length && !$collapsibleLi[0].classList.contains('active')) {
265
+ // onOpenStart callback
266
+ if (typeof this.options.onOpenStart === 'function') {
267
+ this.options.onOpenStart.call(this, $collapsibleLi[0]);
268
+ }
269
+
270
+ // Handle accordion behavior
271
+ if (this.options.accordion) {
272
+ var $collapsibleLis = this.$el.children('li');
273
+ var $activeLis = this.$el.children('li.active');
274
+ $activeLis.each(function (el) {
275
+ var index = $collapsibleLis.index($(el));
276
+ _this6.close(index);
277
+ });
278
+ }
279
+
280
+ // Animate in
281
+ $collapsibleLi[0].classList.add('active');
282
+ this._animateIn(index);
283
+ }
284
+ }
285
+
286
+ /**
287
+ * Close Collapsible
288
+ * @param {Number} index - 0th index of slide
289
+ */
290
+
291
+ }, {
292
+ key: 'close',
293
+ value: function close(index) {
294
+ var $collapsibleLi = this.$el.children('li').eq(index);
295
+ if ($collapsibleLi.length && $collapsibleLi[0].classList.contains('active')) {
296
+ // onCloseStart callback
297
+ if (typeof this.options.onCloseStart === 'function') {
298
+ this.options.onCloseStart.call(this, $collapsibleLi[0]);
299
+ }
300
+
301
+ // Animate out
302
+ $collapsibleLi[0].classList.remove('active');
303
+ this._animateOut(index);
304
+ }
305
+ }
306
+ }], [{
307
+ key: 'init',
308
+ value: function init(els, options) {
309
+ return _get(Collapsible.__proto__ || Object.getPrototypeOf(Collapsible), 'init', this).call(this, this, els, options);
310
+ }
311
+
312
+ /**
313
+ * Get Instance
314
+ */
315
+
316
+ }, {
317
+ key: 'getInstance',
318
+ value: function getInstance(el) {
319
+ var domElem = !!el.jquery ? el[0] : el;
320
+ return domElem.M_Collapsible;
321
+ }
322
+ }, {
323
+ key: 'defaults',
324
+ get: function () {
325
+ return _defaults;
326
+ }
327
+ }]);
328
+
329
+ return Collapsible;
330
+ }(Component);
331
+
332
+ M.Collapsible = Collapsible;
333
+
334
+ if (M.jQueryLoaded) {
335
+ M.initializeJqueryWrapper(Collapsible, 'collapsible', 'M_Collapsible');
336
+ }
337
+ })(cash, M.anime);
@@ -0,0 +1,57 @@
1
+ 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; }; }();
2
+
3
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
+
5
+ var Component = function () {
6
+ /**
7
+ * Generic constructor for all components
8
+ * @constructor
9
+ * @param {Element} el
10
+ * @param {Object} options
11
+ */
12
+ function Component(classDef, el, options) {
13
+ _classCallCheck(this, Component);
14
+
15
+ // Display error if el is valid HTML Element
16
+ if (!(el instanceof Element)) {
17
+ console.error(Error(el + ' is not an HTML Element'));
18
+ }
19
+
20
+ // If exists, destroy and reinitialize in child
21
+ var ins = classDef.getInstance(el);
22
+ if (!!ins) {
23
+ ins.destroy();
24
+ }
25
+
26
+ this.el = el;
27
+ this.$el = cash(el);
28
+ }
29
+
30
+ /**
31
+ * Initializes components
32
+ * @param {class} classDef
33
+ * @param {Element | NodeList | jQuery} els
34
+ * @param {Object} options
35
+ */
36
+
37
+
38
+ _createClass(Component, null, [{
39
+ key: 'init',
40
+ value: function init(classDef, els, options) {
41
+ var instances = null;
42
+ if (els instanceof Element) {
43
+ instances = new classDef(els, options);
44
+ } else if (!!els && (els.jquery || els.cash || els instanceof NodeList)) {
45
+ var instancesArr = [];
46
+ for (var i = 0; i < els.length; i++) {
47
+ instancesArr.push(new classDef(els[i], options));
48
+ }
49
+ instances = instancesArr;
50
+ }
51
+
52
+ return instances;
53
+ }
54
+ }]);
55
+
56
+ return Component;
57
+ }();