luda 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (246) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +5 -0
  4. data/assets/javascripts/luda-degradation.js +131 -0
  5. data/assets/javascripts/luda-degradation.js.map +1 -0
  6. data/assets/javascripts/luda-degradation.min.js +7 -0
  7. data/assets/javascripts/luda-degradation.min.js.map +1 -0
  8. data/assets/javascripts/luda-sprockets.js +11 -0
  9. data/assets/javascripts/luda.js +2024 -0
  10. data/assets/javascripts/luda.js.map +1 -0
  11. data/assets/javascripts/luda.min.js +7 -0
  12. data/assets/javascripts/luda.min.js.map +1 -0
  13. data/assets/javascripts/luda/behaviours/enter-click.js +38 -0
  14. data/assets/javascripts/luda/behaviours/focus.js +103 -0
  15. data/assets/javascripts/luda/behaviours/radio-tab.js +69 -0
  16. data/assets/javascripts/luda/behaviours/readonly.js +57 -0
  17. data/assets/javascripts/luda/behaviours/toggle.js +104 -0
  18. data/assets/javascripts/luda/collections/carousel.js +314 -0
  19. data/assets/javascripts/luda/collections/dropdown.js +269 -0
  20. data/assets/javascripts/luda/collections/form-dropdown.js +112 -0
  21. data/assets/javascripts/luda/collections/tab.js +117 -0
  22. data/assets/javascripts/luda/component.js +240 -0
  23. data/assets/javascripts/luda/constants.js +18 -0
  24. data/assets/javascripts/luda/degradation.js +125 -0
  25. data/assets/javascripts/luda/dom.js +81 -0
  26. data/assets/javascripts/luda/elements/form-file.js +104 -0
  27. data/assets/javascripts/luda/elements/form-select.js +212 -0
  28. data/assets/javascripts/luda/event.js +193 -0
  29. data/assets/javascripts/luda/index.js +20 -0
  30. data/assets/javascripts/luda/install.js +75 -0
  31. data/assets/javascripts/luda/singleton.js +77 -0
  32. data/assets/javascripts/luda/utilities.js +16 -0
  33. data/assets/stylesheets/luda/_core/_base.sass +430 -0
  34. data/assets/stylesheets/luda/_core/_functions.sass +240 -0
  35. data/assets/stylesheets/luda/_core/_variables.sass +710 -0
  36. data/assets/stylesheets/luda/_core/behaviours/_disabled.sass +12 -0
  37. data/assets/stylesheets/luda/_core/behaviours/_focus.sass +7 -0
  38. data/assets/stylesheets/luda/_core/behaviours/_readonly.sass +16 -0
  39. data/assets/stylesheets/luda/_core/behaviours/_toggle.sass +4 -0
  40. data/assets/stylesheets/luda/_core/collections/_alert.sass +24 -0
  41. data/assets/stylesheets/luda/_core/collections/_avatar.sass +117 -0
  42. data/assets/stylesheets/luda/_core/collections/_breadcrumb.sass +21 -0
  43. data/assets/stylesheets/luda/_core/collections/_button-group.sass +67 -0
  44. data/assets/stylesheets/luda/_core/collections/_button-icon.sass +46 -0
  45. data/assets/stylesheets/luda/_core/collections/_carousel.sass +132 -0
  46. data/assets/stylesheets/luda/_core/collections/_dropdown.sass +60 -0
  47. data/assets/stylesheets/luda/_core/collections/_form-button.sass +23 -0
  48. data/assets/stylesheets/luda/_core/collections/_form-dropdown.sass +21 -0
  49. data/assets/stylesheets/luda/_core/collections/_form-group.sass +48 -0
  50. data/assets/stylesheets/luda/_core/collections/_form-icon.sass +71 -0
  51. data/assets/stylesheets/luda/_core/collections/_media.sass +55 -0
  52. data/assets/stylesheets/luda/_core/collections/_modal.sass +12 -0
  53. data/assets/stylesheets/luda/_core/collections/_nav.sass +162 -0
  54. data/assets/stylesheets/luda/_core/collections/_tab.sass +18 -0
  55. data/assets/stylesheets/luda/_core/elements/_badge.sass +19 -0
  56. data/assets/stylesheets/luda/_core/elements/_baseline.sass +22 -0
  57. data/assets/stylesheets/luda/_core/elements/_button.sass +136 -0
  58. data/assets/stylesheets/luda/_core/elements/_container.sass +8 -0
  59. data/assets/stylesheets/luda/_core/elements/_grid.sass +55 -0
  60. data/assets/stylesheets/luda/_core/elements/_icon.sass +110 -0
  61. data/assets/stylesheets/luda/_core/elements/_overlay.sass +11 -0
  62. data/assets/stylesheets/luda/_core/elements/_progress.sass +31 -0
  63. data/assets/stylesheets/luda/_core/elements/_scrollbar.sass +21 -0
  64. data/assets/stylesheets/luda/_core/elements/_table.sass +102 -0
  65. data/assets/stylesheets/luda/_core/elements/_turbolinks-progress-bar.sass +5 -0
  66. data/assets/stylesheets/luda/_core/elements/form/_form-check-radio.sass +105 -0
  67. data/assets/stylesheets/luda/_core/elements/form/_form-element.sass +83 -0
  68. data/assets/stylesheets/luda/_core/elements/form/_form-helper.sass +66 -0
  69. data/assets/stylesheets/luda/_core/elements/form/_form-label.sass +20 -0
  70. data/assets/stylesheets/luda/_core/elements/form/_form-range.sass +92 -0
  71. data/assets/stylesheets/luda/_core/elements/form/_form-row.sass +214 -0
  72. data/assets/stylesheets/luda/_core/elements/typography/_code.sass +27 -0
  73. data/assets/stylesheets/luda/_core/elements/typography/_link.sass +15 -0
  74. data/assets/stylesheets/luda/_core/elements/typography/_list.sass +14 -0
  75. data/assets/stylesheets/luda/_core/elements/typography/_mark.sass +7 -0
  76. data/assets/stylesheets/luda/_core/elements/typography/_quote.sass +68 -0
  77. data/assets/stylesheets/luda/_core/elements/typography/_sub-sup.sass +16 -0
  78. data/assets/stylesheets/luda/_core/elements/typography/_typography.sass +52 -0
  79. data/assets/stylesheets/luda/_core/mixins/_browser.sass +15 -0
  80. data/assets/stylesheets/luda/_core/mixins/_button.sass +90 -0
  81. data/assets/stylesheets/luda/_core/mixins/_dropdown.sass +40 -0
  82. data/assets/stylesheets/luda/_core/mixins/_focus.sass +3 -0
  83. data/assets/stylesheets/luda/_core/mixins/_form.sass +27 -0
  84. data/assets/stylesheets/luda/_core/mixins/_install.sass +7 -0
  85. data/assets/stylesheets/luda/_core/mixins/_media-query.sass +66 -0
  86. data/assets/stylesheets/luda/_core/mixins/_overlay.sass +14 -0
  87. data/assets/stylesheets/luda/_core/mixins/_sass-lint-fix.sass +3 -0
  88. data/assets/stylesheets/luda/_core/mixins/_typography.sass +40 -0
  89. data/assets/stylesheets/luda/_core/utilities/_align.sass +19 -0
  90. data/assets/stylesheets/luda/_core/utilities/_background.sass +88 -0
  91. data/assets/stylesheets/luda/_core/utilities/_color.sass +36 -0
  92. data/assets/stylesheets/luda/_core/utilities/_display.sass +40 -0
  93. data/assets/stylesheets/luda/_core/utilities/_flex.sass +114 -0
  94. data/assets/stylesheets/luda/_core/utilities/_float.sass +21 -0
  95. data/assets/stylesheets/luda/_core/utilities/_opacity.sass +19 -0
  96. data/assets/stylesheets/luda/_core/utilities/_overflow.sass +18 -0
  97. data/assets/stylesheets/luda/_core/utilities/_position.sass +48 -0
  98. data/assets/stylesheets/luda/_core/utilities/_shape.sass +62 -0
  99. data/assets/stylesheets/luda/_core/utilities/_size.sass +67 -0
  100. data/assets/stylesheets/luda/_core/utilities/_space.sass +227 -0
  101. data/assets/stylesheets/luda/_core/utilities/_text.sass +85 -0
  102. data/assets/stylesheets/luda/_core/utilities/_visibility.sass +11 -0
  103. data/assets/stylesheets/luda/_core/utilities/_z-index.sass +19 -0
  104. data/assets/stylesheets/luda/_default.sass +51 -0
  105. data/assets/stylesheets/luda/core/_base.sass +430 -0
  106. data/assets/stylesheets/luda/core/_functions.sass +240 -0
  107. data/assets/stylesheets/luda/core/_variables.sass +710 -0
  108. data/assets/stylesheets/luda/core/behaviours/_disabled.sass +12 -0
  109. data/assets/stylesheets/luda/core/behaviours/_focus.sass +7 -0
  110. data/assets/stylesheets/luda/core/behaviours/_readonly.sass +16 -0
  111. data/assets/stylesheets/luda/core/behaviours/_toggle.sass +4 -0
  112. data/assets/stylesheets/luda/core/collections/_alert.sass +24 -0
  113. data/assets/stylesheets/luda/core/collections/_avatar.sass +117 -0
  114. data/assets/stylesheets/luda/core/collections/_breadcrumb.sass +21 -0
  115. data/assets/stylesheets/luda/core/collections/_button-group.sass +67 -0
  116. data/assets/stylesheets/luda/core/collections/_button-icon.sass +46 -0
  117. data/assets/stylesheets/luda/core/collections/_carousel.sass +132 -0
  118. data/assets/stylesheets/luda/core/collections/_dropdown.sass +60 -0
  119. data/assets/stylesheets/luda/core/collections/_form-button.sass +23 -0
  120. data/assets/stylesheets/luda/core/collections/_form-dropdown.sass +21 -0
  121. data/assets/stylesheets/luda/core/collections/_form-group.sass +48 -0
  122. data/assets/stylesheets/luda/core/collections/_form-icon.sass +71 -0
  123. data/assets/stylesheets/luda/core/collections/_media.sass +55 -0
  124. data/assets/stylesheets/luda/core/collections/_modal.sass +12 -0
  125. data/assets/stylesheets/luda/core/collections/_nav.sass +162 -0
  126. data/assets/stylesheets/luda/core/collections/_tab.sass +18 -0
  127. data/assets/stylesheets/luda/core/elements/_badge.sass +19 -0
  128. data/assets/stylesheets/luda/core/elements/_baseline.sass +22 -0
  129. data/assets/stylesheets/luda/core/elements/_button.sass +136 -0
  130. data/assets/stylesheets/luda/core/elements/_container.sass +8 -0
  131. data/assets/stylesheets/luda/core/elements/_grid.sass +55 -0
  132. data/assets/stylesheets/luda/core/elements/_icon.sass +110 -0
  133. data/assets/stylesheets/luda/core/elements/_overlay.sass +11 -0
  134. data/assets/stylesheets/luda/core/elements/_progress.sass +31 -0
  135. data/assets/stylesheets/luda/core/elements/_scrollbar.sass +21 -0
  136. data/assets/stylesheets/luda/core/elements/_table.sass +102 -0
  137. data/assets/stylesheets/luda/core/elements/_turbolinks-progress-bar.sass +5 -0
  138. data/assets/stylesheets/luda/core/elements/form/_form-check-radio.sass +105 -0
  139. data/assets/stylesheets/luda/core/elements/form/_form-element.sass +83 -0
  140. data/assets/stylesheets/luda/core/elements/form/_form-helper.sass +66 -0
  141. data/assets/stylesheets/luda/core/elements/form/_form-label.sass +20 -0
  142. data/assets/stylesheets/luda/core/elements/form/_form-range.sass +92 -0
  143. data/assets/stylesheets/luda/core/elements/form/_form-row.sass +214 -0
  144. data/assets/stylesheets/luda/core/elements/typography/_code.sass +27 -0
  145. data/assets/stylesheets/luda/core/elements/typography/_link.sass +15 -0
  146. data/assets/stylesheets/luda/core/elements/typography/_list.sass +14 -0
  147. data/assets/stylesheets/luda/core/elements/typography/_mark.sass +7 -0
  148. data/assets/stylesheets/luda/core/elements/typography/_quote.sass +68 -0
  149. data/assets/stylesheets/luda/core/elements/typography/_sub-sup.sass +16 -0
  150. data/assets/stylesheets/luda/core/elements/typography/_typography.sass +52 -0
  151. data/assets/stylesheets/luda/core/mixins/_browser.sass +15 -0
  152. data/assets/stylesheets/luda/core/mixins/_button.sass +90 -0
  153. data/assets/stylesheets/luda/core/mixins/_dropdown.sass +40 -0
  154. data/assets/stylesheets/luda/core/mixins/_focus.sass +3 -0
  155. data/assets/stylesheets/luda/core/mixins/_form.sass +27 -0
  156. data/assets/stylesheets/luda/core/mixins/_install.sass +7 -0
  157. data/assets/stylesheets/luda/core/mixins/_media-query.sass +66 -0
  158. data/assets/stylesheets/luda/core/mixins/_overlay.sass +14 -0
  159. data/assets/stylesheets/luda/core/mixins/_sass-lint-fix.sass +3 -0
  160. data/assets/stylesheets/luda/core/mixins/_typography.sass +40 -0
  161. data/assets/stylesheets/luda/core/utilities/_align.sass +19 -0
  162. data/assets/stylesheets/luda/core/utilities/_background.sass +88 -0
  163. data/assets/stylesheets/luda/core/utilities/_color.sass +36 -0
  164. data/assets/stylesheets/luda/core/utilities/_display.sass +40 -0
  165. data/assets/stylesheets/luda/core/utilities/_flex.sass +114 -0
  166. data/assets/stylesheets/luda/core/utilities/_float.sass +21 -0
  167. data/assets/stylesheets/luda/core/utilities/_opacity.sass +19 -0
  168. data/assets/stylesheets/luda/core/utilities/_overflow.sass +18 -0
  169. data/assets/stylesheets/luda/core/utilities/_position.sass +48 -0
  170. data/assets/stylesheets/luda/core/utilities/_shape.sass +62 -0
  171. data/assets/stylesheets/luda/core/utilities/_size.sass +67 -0
  172. data/assets/stylesheets/luda/core/utilities/_space.sass +227 -0
  173. data/assets/stylesheets/luda/core/utilities/_text.sass +85 -0
  174. data/assets/stylesheets/luda/core/utilities/_visibility.sass +11 -0
  175. data/assets/stylesheets/luda/core/utilities/_z-index.sass +19 -0
  176. data/assets/stylesheets/luda/default/_banner.sass +7 -0
  177. data/assets/stylesheets/luda/default/_base.sass +6 -0
  178. data/assets/stylesheets/luda/default/_functions.sass +1 -0
  179. data/assets/stylesheets/luda/default/_mixins.sass +10 -0
  180. data/assets/stylesheets/luda/default/_variables.sass +1 -0
  181. data/assets/stylesheets/luda/default/behaviours/_disabled.sass +5 -0
  182. data/assets/stylesheets/luda/default/behaviours/_focus.sass +5 -0
  183. data/assets/stylesheets/luda/default/behaviours/_readonly.sass +5 -0
  184. data/assets/stylesheets/luda/default/behaviours/_toggle.sass +5 -0
  185. data/assets/stylesheets/luda/default/collections/_alert.sass +6 -0
  186. data/assets/stylesheets/luda/default/collections/_avatar.sass +7 -0
  187. data/assets/stylesheets/luda/default/collections/_breadcrumb.sass +6 -0
  188. data/assets/stylesheets/luda/default/collections/_button-group.sass +7 -0
  189. data/assets/stylesheets/luda/default/collections/_button-icon.sass +8 -0
  190. data/assets/stylesheets/luda/default/collections/_carousel.sass +7 -0
  191. data/assets/stylesheets/luda/default/collections/_dropdown.sass +8 -0
  192. data/assets/stylesheets/luda/default/collections/_form-button.sass +9 -0
  193. data/assets/stylesheets/luda/default/collections/_form-dropdown.sass +8 -0
  194. data/assets/stylesheets/luda/default/collections/_form-group.sass +11 -0
  195. data/assets/stylesheets/luda/default/collections/_form-icon.sass +8 -0
  196. data/assets/stylesheets/luda/default/collections/_media.sass +7 -0
  197. data/assets/stylesheets/luda/default/collections/_modal.sass +7 -0
  198. data/assets/stylesheets/luda/default/collections/_nav.sass +10 -0
  199. data/assets/stylesheets/luda/default/collections/_tab.sass +9 -0
  200. data/assets/stylesheets/luda/default/elements/_badge.sass +6 -0
  201. data/assets/stylesheets/luda/default/elements/_baseline.sass +6 -0
  202. data/assets/stylesheets/luda/default/elements/_button.sass +7 -0
  203. data/assets/stylesheets/luda/default/elements/_container.sass +6 -0
  204. data/assets/stylesheets/luda/default/elements/_form.sass +13 -0
  205. data/assets/stylesheets/luda/default/elements/_grid.sass +6 -0
  206. data/assets/stylesheets/luda/default/elements/_icon.sass +6 -0
  207. data/assets/stylesheets/luda/default/elements/_overlay.sass +6 -0
  208. data/assets/stylesheets/luda/default/elements/_progress.sass +6 -0
  209. data/assets/stylesheets/luda/default/elements/_scrollbar.sass +6 -0
  210. data/assets/stylesheets/luda/default/elements/_table.sass +6 -0
  211. data/assets/stylesheets/luda/default/elements/_turbolinks-progress-bar.sass +6 -0
  212. data/assets/stylesheets/luda/default/elements/_typography.sass +12 -0
  213. data/assets/stylesheets/luda/default/elements/form/_form-check-radio.sass +5 -0
  214. data/assets/stylesheets/luda/default/elements/form/_form-element.sass +5 -0
  215. data/assets/stylesheets/luda/default/elements/form/_form-helper.sass +5 -0
  216. data/assets/stylesheets/luda/default/elements/form/_form-label.sass +5 -0
  217. data/assets/stylesheets/luda/default/elements/form/_form-range.sass +5 -0
  218. data/assets/stylesheets/luda/default/elements/form/_form-row.sass +5 -0
  219. data/assets/stylesheets/luda/default/elements/typography/_code.sass +5 -0
  220. data/assets/stylesheets/luda/default/elements/typography/_link.sass +5 -0
  221. data/assets/stylesheets/luda/default/elements/typography/_list.sass +4 -0
  222. data/assets/stylesheets/luda/default/elements/typography/_mark.sass +5 -0
  223. data/assets/stylesheets/luda/default/elements/typography/_quote.sass +5 -0
  224. data/assets/stylesheets/luda/default/elements/typography/_sub-sup.sass +5 -0
  225. data/assets/stylesheets/luda/default/elements/typography/_typography.sass +5 -0
  226. data/assets/stylesheets/luda/default/index.sass +56 -0
  227. data/assets/stylesheets/luda/default/utilities/_align.sass +5 -0
  228. data/assets/stylesheets/luda/default/utilities/_background.sass +5 -0
  229. data/assets/stylesheets/luda/default/utilities/_color.sass +5 -0
  230. data/assets/stylesheets/luda/default/utilities/_display.sass +5 -0
  231. data/assets/stylesheets/luda/default/utilities/_flex.sass +5 -0
  232. data/assets/stylesheets/luda/default/utilities/_float.sass +5 -0
  233. data/assets/stylesheets/luda/default/utilities/_opacity.sass +5 -0
  234. data/assets/stylesheets/luda/default/utilities/_overflow.sass +5 -0
  235. data/assets/stylesheets/luda/default/utilities/_position.sass +5 -0
  236. data/assets/stylesheets/luda/default/utilities/_shape.sass +5 -0
  237. data/assets/stylesheets/luda/default/utilities/_size.sass +5 -0
  238. data/assets/stylesheets/luda/default/utilities/_space.sass +5 -0
  239. data/assets/stylesheets/luda/default/utilities/_text.sass +5 -0
  240. data/assets/stylesheets/luda/default/utilities/_visibility.sass +5 -0
  241. data/assets/stylesheets/luda/default/utilities/_z-index.sass +5 -0
  242. data/lib/luda.rb +72 -0
  243. data/lib/luda/config.rb +3 -0
  244. data/lib/luda/engine.rb +11 -0
  245. data/lib/luda/version.rb +3 -0
  246. metadata +302 -0
