Migrating from 1.x to 2.0

Improvements

  • 5 to 12 times better rendering performance (depending on the context)

  • Change to MIT License

  • Core code readability/maintainability --> Enable core contributor team growth

  • Vue integration and extenability --> Modern JS workflow and increased flexibility

  • Better IDE support --> Removed registry logic enables traceability

  • Easier API for component development

  • Improved naming schemas

  • Reworked docs

License change

We decided to switch back to the MIT License in order to emphasize that we want to create an Open Source project without any commercial restrictions. We will create a blog post about that soon!

Breaking changes

Trailblazer Cell dependency removed

We did a complete Ruby core rewrite and removed the internal dependencies from cells, haml and trailblazer-cells. We're now using pure Ruby for Matestack's HTML rendering and component based UI structuring. We removed the dependency as we realized that we're just using a small subset of Trailblazer's cell feature and are better off when implementing our own business logic. Thank you Trailblazer for bringing us so far!

We only used Trailblazer's cell API internally. If you just used the documented API of Matestack, you only need to follow the below migration steps:

Rails controller

Application helper

Apps

yield_page

  • Use yield instead of yield_page

or if you want to yield in some method other than response:

Loading state element

Minimal app wrapping removed

  • Until 1.5.0, matestack-ui-core rendered a minimal app around pages without explicitly associated app

  • This behavior is removed in 2.0.0 -> a page will be rendered without any wrapping app until an app is explicitly associated

Pages

Controller instance variables

  • No more implicit controller instance variable access - > inject like you would inject options into a component

Components

Registry

Slots

Text options

Required options notation

Required/optional options access

Required/optional options alias

HTML tag attributes

Definition and rendering on default HTML tags

  • No more whitelisting through explicitly defined HTML ATTRIBUTES

  • On default HTML tags, all defined options will be rendered as attributes on that tag

Definition and rendering within components

  • No more whitelisting through explicitly defined HTML ATTRIBUTES

  • No more access through html_attributes, use simple options instead

yield_components

or if you want to yield in some method other than response:

Vue.js

  • matestack-ui-core does not include prebundle packs for Sprockets anymore

  • MatestackUiCore is not available in the global window object anymore by default

  • Please use the webpacker approach in order to manage and import your JavaScript assets

Vue.js integration/mounting

  • Within your application pack, you now have to import and mount Vue/Vuex manually

Vue.js component definition

Vue.js component name helper

Vue.js props injection/usage

  • No more implicit injection of all options into Vue.js component

  • No more @component_config instance variable and setup method

  • Use explicit method in order to inject specific options into Vue.js components

Form components

Root form component name

  • renamed form to matestack_form as form is now rendering the HTML form

  • matestack_form renders the Vue.js driven form as prior to 2.0.0

Submit

  • form_submit component removed, use something like button 'submit', type: :submit instead

  • get Vue.js form loading state via simple loading instead of loading()

Custom form components

Base class

Example for Form Input, adapt all other custom components accordingly:

Collection component

Helper

Filter

  • It's now possible to use ALL form child components within a collection_filter

Onclick

  • changed from rendering a div as root element to a a tag in order to have an inline root element being consistent with transition and action

this possibly breaks the appearance of your UI as we're switching from a block to an inline root element

will now render:

instead of:

You can keep the block style by simply applying following styles to your application:

  • link is now calling the HTML link tag instead of rendering an a tag

  • use a href: ... or a path: ... instead

Isolate

isolate component doesn't raise 'not authorized' anymore. When isolate is not authorized no content is returned. Only a warning is logged to the console

Rails view

rails_view is replaced by rails_render. Use rails_render partial: '/some_partial', locals: { foo: 1 }; rails_render file: '/some_view', locals: { foo: 1 } to render a partial or a file or anything you want. Use the same as you would use rails render

Component argument

  • Pass in text arguments like header 'Your headline', color: :blue

  • Access it now with self.text or context.text instead of @argument

Minor HTML rendering changes

  • In general: content blocks take precedence over text or :text option

  • area coords will no longer be automatically joined -> html option does exactly what is expected, no magic

  • italic and icon are now called with the corresponding html tag i

  • a has no more option :path which can take a symbol and renders it with rails url helper. Use :href/:path with or without rails url helper instead

  • unescaped renamed to unescape as it fits the naming conventions more. For example rails html_escape not html_escaped. unescaped is deprecated now

  • video has no more magic creation of source tag or automatically fetch asset path to keep dsl as close to html as possible

  • removed alias pg for paragraph

  • transition can no longer handle symbols as path. Use rails path helper instead

  • Matestack::Ui::DynamicActionviewComponent, Matestack::Ui::Core::Actionview::Dynamic and static removed -> is not needed

Last updated

Was this helpful?