matestack-ui-core 0.7.4 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (295) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +8 -0
  3. data/README.md +28 -216
  4. data/app/concepts/matestack/ui/core/abbr/abbr.haml +3 -3
  5. data/app/concepts/matestack/ui/core/abbr/abbr.rb +1 -8
  6. data/app/concepts/matestack/ui/core/action/action.haml +1 -1
  7. data/app/concepts/matestack/ui/core/action/action.js +120 -39
  8. data/app/concepts/matestack/ui/core/action/action.rb +40 -15
  9. data/app/concepts/matestack/ui/core/actionview/dynamic.haml +4 -4
  10. data/app/concepts/matestack/ui/core/address/address.haml +3 -3
  11. data/app/concepts/matestack/ui/core/address/address.rb +1 -1
  12. data/app/concepts/matestack/ui/core/app/app.haml +2 -3
  13. data/app/concepts/matestack/ui/core/app/app.js +16 -5
  14. data/app/concepts/matestack/ui/core/app/app.rb +33 -56
  15. data/app/concepts/matestack/ui/core/app/location.js +2 -3
  16. data/app/concepts/matestack/ui/core/app/store.js +38 -5
  17. data/app/concepts/matestack/ui/core/area/area.haml +1 -1
  18. data/app/concepts/matestack/ui/core/area/area.rb +2 -14
  19. data/app/concepts/matestack/ui/core/article/article.haml +3 -3
  20. data/app/concepts/matestack/ui/core/article/article.rb +1 -1
  21. data/app/concepts/matestack/ui/core/aside/aside.haml +1 -1
  22. data/app/concepts/matestack/ui/core/aside/aside.rb +0 -1
  23. data/app/concepts/matestack/ui/core/async/async.haml +6 -2
  24. data/app/concepts/matestack/ui/core/async/async.js +62 -6
  25. data/app/concepts/matestack/ui/core/async/async.rb +33 -5
  26. data/app/concepts/matestack/ui/core/async/children_wrapper.haml +2 -0
  27. data/app/concepts/matestack/ui/core/b/b.haml +3 -3
  28. data/app/concepts/matestack/ui/core/b/b.rb +1 -1
  29. data/app/concepts/matestack/ui/core/bdi/bdi.haml +3 -3
  30. data/app/concepts/matestack/ui/core/bdi/bdi.rb +1 -0
  31. data/app/concepts/matestack/ui/core/bdo/bdo.haml +3 -3
  32. data/app/concepts/matestack/ui/core/bdo/bdo.rb +2 -7
  33. data/app/concepts/matestack/ui/core/blockquote/blockquote.haml +3 -3
  34. data/app/concepts/matestack/ui/core/blockquote/blockquote.rb +2 -7
  35. data/app/concepts/matestack/ui/core/br/br.haml +4 -4
  36. data/app/concepts/matestack/ui/core/br/br.rb +1 -1
  37. data/app/concepts/matestack/ui/core/button/button.haml +3 -3
  38. data/app/concepts/matestack/ui/core/button/button.rb +3 -7
  39. data/app/concepts/matestack/ui/core/caption/caption.haml +3 -3
  40. data/app/concepts/matestack/ui/core/caption/caption.rb +1 -1
  41. data/app/concepts/matestack/ui/core/cite/cite.haml +3 -3
  42. data/app/concepts/matestack/ui/core/cite/cite.rb +1 -1
  43. data/app/concepts/matestack/ui/core/code/code.haml +3 -3
  44. data/app/concepts/matestack/ui/core/code/code.rb +1 -1
  45. data/app/concepts/matestack/ui/core/collection/content/content.rb +5 -7
  46. data/app/concepts/matestack/ui/core/collection/content/next/next.haml +1 -1
  47. data/app/concepts/matestack/ui/core/collection/content/page/link/link.haml +1 -1
  48. data/app/concepts/matestack/ui/core/collection/content/page/link/link.rb +5 -3
  49. data/app/concepts/matestack/ui/core/collection/content/previous/previous.haml +1 -1
  50. data/app/concepts/matestack/ui/core/collection/filter/filter.rb +4 -5
  51. data/app/concepts/matestack/ui/core/collection/filter/input/input.rb +11 -8
  52. data/app/concepts/matestack/ui/core/collection/filter/reset/reset.haml +1 -1
  53. data/app/concepts/matestack/ui/core/collection/filter/select/select.haml +10 -0
  54. data/app/concepts/matestack/ui/core/collection/filter/select/select.rb +30 -0
  55. data/app/concepts/matestack/ui/core/collection/filter/submit/submit.haml +1 -1
  56. data/app/concepts/matestack/ui/core/collection/helper.rb +14 -6
  57. data/app/concepts/matestack/ui/core/collection/order/order.js +1 -1
  58. data/app/concepts/matestack/ui/core/collection/order/order.rb +4 -5
  59. data/app/concepts/matestack/ui/core/collection/order/toggle/indicator/indicator.rb +9 -5
  60. data/app/concepts/matestack/ui/core/collection/order/toggle/toggle.haml +1 -1
  61. data/app/concepts/matestack/ui/core/collection/order/toggle/toggle.rb +0 -1
  62. data/app/concepts/matestack/ui/core/component/base.rb +424 -0
  63. data/app/concepts/matestack/ui/core/component/children.haml +2 -2
  64. data/app/concepts/matestack/ui/core/component/component.js +1 -55
  65. data/app/concepts/matestack/ui/core/component/dynamic.haml +1 -1
  66. data/app/concepts/matestack/ui/core/component/dynamic.rb +25 -247
  67. data/app/concepts/matestack/ui/core/component/rerender.rb +8 -0
  68. data/app/concepts/matestack/ui/core/component/static.rb +3 -12
  69. data/app/concepts/matestack/ui/core/data/data.haml +3 -3
  70. data/app/concepts/matestack/ui/core/data/data.rb +2 -5
  71. data/app/concepts/matestack/ui/core/{absolute/absolute.haml → datalist/datalist.haml} +1 -1
  72. data/app/concepts/matestack/ui/core/datalist/datalist.rb +4 -0
  73. data/app/concepts/matestack/ui/core/dd/dd.haml +3 -3
  74. data/app/concepts/matestack/ui/core/dd/dd.rb +1 -1
  75. data/app/concepts/matestack/ui/core/del/del.haml +3 -3
  76. data/app/concepts/matestack/ui/core/del/del.rb +2 -0
  77. data/app/concepts/matestack/ui/core/details/details.haml +1 -1
  78. data/app/concepts/matestack/ui/core/details/details.rb +1 -1
  79. data/app/concepts/matestack/ui/core/dfn/dfn.haml +3 -3
  80. data/app/concepts/matestack/ui/core/dfn/dfn.rb +1 -1
  81. data/app/concepts/matestack/ui/core/dialog/dialog.haml +3 -3
  82. data/app/concepts/matestack/ui/core/dialog/dialog.rb +2 -5
  83. data/app/concepts/matestack/ui/core/div/div.haml +1 -1
  84. data/app/concepts/matestack/ui/core/div/div.rb +0 -1
  85. data/app/concepts/matestack/ui/core/dl/dl.haml +3 -3
  86. data/app/concepts/matestack/ui/core/dl/dl.rb +2 -2
  87. data/app/concepts/matestack/ui/core/dt/dt.haml +3 -3
  88. data/app/concepts/matestack/ui/core/dt/dt.rb +1 -1
  89. data/app/concepts/matestack/ui/core/em/em.haml +3 -3
  90. data/app/concepts/matestack/ui/core/em/em.rb +1 -1
  91. data/app/concepts/matestack/ui/core/fieldset/fieldset.haml +4 -4
  92. data/app/concepts/matestack/ui/core/fieldset/fieldset.rb +3 -6
  93. data/app/concepts/matestack/ui/core/figure/figure.haml +1 -1
  94. data/app/concepts/matestack/ui/core/figure/figure.rb +0 -1
  95. data/app/concepts/matestack/ui/core/footer/footer.haml +1 -1
  96. data/app/concepts/matestack/ui/core/footer/footer.rb +0 -1
  97. data/app/concepts/matestack/ui/core/form/checkbox/checkbox.rb +79 -0
  98. data/app/concepts/matestack/ui/core/form/form.haml +1 -1
  99. data/app/concepts/matestack/ui/core/form/form.js +257 -123
  100. data/app/concepts/matestack/ui/core/form/form.rb +52 -19
  101. data/app/concepts/matestack/ui/core/form/has_errors.rb +54 -0
  102. data/app/concepts/matestack/ui/core/form/has_input_html_attributes.rb +13 -0
  103. data/app/concepts/matestack/ui/core/form/input/input.rb +39 -52
  104. data/app/concepts/matestack/ui/core/form/radio/radio.rb +71 -0
  105. data/app/concepts/matestack/ui/core/form/select/select.haml +9 -76
  106. data/app/concepts/matestack/ui/core/form/select/select.rb +44 -49
  107. data/app/concepts/matestack/ui/core/form/submit/submit.haml +1 -1
  108. data/app/concepts/matestack/ui/core/form/submit/submit.rb +5 -2
  109. data/app/concepts/matestack/ui/core/form/textarea/textarea.rb +28 -0
  110. data/app/concepts/matestack/ui/core/form/utils.rb +47 -0
  111. data/app/concepts/matestack/ui/core/header/header.haml +1 -1
  112. data/app/concepts/matestack/ui/core/header/header.rb +0 -1
  113. data/app/concepts/matestack/ui/core/heading/heading.haml +4 -49
  114. data/app/concepts/matestack/ui/core/heading/heading.rb +1 -1
  115. data/app/concepts/matestack/ui/core/hr/hr.haml +1 -1
  116. data/app/concepts/matestack/ui/core/hr/hr.rb +0 -1
  117. data/app/concepts/matestack/ui/core/icon/icon.haml +3 -3
  118. data/app/concepts/matestack/ui/core/icon/icon.rb +1 -1
  119. data/app/concepts/matestack/ui/core/iframe/iframe.haml +3 -3
  120. data/app/concepts/matestack/ui/core/iframe/iframe.rb +3 -10
  121. data/app/concepts/matestack/ui/core/img/img.haml +1 -1
  122. data/app/concepts/matestack/ui/core/img/img.rb +8 -8
  123. data/app/concepts/matestack/ui/core/input/input.haml +1 -3
  124. data/app/concepts/matestack/ui/core/input/input.rb +4 -0
  125. data/app/concepts/matestack/ui/core/ins/ins.haml +3 -3
  126. data/app/concepts/matestack/ui/core/ins/ins.rb +2 -6
  127. data/app/concepts/matestack/ui/core/isolated/children_wrapper.haml +2 -0
  128. data/app/concepts/matestack/ui/core/isolated/isolated.haml +10 -0
  129. data/app/concepts/matestack/ui/core/isolated/isolated.js +108 -0
  130. data/app/concepts/matestack/ui/core/isolated/isolated.rb +59 -0
  131. data/app/concepts/matestack/ui/core/js/core.js +30 -6
  132. data/app/concepts/matestack/ui/core/kbd/kbd.haml +3 -3
  133. data/app/concepts/matestack/ui/core/kbd/kbd.rb +1 -0
  134. data/app/concepts/matestack/ui/core/label/label.haml +3 -3
  135. data/app/concepts/matestack/ui/core/label/label.rb +2 -6
  136. data/app/concepts/matestack/ui/core/legend/legend.haml +3 -3
  137. data/app/concepts/matestack/ui/core/legend/legend.rb +1 -1
  138. data/app/concepts/matestack/ui/core/li/li.haml +3 -3
  139. data/app/concepts/matestack/ui/core/li/li.rb +2 -1
  140. data/app/concepts/matestack/ui/core/link/link.haml +3 -3
  141. data/app/concepts/matestack/ui/core/link/link.rb +10 -14
  142. data/app/concepts/matestack/ui/core/main/main.haml +1 -1
  143. data/app/concepts/matestack/ui/core/main/main.rb +0 -1
  144. data/app/concepts/matestack/ui/core/map/map.haml +1 -1
  145. data/app/concepts/matestack/ui/core/map/map.rb +1 -7
  146. data/app/concepts/matestack/ui/core/mark/mark.haml +3 -3
  147. data/app/concepts/matestack/ui/core/mark/mark.rb +1 -0
  148. data/app/concepts/matestack/ui/core/meter/meter.haml +1 -1
  149. data/app/concepts/matestack/ui/core/meter/meter.rb +1 -10
  150. data/app/concepts/matestack/ui/core/nav/nav.haml +1 -1
  151. data/app/concepts/matestack/ui/core/nav/nav.rb +0 -1
  152. data/app/concepts/matestack/ui/core/noscript/noscript.haml +3 -3
  153. data/app/concepts/matestack/ui/core/noscript/noscript.rb +1 -1
  154. data/app/concepts/matestack/ui/core/object/object.haml +1 -1
  155. data/app/concepts/matestack/ui/core/object/object.rb +1 -11
  156. data/app/concepts/matestack/ui/core/ol/ol.haml +1 -1
  157. data/app/concepts/matestack/ui/core/ol/ol.rb +1 -1
  158. data/app/concepts/matestack/ui/core/onclick/onclick.haml +1 -1
  159. data/app/concepts/matestack/ui/core/onclick/onclick.rb +1 -0
  160. data/app/concepts/matestack/ui/core/optgroup/optgroup.haml +1 -1
  161. data/app/concepts/matestack/ui/core/optgroup/optgroup.rb +1 -6
  162. data/app/concepts/matestack/ui/core/option/option.haml +3 -3
  163. data/app/concepts/matestack/ui/core/option/option.rb +2 -8
  164. data/app/concepts/matestack/ui/core/output/output.haml +3 -3
  165. data/app/concepts/matestack/ui/core/output/output.rb +2 -7
  166. data/app/concepts/matestack/ui/core/page/{content.js → content/content.js} +8 -2
  167. data/app/concepts/matestack/ui/core/page/content/content.rb +28 -0
  168. data/app/concepts/matestack/ui/core/page/page.haml +3 -9
  169. data/app/concepts/matestack/ui/core/page/page.rb +15 -175
  170. data/app/concepts/matestack/ui/core/paragraph/paragraph.haml +3 -3
  171. data/app/concepts/matestack/ui/core/paragraph/paragraph.rb +1 -1
  172. data/app/concepts/matestack/ui/core/param/param.haml +1 -1
  173. data/app/concepts/matestack/ui/core/param/param.rb +1 -6
  174. data/app/concepts/matestack/ui/core/partial/partial.rb +0 -1
  175. data/app/concepts/matestack/ui/core/picture/picture.haml +1 -1
  176. data/app/concepts/matestack/ui/core/pre/pre.haml +3 -3
  177. data/app/concepts/matestack/ui/core/pre/pre.rb +1 -1
  178. data/app/concepts/matestack/ui/core/progress/progress.haml +1 -1
  179. data/app/concepts/matestack/ui/core/progress/progress.rb +1 -10
  180. data/app/concepts/matestack/ui/core/q/q.haml +3 -3
  181. data/app/concepts/matestack/ui/core/q/q.rb +2 -7
  182. data/app/concepts/matestack/ui/core/rp/rp.haml +3 -3
  183. data/app/concepts/matestack/ui/core/rp/rp.rb +1 -1
  184. data/app/concepts/matestack/ui/core/rt/rt.haml +3 -3
  185. data/app/concepts/matestack/ui/core/rt/rt.rb +1 -1
  186. data/app/concepts/matestack/ui/core/ruby/ruby.haml +3 -3
  187. data/app/concepts/matestack/ui/core/ruby/ruby.rb +1 -1
  188. data/app/concepts/matestack/ui/core/s/s.haml +3 -3
  189. data/app/concepts/matestack/ui/core/s/s.rb +1 -1
  190. data/app/concepts/matestack/ui/core/samp/samp.haml +3 -3
  191. data/app/concepts/matestack/ui/core/samp/samp.rb +1 -0
  192. data/app/concepts/matestack/ui/core/section/section.haml +1 -1
  193. data/app/concepts/matestack/ui/core/section/section.rb +0 -1
  194. data/app/concepts/matestack/ui/core/slot/slot.rb +1 -2
  195. data/app/concepts/matestack/ui/core/small/small.haml +3 -3
  196. data/app/concepts/matestack/ui/core/small/small.rb +1 -1
  197. data/app/concepts/matestack/ui/core/span/span.haml +3 -3
  198. data/app/concepts/matestack/ui/core/span/span.rb +1 -1
  199. data/app/concepts/matestack/ui/core/strong/strong.haml +3 -3
  200. data/app/concepts/matestack/ui/core/strong/strong.rb +1 -1
  201. data/app/concepts/matestack/ui/core/sub/sub.haml +3 -3
  202. data/app/concepts/matestack/ui/core/sub/sub.rb +1 -1
  203. data/app/concepts/matestack/ui/core/summary/summary.haml +3 -3
  204. data/app/concepts/matestack/ui/core/summary/summary.rb +1 -1
  205. data/app/concepts/matestack/ui/core/sup/sup.haml +3 -3
  206. data/app/concepts/matestack/ui/core/sup/sup.rb +1 -1
  207. data/app/concepts/matestack/ui/core/table/table.haml +1 -1
  208. data/app/concepts/matestack/ui/core/table/table.rb +0 -1
  209. data/app/concepts/matestack/ui/core/tbody/tbody.haml +1 -1
  210. data/app/concepts/matestack/ui/core/tbody/tbody.rb +0 -1
  211. data/app/concepts/matestack/ui/core/td/td.haml +3 -3
  212. data/app/concepts/matestack/ui/core/td/td.rb +2 -1
  213. data/app/concepts/matestack/ui/core/template/template.haml +1 -1
  214. data/app/concepts/matestack/ui/core/textarea/textarea.haml +5 -0
  215. data/app/concepts/matestack/ui/core/textarea/textarea.rb +10 -0
  216. data/app/concepts/matestack/ui/core/tfoot/tfoot.haml +1 -1
  217. data/app/concepts/matestack/ui/core/tfoot/tfoot.rb +0 -1
  218. data/app/concepts/matestack/ui/core/th/th.haml +3 -3
  219. data/app/concepts/matestack/ui/core/th/th.rb +2 -1
  220. data/app/concepts/matestack/ui/core/thead/thead.haml +1 -1
  221. data/app/concepts/matestack/ui/core/thead/thead.rb +0 -1
  222. data/app/concepts/matestack/ui/core/time/time.haml +1 -1
  223. data/app/concepts/matestack/ui/core/time/time.rb +1 -7
  224. data/app/concepts/matestack/ui/core/toggle/toggle.haml +2 -0
  225. data/app/concepts/matestack/ui/core/toggle/toggle.js +71 -0
  226. data/app/concepts/matestack/ui/core/toggle/toggle.rb +13 -0
  227. data/app/concepts/matestack/ui/core/tr/tr.haml +1 -1
  228. data/app/concepts/matestack/ui/core/tr/tr.rb +0 -1
  229. data/app/concepts/matestack/ui/core/transition/transition.haml +3 -3
  230. data/app/concepts/matestack/ui/core/transition/transition.js +17 -1
  231. data/app/concepts/matestack/ui/core/transition/transition.rb +15 -8
  232. data/app/concepts/matestack/ui/core/u/u.haml +3 -3
  233. data/app/concepts/matestack/ui/core/u/u.rb +1 -1
  234. data/app/concepts/matestack/ui/core/ul/ul.haml +1 -1
  235. data/app/concepts/matestack/ui/core/ul/ul.rb +0 -1
  236. data/app/concepts/matestack/ui/core/unescaped/unescaped.rb +3 -1
  237. data/app/concepts/matestack/ui/core/var/var.haml +3 -3
  238. data/app/concepts/matestack/ui/core/var/var.rb +1 -0
  239. data/app/concepts/matestack/ui/core/video/video.haml +2 -2
  240. data/app/concepts/matestack/ui/core/video/video.rb +4 -14
  241. data/app/concepts/matestack/ui/core/view/view.haml +1 -0
  242. data/app/concepts/matestack/ui/core/view/view.rb +30 -0
  243. data/app/concepts/matestack/ui/core/wbr/wbr.haml +5 -1
  244. data/app/concepts/matestack/ui/core/wbr/wbr.rb +1 -0
  245. data/app/concepts/matestack/ui/core/youtube/youtube.haml +1 -1
  246. data/app/concepts/matestack/ui/core/youtube/youtube.rb +18 -16
  247. data/app/helpers/matestack/ui/core/application_helper.rb +90 -19
  248. data/app/lib/matestack/ui/component.rb +1 -0
  249. data/app/lib/matestack/ui/core/has_view_context.rb +8 -4
  250. data/app/lib/matestack/ui/core/html_attributes.rb +43 -0
  251. data/app/lib/matestack/ui/core/properties.rb +161 -0
  252. data/app/lib/matestack/ui/core/rendering/default_renderer_class_determiner.rb +33 -0
  253. data/app/lib/matestack/ui/core/rendering/main_renderer.rb +200 -0
  254. data/app/lib/matestack/ui/isolated_component.rb +1 -0
  255. data/app/lib/matestack/ui/vue_js_component.rb +1 -0
  256. data/lib/matestack/ui/core.rb +4 -2
  257. data/lib/matestack/ui/core/cell.rb +0 -2
  258. data/lib/matestack/ui/core/component/registry.rb +47 -0
  259. data/lib/matestack/ui/core/components.rb +268 -0
  260. data/lib/matestack/ui/core/dsl.rb +6 -0
  261. data/lib/matestack/ui/core/engine.rb +16 -0
  262. data/lib/matestack/ui/core/version.rb +1 -1
  263. data/vendor/assets/javascripts/dist/matestack-ui-core.js +852 -311
  264. data/vendor/assets/javascripts/dist/matestack-ui-core.js.map +1 -1
  265. data/vendor/assets/javascripts/dist/matestack-ui-core.min.js +1 -1
  266. data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.br +0 -0
  267. data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.gz +0 -0
  268. data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.map +1 -1
  269. data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.map.br +0 -0
  270. data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.map.gz +0 -0
  271. metadata +49 -65
  272. data/MIT-LICENSE +0 -20
  273. data/app/concepts/matestack/ui/core/absolute/absolute.rb +0 -17
  274. data/app/concepts/matestack/ui/core/collection/filter/input/input.haml +0 -2
  275. data/app/concepts/matestack/ui/core/component/response.haml +0 -2
  276. data/app/concepts/matestack/ui/core/component/response_dynamic.haml +0 -7
  277. data/app/concepts/matestack/ui/core/component/response_dynamic_without_rerender.haml +0 -3
  278. data/app/concepts/matestack/ui/core/component/static.haml +0 -1
  279. data/app/concepts/matestack/ui/core/form/inline/inline.haml +0 -6
  280. data/app/concepts/matestack/ui/core/form/inline/inline.rb +0 -9
  281. data/app/concepts/matestack/ui/core/form/input/input.haml +0 -27
  282. data/app/concepts/matestack/ui/core/html/html.haml +0 -3
  283. data/app/concepts/matestack/ui/core/html/html.js +0 -10
  284. data/app/concepts/matestack/ui/core/html/html.rb +0 -17
  285. data/app/concepts/matestack/ui/core/isolate/isolate.haml +0 -2
  286. data/app/concepts/matestack/ui/core/isolate/isolate.rb +0 -11
  287. data/app/concepts/matestack/ui/core/page/content.haml +0 -7
  288. data/app/concepts/matestack/ui/core/page/content.rb +0 -5
  289. data/app/concepts/matestack/ui/core/pg/pg.haml +0 -5
  290. data/app/concepts/matestack/ui/core/pg/pg.rb +0 -5
  291. data/app/lib/matestack/ui/core/app_node.rb +0 -53
  292. data/app/lib/matestack/ui/core/component_node.rb +0 -87
  293. data/app/lib/matestack/ui/core/page_node.rb +0 -100
  294. data/app/lib/matestack/ui/core/render.rb +0 -89
  295. data/app/lib/matestack/ui/core/to_cell.rb +0 -129
