Skip to content

Commit 7fa6837

Browse files
authored
fix: some small refinements in the ui codebase (#6315)
1 parent 7c580b8 commit 7fa6837

File tree

14 files changed

+138
-66
lines changed

14 files changed

+138
-66
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"version": "node scripts/genChangelog.js && node scripts/genDocs.js && git add CHANGELOG.md && git add docs",
2020
"docs": "vuepress dev docs",
2121
"docs:build": "vuepress build docs",
22-
"patch-chromedriver": "node scripts/patchChromedriver.js"
22+
"patch-chromedriver": "node scripts/patchChromedriver.js",
23+
"postinstall": "patch-package"
2324
},
2425
"gitHooks": {
2526
"pre-commit": "lint-staged",
@@ -64,6 +65,7 @@
6465
"memfs": "^3.2.0",
6566
"minimist": "^1.2.5",
6667
"node-fetch": "^2.6.1",
68+
"patch-package": "^6.2.2",
6769
"prettier": ">= 1.13.0",
6870
"rimraf": "^3.0.2",
6971
"semver": "^7.3.4",

packages/@vue/cli-ui-addon-webpack/.babelrc

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: ['@vue/cli-plugin-babel/preset']
3+
}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
module.exports = {
2-
presets: [
3-
'@vue/app'
4-
]
2+
presets: ['@vue/cli-plugin-babel/preset']
53
}

packages/@vue/cli-ui/.babelrc

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/@vue/cli-ui/apollo-server/util/logger.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ exports.dumpObject = (obj) => {
2626
result[key] = type
2727
}
2828
})
29-
return result.toString()
29+
return JSON.stringify(result)
3030
}

packages/@vue/cli-ui/babel.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: ['@vue/cli-plugin-babel/preset']
3+
}

