matestack-ui-core 1.5.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +17 -5
- data/README.md +78 -115
- data/Rakefile +0 -2
- data/lib/matestack/ui/app.rb +1 -0
- data/lib/matestack/ui/component.rb +1 -0
- data/lib/matestack/ui/core.rb +58 -10
- data/lib/matestack/ui/core/app.rb +36 -0
- data/lib/matestack/ui/core/base.rb +109 -0
- data/lib/matestack/ui/core/component.rb +8 -0
- data/lib/matestack/ui/core/context.rb +17 -0
- data/lib/matestack/ui/core/helper.rb +91 -0
- data/lib/matestack/ui/core/page.rb +63 -0
- data/lib/matestack/ui/core/properties.rb +105 -0
- data/lib/matestack/ui/core/slots.rb +15 -0
- data/lib/matestack/ui/core/tag_helper.rb +94 -0
- data/lib/matestack/ui/core/version.rb +1 -1
- data/lib/matestack/ui/core/vue_attributes.rb +13 -0
- data/lib/matestack/ui/page.rb +1 -0
- data/{app/concepts/matestack/ui/core → lib/matestack/ui/vue_js}/app/app.js +2 -3
- data/{app/concepts/matestack/ui/core → lib/matestack/ui/vue_js}/app/location.js +0 -0
- data/{app/concepts/matestack/ui/core → lib/matestack/ui/vue_js}/app/store.js +1 -1
- data/lib/matestack/ui/vue_js/components.rb +94 -0
- data/lib/matestack/ui/vue_js/components/action.js +151 -0
- data/lib/matestack/ui/vue_js/components/action.rb +46 -0
- data/{app/concepts/matestack/ui/core/async → lib/matestack/ui/vue_js/components}/async.js +22 -22
- data/lib/matestack/ui/vue_js/components/async.rb +84 -0
- data/{app/concepts/matestack/ui/core/cable → lib/matestack/ui/vue_js/components}/cable.js +14 -14
- data/lib/matestack/ui/vue_js/components/cable.rb +69 -0
- data/{app/concepts/matestack/ui/core/collection/content → lib/matestack/ui/vue_js/components/collection}/content.js +21 -22
- data/lib/matestack/ui/vue_js/components/collection/content.rb +32 -0
- data/lib/matestack/ui/vue_js/components/collection/filter.js +45 -0
- data/lib/matestack/ui/vue_js/components/collection/filter.rb +29 -0
- data/lib/matestack/ui/vue_js/components/collection/filter_reset.rb +19 -0
- data/{app/concepts/matestack/ui/core → lib/matestack/ui/vue_js/components}/collection/helper.rb +66 -65
- data/lib/matestack/ui/vue_js/components/collection/next.rb +19 -0
- data/lib/matestack/ui/vue_js/components/collection/order.js +46 -0
- data/lib/matestack/ui/vue_js/components/collection/order.rb +28 -0
- data/lib/matestack/ui/vue_js/components/collection/order_toggle.rb +21 -0
- data/lib/matestack/ui/vue_js/components/collection/order_toggle_indicator.rb +30 -0
- data/lib/matestack/ui/vue_js/components/collection/page.rb +21 -0
- data/lib/matestack/ui/vue_js/components/collection/previous.rb +19 -0
- data/lib/matestack/ui/vue_js/components/form/base.rb +167 -0
- data/{app/concepts/matestack/ui/core/form/checkbox → lib/matestack/ui/vue_js/components/form}/checkbox.js +2 -2
- data/lib/matestack/ui/vue_js/components/form/checkbox.rb +105 -0
- data/{app/concepts/matestack/ui/core/form/checkbox/mixin.js → lib/matestack/ui/vue_js/components/form/checkbox_mixin.js} +5 -2
- data/lib/matestack/ui/vue_js/components/form/context.rb +15 -0
- data/{app/concepts/matestack/ui/core → lib/matestack/ui/vue_js/components}/form/form.js +53 -53
- data/lib/matestack/ui/vue_js/components/form/form.rb +64 -0
- data/{app/concepts/matestack/ui/core/form/input → lib/matestack/ui/vue_js/components/form}/input.js +2 -2
- data/lib/matestack/ui/vue_js/components/form/input.rb +37 -0
- data/{app/concepts/matestack/ui/core/form/input/mixin.js → lib/matestack/ui/vue_js/components/form/input_mixin.js} +5 -2
- data/{app/concepts/matestack/ui/core/form/radio → lib/matestack/ui/vue_js/components/form}/radio.js +2 -2
- data/lib/matestack/ui/vue_js/components/form/radio.rb +76 -0
- data/{app/concepts/matestack/ui/core/form/radio/mixin.js → lib/matestack/ui/vue_js/components/form/radio_mixin.js} +4 -1
- data/{app/concepts/matestack/ui/core/form/select → lib/matestack/ui/vue_js/components/form}/select.js +2 -2
- data/lib/matestack/ui/vue_js/components/form/select.rb +88 -0
- data/{app/concepts/matestack/ui/core/form/select/mixin.js → lib/matestack/ui/vue_js/components/form/select_mixin.js} +5 -2
- data/{app/concepts/matestack/ui/core/form/textarea → lib/matestack/ui/vue_js/components/form}/textarea.js +2 -2
- data/lib/matestack/ui/vue_js/components/form/textarea.rb +37 -0
- data/{app/concepts/matestack/ui/core/form/textarea/mixin.js → lib/matestack/ui/vue_js/components/form/textarea_mixin.js} +5 -2
- data/{app/concepts/matestack/ui/core/isolated → lib/matestack/ui/vue_js/components}/isolated.js +19 -19
- data/lib/matestack/ui/vue_js/components/isolated.rb +86 -0
- data/{app/concepts/matestack/ui/core/component/component.js → lib/matestack/ui/vue_js/components/mixin.js} +2 -2
- data/{app/concepts/matestack/ui/core/onclick → lib/matestack/ui/vue_js/components}/onclick.js +3 -4
- data/lib/matestack/ui/vue_js/components/onclick.rb +37 -0
- data/{app/concepts/matestack/ui/core/toggle → lib/matestack/ui/vue_js/components}/toggle.js +17 -17
- data/lib/matestack/ui/vue_js/components/toggle.rb +38 -0
- data/{app/concepts/matestack/ui/core/transition → lib/matestack/ui/vue_js/components}/transition.js +6 -6
- data/lib/matestack/ui/vue_js/components/transition.rb +40 -0
- data/lib/matestack/ui/vue_js/event_hub.js +5 -0
- data/{app/concepts/matestack/ui/core/js/helpers/query-params-helper.js → lib/matestack/ui/vue_js/helpers/query_params_helper.js} +0 -0
- data/lib/matestack/ui/vue_js/index.js +52 -0
- data/lib/matestack/ui/vue_js/initialize.rb +5 -0
- data/{app/concepts/matestack/ui/core/page/content → lib/matestack/ui/vue_js/page}/content.js +1 -1
- data/lib/matestack/ui/vue_js/vue.rb +63 -0
- data/lib/matestack/ui/vue_js_component.rb +2 -0
- metadata +75 -404
- data/app/concepts/matestack/ui/core/abbr/abbr.haml +0 -5
- data/app/concepts/matestack/ui/core/abbr/abbr.rb +0 -5
- data/app/concepts/matestack/ui/core/action/action.haml +0 -3
- data/app/concepts/matestack/ui/core/action/action.js +0 -152
- data/app/concepts/matestack/ui/core/action/action.rb +0 -80
- data/app/concepts/matestack/ui/core/actionview/dynamic.haml +0 -6
- data/app/concepts/matestack/ui/core/actionview/dynamic.rb +0 -28
- data/app/concepts/matestack/ui/core/actionview/static.haml +0 -1
- data/app/concepts/matestack/ui/core/actionview/static.rb +0 -28
- data/app/concepts/matestack/ui/core/address/address.haml +0 -5
- data/app/concepts/matestack/ui/core/address/address.rb +0 -5
- data/app/concepts/matestack/ui/core/app/app.haml +0 -3
- data/app/concepts/matestack/ui/core/app/app.rb +0 -51
- data/app/concepts/matestack/ui/core/area/area.haml +0 -1
- data/app/concepts/matestack/ui/core/area/area.rb +0 -6
- data/app/concepts/matestack/ui/core/article/article.haml +0 -5
- data/app/concepts/matestack/ui/core/article/article.rb +0 -5
- data/app/concepts/matestack/ui/core/aside/aside.haml +0 -3
- data/app/concepts/matestack/ui/core/aside/aside.rb +0 -4
- data/app/concepts/matestack/ui/core/async/async.haml +0 -6
- data/app/concepts/matestack/ui/core/async/async.rb +0 -37
- data/app/concepts/matestack/ui/core/async/children_wrapper.haml +0 -2
- data/app/concepts/matestack/ui/core/b/b.haml +0 -5
- data/app/concepts/matestack/ui/core/b/b.rb +0 -5
- data/app/concepts/matestack/ui/core/bdi/bdi.haml +0 -5
- data/app/concepts/matestack/ui/core/bdi/bdi.rb +0 -5
- data/app/concepts/matestack/ui/core/bdo/bdo.haml +0 -5
- data/app/concepts/matestack/ui/core/bdo/bdo.rb +0 -6
- data/app/concepts/matestack/ui/core/blockquote/blockquote.haml +0 -5
- data/app/concepts/matestack/ui/core/blockquote/blockquote.rb +0 -6
- data/app/concepts/matestack/ui/core/br/br.haml +0 -5
- data/app/concepts/matestack/ui/core/br/br.rb +0 -5
- data/app/concepts/matestack/ui/core/button/button.haml +0 -5
- data/app/concepts/matestack/ui/core/button/button.rb +0 -7
- data/app/concepts/matestack/ui/core/cable/cable.haml +0 -4
- data/app/concepts/matestack/ui/core/cable/cable.rb +0 -28
- data/app/concepts/matestack/ui/core/cable/children_wrapper.haml +0 -2
- data/app/concepts/matestack/ui/core/caption/caption.haml +0 -5
- data/app/concepts/matestack/ui/core/caption/caption.rb +0 -5
- data/app/concepts/matestack/ui/core/cite/cite.haml +0 -5
- data/app/concepts/matestack/ui/core/cite/cite.rb +0 -5
- data/app/concepts/matestack/ui/core/code/code.haml +0 -5
- data/app/concepts/matestack/ui/core/code/code.rb +0 -5
- data/app/concepts/matestack/ui/core/collection/content/content.rb +0 -16
- data/app/concepts/matestack/ui/core/collection/content/next/next.haml +0 -3
- data/app/concepts/matestack/ui/core/collection/content/next/next.rb +0 -5
- data/app/concepts/matestack/ui/core/collection/content/page/link/link.haml +0 -3
- data/app/concepts/matestack/ui/core/collection/content/page/link/link.rb +0 -7
- data/app/concepts/matestack/ui/core/collection/content/previous/previous.haml +0 -3
- data/app/concepts/matestack/ui/core/collection/content/previous/previous.rb +0 -5
- data/app/concepts/matestack/ui/core/collection/filter/filter.js +0 -48
- data/app/concepts/matestack/ui/core/collection/filter/filter.rb +0 -16
- data/app/concepts/matestack/ui/core/collection/filter/input/input.rb +0 -28
- data/app/concepts/matestack/ui/core/collection/filter/reset/reset.haml +0 -3
- data/app/concepts/matestack/ui/core/collection/filter/reset/reset.rb +0 -5
- data/app/concepts/matestack/ui/core/collection/filter/select/select.haml +0 -10
- data/app/concepts/matestack/ui/core/collection/filter/select/select.rb +0 -30
- data/app/concepts/matestack/ui/core/collection/filter/submit/submit.haml +0 -3
- data/app/concepts/matestack/ui/core/collection/filter/submit/submit.rb +0 -5
- data/app/concepts/matestack/ui/core/collection/order/order.js +0 -56
- data/app/concepts/matestack/ui/core/collection/order/order.rb +0 -16
- data/app/concepts/matestack/ui/core/collection/order/toggle/indicator/indicator.rb +0 -17
- data/app/concepts/matestack/ui/core/collection/order/toggle/toggle.haml +0 -3
- data/app/concepts/matestack/ui/core/collection/order/toggle/toggle.rb +0 -4
- data/app/concepts/matestack/ui/core/component/anonym-dynamic-component.js +0 -10
- data/app/concepts/matestack/ui/core/component/base.rb +0 -430
- data/app/concepts/matestack/ui/core/component/children.haml +0 -2
- data/app/concepts/matestack/ui/core/component/dynamic.haml +0 -6
- data/app/concepts/matestack/ui/core/component/dynamic.rb +0 -47
- data/app/concepts/matestack/ui/core/component/dynamic_without_rerender.haml +0 -2
- data/app/concepts/matestack/ui/core/component/static.rb +0 -7
- data/app/concepts/matestack/ui/core/data/data.haml +0 -5
- data/app/concepts/matestack/ui/core/data/data.rb +0 -6
- data/app/concepts/matestack/ui/core/datalist/datalist.haml +0 -3
- data/app/concepts/matestack/ui/core/datalist/datalist.rb +0 -4
- data/app/concepts/matestack/ui/core/dd/dd.haml +0 -5
- data/app/concepts/matestack/ui/core/dd/dd.rb +0 -5
- data/app/concepts/matestack/ui/core/del/del.haml +0 -5
- data/app/concepts/matestack/ui/core/del/del.rb +0 -6
- data/app/concepts/matestack/ui/core/details/details.haml +0 -3
- data/app/concepts/matestack/ui/core/details/details.rb +0 -5
- data/app/concepts/matestack/ui/core/dfn/dfn.haml +0 -5
- data/app/concepts/matestack/ui/core/dfn/dfn.rb +0 -6
- data/app/concepts/matestack/ui/core/dialog/dialog.haml +0 -5
- data/app/concepts/matestack/ui/core/dialog/dialog.rb +0 -6
- data/app/concepts/matestack/ui/core/div/div.haml +0 -3
- data/app/concepts/matestack/ui/core/div/div.rb +0 -4
- data/app/concepts/matestack/ui/core/dl/dl.haml +0 -5
- data/app/concepts/matestack/ui/core/dl/dl.rb +0 -5
- data/app/concepts/matestack/ui/core/dt/dt.haml +0 -5
- data/app/concepts/matestack/ui/core/dt/dt.rb +0 -5
- data/app/concepts/matestack/ui/core/em/em.haml +0 -5
- data/app/concepts/matestack/ui/core/em/em.rb +0 -5
- data/app/concepts/matestack/ui/core/fieldset/fieldset.haml +0 -5
- data/app/concepts/matestack/ui/core/fieldset/fieldset.rb +0 -6
- data/app/concepts/matestack/ui/core/figure/figure.haml +0 -3
- data/app/concepts/matestack/ui/core/figure/figure.rb +0 -4
- data/app/concepts/matestack/ui/core/footer/footer.haml +0 -3
- data/app/concepts/matestack/ui/core/footer/footer.rb +0 -4
- data/app/concepts/matestack/ui/core/form/checkbox/base.rb +0 -120
- data/app/concepts/matestack/ui/core/form/checkbox/checkbox.rb +0 -16
- data/app/concepts/matestack/ui/core/form/form.haml +0 -2
- data/app/concepts/matestack/ui/core/form/form.rb +0 -104
- data/app/concepts/matestack/ui/core/form/has_errors.rb +0 -54
- data/app/concepts/matestack/ui/core/form/has_input_html_attributes.rb +0 -13
- data/app/concepts/matestack/ui/core/form/input/base.rb +0 -75
- data/app/concepts/matestack/ui/core/form/input/input.rb +0 -17
- data/app/concepts/matestack/ui/core/form/radio/base.rb +0 -90
- data/app/concepts/matestack/ui/core/form/radio/radio.rb +0 -16
- data/app/concepts/matestack/ui/core/form/select/base.rb +0 -98
- data/app/concepts/matestack/ui/core/form/select/select.rb +0 -19
- data/app/concepts/matestack/ui/core/form/submit/base.rb +0 -12
- data/app/concepts/matestack/ui/core/form/submit/submit.js +0 -19
- data/app/concepts/matestack/ui/core/form/submit/submit.rb +0 -15
- data/app/concepts/matestack/ui/core/form/textarea/base.rb +0 -49
- data/app/concepts/matestack/ui/core/form/textarea/textarea.rb +0 -17
- data/app/concepts/matestack/ui/core/form/utils.rb +0 -47
- data/app/concepts/matestack/ui/core/header/header.haml +0 -3
- data/app/concepts/matestack/ui/core/header/header.rb +0 -4
- data/app/concepts/matestack/ui/core/heading/heading.haml +0 -5
- data/app/concepts/matestack/ui/core/heading/heading.rb +0 -5
- data/app/concepts/matestack/ui/core/hr/hr.haml +0 -1
- data/app/concepts/matestack/ui/core/hr/hr.rb +0 -4
- data/app/concepts/matestack/ui/core/icon/icon.haml +0 -5
- data/app/concepts/matestack/ui/core/icon/icon.rb +0 -5
- data/app/concepts/matestack/ui/core/iframe/iframe.haml +0 -5
- data/app/concepts/matestack/ui/core/iframe/iframe.rb +0 -7
- data/app/concepts/matestack/ui/core/img/img.haml +0 -1
- data/app/concepts/matestack/ui/core/img/img.rb +0 -15
- data/app/concepts/matestack/ui/core/input/input.haml +0 -1
- data/app/concepts/matestack/ui/core/input/input.rb +0 -9
- data/app/concepts/matestack/ui/core/ins/ins.haml +0 -5
- data/app/concepts/matestack/ui/core/ins/ins.rb +0 -6
- data/app/concepts/matestack/ui/core/isolated/children_wrapper.haml +0 -2
- data/app/concepts/matestack/ui/core/isolated/isolated.haml +0 -10
- data/app/concepts/matestack/ui/core/isolated/isolated.rb +0 -59
- data/app/concepts/matestack/ui/core/js/core.js +0 -66
- data/app/concepts/matestack/ui/core/js/event-hub.js +0 -5
- data/app/concepts/matestack/ui/core/kbd/kbd.haml +0 -5
- data/app/concepts/matestack/ui/core/kbd/kbd.rb +0 -5
- data/app/concepts/matestack/ui/core/label/label.haml +0 -5
- data/app/concepts/matestack/ui/core/label/label.rb +0 -6
- data/app/concepts/matestack/ui/core/legend/legend.haml +0 -5
- data/app/concepts/matestack/ui/core/legend/legend.rb +0 -5
- data/app/concepts/matestack/ui/core/li/li.haml +0 -5
- data/app/concepts/matestack/ui/core/li/li.rb +0 -6
- data/app/concepts/matestack/ui/core/link/link.haml +0 -5
- data/app/concepts/matestack/ui/core/link/link.rb +0 -23
- data/app/concepts/matestack/ui/core/main/main.haml +0 -3
- data/app/concepts/matestack/ui/core/main/main.rb +0 -4
- data/app/concepts/matestack/ui/core/map/map.haml +0 -3
- data/app/concepts/matestack/ui/core/map/map.rb +0 -5
- data/app/concepts/matestack/ui/core/mark/mark.haml +0 -5
- data/app/concepts/matestack/ui/core/mark/mark.rb +0 -5
- data/app/concepts/matestack/ui/core/meter/meter.haml +0 -4
- data/app/concepts/matestack/ui/core/meter/meter.rb +0 -5
- data/app/concepts/matestack/ui/core/nav/nav.haml +0 -3
- data/app/concepts/matestack/ui/core/nav/nav.rb +0 -4
- data/app/concepts/matestack/ui/core/noscript/noscript.haml +0 -5
- data/app/concepts/matestack/ui/core/noscript/noscript.rb +0 -5
- data/app/concepts/matestack/ui/core/object/object.haml +0 -1
- data/app/concepts/matestack/ui/core/object/object.rb +0 -5
- data/app/concepts/matestack/ui/core/ol/ol.haml +0 -3
- data/app/concepts/matestack/ui/core/ol/ol.rb +0 -5
- data/app/concepts/matestack/ui/core/onclick/onclick.haml +0 -2
- data/app/concepts/matestack/ui/core/onclick/onclick.rb +0 -6
- data/app/concepts/matestack/ui/core/optgroup/optgroup.haml +0 -3
- data/app/concepts/matestack/ui/core/optgroup/optgroup.rb +0 -5
- data/app/concepts/matestack/ui/core/option/option.haml +0 -5
- data/app/concepts/matestack/ui/core/option/option.rb +0 -6
- data/app/concepts/matestack/ui/core/output/output.haml +0 -5
- data/app/concepts/matestack/ui/core/output/output.rb +0 -6
- data/app/concepts/matestack/ui/core/page/content/content.rb +0 -28
- data/app/concepts/matestack/ui/core/page/page.haml +0 -3
- data/app/concepts/matestack/ui/core/page/page.rb +0 -30
- data/app/concepts/matestack/ui/core/paragraph/paragraph.haml +0 -5
- data/app/concepts/matestack/ui/core/paragraph/paragraph.rb +0 -5
- data/app/concepts/matestack/ui/core/param/param.haml +0 -1
- data/app/concepts/matestack/ui/core/param/param.rb +0 -5
- data/app/concepts/matestack/ui/core/partial/partial.haml +0 -2
- data/app/concepts/matestack/ui/core/partial/partial.rb +0 -4
- data/app/concepts/matestack/ui/core/picture/picture.haml +0 -3
- data/app/concepts/matestack/ui/core/picture/picture.rb +0 -4
- data/app/concepts/matestack/ui/core/plain/plain.rb +0 -9
- data/app/concepts/matestack/ui/core/pre/pre.haml +0 -5
- data/app/concepts/matestack/ui/core/pre/pre.rb +0 -5
- data/app/concepts/matestack/ui/core/progress/progress.haml +0 -3
- data/app/concepts/matestack/ui/core/progress/progress.rb +0 -5
- data/app/concepts/matestack/ui/core/q/q.haml +0 -5
- data/app/concepts/matestack/ui/core/q/q.rb +0 -6
- data/app/concepts/matestack/ui/core/rp/rp.haml +0 -5
- data/app/concepts/matestack/ui/core/rp/rp.rb +0 -5
- data/app/concepts/matestack/ui/core/rt/rt.haml +0 -5
- data/app/concepts/matestack/ui/core/rt/rt.rb +0 -5
- data/app/concepts/matestack/ui/core/ruby/ruby.haml +0 -5
- data/app/concepts/matestack/ui/core/ruby/ruby.rb +0 -5
- data/app/concepts/matestack/ui/core/s/s.haml +0 -5
- data/app/concepts/matestack/ui/core/s/s.rb +0 -6
- data/app/concepts/matestack/ui/core/samp/samp.haml +0 -5
- data/app/concepts/matestack/ui/core/samp/samp.rb +0 -5
- data/app/concepts/matestack/ui/core/section/section.haml +0 -3
- data/app/concepts/matestack/ui/core/section/section.rb +0 -4
- data/app/concepts/matestack/ui/core/select/select.haml +0 -3
- data/app/concepts/matestack/ui/core/select/select.rb +0 -7
- data/app/concepts/matestack/ui/core/slot/slot.haml +0 -2
- data/app/concepts/matestack/ui/core/slot/slot.rb +0 -4
- data/app/concepts/matestack/ui/core/small/small.haml +0 -5
- data/app/concepts/matestack/ui/core/small/small.rb +0 -5
- data/app/concepts/matestack/ui/core/span/span.haml +0 -5
- data/app/concepts/matestack/ui/core/span/span.rb +0 -5
- data/app/concepts/matestack/ui/core/strong/strong.haml +0 -5
- data/app/concepts/matestack/ui/core/strong/strong.rb +0 -5
- data/app/concepts/matestack/ui/core/sub/sub.haml +0 -5
- data/app/concepts/matestack/ui/core/sub/sub.rb +0 -5
- data/app/concepts/matestack/ui/core/summary/summary.haml +0 -5
- data/app/concepts/matestack/ui/core/summary/summary.rb +0 -5
- data/app/concepts/matestack/ui/core/sup/sup.haml +0 -5
- data/app/concepts/matestack/ui/core/sup/sup.rb +0 -5
- data/app/concepts/matestack/ui/core/table/table.haml +0 -3
- data/app/concepts/matestack/ui/core/table/table.rb +0 -4
- data/app/concepts/matestack/ui/core/tbody/tbody.haml +0 -3
- data/app/concepts/matestack/ui/core/tbody/tbody.rb +0 -4
- data/app/concepts/matestack/ui/core/td/td.haml +0 -5
- data/app/concepts/matestack/ui/core/td/td.rb +0 -6
- data/app/concepts/matestack/ui/core/template/template.haml +0 -3
- data/app/concepts/matestack/ui/core/template/template.rb +0 -4
- data/app/concepts/matestack/ui/core/textarea/textarea.haml +0 -5
- data/app/concepts/matestack/ui/core/textarea/textarea.rb +0 -10
- data/app/concepts/matestack/ui/core/tfoot/tfoot.haml +0 -3
- data/app/concepts/matestack/ui/core/tfoot/tfoot.rb +0 -4
- data/app/concepts/matestack/ui/core/th/th.haml +0 -5
- data/app/concepts/matestack/ui/core/th/th.rb +0 -6
- data/app/concepts/matestack/ui/core/thead/thead.haml +0 -3
- data/app/concepts/matestack/ui/core/thead/thead.rb +0 -4
- data/app/concepts/matestack/ui/core/time/time.haml +0 -3
- data/app/concepts/matestack/ui/core/time/time.rb +0 -5
- data/app/concepts/matestack/ui/core/toggle/toggle.haml +0 -2
- data/app/concepts/matestack/ui/core/toggle/toggle.rb +0 -13
- data/app/concepts/matestack/ui/core/tr/tr.haml +0 -3
- data/app/concepts/matestack/ui/core/tr/tr.rb +0 -4
- data/app/concepts/matestack/ui/core/transition/transition.haml +0 -5
- data/app/concepts/matestack/ui/core/transition/transition.rb +0 -38
- data/app/concepts/matestack/ui/core/u/u.haml +0 -5
- data/app/concepts/matestack/ui/core/u/u.rb +0 -6
- data/app/concepts/matestack/ui/core/ul/ul.haml +0 -3
- data/app/concepts/matestack/ui/core/ul/ul.rb +0 -4
- data/app/concepts/matestack/ui/core/unescaped/unescaped.rb +0 -9
- data/app/concepts/matestack/ui/core/var/var.haml +0 -5
- data/app/concepts/matestack/ui/core/var/var.rb +0 -5
- data/app/concepts/matestack/ui/core/video/video.haml +0 -3
- data/app/concepts/matestack/ui/core/video/video.rb +0 -13
- data/app/concepts/matestack/ui/core/view/view.haml +0 -1
- data/app/concepts/matestack/ui/core/view/view.rb +0 -30
- data/app/concepts/matestack/ui/core/wbr/wbr.haml +0 -5
- data/app/concepts/matestack/ui/core/wbr/wbr.rb +0 -5
- data/app/concepts/matestack/ui/core/youtube/youtube.haml +0 -1
- data/app/concepts/matestack/ui/core/youtube/youtube.rb +0 -28
- data/app/helpers/matestack/ui/core/application_helper.rb +0 -111
- data/app/javascript/matestack-ui-core/index.js +0 -32
- data/app/javascript/matestack-ui-core/styles/index.scss +0 -5
- data/app/javascript/packs/matestack-ui-core.js +0 -8
- data/app/lib/matestack/ui/app.rb +0 -1
- data/app/lib/matestack/ui/component.rb +0 -1
- data/app/lib/matestack/ui/core/has_view_context.rb +0 -16
- data/app/lib/matestack/ui/core/html_attributes.rb +0 -43
- data/app/lib/matestack/ui/core/properties.rb +0 -161
- data/app/lib/matestack/ui/core/rendering/default_renderer_class_determiner.rb +0 -33
- data/app/lib/matestack/ui/core/rendering/main_renderer.rb +0 -203
- data/app/lib/matestack/ui/dynamic_actionview_component.rb +0 -1
- data/app/lib/matestack/ui/dynamic_component.rb +0 -1
- data/app/lib/matestack/ui/isolated_component.rb +0 -1
- data/app/lib/matestack/ui/page.rb +0 -1
- data/app/lib/matestack/ui/static_actionview_component.rb +0 -1
- data/app/lib/matestack/ui/static_component.rb +0 -1
- data/app/lib/matestack/ui/vue_js_component.rb +0 -1
- data/config/routes.rb +0 -2
- data/lib/generators/matestack/app/USAGE +0 -21
- data/lib/generators/matestack/app/app_generator.rb +0 -25
- data/lib/generators/matestack/app/templates/app/controllers/%file_name%_controller.rb.tt +0 -5
- data/lib/generators/matestack/app/templates/app/matestack/apps/%file_name%.rb.tt +0 -28
- data/lib/generators/matestack/component/USAGE +0 -20
- data/lib/generators/matestack/component/component_generator.rb +0 -29
- data/lib/generators/matestack/component/templates/app/matestack/components/%namespace%/%file_name%.haml.tt +0 -5
- data/lib/generators/matestack/component/templates/app/matestack/components/%namespace%/%file_name%.js.tt +0 -17
- data/lib/generators/matestack/component/templates/app/matestack/components/%namespace%/%file_name%.rb.tt +0 -11
- data/lib/generators/matestack/component/templates/app/matestack/components/%namespace%/%file_name%.scss.tt +0 -1
- data/lib/generators/matestack/core/component/USAGE +0 -16
- data/lib/generators/matestack/core/component/component_generator.rb +0 -23
- data/lib/generators/matestack/core/component/templates/app/concepts/matestack/ui/core/%file_name%/%file_name%.haml.tt +0 -5
- data/lib/generators/matestack/core/component/templates/app/concepts/matestack/ui/core/%file_name%/%file_name%.rb.tt +0 -4
- data/lib/generators/matestack/core/component/templates/docs/components/%file_name%.md.tt +0 -45
- data/lib/generators/matestack/core/component/templates/spec/usage/components/%file_name%_spec.rb +0 -31
- data/lib/generators/matestack/page/USAGE +0 -28
- data/lib/generators/matestack/page/page_generator.rb +0 -54
- data/lib/generators/matestack/page/templates/app/matestack/pages/%app_name%/%namespace%/%file_name%.rb.tt +0 -29
- data/lib/matestack/ui/core/cell.rb +0 -31
- data/lib/matestack/ui/core/component/registry.rb +0 -47
- data/lib/matestack/ui/core/components.rb +0 -271
- data/lib/matestack/ui/core/dsl.rb +0 -6
- data/lib/matestack/ui/core/engine.rb +0 -35
- data/lib/tasks/matestack/ui/core_tasks.rake +0 -4
- data/vendor/assets/javascripts/dist/manifest.json +0 -18
- data/vendor/assets/javascripts/dist/manifest.json.br +0 -0
- data/vendor/assets/javascripts/dist/manifest.json.gz +0 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.css +0 -3
- data/vendor/assets/javascripts/dist/matestack-ui-core.css.map +0 -1
- data/vendor/assets/javascripts/dist/matestack-ui-core.js +0 -17734
- data/vendor/assets/javascripts/dist/matestack-ui-core.js.map +0 -1
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.css +0 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js +0 -3
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.LICENSE.txt +0 -11
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.br +0 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.gz +0 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.map +0 -1
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.map.br +0 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.map.gz +0 -0
- data/vendor/assets/javascripts/matestack-ui-core.js.erb +0 -2
- data/vendor/assets/stylesheets/dist +0 -1
- data/vendor/assets/stylesheets/matestack-ui-core.css.erb +0 -2
@@ -1,16 +0,0 @@
|
|
1
|
-
module Matestack::Ui::Core::Collection::Order
|
2
|
-
class Order < Matestack::Ui::Core::Component::Dynamic
|
3
|
-
vue_js_component_name 'matestack-ui-core-collection-order'
|
4
|
-
|
5
|
-
def setup
|
6
|
-
@component_config = @component_config.except(:data, :paginated_data)
|
7
|
-
end
|
8
|
-
|
9
|
-
def response
|
10
|
-
div html_attributes do
|
11
|
-
yield_components
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module Matestack::Ui::Core::Collection::Order::Toggle::Indicator
|
2
|
-
class Indicator < Matestack::Ui::Core::Component::Static
|
3
|
-
|
4
|
-
def response
|
5
|
-
span html_attributes do
|
6
|
-
span attributes: {"v-if": "ordering['#{@component_config[:key]}'] === undefined"}, text: @component_config[:default]
|
7
|
-
unescaped "{{
|
8
|
-
orderIndicator(
|
9
|
-
'#{@component_config[:key]}',
|
10
|
-
{ asc: '#{@component_config[:asc]}', desc: '#{@component_config[:desc]}'}
|
11
|
-
)
|
12
|
-
}}"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import Vue from 'vue/dist/vue.esm'
|
2
|
-
import componentMixin from './component'
|
3
|
-
|
4
|
-
const componentDef = {
|
5
|
-
mixins: [componentMixin]
|
6
|
-
}
|
7
|
-
|
8
|
-
let component = Vue.component('matestack-ui-core-anonym-dynamic-component', componentDef)
|
9
|
-
|
10
|
-
export default componentDef
|
@@ -1,430 +0,0 @@
|
|
1
|
-
module Matestack::Ui::Core::Component
|
2
|
-
class Base < Trailblazer::Cell
|
3
|
-
include Matestack::Ui::Core::Cell
|
4
|
-
include Matestack::Ui::Core::HasViewContext
|
5
|
-
include Matestack::Ui::Core::HtmlAttributes
|
6
|
-
include Matestack::Ui::Core::Properties
|
7
|
-
include Matestack::Ui::Core::DSL
|
8
|
-
|
9
|
-
# define html global attributes
|
10
|
-
html_attributes *HTML_GLOBAL_ATTRIBUTES, *HTML_EVENT_ATTRIBUTES
|
11
|
-
|
12
|
-
|
13
|
-
view_paths << "#{Matestack::Ui::Core::Engine.root}/app/concepts"
|
14
|
-
view_paths << "#{::Rails.root}#{'/' unless ::Rails.root.nil?}app/matestack"
|
15
|
-
|
16
|
-
extend ViewName::Flat
|
17
|
-
|
18
|
-
attr_reader :children, :yield_components_to, :argument, :options
|
19
|
-
|
20
|
-
# TODO: Seems the `context` method is defined in Cells, would be
|
21
|
-
# easy to move up - question really is how much of cells we're still using?
|
22
|
-
def initialize(model = nil, options = {})
|
23
|
-
# @model also exists with the same content? Is there any reason we wouldn't
|
24
|
-
# wanna use it instead of @argument? There's even a `model` accessor for it
|
25
|
-
# TODO
|
26
|
-
@argument = model
|
27
|
-
@options = options
|
28
|
-
|
29
|
-
# TODO works around a semantic where if just a hash is passed apparently
|
30
|
-
# those are the options
|
31
|
-
@options = model.dup if @options.empty? && model.is_a?(Hash)
|
32
|
-
|
33
|
-
super(model, @options)
|
34
|
-
# DSL-relevant
|
35
|
-
@children = []
|
36
|
-
@current_parent_context = self
|
37
|
-
# remember where we need to insert components on yield_components_for usage
|
38
|
-
@yield_components_to = nil
|
39
|
-
|
40
|
-
# TODO: everything beyond this point is probably not needed for the
|
41
|
-
# Page subclass
|
42
|
-
|
43
|
-
# TODO: potentially only used in form like components
|
44
|
-
# Suggestion: Introduce a new super class to remove this complexity
|
45
|
-
# from the base class.
|
46
|
-
@included_config = @options[:included_config]
|
47
|
-
# p self.class.name
|
48
|
-
# p @included_config
|
49
|
-
|
50
|
-
# TODO seemingly never accessed? (at least by us)
|
51
|
-
# but probably good to expose to have access to current_user & friends
|
52
|
-
# #context is defined in `Cell::ViewModel`
|
53
|
-
# and it just grabs @options[:context]
|
54
|
-
@controller_context = context&.fetch(:controller_context, nil)
|
55
|
-
|
56
|
-
# Add matestack context, containing controller etc.
|
57
|
-
@matestack_context = options.dig(:matestack_context)
|
58
|
-
|
59
|
-
# TODO: technically only relevant for Dynamic, however it relies on
|
60
|
-
# @options being set but must be set before `setup` is called.
|
61
|
-
# As both happen in this controller it isn't possible to squeeze
|
62
|
-
# it inbetween the super calls in the Dynamic super class.
|
63
|
-
#
|
64
|
-
# This is the configuration for the VueJS component
|
65
|
-
@component_config = @options.except(:context, :children, :url_params, :included_config, :matestack_context, :slots)
|
66
|
-
|
67
|
-
# TODO: no idea why this is called `url_params` it contains
|
68
|
-
# much more than this e.g. almost all params so maybe rename it?
|
69
|
-
# will be deprecated in future releases. use the `params` method in order to access query params
|
70
|
-
@url_params = context&.[](:params)&.except(:action, :controller, :component_key, :matestack_context)
|
71
|
-
|
72
|
-
# used when creating the child component tree
|
73
|
-
# if true, the block of an async component with a defer value will not be processed
|
74
|
-
# this saves serverside computation time on initial page requests where some components
|
75
|
-
# should only be resolved in a subsequent component rendering call
|
76
|
-
# whithin this subsequent component rendering call, the value is set to false via
|
77
|
-
# matestack_set_skip_defer(false)
|
78
|
-
@matestack_skip_defer = true
|
79
|
-
|
80
|
-
# TODO: do we realy have to call this every time on initialize or should
|
81
|
-
# it maybe be called more dynamically like its dynamic_tag_attributes
|
82
|
-
# equivalent in Dynamic?
|
83
|
-
set_tag_attributes
|
84
|
-
setup
|
85
|
-
validate_options
|
86
|
-
end
|
87
|
-
|
88
|
-
# whithin subsequent component rendering calls, the value is set to false in order to render
|
89
|
-
# the content of deferred components
|
90
|
-
def matestack_set_skip_defer bool
|
91
|
-
@matestack_skip_defer = bool
|
92
|
-
end
|
93
|
-
|
94
|
-
def set_included_config config
|
95
|
-
@included_config = config
|
96
|
-
end
|
97
|
-
|
98
|
-
def get_included_config
|
99
|
-
@included_config
|
100
|
-
end
|
101
|
-
alias :included_config :get_included_config
|
102
|
-
|
103
|
-
def component_config
|
104
|
-
@component_config
|
105
|
-
end
|
106
|
-
|
107
|
-
# TODO: modifies/recreates view lookup paths on every invocation?!
|
108
|
-
# At least memoize it I guess...
|
109
|
-
# better even maybe/probably give a component an (automatic) way to know
|
110
|
-
# exactly where its template is probably based on its own file location.
|
111
|
-
# Then no lookup/search has to happen.
|
112
|
-
def self.prefixes
|
113
|
-
_prefixes = super
|
114
|
-
modified_prefixes = _prefixes.map do |prefix|
|
115
|
-
prefix_parts = prefix.split("/")
|
116
|
-
if prefix_parts.last.include?(self.name.split("::")[-1].underscore)
|
117
|
-
prefix_parts[0..-2].join("/") + '/'
|
118
|
-
else
|
119
|
-
prefix
|
120
|
-
end
|
121
|
-
end
|
122
|
-
return modified_prefixes + _prefixes
|
123
|
-
end
|
124
|
-
|
125
|
-
def self.views_dir
|
126
|
-
return ""
|
127
|
-
end
|
128
|
-
|
129
|
-
# Special validation logic
|
130
|
-
def validate_options
|
131
|
-
if defined? self.class::REQUIRED_KEYS
|
132
|
-
ActiveSupport::Deprecation.warn("REQUIRED_KEYS is deprecated. Use `require :foo` instead.")
|
133
|
-
self.class::REQUIRED_KEYS.each do |key|
|
134
|
-
raise "#{self.class.name}: required key '#{key}' is missing" if options[key].nil?
|
135
|
-
end
|
136
|
-
end
|
137
|
-
custom_options_validation
|
138
|
-
end
|
139
|
-
|
140
|
-
def custom_options_validation
|
141
|
-
true
|
142
|
-
end
|
143
|
-
|
144
|
-
# custom component setup that doesn't seem to be documented
|
145
|
-
# but lots of components use it
|
146
|
-
def setup
|
147
|
-
true
|
148
|
-
end
|
149
|
-
|
150
|
-
# Setup meant to be overridden to setup data from DB or what not
|
151
|
-
# why not just call these functions at the beginning of whatever
|
152
|
-
# we'll call the method like:
|
153
|
-
#
|
154
|
-
# def respone
|
155
|
-
# result = i_call_stuff
|
156
|
-
# plain result
|
157
|
-
# end
|
158
|
-
#
|
159
|
-
# Seems like it might be more complicated? Not sure probably missing something.
|
160
|
-
def prepare
|
161
|
-
true
|
162
|
-
end
|
163
|
-
|
164
|
-
# access params like you would do on rails views and controllers
|
165
|
-
def params
|
166
|
-
if @matestack_context.present? && @matestack_context[:controller].present?
|
167
|
-
@matestack_context[:controller].params
|
168
|
-
elsif context.present? && context[:params]
|
169
|
-
context[:params]
|
170
|
-
else
|
171
|
-
ActionController::Parameters.new({})
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
## ------------------ Rendering ----------------
|
176
|
-
# Invoked by Cell::ViewModel from Rendering#call
|
177
|
-
#
|
178
|
-
def show
|
179
|
-
raise "subclass responsibility"
|
180
|
-
end
|
181
|
-
|
182
|
-
def to_html
|
183
|
-
show
|
184
|
-
end
|
185
|
-
|
186
|
-
def render_content
|
187
|
-
# When/if we implement response then our display purely relies on that
|
188
|
-
# of our children
|
189
|
-
# TODO: this might be another sub class or module for the difference
|
190
|
-
# Like Native Component vs. composed component? Unsure. Might also not be worth it.
|
191
|
-
if respond_to? :response
|
192
|
-
render :children
|
193
|
-
else
|
194
|
-
# We got a template render it around our children
|
195
|
-
render do
|
196
|
-
render :children
|
197
|
-
end
|
198
|
-
end
|
199
|
-
end
|
200
|
-
|
201
|
-
def component_id
|
202
|
-
options[:id] ||= nil
|
203
|
-
end
|
204
|
-
|
205
|
-
def js_action name, arguments
|
206
|
-
argumentString = arguments.join('", "')
|
207
|
-
argumentString = '"' + argumentString + '"'
|
208
|
-
[name, '(', argumentString, ')'].join("")
|
209
|
-
end
|
210
|
-
|
211
|
-
def navigate_to path
|
212
|
-
js_action("navigateTo", [path])
|
213
|
-
end
|
214
|
-
|
215
|
-
def get_children
|
216
|
-
return options[:children]
|
217
|
-
end
|
218
|
-
|
219
|
-
## ---------------------- DSL ------------------------------
|
220
|
-
# Add a new child when building the component tree.
|
221
|
-
#
|
222
|
-
# Invoked in 2 ways
|
223
|
-
# * directly ass add_child class, args, block
|
224
|
-
# * as defined by the DSL methods in `Matestack::Ui::Core::Component::Registry`
|
225
|
-
# which does the same but allows the nicer DSL methods on top of it
|
226
|
-
#
|
227
|
-
# add_child only builds up the whole ruby component structure. Rendering is done
|
228
|
-
# in a later step by calling `#show` on the component where you want to start
|
229
|
-
# rendering.
|
230
|
-
def add_child(child_class, *args, &block)
|
231
|
-
|
232
|
-
# when the child is an async or isolate component like shown below, only render its wrapper
|
233
|
-
# and skip its content on normal page rendering call indicated by @matestack_skip_defer == true
|
234
|
-
# Example: async defer: 1000 { plain "I should be deferred" }
|
235
|
-
# the component will triger a subsequent component rendering call after 1000ms
|
236
|
-
# the main renderer will then set @matestack_skip_defer to false which allows processing
|
237
|
-
# the childs content in order to respond to the subsequent component rendering call with
|
238
|
-
# the childs content. In this case: "I should be deferred"
|
239
|
-
skip_deferred_child_response = false
|
240
|
-
if child_class <= Matestack::Ui::Core::Async::Async || child_class < Matestack::Ui::Core::Isolated::Isolated
|
241
|
-
if args.any? { |arg| arg[:defer].present? } && @matestack_skip_defer == true
|
242
|
-
skip_deferred_child_response = true
|
243
|
-
end
|
244
|
-
end
|
245
|
-
|
246
|
-
# check only allowed keys are passed to isolated components
|
247
|
-
if child_class < Matestack::Ui::Core::Isolated::Isolated
|
248
|
-
unless args.empty? || args[0].keys.all? { |key| [:defer, :public_options, :rerender_on, :init_on, :rerender_delay, :matestack_context, :context].include? key }
|
249
|
-
raise "isolated components can only take params in a public_options hash, which will be exposed to the client side in order to perform an async request with these params."
|
250
|
-
end
|
251
|
-
if args.any? { |arg| arg[:init_on].present? } && @matestack_skip_defer == true
|
252
|
-
skip_deferred_child_response = true
|
253
|
-
end
|
254
|
-
end
|
255
|
-
|
256
|
-
if self.class < Matestack::Ui::Core::Isolated::Isolated
|
257
|
-
parent_context_included_config = @current_parent_context.get_included_config || {}
|
258
|
-
parent_context_included_config.merge!({ isolated_parent_class: self.class.name })
|
259
|
-
args_with_context = add_context_to_options(args,parent_context_included_config)
|
260
|
-
else
|
261
|
-
args_with_context = add_context_to_options(args, @current_parent_context.get_included_config)
|
262
|
-
end
|
263
|
-
|
264
|
-
child = child_class.new(*args_with_context)
|
265
|
-
|
266
|
-
# set the current @matestack_skip_defer state on the child instance
|
267
|
-
# otherwise nested deferred components would never be rendered as
|
268
|
-
# @matestack_skip_defer is true by default
|
269
|
-
child.matestack_set_skip_defer(@matestack_skip_defer)
|
270
|
-
|
271
|
-
@current_parent_context.children << child
|
272
|
-
|
273
|
-
# skip childs body if it should be deferred
|
274
|
-
# only the wrapping structure is rendered in this case
|
275
|
-
unless skip_deferred_child_response
|
276
|
-
child.prepare
|
277
|
-
child.response if child.respond_to?(:response)
|
278
|
-
|
279
|
-
if child_class == Matestack::Ui::Core::Form::Form
|
280
|
-
included_config = args.select { |arg| arg.is_a?(Hash) ? arg[:for] : nil }[0]
|
281
|
-
end
|
282
|
-
execute_child_block(child, included_config, block) if block
|
283
|
-
end
|
284
|
-
|
285
|
-
child
|
286
|
-
end
|
287
|
-
|
288
|
-
# compatibility layer to old-school (not needed anymore)
|
289
|
-
def components(&block)
|
290
|
-
instance_eval &block
|
291
|
-
end
|
292
|
-
|
293
|
-
# TODO: partial is weird, I highly recommend removing it
|
294
|
-
# it exists in basically 2 forms, one that is basically `send`
|
295
|
-
# the other just executes the block it's given.
|
296
|
-
# Same thing can now be achieved through simple method calls
|
297
|
-
def partial(*args)
|
298
|
-
if block_given?
|
299
|
-
yield
|
300
|
-
else
|
301
|
-
send(*args)
|
302
|
-
end
|
303
|
-
end
|
304
|
-
|
305
|
-
# slot allows generating content in one component and passing it to another
|
306
|
-
#
|
307
|
-
# It's a 2 purpose method (might be redone):
|
308
|
-
# * with a block creates the children to be inserted
|
309
|
-
# * without a block it inserts the children at the current point
|
310
|
-
#
|
311
|
-
#
|
312
|
-
def slot(slot_content = [], &block)
|
313
|
-
if block_given?
|
314
|
-
create_slot_children_to_be_inserted(block)
|
315
|
-
else
|
316
|
-
# at this point the children are completely built, we just need
|
317
|
-
# to insert them into the tree at the right spot (which is marked
|
318
|
-
# by where we are currently called hence @current_parent_context)
|
319
|
-
@current_parent_context.children.concat(slot_content)
|
320
|
-
end
|
321
|
-
end
|
322
|
-
|
323
|
-
# TODO the implementation is simple, but reasoning about is quite
|
324
|
-
# complex imo. The main reason is that `yield_components` has no
|
325
|
-
# access to the block. Of course that could be solved by making
|
326
|
-
# it an instance variable. Might be nicer if we could do
|
327
|
-
# `def response(&block)`
|
328
|
-
# Also:
|
329
|
-
# * right now only works with one yield_components, would break with
|
330
|
-
# two that might be nice to raise/warn about
|
331
|
-
#
|
332
|
-
# The biggest trick this pulls is in execte_child_block where the
|
333
|
-
# parent context is shifted to whatever this points to, so that it's
|
334
|
-
# inserted at the right point.
|
335
|
-
def yield_components
|
336
|
-
@yield_components_to = @current_parent_context
|
337
|
-
end
|
338
|
-
|
339
|
-
private
|
340
|
-
|
341
|
-
# This should be simpler, all it does is try to figure out where the hash/option
|
342
|
-
# argument goes and put context in it
|
343
|
-
# Partially caused by the behavior that we have 2 initialize args and it's unclear
|
344
|
-
# which one should be an options hash as both `plain "hello"` and `div id: "lala"`
|
345
|
-
# should work currently
|
346
|
-
def add_context_to_options(args, included_config=nil)
|
347
|
-
case args.size
|
348
|
-
when 0 then [
|
349
|
-
{
|
350
|
-
context: context,
|
351
|
-
included_config: included_config,
|
352
|
-
}
|
353
|
-
]
|
354
|
-
when 1 then
|
355
|
-
arg = args.first
|
356
|
-
if arg.is_a?(Hash)
|
357
|
-
arg[:context] = context
|
358
|
-
arg[:included_config] = included_config
|
359
|
-
arg[:matestack_context] = @matestack_context
|
360
|
-
[arg]
|
361
|
-
else
|
362
|
-
[arg, {context: context, included_config: included_config, matestack_context: @matestack_context}]
|
363
|
-
end
|
364
|
-
when 2 then
|
365
|
-
if args[1] == :include
|
366
|
-
if args.first.is_a?(Hash)
|
367
|
-
args.first[:context] = context
|
368
|
-
args.first[:included_config] = included_config
|
369
|
-
args.first[:matestack_context] = @matestack_context
|
370
|
-
[args.first]
|
371
|
-
end
|
372
|
-
else
|
373
|
-
args[1][:context] = context
|
374
|
-
args[1][:included_config] = included_config
|
375
|
-
args[1][:matestack_context] = @matestack_context
|
376
|
-
[args.first, args[1]]
|
377
|
-
end
|
378
|
-
else
|
379
|
-
raise "too many child arguments what are you doing?"
|
380
|
-
end
|
381
|
-
end
|
382
|
-
|
383
|
-
def execute_child_block(child, included_config=nil, block)
|
384
|
-
previous_parent_context = @current_parent_context
|
385
|
-
begin
|
386
|
-
@current_parent_context = child.yield_components_to || child
|
387
|
-
@current_parent_context.set_included_config(included_config) if included_config.present?
|
388
|
-
instance_eval(&block)
|
389
|
-
ensure
|
390
|
-
@current_parent_context = previous_parent_context
|
391
|
-
end
|
392
|
-
end
|
393
|
-
|
394
|
-
def create_slot_children_to_be_inserted(block)
|
395
|
-
# Basically works through:
|
396
|
-
# 1. create a fake parent (execution_parent_proxy)
|
397
|
-
# 2. set it as the current parrent
|
398
|
-
# 3. evaluate the block in the context in which it was defined
|
399
|
-
# to have access to methods/instance variables
|
400
|
-
# 4. make sure parent context is the previous one again
|
401
|
-
# 5. return the children we added to our "fake parent" so
|
402
|
-
# that they can be inserted wherever again
|
403
|
-
execution_parent_proxy = Base.new()
|
404
|
-
previous_parent_context = @current_parent_context
|
405
|
-
@current_parent_context = execution_parent_proxy
|
406
|
-
|
407
|
-
begin
|
408
|
-
instance_eval(&block)
|
409
|
-
ensure
|
410
|
-
@current_parent_context = previous_parent_context
|
411
|
-
end
|
412
|
-
|
413
|
-
execution_parent_proxy.children
|
414
|
-
end
|
415
|
-
|
416
|
-
## ------------------------ Also Rendering ---------------------
|
417
|
-
# common attribute handling for tags/components
|
418
|
-
def set_tag_attributes
|
419
|
-
default_attributes = {
|
420
|
-
id: component_id,
|
421
|
-
class: options[:class]
|
422
|
-
}
|
423
|
-
unless options[:attributes].nil?
|
424
|
-
default_attributes.merge!(options[:attributes])
|
425
|
-
end
|
426
|
-
|
427
|
-
@tag_attributes = default_attributes
|
428
|
-
end
|
429
|
-
end
|
430
|
-
end
|