@@ -1,13 +1,14 @@
1
1
  import Vue from 'vue/dist/vue.esm'
2
+ import { turbolinksAdapterMixin } from 'vue-turbolinks';
2
3
 
3
4
  // Import from app/concepts/matestack/ui/core:
4
5
  import app from '../app/app'
5
6
  import async from '../async/async'
6
- import pageContent from '../page/content'
7
+ import pageContent from '../page/content/content'
8
+ import toggle from '../toggle/toggle'
7
9
  import store from '../app/store'
8
10
  import component from '../component/component'
9
11
  import anonymDynamicComponent from '../component/anonym-dynamic-component'
10
- import html from '../html/html'
11
12
  import transition from '../transition/transition'
12
13
  import action from '../action/action'
13
14
  import form from '../form/form'
@@ -15,16 +16,39 @@ import onclick from '../onclick/onclick'
15
16
  import collectionContent from '../collection/content/content'
16
17
  import collectionFilter from '../collection/filter/filter'
17
18
  import collectionOrder from '../collection/order/order'
19
+ import isolate from '../isolated/isolated'
18
20
 
19
21
  let matestackUiApp = undefined
20
22
 
23
+ // this event fires first and always
21
24
  document.addEventListener('DOMContentLoaded', () => {
22
-
23
- matestackUiApp = new Vue({
24
- el: "#matestack_ui",
25
+ // somehow we need to inject the turbolinks mixin even
26
+ // if the turbolinks:load event will recreate the vue instance
27
+ // skipping the injection here caused errors when submitting forms or action
28
+ // if they were present on the first page, which was loaded and activated turbolinks
29
+ // the mixin does not impact the app when turbolinks is disabled
30
+ matestackUiApp = new Vue({
31
+ el: "#matestack-ui",
32
+ mixins: [turbolinksAdapterMixin],
25
33
  store: store
26
- })
34
+ })
35
+ })
27
36
 