@@ -0,0 +1,240 @@
1
+ //= require ./install
2
+ //= require ./utilities
3
+ //= require ./dom
4
+ //= require ./event
5
+ (function (global, factory) {
6
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('./install.js'), require('./utilities.js'), require('./dom.js'), require('./event.js')) :
7
+ typeof define === 'function' && define.amd ? define(['./install.js', './utilities.js', './dom.js', './event.js'], factory) :
8
+ (factory());
9
+ }(this, (function () { 'use strict';
10
+
11
+ var Component;
12
+
13
+ luda(Component = (function() {
14
+ class Component {
15
+ _hasDescendant(descendant) {
16
+ if (this._children.length && descendant) {
17
+ if (this._children.includes(descendant)) {
18
+ return true;
19
+ }
20
+ return this._children.some(function(child) {
21
+ return child._hasDescendant(descendant);
22
+ });
23
+ } else {
24
+ return false;
25
+ }
26
+ }
27
+
28
+ _observe() {
29
+ this._observer = new MutationObserver(this._onMutations.bind(this));
30
+ return this._observer.observe(this._$component, this.constructor._observerConfig);
31
+ }
32
+
33
+ _disconnect() {
34
+ this._observer.disconnect();
35
+ return this._observer = null;
36
+ }
37
+
38
+ static create($component) {
39
+ var $family, componentIsElementInstance, instance, parent;
40
+ componentIsElementInstance = $component instanceof Element;
41
+ if (!componentIsElementInstance) {
42
+ throw new Error(this._$COMPONENT_INVALID_ERROR);
43
+ }
44
+ $family = this._query$family($component);
45
+ instance = this.query($component);
46
+ if ($family._$parent) {
47
+ if (parent = this.query($family._$parent)) {
48
+ if (!instance) {
49
+ this._instances.push(instance = this._createInstance($component));
50
+ }
51
+ if (instance._parent !== parent) {
52
+ parent._children.push(instance) && (instance._parent = parent);
53
+ }
54
+ $family._$children.forEach(($child) => {
55
+ return this.create($child);
56
+ });
57
+ return instance;
58
+ } else {
59
+ this.create($family._$parent);
60
+ return this.query($component);
61
+ }
62
+ } else {
63
+ if (!instance) {
64
+ this._instances.push(instance = this._createInstance($component));
65
+ }
66
+ $family._$children.forEach(($child) => {
67
+ return this.create($child);
68
+ });
69
+ return instance;
70
+ }
71
+ }
72
+
73
+ static destroy(instance$component) {
74
+ var attribute, instance, results, value;
75
+ instance = this.query(instance$component);
76
+ if (instance) {
77
+ if (instance._observer) {
78
+ instance._disconnect();
79
+ }
80
+ if (instance._destroy) {
81
+ instance._destroy();
82
+ }
83
+ while (instance._children.length) {
84
+ this.destroy(instance._children[0]);
85
+ }
86
+ if (instance._parent) {
87
+ luda.except(instance, instance._parent._children);
88
+ }
89
+ luda.except(instance, this._instances);
90
+ results = [];
91
+ for (attribute in instance) {
92
+ value = instance[attribute];
93
+ results.push(instance[attribute] = null);
94
+ }
95
+ return results;
96
+ }
97
+ }
98
+
99
+ static query(instance$component) {
100
+ var instance;
101
+ instance = null;
102
+ if (instance$component instanceof this && this._instances.includes(instance$component)) {
103
+ instance = instance$component;
104
+ } else if (instance$component instanceof Element) {
105
+ this._instances.some(function(inited) {
106
+ if (inited._$component === instance$component) {
107
+ instance = inited;
108
+ return true;
109
+ }
110
+ });
111
+ }
112
+ return instance;
113
+ }
114
+
115
+ static _query$family($component) {
116
+ var _$children, _$parent;
117
+ _$parent = null;
118
+ _$children = [];
119
+ if (this._SELECTOR) {
120
+ _$parent = luda.$parent(this._SELECTOR, $component);
121
+ _$children = luda.$unnested(this._SELECTOR, $component, this._SELECTOR);
122
+ }
123
+ return {_$parent, _$children};
124
+ }
125
+
126
+ static _createInstance($component) {
127
+ var instance;
128
+ instance = new this();
129
+ instance._$component = $component;
130
+ instance._parent = null;
131
+ instance._children = [];
132
+ instance._observer = null;
133
+ if (instance._constructor) {
134
+ instance._constructor();
135
+ }
136
+ if (!(instance._observer && instance._onMutations && this._observerConfig)) {
137
+ instance._observe();
138
+ }
139
+ return instance;
140
+ }
141
+
142
+ static _observe(classObj) {
143
+ if (!Component._observer) {
144
+ Component._observer = new MutationObserver(function(mutations) {
145
+ return mutations.forEach(function(mutation) {
146
+ var $addedNodes, $removedNodes;
147
+ $removedNodes = Array.from(mutation.removedNodes);
148
+ $addedNodes = Array.from(mutation.addedNodes);
149
+ $removedNodes.forEach(function($node) {
150
+ if ($node instanceof Element) {
151
+ return Component._Observed.forEach(function(Observed) {
152
+ var $destroies;
153
+ if ($node.matches(Observed._SELECTOR)) {
154
+ return Observed.destroy($node);
155
+ } else {
156
+ $destroies = luda.$children(Observed._SELECTOR, $node);
157
+ return $destroies.forEach(function($destroy) {
158
+ return Observed.destroy($destroy);
159
+ });
160
+ }
161
+ });
162
+ }
163
+ });
164
+ return $addedNodes.forEach(function($node) {
165
+ if ($node instanceof Element) {
166
+ return Component._Observed.forEach(function(Observed) {
167
+ var $creates;
168
+ if ($node.matches(Observed._SELECTOR)) {
169
+ return Observed.create($node);
170
+ } else {
171
+ $creates = luda.$children(Observed._SELECTOR, $node);
172
+ return $creates.forEach(function($create) {
173
+ return Observed.create($create);
174
+ });
175
+ }
176
+ });
177
+ }
178
+ });
179
+ });
180
+ });
181
+ Component._observer.observe(document.documentElement, Component._observerConfig);
182
+ }
183
+ if (!Component._Observed.includes(classObj)) {
184
+ return Component._Observed.push(classObj);
185
+ }
186
+ }
187
+
188
+ static _install() {
189
+ var exposed, self;
190
+ self = this;
191
+ if (this === Component) {
192
+ return this;
193
+ }
194
+ if (!(this._SELECTOR || typeof this._SELECTOR !== 'string')) {
195
+ throw new Error(this._COMPONENT_NO_SELECTOR_ERROR);
196
+ }
197
+ if (!this.hasOwnProperty('_instances')) {
198
+ this._instances = [];
199
+ }
200
+ if (typeof this._init === 'function') {
201
+ exposed = this._init();
202
+ }
203
+ luda.on(luda._DOC_READY, function() {
204
+ luda.$children(self._SELECTOR).forEach(function($component) {
205
+ return self.create($component);
206
+ });
207
+ return Component._observe(self);
208
+ });
209
+ if (exposed) {
210
+ return exposed;
211
+ } else {
212
+ return this;
213
+ }
214
+ }
215
+
216
+ }
217
+ Component._SCOPE = 'Component';
218
+
219
+ Component._COMPONENT_NO_SELECTOR_ERROR = 'Extended component must has a css selector';
220
+
221
+ Component._$COMPONENT_INVALID_ERROR = '@param $component must be an instance of Element';
222
+
223
+ Component._SELECTOR = '';
224
+
225
+ Component._instances = [];
226
+
227
+ Component._Observed = [];
228
+
229
+ Component._observer = null;
230
+
231
+ Component._observerConfig = {
232
+ childList: true,
233
+ subtree: true
234
+ };
235
+
236
+ return Component;
237
+
238
+ }).call(this));
239
+
240
+ })));
@@ -0,0 +1,18 @@
1
+ //= require ./install
2
+ (function (global, factory) {
3
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('./install.js')) :
4
+ typeof define === 'function' && define.amd ? define(['./install.js'], factory) :
5
+ (factory());
6
+ }(this, (function () { 'use strict';
7
+
8
+ luda({
9
+ KEY_LEFT: 37,
10
+ KEY_UP: 38,
11
+ KEY_RIGHT: 39,
12
+ KEY_DOWN: 40,
13
+ KEY_TAB: 9,
14
+ KEY_ESC: 27,
15
+ KEY_ENTER: 13
16
+ });
17
+
18
+ })));
@@ -0,0 +1,125 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
3
+ typeof define === 'function' && define.amd ? define(factory) :
4
+ (factory());
5
+ }(this, (function () { 'use strict';
6
+
7
+ var Degradation;
8
+
9
+ Degradation = {
10
+ _URL_ATTRIBUTE: 'data-degradation-url',
11
+ _HTML: ['<div id="luda-degradation-html" ', 'style="padding:100px 30px;text-align:center">', '<h1>Your Browser Is Too Old!</h1>', '<p>', 'Please visit this site with a modern browser ', '<a target="_blank" href="https://www.google.com/chrome/">', '(Chrome recommended)', '</a>', '.</p>', '</div>'].join(''),
12
+ _CSS_PROPERTIES: [
13
+ {
14
+ display: 'flex',
15
+ position: ['sticky',
16
+ 'fixed']
17
+ },
18
+ 'transition',
19
+ 'animation'
20
+ ],
21
+ _JS_PROPERTIES: {
22
+ es6Class: 'class X {}',
23
+ es6ArrowFunction: '((x) => x)()'
24
+ },
25
+ _NOTIFY_MILLSECONDS: 500,
26
+ check: function() {
27
+ this._checkEnv();
28
+ this._checkJS(this._JS_PROPERTIES);
29
+ return this._checkCSS(this._CSS_PROPERTIES);
30
+ },
31
+ _eval: eval,
32
+ _checkEnv: function() {
33
+ if (typeof document !== 'undefined') {
34
+ if (typeof window !== 'undefined') {
35
+ return window;
36
+ }
37
+ if (typeof global !== 'undefined') {
38
+ return global;
39
+ }
40
+ }
41
+ throw new Error('Unsupported runtime environment.');
42
+ },
43
+ _checkJS: function(properties) {
44
+ var err, property, results, value;
45
+ results = [];
46
+ for (property in properties) {
47
+ value = properties[property];
48
+ try {
49
+ results.push(this._eval(value));
50
+ } catch (error) {
51
+ err = error;
52
+ this._notify();
53
+ throw new Error(property + ' ' + err);
54
+ }
55
+ }
56
+ return results;
57
+ },
58
+ _checkCSS: function(properties) {
59
+ var ele, i, len, name, property, results, value, valueEle;
60
+ ele = document.createElement('div');
61
+ results = [];
62
+ for (i = 0, len = properties.length; i < len; i++) {
63
+ property = properties[i];
64
+ if (typeof property === 'string') {
65
+ results.push(this._CSSPropertySupported(ele, property));
66
+ } else {
67
+ results.push((function() {
68
+ var results1;
69
+ results1 = [];
70
+ for (name in property) {
71
+ value = property[name];
72
+ this._CSSPropertySupported(ele, name);
73
+ if (value instanceof Array) {
74
+ results1.push((function() {
75
+ var j, len1, results2;
76
+ results2 = [];
77
+ for (j = 0, len1 = value.length; j < len1; j++) {
78
+ valueEle = value[j];
79
+ results2.push(this._CSSValueSupported(ele, name, valueEle));
80
+ }
81
+ return results2;
82
+ }).call(this));
83
+ } else {
84
+ results1.push(this._CSSValueSupported(ele, name, value));
85
+ }
86
+ }
87
+ return results1;
88
+ }).call(this));
89
+ }
90
+ }
91
+ return results;
92
+ },
93
+ _CSSPropertySupported: function(ele, property) {
94
+ if (typeof ele.style[property] !== 'string') {
95
+ this._notify();
96
+ throw new Error('Unsupported CSS property: ' + property);
97
+ }
98
+ },
99
+ _CSSValueSupported: function(ele, property, value) {
100
+ ele.style[property] = value;
101
+ if (ele.style[property] !== value) {
102
+ this._notify();
103
+ throw new Error('Unsupported CSS property value: ' + property + ' ' + value);
104
+ }
105
+ },
106
+ _notify: function() {
107
+ var _self, redirectUrl;
108
+ redirectUrl = document.documentElement.getAttribute(this._URL_ATTRIBUTE);
109
+ if (redirectUrl) {
110
+ return location.href = redirectUrl;
111
+ }
112
+ _self = this;
113
+ return setInterval(function() {
114
+ if (!document.getElementById('luda-degradation-html')) {
115
+ if (document.body) {
116
+ return document.body.innerHTML = _self._HTML;
117
+ }
118
+ }
119
+ }, this._NOTIFY_MILLSECONDS);
120
+ }
121
+ };
122
+
123
+ Degradation.check();
124
+
125
+ })));
@@ -0,0 +1,81 @@
1
+ //= require ./install
2
+ (function (global, factory) {
3
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('./install.js')) :
4
+ typeof define === 'function' && define.amd ? define(['./install.js'], factory) :
5
+ (factory());
6
+ }(this, (function () { 'use strict';
7
+
8
+ luda({
9
+ $child: function(selector, $ancestor) {
10
+ if (!$ancestor) {
11
+ $ancestor = document;
12
+ }
13
+ return $ancestor.querySelector(selector);
14
+ },
15
+ $children: function(selector, $ancestor) {
16
+ var $descendant, descendants;
17
+ if (!$ancestor) {
18
+ $ancestor = document;
19
+ }
20
+ $descendant = this.$child(selector, $ancestor);
21
+ if ($descendant) {
22
+ return descendants = Array.from($ancestor.querySelectorAll(selector));
23
+ } else {
24
+ return descendants = [];
25
+ }
26
+ },
27
+ $unnested: function(selector, $ancestor, ancestorSelector) {
28
+ var descendants;
29
+ descendants = this.$children(selector, $ancestor);
30
+ return descendants.filter(($descendant) => {
31
+ if (this.$parent(ancestorSelector, $descendant) === $ancestor) {
32
+ return $descendant;
33
+ }
34
+ });
35
+ },
36
+ $parent: function(selector, $descendant) {
37
+ var $ancestor;
38
+ $ancestor = $descendant.parentNode;
39
+ if ($ancestor) {
40
+ if ($ancestor.matches && $ancestor.matches(selector)) {
41
+ return $ancestor;
42
+ } else {
43
+ return this.$parent(selector, $ancestor);
44
+ }
45
+ }
46
+ },
47
+ $parents: function(selector, $descendant, _ancestors) {
48
+ var $ancestor;
49
+ $ancestor = this.$parent(selector, $descendant);
50
+ if (!_ancestors) {
51
+ _ancestors = [];
52
+ }
53
+ if ($ancestor) {
54
+ _ancestors.push($ancestor);
55
+ return this.$parents(selector, $ancestor, _ancestors);
56
+ } else {
57
+ return _ancestors;
58
+ }
59
+ },
60
+ $after: function($node, $target) {
61
+ var $parent;
62
+ $parent = $target.parentNode;
63
+ if ($parent.lastChild === $target) {
64
+ return $parent.appendChild($node);
65
+ } else {
66
+ return $parent.insertBefore($node, $target.nextSibling);
67
+ }
68
+ },
69
+ $prepend: function($node, $target) {
70
+ if ($target.firstChild) {
71
+ return $target.insertBefore($node, $target.firstChild);
72
+ } else {
73
+ return $target.appendChild($node);
74
+ }
75
+ },
76
+ reflow: function($element) {
77
+ return $element.offsetHeight;
78
+ }
79
+ });
80
+
81
+ })));