packages/@vue/cli-ui/package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"devDependencies": {
6767
"@babel/core": "^7.12.16",
6868
"@babel/eslint-parser": "^7.12.16",
69+
"date-fns": "^2.17.0",
6970
"@vue/cli-plugin-babel": "^5.0.0-alpha.5",
7071
"@vue/cli-plugin-e2e-cypress": "^5.0.0-alpha.5",
7172
"@vue/cli-plugin-eslint": "^5.0.0-alpha.5",
@@ -85,7 +86,7 @@
8586
"eslint-plugin-vue": "^7.6.0",
8687
"lint-staged": "^10.5.4",
8788
"lodash.debounce": "^4.0.8",
88-
"portal-vue": "^1.3.0",
89+
"portal-vue": "^2.1.7",
8990
"rimraf": "^3.0.2",
9091
"start-server-and-test": "^1.12.0",
9192
"stylus": "^0.54.5",
@@ -97,13 +98,15 @@
9798
"vue-color": "^2.8.1",
9899
"vue-i18n": "^8.22.4",
99100
"vue-instantsearch": "^1.5.1",
100-
"vue-meta": "^1.6.0",
101-
"vue-observe-visibility": "^0.4.6",
101+
"vue-meta": "^2.4.0",
102+
"vue-observe-visibility": "^1.0.0",
102103
"vue-router": "^3.5.1",
103104
"vue-template-compiler": "^2.6.12",
104105
"vue-timeago": "^5.1.3",
105106
"vue-virtual-scroller": "^1.0.10",
106-
"xterm": "^3.13.2"
107+
"xterm": "~4.10.0",
108+
"xterm-addon-fit": "^0.5.0",
109+
"xterm-addon-web-links": "^0.4.0"
107110
},
108111
"browserslist": [
109112
"> 1%",

packages/@vue/cli-ui/src/components/content/TerminalView.vue

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,8 @@
3939

4040
<script>
4141
import { Terminal } from 'xterm'
42-
import * as fit from 'xterm/dist/addons/fit/fit'
43-
import * as webLinks from 'xterm/dist/addons/webLinks/webLinks'
44-
45-
Terminal.applyAddon(fit)
46-
Terminal.applyAddon(webLinks)
42+
import { FitAddon } from 'xterm-addon-fit'
43+
import { WebLinksAddon } from 'xterm-addon-web-links'
4744
4845
const defaultTheme = {
4946
foreground: '#2c3e50',
@@ -154,7 +151,7 @@ export default {
154151
},
155152
156153
beforeDestroy () {
157-
this.$_terminal.destroy()
154+
this.$_terminal.dispose()
158155
},
159156
160157
methods: {
@@ -165,11 +162,19 @@ export default {
165162
theme: this.theme,
166163
...this.options
167164
})
168-
webLinks.webLinksInit(term, this.handleLink)
165+
166+
const fitAddon = new FitAddon()
167+
const webLinksAddon = new WebLinksAddon(this.handleLink)
168+
169+
this.$_fitAddon = fitAddon
170+
171+
term.loadAddon(fitAddon)
172+
term.loadAddon(webLinksAddon)
173+
169174
term.open(this.$refs.render)
170175
171-
term.on('blur', () => this.$emit('blur'))
172-
term.on('focus', () => this.$emit('focus'))
176+
term.onBlur(() => this.$emit('blur'))
177+
term.onFocus(() => this.$emit('focus'))
173178
174179
if (this.autoSize) {
175180
this.$nextTick(this.fit)
@@ -226,6 +231,7 @@ export default {
226231
},
227232
228233
handleLink (event, uri) {
234+
console.log('aaa')
229235
if (this.openLinks) {
230236
window.open(uri, '_blank')
231237
}
@@ -238,7 +244,7 @@ export default {
238244
239245
await this.$nextTick()
240246
241-
term.fit()
247+
this.$_fitAddon.fit()
242248
term.element.style.display = ''
243249
term.refresh(0, term.rows - 1)
244250
},
@@ -255,7 +261,7 @@ export default {
255261
</script>
256262

257263
<style lang="stylus">
258-
@import "~xterm/dist/xterm.css"
264+
@import "~xterm/css/xterm.css"
259265
</style>
260266

261267
<style lang="stylus" scoped>

packages/@vue/cli-ui/src/components/view/ViewNav.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ export default {
208208
border none !important
209209
background $vue-ui-color-primary
210210
211-
>>> .v-popover .trigger,
212211
>>> .vue-ui-dropdown
213212
display block !important
214213

packages/@vue/cli-ui/src/components/view/ViewNavButton.vue

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<template>
22
<div class="project-nav-button">
3-
<v-popover
3+
<v-tooltip
44
trigger="hover"
55
handle-resize
6-
popover-class="force-tooltip"
6+
class="force-tooltip"
77
placement="right"
8-
offset="4"
8+
:offset="[0, 4]"
99
:delay="{ show: 300, hide: 0 }"
1010
>
1111
<VueGroupButton
@@ -27,18 +27,18 @@
2727
<span v-if="$responsive.wide" class="label">{{ $t(view.tooltip) }}</span>
2828
</VueGroupButton>
2929

30-
<template slot="popover">
30+
<template slot="popper">
3131
<div class="title">{{ $t(view.tooltip) }}</div>
3232

33-
<div v-if="badges" class="badges">
33+
<div v-if="badges.length" class="badges">
3434
<ViewBadge
3535
v-for="badge of badges"
3636
:key="badge.id"
3737
:badge="badge"
3838
/>
3939
</div>
4040
</template>
41-
</v-popover>
41+
</v-tooltip>
4242

4343
<div
4444
v-if="firstNotHiddenBadge"
@@ -96,6 +96,9 @@ $bg-dark = $vue-ui-color-dark
9696
.project-nav-button
9797
position relative
9898
99+
.force-tooltip
100+
width 100%
101+
99102
.bullet
100103
position absolute
101104
width 6px

packages/@vue/cli-ui/src/i18n.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,14 @@ async function autoDetect () {
4949
console.log(`[UI] No locale data was found for your locale ${codes[0]}.`)
5050
}
5151

52-
const dateFnsLocale = i18n.locale.toLowerCase().replace(/-/g, '_')
52+
let dateFnsLocale = i18n.locale
53+
if (dateFnsLocale === 'en') {
54+
dateFnsLocale = 'en-US'
55+
} else if (dateFnsLocale === 'zh') {
56+
// we use `zh` as language code in transifex, but date-fns only has zh-CN
57+
dateFnsLocale = 'zh-CN'
58+
}
59+
5360
Vue.component('VueTimeago', createTimeago({
5461
name: 'VueTimeago',
5562
locale: i18n.locale,

patches/vue+2.6.12.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/node_modules/vue/dist/vue.runtime.esm.js b/node_modules/vue/dist/vue.runtime.esm.js
2+
index 67eadde..70bd6e6 100644
3+
--- a/node_modules/vue/dist/vue.runtime.esm.js
4+
+++ b/node_modules/vue/dist/vue.runtime.esm.js
5+
@@ -3407,7 +3407,7 @@ function _createElement (
6+
ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
7+
if (config.isReservedTag(tag)) {
8+
// platform built-in elements
9+
- if (process.env.NODE_ENV !== 'production' && isDef(data) && isDef(data.nativeOn)) {
10+
+ if (process.env.NODE_ENV !== 'production' && isDef(data) && isDef(data.nativeOn) && data.tag !== 'component') {
11+
warn(
12+
("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
13+
context

0 commit comments

Comments
 (0)