37
+ // this event fires after DOMContentLoaded and only if turbolinks are enabled
38
+ document.addEventListener('turbolinks:load', () => {
39
+ // we need to empty the currently stored pageTemplate state variable
40
+ // otherwise the matestack page will jump back to the latest pageTemplate
41
+ // fetched during the last matestack transition as the turbolinks powered
42
+ // page transition does not write the matestack store pageTemplate state variable
43
+ store.commit('resetPageTemplate')
44
+ // we need to destroy the vue app instance
45
+ matestackUiApp.$destroy();
46
+ // and recreate it right afterwards in order to work when used with turbolinks
47
+ matestackUiApp = new Vue({
48
+ el: "#matestack-ui",
49
+ mixins: [turbolinksAdapterMixin],
50
+ store: store
51
+ })
28
52
  })
29
53
 
30
54
  export default Vue
@@ -1,5 +1,5 @@
1
- %kbd{@tag_attributes}
2
- - if options[:text].blank? && block_given?
1
+ %kbd{ html_attributes }
2
+ - if text.nil? && block_given?
3
3
  = yield
4
4
  - else
5
- = options[:text]
5
+ = text
@@ -1,4 +1,5 @@
1
1
  module Matestack::Ui::Core::Kbd
2
2
  class Kbd < Matestack::Ui::Core::Component::Static
