Skip to content

Commit 62b68d1

Browse files
jonasjabarigitbook-bot
authored andcommitted
GitBook: [#8] No subject
1 parent 2f4694c commit 62b68d1

File tree

1 file changed

+82
-72
lines changed

1 file changed

+82
-72
lines changed

docs/migrate-to-3.0.md

Lines changed: 82 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
1-
# Installation & setup changes
1+
# Migrating to 3.0
22

3-
## Core/Vuejs repo and gem split
3+
## Installation & setup changes
44

5-
- `matestack-ui-core` previously contained logic for
6-
- Ruby -> HTML conversion
7-
- Reactivity via prebuilt and custom Vue.js components
8-
- in order to have better seperation of concerns, we've moved the reactivity related things to its own repository/gem -> `matestack-ui-vuejs`
9-
- `matestack-ui-core` is now meant to be combined with any reactivity framework or none at all
5+
### Core/Vuejs repo and gem split
6+
7+
* `matestack-ui-core` previously contained logic for
8+
* Ruby -> HTML conversion
9+
* Reactivity via prebuilt and custom Vue.js components
10+
* in order to have better seperation of concerns, we've moved the reactivity related things to its own repository/gem -> `matestack-ui-vuejs`
11+
* `matestack-ui-core` is now meant to be combined with any reactivity framework or none at all
1012

1113
If you've used reactivity features of `matestack-ui-core` 2.x you now have to install `matestack-ui-vuejs` (Ruby Gem & NPM Package) additionally:
1214

1315
`Gemfile`
16+
1417
```ruby
1518
gem 'matestack-ui-core', '~> 3.0'
1619
gem 'matestack-ui-vuejs', '~> 3.0'
1720
```
1821

1922
`package.json`
23+
2024
```json
2125
{
2226
"name": "my-app",
@@ -25,14 +29,12 @@ gem 'matestack-ui-vuejs', '~> 3.0'
2529
"..."
2630
}
2731
}
28-
2932
```
3033

31-
## IE 11 support dropped
32-
34+
### IE 11 support dropped
3335

34-
- vue3 dropped IE 11 support
35-
- when using babel alongside webpacker, please adjust your package.json or .browserslistrc config in order to exclude IE 11 support:
36+
* vue3 dropped IE 11 support
37+
* when using babel alongside webpacker, please adjust your package.json or .browserslistrc config in order to exclude IE 11 support:
3638

3739
```json
3840
{
@@ -47,11 +49,11 @@ gem 'matestack-ui-vuejs', '~> 3.0'
4749

4850
Otherwise you may encounter issues around `regeneratorRuntime` (especially when using Vuex)
4951

50-
## Setup via webpacker
51-
52+
### Setup via webpacker
5253

5354
`config/webpack/environment.js`
54-
```js
55+
56+
```javascript
5557
const { environment } = require('@rails/webpacker')
5658
const webpack = require('webpack');
5759

@@ -80,12 +82,13 @@ and then just use `import { whatever } from 'vue'` instead of `import { whatever
8082

8183
**Optional: vue3 compat build usage**
8284

83-
- if you're using any vue2 APIs (or one of the libraries you're using), you can use the vue3 compat build
84-
- this enables you to use both vue2 and vue3 APIs and migrate step by step
85-
- usage via webpack config when using webpacker 5.x and up:
85+
* if you're using any vue2 APIs (or one of the libraries you're using), you can use the vue3 compat build
86+
* this enables you to use both vue2 and vue3 APIs and migrate step by step
87+
* usage via webpack config when using webpacker 5.x and up:
8688

8789
`config/webpack/environment.js`
88-
```js
90+
91+
```javascript
8992
const { environment } = require('@rails/webpacker')
9093
const webpack = require('webpack')
9194

