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
yield_pageUse
yieldinstead ofyield_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-corerendered a minimal app around pages without explicitly associated appThis 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
Include your registry in components, pages, and apps directly instead of including it in your controller.
or
Create base classes for apps, pages and components inherting from Matestack's base classes including the registry(ies) and let your apps, pages and components inherit from them. As this is just a plain Ruby module, you need to include it in all contexts you want to use the alias method (unlike the registry prior to 2.0.0).
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 simpleoptionsinstead
yield_components
or if you want to yield in some method other than response:
Vue.js
matestack-ui-coredoes not include prebundle packs for Sprockets anymoreMatestackUiCoreis not available in the global window object anymore by defaultPlease 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_configinstance variable andsetupmethodUse explicit method in order to inject specific options into Vue.js components
Form components
Root form component name
renamed
formtomatestack_formasformis now rendering the HTML formmatestack_formrenders the Vue.js driven form as prior to 2.0.0
Submit
form_submitcomponent removed, use something likebutton 'submit', type: :submitinsteadget Vue.js form loading state via simple
loadinginstead ofloading()
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
divas root element to aatag in order to have an inline root element being consistent withtransitionandaction
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
link is now calling the HTML
linktag instead of rendering anataguse
a href: ...ora 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: :blueAccess it now with
self.textorcontext.textinstead of@argument
Minor HTML rendering changes
In general: content blocks take precedence over text or :text option
areacoords will no longer be automatically joined -> html option does exactly what is expected, no magicitalicandiconare now called with the corresponding html tagiahas 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 insteadunescapedrenamed tounescapeas it fits the naming conventions more. For example rails html_escape not html_escaped.unescapedis deprecated nowvideohas no more magic creation of source tag or automatically fetch asset path to keep dsl as close to html as possibleremoved alias
pgforparagraphtransitioncan no longer handle symbols as path. Use rails path helper insteadMatestack::Ui::DynamicActionviewComponent, Matestack::Ui::Core::Actionview::Dynamicand static removed -> is not needed
Last updated
Was this helpful?