3
+ optional :text
3
4
  end
4
5
  end
@@ -1,5 +1,5 @@
1
- %label{@tag_attributes}
2
- - if options[:text].nil? && block_given?
1
+ %label{ html_attributes }
2
+ - if text.nil? && block_given?
3
3
  = yield
4
4
  - else
5
- = options[:text]
5
+ = text
@@ -1,10 +1,6 @@
1
1
  module Matestack::Ui::Core::Label
2
2
  class Label < Matestack::Ui::Core::Component::Static
3
- def setup
4
- @tag_attributes.merge!({
5
- for: options[:for],
6
- form: options[:form]
7
- })
8
- end
3
+ html_attributes :for, :form
4
+ optional :text
9
5
  end
10
6
  end
@@ -1,5 +1,5 @@
1
- %legend{@tag_attributes}
2
- - if options[:text].nil? && block_given?
1
+ %legend{ html_attributes }
2
+ - if text.nil? && block_given?
3
3
  = yield
4
4
  - else
5
- = options[:text]
5
+ = text
@@ -1,5 +1,5 @@
1
1
  module Matestack::Ui::Core::Legend
2
2
  class Legend < Matestack::Ui::Core::Component::Static
3
-
3
+ optional :text
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
- %li{@tag_attributes}
2
- - if options[:text].nil? && block_given?
1
+ %li{ html_attributes }
2
+ - if text.nil? && block_given?
3
3
  = yield