@@ -108,20 +111,21 @@ environment.config.merge(customWebpackConfig)
108111
module.exports = environment
109112
```
110113

111-
# Ruby related changes
114+
## Ruby related changes
112115

113-
## `Matestack::Ui::App` is now called `Matestack::Ui::Layout`
116+
### `Matestack::Ui::App` is now called `Matestack::Ui::Layout`
114117

115-
- `Matestack::Ui::App` was always meant to be a layout wrapping pages, but was supercharged with some vuejs logic before splitting the `core` and `vuejs` repos
116-
- now `Matestack::Ui::App` is only a layout, that's why it should be named like that: `Matestack::Ui::Layout`
118+
* `Matestack::Ui::App` was always meant to be a layout wrapping pages, but was supercharged with some vuejs logic before splitting the `core` and `vuejs` repos
119+
* now `Matestack::Ui::App` is only a layout, that's why it should be named like that: `Matestack::Ui::Layout`
117120

118-
-> Search&Replace
121+
\-> Search\&Replace
119122

120-
## `matestack_app` method is renamed to `matestack_layout`
123+
### `matestack_app` method is renamed to `matestack_layout`
121124

122-
- following the above mentioned naming adjustment, the `matestack_app` method used on controller level is renamed to `matestack_layout`
125+
* following the above mentioned naming adjustment, the `matestack_app` method used on controller level is renamed to `matestack_layout`
123126

124127
`app/controllers/demo_controller.rb`
128+
125129
```ruby
126130
class DemoController < ActionController::Base
127131
include Matestack::Ui::Core::Helper
@@ -137,14 +141,15 @@ class DemoController < ActionController::Base
137141
end
138142
```
139143

140-
# `Matestack::Ui::Layout` `Matestack::Ui::Page` wrapping DOM structures
144+
## `Matestack::Ui::Layout` `Matestack::Ui::Page` wrapping DOM structures
141145

142-
- previously, `Matestack::Ui::App` added some wrapping DOM structure around the whole layout and around it's `yield`
143-
- this enabled dynamic page transition and loading state animations
144-
- `Matestack::Ui::Layout` now purely renders the layout and yields a page without anything in between
145-
- the wrapping DOM structres required for dynamic page transitions and loading state animations needs to be added via two new components if you want to use these features via `matestack-ui-vuejs` (see section below!)
146+
* previously, `Matestack::Ui::App` added some wrapping DOM structure around the whole layout and around it's `yield`
147+
* this enabled dynamic page transition and loading state animations
148+
* `Matestack::Ui::Layout` now purely renders the layout and yields a page without anything in between
149+
* the wrapping DOM structres required for dynamic page transitions and loading state animations needs to be added via two new components if you want to use these features via `matestack-ui-vuejs` (see section below!)
146150

147151
`matestack/some/app/layout.rb`
152+
148153
```ruby
149154
class Some::App::Layout < Matestack::Ui::Layout
150155
def response
@@ -157,6 +162,7 @@ end
157162
```
158163

159164
`matestack/some/app/pages/some_page.rb`
165+
160166
```ruby
161167
class Some::App::Pages::SomePage < Matestack::Ui::Page
162168
def response
@@ -178,14 +184,14 @@ will just render:
178184
</body>
179185
```
180186

181-
## `Matestack::Ui::Layout` adjustments when using `matestack-ui-vuejs`
182-
187+
### `Matestack::Ui::Layout` adjustments when using `matestack-ui-vuejs`
183188

184-
- `Matestack::Ui::Layout` classes are no longer automatically wrapped by a component tag meant to mount the matestack-ui-core-app component on it.
185-
- this has to be done manually via the `matestack_vue_js_app` component, which is more explicit and gives more flexibility
186-
- additionally, the `page_switch` component has to wrap the `yield` in order to support dynamic page transitions
189+
* `Matestack::Ui::Layout` classes are no longer automatically wrapped by a component tag meant to mount the matestack-ui-core-app component on it.
190+
* this has to be done manually via the `matestack_vue_js_app` component, which is more explicit and gives more flexibility
191+
* additionally, the `page_switch` component has to wrap the `yield` in order to support dynamic page transitions
187192

188193
`matestack/some/vue_js/app/layout.rb`
194+
189195
```ruby
190196
class Some::VueJs::App::Layout < Matestack::Ui::Layout
191197

@@ -203,8 +209,8 @@ class Some::VueJs::App::Layout < Matestack::Ui::Layout
203209
end
204210
```
205211

206-
- using these components will add the original wrapping DOM structres which enables loading state animations
207-
- new `<matestack-component-tempate>` will be rendered coming from these two new components
212+
* using these components will add the original wrapping DOM structres which enables loading state animations
213+
* new `<matestack-component-tempate>` will be rendered coming from these two new components
208214

209215
```html
210216
<body> <!-- coming from rails layout if specified -->
@@ -231,19 +237,19 @@ end
231237
</body>
232238
```
233239

234-
# Vuejs related changes in order to support vue3
240+
## VueJs related changes in order to support vue3
235241

242+
### `MatestackUiCore` is now `MatestackUiVueJs`
236243

237-
## `MatestackUiCore` is now `MatestackUiVueJs`
244+
* following the repo/gem split, the Vue.js related libary is now called `MatestackUiVueJs`
238245

239-
- following the repo/gem split, the Vue.js related libary is now called `MatestackUiVueJs`
246+
\-> Search\&Replace
240247

241-
-> Search&Replace
242-
243-
## app definition and mount
248+
### app definition and mount
244249

245250
`javascript/packs/application.js`
246-
```js
251+
252+
```javascript
247253
import { createApp } from 'vue'
248254
import MatestackUiVueJs from 'matestack-ui-vuejs'
249255

@@ -254,10 +260,11 @@ document.addEventListener('DOMContentLoaded', () => {
254260
})
255261
```
256262

