Skip to content

Commit 5c3c208

Browse files
fix(MdCore): remove all async/await from codebase
1 parent ae49a63 commit 5c3c208

File tree

33 files changed

+1542
-737
lines changed

33 files changed

+1542
-737
lines changed

.babelrc

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
{
22
"presets": [
3-
"es2015",
4-
"stage-3",
5-
[
6-
"env",
7-
{
8-
"modules": false,
9-
"useBuiltIns": false
10-
}
11-
]
3+
"@babel/preset-es2015",
4+
"@babel/preset-env"
125
],
136
"plugins": [
14-
"syntax-dynamic-import"
7+
"@babel/plugin-syntax-dynamic-import",
8+
"@babel/plugin-proposal-object-rest-spread"
159
],
1610
"ignore": [
1711
"dist/*.js"

ROADMAP.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ The release strategy will be like this:
3838
- [X] Multiple themes
3939
- [x] CSS Variables
4040
- [ ] CSS-only themes
41-
- [ ] SSR Support - `NEW`
41+
- [X] SSR Support - `NEW`
4242
- [X] Basic Support
4343

4444
### Components
45-
- [ ] MdAutocomplete - `NEW API`
45+
- [X] MdAutocomplete - `NEW API`
4646
- [X] MdApp - `NEW`
4747
- [X] Documentation
4848
- [X] Reusable App Shell component
@@ -79,8 +79,8 @@ The release strategy will be like this:
7979
- [X] Prompt
8080
- [X] Custom
8181
- [X] MdDivider
82-
- [ ] MdDrawer - `NEW API`
83-
- [ ] Documentation
82+
- [X] MdDrawer - `NEW API`
83+
- [X] Documentation
8484
- [x] Deprecate md-sidenav
8585
- [X] Persistent - `NEW`
8686
- [X] Permanent - `NEW`
@@ -92,8 +92,8 @@ The release strategy will be like this:
9292
- [X] Deprecate whiteframe component
9393
- [X] Elevation classes
9494
- [X] MdEmptyState - `NEW`
95-
- [ ] MdField - `NEW API`
96-
- [ ] Documentation
95+
- [X] MdField - `NEW API`
96+
- [X] Documentation
9797
- [X] Change md-input-container to md-field
9898
- [X] Input/Textarea
9999
- [X] Checkbox
@@ -102,8 +102,8 @@ The release strategy will be like this:
102102
- [X] File - `NEW API`
103103
- [x] Select
104104
- [X] MdIcon
105-
- [ ] MdLayout - `NEW API`
106-
- [ ] Documentation
105+
- [X] MdLayout - `NEW API`
106+
- [X] Documentation
107107
- [X] Deprecate layout component
108108
- [X] New flexbox/responsive/class-based grid
109109
- [ ] MdList - `NEW API`
@@ -112,26 +112,26 @@ The release strategy will be like this:
112112
- [X] Expansion
113113
- [X] Input Controls
114114
- [X] MdMenu - `NEW API`
115-
- [ ] MdProgress - `NEW API`
116-
- [ ] Documentation
117-
- [ ] Spinner
118-
- [ ] Bar
119-
- [ ] 0%/100% progress
120-
- [ ] Indeterminate state
115+
- [X] MdProgress - `NEW API`
116+
- [X] Documentation
117+
- [X] Spinner
118+
- [X] Bar
119+
- [X] 0%/100% progress
120+
- [X] Indeterminate state
121121
- [X] MdRadio
122122
- [ ] MdRipple - `NEW API`
123123
- [ ] Documentation
124124
- [X] New ripple
125125
- [ ] Abstract component
126126
- [ ] Performance improvements
127-
- [ ] MdSnackbar
128-
- [ ] Documentation
127+
- [X] MdSnackbar
128+
- [X] Documentation
129129
- [X] Themed Snackbar
130130
- [X] MdSpeedDial - `NEW API`
131131
- [X] Click Action
132132
- [X] Multiple Effects
133-
- [ ] MdSteppers - `NEW API`
134-
- [ ] Documentation
133+
- [X] MdSteppers - `NEW API`
134+
- [X] Documentation
135135
- [X] Horizontal
136136
- [X] Vertical
137137
- [X] MdSubheader
@@ -146,8 +146,8 @@ The release strategy will be like this:
146146
- [x] Selection
147147
- [ ] Pagination
148148
- [x] Alternate Header
149-
- [ ] MdTabs
150-
- [ ] Documentation
149+
- [X] MdTabs
150+
- [X] Documentation
151151
- [X] Router integration - `NEW`
152152
- [X] Router Sync - `NEW`
153153
- [X] Symple way to trigger active tab
@@ -160,15 +160,15 @@ The release strategy will be like this:
160160
- [ ] Guide
161161
- [ ] Extending Vue Material
162162
- [ ] Third Party Components
163-
- [ ] About
163+
- [X] About
164164
- [ ] Changelog
165165
- [ ] Components summary
166166
- [ ] Contribute
167-
- [ ] Getting Started
167+
- [X] Getting Started
168168
- [ ] Migration Guide
169-
- [ ] Static docs
170-
- [ ] Themes
171-
- [ ] Configuration
169+
- [X] Static docs
170+
- [X] Themes
171+
- [X] Configuration
172172
- [ ] Dynamic Themes
173173
- [ ] UI Elements summary
174174

build/docs/webpack.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const componentExampleLoader = require.resolve('../loaders/component-example-loa
2929
const webpackConfig = {
3030
entry: {
3131
app: [
32-
'babel-polyfill',
32+
'@babel/polyfill',
3333
'./docs/app/index.js',
3434
'./build/docs/offline.js'
3535
]

build/loaders/component-example-loader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const path = require('path')
55
const compiler = require('vue-template-compiler')
66
const { resolvePath } = require('../config')
77
const { transform } = require('babel-core')
8-
const transpile = code => transform(code, {extends: resolvePath('.babelrc')}).code
8+
const transpile = code => transform(code).code
99
const { getIndentedSource } = require('../../docs/app/mixins/codeSource')
1010

1111
function camelCaseToDash (str) {

build/local/webpack.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default {
1212
devtool: 'cheap-module-eval-source-map',
1313
entry: {
1414
docs: [
15-
'babel-polyfill',
15+
'@babel/polyfill',
1616
'./docs/app/index.js',
1717
'./build/local/client'
1818
]

docs/app/components/CodeBlock.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@
5959
}
6060
}
6161
},
62-
async mounted () {
63-
await this.$nextTick()
62+
mounted () {
63+
this.$nextTick().then(() => {
64+
this.reindentSource()
65+
this.enableCopy()
6466
65-
this.reindentSource()
66-
this.enableCopy()
67-
68-
highlight.highlightBlock(this.$refs.block)
67+
highlight.highlightBlock(this.$refs.block)
68+
})
6969
}
7070
}
7171
</script>

docs/app/template/MainNavContent.vue

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,22 @@
8686
}
8787
},
8888
methods: {
89-
async scrollActiveItemIntoView () {
90-
await this.$nextTick()
91-
92-
const activeEl = this.$el.querySelector('.router-link-exact-active')
93-
94-
if (activeEl) {
95-
activeEl.scrollIntoView({
96-
behavior: 'smooth'
97-
})
98-
}
89+
scrollActiveItemIntoView () {
90+
this.$nextTick().then(() => {
91+
const activeEl = this.$el.querySelector('.router-link-exact-active')
92+
93+
if (activeEl) {
94+
activeEl.scrollIntoView({
95+
behavior: 'smooth'
96+
})
97+
}
98+
})
9999
}
100100
},
101-
async mounted () {
102-
await this.$nextTick()
103-
window.setTimeout(this.scrollActiveItemIntoView, 700)
101+
mounted () {
102+
this.$nextTick().then(() => {
103+
window.setTimeout(this.scrollActiveItemIntoView, 700)
104+
})
104105
}
105106
}
106107
</script>

package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,19 @@
4343
},
4444
"dependencies": {},
4545
"devDependencies": {
46+
"@babel/cli": "^7.0.0-beta.38",
47+
"@babel/core": "^7.0.0-beta.38",
48+
"@babel/node": "^7.0.0-beta.38",
49+
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.38",
50+
"@babel/plugin-syntax-dynamic-import": "^7.0.0-beta.38",
51+
"@babel/polyfill": "^7.0.0-beta.38",
52+
"@babel/preset-env": "^7.0.0-beta.38",
53+
"@babel/preset-es2015": "^7.0.0-beta.38",
4654
"autoprefixer": "^7.1.6",
4755
"avoriaz": "^6.0.1",
4856
"axios": "^0.17.0",
49-
"babel-cli": "^6.26.0",
50-
"babel-core": "^6.26.0",
5157
"babel-eslint": "^8.0.1",
52-
"babel-loader": "^7.1.2",
53-
"babel-plugin-syntax-dynamic-import": "^6.18.0",
54-
"babel-polyfill": "^6.26.0",
55-
"babel-preset-env": "^1.6.1",
56-
"babel-preset-es2015": "^6.24.1",
57-
"babel-preset-stage-3": "^6.24.1",
58+
"babel-loader": "8.0.0-beta.0",
5859
"chalk": "^2.3.0",
5960
"clipboard": "^1.7.1",
6061
"commitizen": "^2.9.6",

src/components/MdApp/MdAppDrawer.vue

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,15 @@
4747
return 0
4848
}
4949
},
50-
async mounted () {
51-
await this.$nextTick()
52-
this.drawerElement = this.$children[0]
53-
this.MdApp.drawer.width = this.getDrawerWidth()
54-
this.MdApp.drawer.active = this.visible
55-
this.MdApp.drawer.mode = this.mode
56-
this.MdApp.drawer.submode = this.submode
57-
this.MdApp.drawer.initialWidth = this.$el.offsetWidth
50+
mounted () {
51+
this.$nextTick().then(() => {
52+
this.drawerElement = this.$children[0]
53+
this.MdApp.drawer.width = this.getDrawerWidth()
54+
this.MdApp.drawer.active = this.visible
55+
this.MdApp.drawer.mode = this.mode
56+
this.MdApp.drawer.submode = this.submode
57+
this.MdApp.drawer.initialWidth = this.$el.offsetWidth
58+
})
5859
}
5960
}
6061
</script>

src/components/MdAutocomplete/MdAutocomplete.vue

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,13 @@
126126
mdOptions: {
127127
deep: true,
128128
immediate: true,
129-
async handler () {
129+
handler () {
130130
if (this.isPromise(this.mdOptions)) {
131131
this.isPromisePending = true
132-
this.filteredAsyncOptions = await this.mdOptions
133-
this.isPromisePending = false
132+
this.mdOptions.then(options => {
133+
this.filteredAsyncOptions = options
134+
this.isPromisePending = false
135+
})
134136
}
135137
}
136138
},
@@ -191,22 +193,27 @@
191193
this.$emit('md-changed', this.searchTerm)
192194
}
193195
},
194-
async showOptions () {
196+
showOptions () {
195197
if (this.showMenu) {
196198
return false
197199
}
198200
199201
this.showMenu = true
200-
await this.$nextTick()
201-
this.triggerPopover = true
202-
this.$emit('md-opened')
202+
this.$nextTick().then(() => {
203+
this.triggerPopover = true
204+
this.$emit('md-opened')
205+
})
203206
},
204-
async hideOptions () {
205-
await this.$nextTick()
206-
this.showMenu = false
207-
await this.$nextTick()
208-
this.triggerPopover = false
209-
this.$emit('md-closed')
207+
hideOptions () {
208+
const clearPopover = () => {
209+
this.triggerPopover = false
210+
this.$emit('md-closed')
211+
}
212+
213+
this.$nextTick().then(() => {
214+
this.showMenu = false
215+
this.$nextTick().then(clearPopover)
216+
})
210217
},
211218
selectItem (item, $event) {
212219
const content = $event.target.textContent.trim()

src/components/MdBottomBar/MdBottomBar.vue

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,19 @@
114114
created () {
115115
this.MdBottomBar.type = this.mdType
116116
},
117-
async mounted () {
118-
await this.$nextTick()
117+
mounted () {
118+
this.$nextTick().then(() => {
119+
if (this.mdSyncRoute) {
120+
this.setActiveItemByRoute()
121+
} else {
122+
this.setActiveItemByIndex(0)
123+
}
119124
120-
if (this.mdSyncRoute) {
121-
this.setActiveItemByRoute()
122-
} else {
123-
this.setActiveItemByIndex(0)
124-
}
125+
window.setTimeout(() => {
126+
this.setupWatchers()
127+
}, 100)
128+
})
125129
126-
window.setTimeout(() => {
127-
this.setupWatchers()
128-
}, 100)
129130
}
130131
})
131132
</script>

0 commit comments

Comments
 (0)