4
4
  - else
5
- = options[:text]
5
+ = text
@@ -1,5 +1,6 @@
1
1
  module Matestack::Ui::Core::Li
2
2
  class Li < Matestack::Ui::Core::Component::Static
3
-
3
+ html_attributes :value
4
+ optional :text
4
5
  end
5
6
  end
@@ -1,5 +1,5 @@
1
- %a{@tag_attributes}
2
- - if options[:text].nil? && block_given?
1
+ %a{ link_attributes }
2
+ - if text.nil? && block_given?
3
3
  = yield
4
4
  - else
5
- = options[:text]
5
+ = text
@@ -1,25 +1,21 @@
1
1
  module Matestack::Ui::Core::Link
2
2
  class Link < Matestack::Ui::Core::Component::Static
3
+ html_attributes :download, :href, :hreflang, :media, :ping, :referrerpolicy, :rel, :target, :type
3
4
 
4
- REQUIRED_KEYS = [:path]
5
+ optional :text, :path, params: { as: :link_params }
5
6
 
6
- def setup
7
- @tag_attributes.merge!({
8
- "class": options[:class],
9
- "id": component_id,
10
- "method": options[:method],
11
- "target": options[:target] ||= nil,
12
- "href": link_path,
13
- "title": options[:title]
14
- })
7
+ def link_attributes
8
+ html_attributes.tap do |attributes|
9
+ attributes[:href] = link_path if path
10
+ end
15
11
  end