257-
## custom component registration
263+
### custom component registration
258264

259265
`some/component/file.js`
260-
```js
266+
267+
```javascript
261268
import MatestackUiVueJs from 'matestack-ui-vuejs'
262269

263270
const myComponent = {
@@ -277,7 +284,8 @@ export default myComponent
277284
```
278285

279286
`javascript/packs/application.js`
280-
```js
287+
288+
```javascript
281289
import { createApp } from 'vue'
282290
import MatestackUiVueJs from 'matestack-ui-vuejs'
283291

@@ -292,12 +300,13 @@ document.addEventListener('DOMContentLoaded', () => {
292300
})
293301
```
294302

295-
## component template
303+
### component template
296304

297-
- For application components, apply `template: MatestackUiVueJs.componentHelpers.inlineTemplate`
305+
* For application components, apply `template: MatestackUiVueJs.componentHelpers.inlineTemplate`
298306

299307
`some/component/file.js`
300-
```js
308+
309+
```javascript
301310
import MatestackUiVueJs from 'matestack-ui-vuejs'
302311

303312
const myComponent = {
@@ -316,16 +325,17 @@ const myComponent = {
316325
export default myComponent
317326
```
318327

319-
- Only for core components
320-
- add import `import componentHelpers from 'some/relative/path/to/helpers'`
321-
- and then apply `template: componentHelpers.inlineTemplate`
328+
* Only for core components
329+
* add import `import componentHelpers from 'some/relative/path/to/helpers'`
330+
* and then apply `template: componentHelpers.inlineTemplate`
322331

323-
## component scope prefix
332+
### component scope prefix
324333

325-
- use `vc.` (short for vue component) in order to prefix all properties references or method calls within your vue.js component `response`
334+
* use `vc.` (short for vue component) in order to prefix all properties references or method calls within your vue.js component `response`
326335

327336
`some/component/file.js`
328-
```js
337+
338+
```javascript
329339
import MatestackUiVueJs from 'matestack-ui-vuejs'
330340

331341
const myComponent = {
@@ -359,30 +369,30 @@ class Components::MyComponent < Matestack::Ui::VueJsComponent
359369
end
360370
```
361371

362-
## component $refs
372+
### component $refs
363373

364-
- use `this.getRefs()` instead of `this.$refs`
374+
* use `this.getRefs()` instead of `this.$refs`
365375

366-
-> Search&Replace
376+
\-> Search\&Replace
367377

368-
## component $el
378+
### component $el
369379

370-
- use `this.getElement()` instead of `this.$el`
380+
* use `this.getElement()` instead of `this.$el`
371381

372-
-> Search&Replace
382+
\-> Search\&Replace
373383

374-
## component beforeDestroy hook
384+
### component beforeDestroy hook
375385

376-
- `beforeDestroy` was renamed to `beforeUnmount` within vue3
386+
* `beforeDestroy` was renamed to `beforeUnmount` within vue3
377387

378-
-> Search&Replace
388+
\-> Search\&Replace
379389

380-
## $set, Vue.set
390+
### $set, Vue.set
381391

382-
- `this.$set` and `Vue.set` are removed in vue3 as they are not longer required for proper reactivity binding
383-
- If you use these methods, use plain JavaScript mutations instead
392+
* `this.$set` and `Vue.set` are removed in vue3 as they are not longer required for proper reactivity binding
393+
* If you use these methods, use plain JavaScript mutations instead
384394

385-
## Vuex store dependency removed
395+
### Vuex store dependency removed
386396

387-
- previously a Vuex store was required and by default available. Now it's optional
388-
- you can add a store manually following the official Vuex 4.x docs
397+
* previously a Vuex store was required and by default available. Now it's optional
398+
* you can add a store manually following the official Vuex 4.x docs

0 commit comments

Comments
 (0)