16
12
 
17
13
  def link_path
18
- if options[:path].is_a?(Symbol)
19
- return ::Rails.application.routes.url_helpers.send(options[:path], options[:params])
14
+ if path.is_a?(Symbol)
15
+ return ::Rails.application.routes.url_helpers.send(path, link_params)
20
16
  end
21
- if options[:path].is_a?(String)
22
- return options[:path]
17
+ if path.is_a?(String)
18
+ return path
23
19
  end
24
20
  end
25
21
 
@@ -1,3 +1,3 @@
1
- %main{@tag_attributes}
1
+ %main{ html_attributes }
2
2
  - if block_given?
3
3
  = yield
@@ -1,5 +1,4 @@
1
1
  module Matestack::Ui::Core::Main
2
2
  class Main < Matestack::Ui::Core::Component::Static
3
-
4
3
  end
5
4
  end
@@ -1,3 +1,3 @@
1
- %map{@tag_attributes}
1
+ %map{ html_attributes }
2
2
  - if block_given?
3
3
  = yield
@@ -1,11 +1,5 @@
1
1
  module Matestack::Ui::Core::Map
2
2
  class Map < Matestack::Ui::Core::Component::Static
3
- REQUIRED_KEYS = [:name]
4
-
5
- def setup
6
- @tag_attributes.merge!({
7
- name: options[:name]
8
- })
9
- end
3
+ html_attributes :name
10
4
  end
11
5
  end
@@ -1,5 +1,5 @@
1
- %mark{@tag_attributes}
2
- - if options[:text].blank? && block_given?
1
+ %mark{ html_attributes }
2
+ - if text.nil? && block_given?
3
3
  = yield
4
4
  - else
5
- = options[:text]
5
+ = text
@@ -1,4 +1,5 @@
1
1
  module Matestack::Ui::Core::Mark
2
2
  class Mark < Matestack::Ui::Core::Component::Static
3
+ optional :text
3
4
  end
4
5
  end
@@ -1,4 +1,4 @@
1
- %meter{@tag_attributes}
1
+ %meter{ html_attributes }
2
2
  - if block_given?
3
3
  = yield
4
4
 
@@ -1,14 +1,5 @@
1
1
  module Matestack::Ui::Core::Meter
2
2
  class Meter < Matestack::Ui::Core::Component::Static
3
- def setup
4
- @tag_attributes.merge!({
5
- value: options[:value],
6
- min: options[:min],
7
- max: options[:max],
8
- low: options[:low],
9
- high: options[:high],
10
- optimum: options[:optimum]
11
- })
12
- end
3
+ html_attributes :form, :high, :low, :max, :min, :optimum, :value
13
4
  end
14
5
  end
@@ -1,3 +1,3 @@
1
- %nav{@tag_attributes}
1
+ %nav{ html_attributes }
2
2
  - if block_given?
3
3
  = yield
@@ -1,5 +1,4 @@
1
1
  module Matestack::Ui::Core::Nav
2
2
  class Nav < Matestack::Ui::Core::Component::Static
3
-
4
3
  end
5
4
  end
@@ -1,5 +1,5 @@
1
- %noscript{@tag_attributes}
2
- - if options[:text].nil? && block_given?
1
+ %noscript{ html_attributes }
2
+ - if text.nil? && block_given?
3
3
  = yield
4
4
  - else
5
- = options[:text]
5
+ = text
@@ -1,5 +1,5 @@
1
1
  module Matestack::Ui::Core::Noscript
2
2
  class Noscript < Matestack::Ui::Core::Component::Static
3
-
3
+ optional :text
4
4
  end
5
5
  end
@@ -1 +1 @@
1
- %object{@tag_attributes}
1
+ %object{ html_attributes }
@@ -1,15 +1,5 @@
1
1
  module Matestack::Ui::Core::Object
2
2
  class Object < Matestack::Ui::Core::Component::Static
3
- def setup
4
- @tag_attributes.merge!({
5
- width: options[:width],
6
- height: options[:height],
7
- data: options[:data],
8
- form: options[:form],
9
- name: options[:name],
10
- type: options[:type],
11
- usemap: options[:usemap]
12
- })
13
- end
3
+ html_attributes :data, :form, :height, :name, :type, :typemustmatch, :usemap, :width
14
4
  end
15
5
  end
@@ -1,3 +1,3 @@
1
- %ol{@tag_attributes}
1
+ %ol{ html_attributes }
2
2
  - if block_given?
3
3
  = yield
@@ -1,5 +1,5 @@
1
1
  module Matestack::Ui::Core::Ol
2
2
  class Ol < Matestack::Ui::Core::Component::Static
3
-
3
+ html_attributes :reversed, :start, :type
4
4
  end
5
5
  end
@@ -1,2 +1,2 @@
1
- %div{@tag_attributes, "@click": "perform"}
1
+ %div{ html_attributes, "@click": "perform" }
2
2
  = yield
@@ -1,5 +1,6 @@
1
1
  module Matestack::Ui::Core::Onclick
2
2
  class Onclick < Matestack::Ui::Core::Component::Dynamic
3
+ vue_js_component_name "matestack-ui-core-onclick"
3
4
 
4
5
  end
5
6
  end
@@ -1,3 +1,3 @@
1
- %optgroup{@tag_attributes}
1
+ %optgroup{ html_attributes }
2
2
  - if block_given?
3
3
  = yield
@@ -1,10 +1,5 @@
1
1
  module Matestack::Ui::Core::Optgroup
2
2
  class Optgroup < Matestack::Ui::Core::Component::Static
3
- def setup
4
- @tag_attributes.merge!(
5
- disabled: options[:disabled] ||= nil,
6
- label: options[:label]
7
- )
8
- end
3
+ html_attributes :disabled, :label
9
4
  end
10
5
  end
@@ -1,5 +1,5 @@
1
- %option{@tag_attributes}
2
- - if options[:text].blank? && block_given?
1
+ %option{ html_attributes }
2
+ - if text.nil? && block_given?
3
3
  = yield
4
4
  - else
5
- = options[:text]
5
+ = text
@@ -1,12 +1,6 @@
1
1
  module Matestack::Ui::Core::Option
2
2
  class Option < Matestack::Ui::Core::Component::Static
3
- def setup
4
- @tag_attributes.merge!(
5
- disabled: options[:disabled] ||= nil,
6
- selected: options[:selected] ||= nil,
7
- label: options[:label],
8
- value: options[:value]
9
- )
10
- end
3
+ html_attributes :disabled, :label, :selected, :value
4
+ optional :text
11
5
  end
12
6
  end
@@ -1,5 +1,5 @@
1
- %output{@tag_attributes}
2
- - if options[:text].blank? && block_given?
1
+ %output{ html_attributes }
2
+ - if text.nil? && block_given?
3
3
  = yield
4
4
  - else
5
- = options[:text]
5
+ = text
@@ -1,11 +1,6 @@
1
1
  module Matestack::Ui::Core::Output
2
2
  class Output < Matestack::Ui::Core::Component::Static
3
- def setup
4
- @tag_attributes.merge!(
5
- name: options[:name],
6
- for: options[:for],
7
- form: options[:form]
8
- )
9
- end
3
+ html_attributes :for, :form, :name
4
+ optional :text
10
5
  end
11
6
  end
@@ -1,6 +1,8 @@
1
1
  import Vue from 'vue/dist/vue.esm'
2
2
  import Vuex from 'vuex'
3
- import componentMixin from '../component/component'
3
+ import componentMixin from '../../component/component'
4
+
5
+ import VRuntimeTemplate from "v-runtime-template"
4
6
 
5
7
  const componentDef = {
6
8
  mixins: [componentMixin],
@@ -9,7 +11,11 @@ const componentDef = {
9
11
  },
10
12
  computed: Vuex.mapState({
11
13
  asyncPageTemplate: state => state.pageTemplate,
12
- })
14
+ loading: state => state.pageLoading
15
+ }),
16
+ components: {
17
+ VRuntimeTemplate: VRuntimeTemplate
18
+ }
13
19
  }
14
20
 
15
21
  let component = Vue.component('matestack-ui-core-page-content', componentDef)
@@ -0,0 +1,28 @@
1
+ module Matestack::Ui::Core::Page::Content
2
+ class Content < Matestack::Ui::Core::Component::Dynamic
3
+ vue_js_component_name "matestack-ui-core-page-content"
4
+
5
+ def response
6
+ div class: "matestack-page-container", attributes: loading_classes do
7
+ if options[:slots] && options[:slots][:loading_state]
8
+ div class: "loading-state-element-wrapper", attributes: loading_classes do
9
+ slot options[:slots][:loading_state]
10
+ end
11
+ end
12
+ div class: "matestack-page-wrapper", attributes: loading_classes do
13
+ div attributes: { "v-if": "asyncPageTemplate == null" } do
14
+ yield_components
15
+ end
16
+ div attributes: { "v-if": "asyncPageTemplate != null" } do
17
+ plain content_tag("v-runtime-template", nil, ":template": "asyncPageTemplate")
18
+ end
19
+ end
20
+ end
21
+ end
22
+
23
+ def loading_classes
24
+ { "v-bind:class": "{ 'loading': loading === true }" }
25
+ end
26
+
27
+ end
28
+ end